AT_abc476_g [ABC476G] Increasing Popcount
Description
You are given positive integers $ L $ and $ R $ satisfying $ L\le R $ .
A sequence of positive integers $ A=(A_L,A_{L+1},\ldots,A_R) $ of length $ R-L+1 $ satisfying the following condition is called a **good integer sequence**:
- For every pair of integers $ (i,j) $ satisfying $ L\le i < j\le R $ , if $ A_i = A_j $ , then $ \operatorname{popcount}(i)
Input Format
The input is given from Standard Input in the following format:
> $ T $ $ \text{case}_1 $ $ \text{case}_2 $ $ \vdots $ $ \text{case}_T $
Each test case is given in the following format.
> $ L $ $ R $
Output Format
Output $ T $ lines.
The $ i $ -th line $ (1\le i\le T) $ should contain the answer for the $ i $ -th test case $ \text{case}_i $ .
Explanation/Hint
### Sample Explanation 1
Consider the first test case.
$ (A_3,A_4,A_5,A_6)=(1,2,2,3) $ is a good integer sequence, and $ \max(A_3,A_4,A_5,A_6)=3 $ .
There is no good integer sequence with $ \max(A_3,A_4,A_5,A_6) < 3 $ , so output $ 3 $ on the first line.
### Constraints
- $ 1\le T\le 10^4 $
- $ 1\le L \le R\le 10^{18} $
- All input values are integers.