A or...or B Problem

AtCoder
IDagc015_d
Time2000ms
Memory256MB
Difficulty
Nukes has an integer that can be represented as the bitwise OR of one or more integers between $A$ and $B$ (inclusive). How many possible candidates of the value of Nukes's integer there are? ## Constraints * $1 ≤ A ≤ B < 2^{60}$ * $A$ and $B$ are integers. ## Input The input is given from Standard Input in the following format: $A$ $B$ [samples]
Samples
Input #1
7
9
Output #1
4

In this case, $A=7$ and $B=9$. There are four integers that can be represented as the bitwise OR of a non-empty subset of {$7$, $8$, $9$}: $7$, $8$, $9$ and $15$.
Input #2
65
98
Output #2
63
Input #3
271828182845904523
314159265358979323
Output #3
68833183630578410
API Response (JSON)
{
  "problem": {
    "name": "A or...or B Problem",
    "description": {
      "content": "Nukes has an integer that can be represented as the bitwise OR of one or more integers between $A$ and $B$ (inclusive). How many possible candidates of the value of Nukes's integer there are?",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "agc015_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Nukes has an integer that can be represented as the bitwise OR of one or more integers between $A$ and $B$ (inclusive). How many possible candidates of the value of Nukes's integer there are?\n\n## Cons...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments