| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 93 | 61 | 56 | 64.368% |
You are given a pair of positive integers $a$ and $b$ ($a ≤ b$). Among those integers between $a$ and $b,ドル inclusive, your task is to find the sparsest one, that is, the one with the least number of 1’s in its binary representation. If there are two or more such integers, you should find the smallest among them.
Suppose, for instance, that $a = 10$ and $b = 13$. The integers between $a$ and $b,ドル inclusive, are 10ドル,ドル 11ドル,ドル 12ドル,ドル and 13ドル,ドル and their binary representations are 1010, 1011, 1100, and 1101, respectively. Thus, in this case, the answer is 10ドル,ドル since 10ドル$ and 12ドル$ have the least number of 1’s in their binary representations and 10ドル$ is smaller than 12ドル$.
The input consists of a single test case of the following format.
$a$ $b$
Here, $a$ and $b$ ($a ≤ b$) are integers between 1ドル$ and 10ドル^{18},ドル inclusive.
Output a line containing the smallest among the sparsest integers between $a$ and $b,ドル inclusive.
10 13
10
11 15
12
11 20
16
1 1000000000000000000
1
9876543210 9876543210
9876543210