B. Biggest Bitwise-Or

    传统题 1000ms 256MiB

Biggest Bitwise-Or

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Given two natural numbers l,rl,r, you need to choose two integers x,yx,y that satisfy lxyrl\le x\le y\le r, and maximize xyx|y.

The operator | represents bitwise-or operation.

Format

Input

The first line contains one integer T(1T10001)T(1\le T\le 10001) --- the number of test cases.

Each test case consists of one line containing two integers l,r(0lr1018)l,r(0\le l \le r\le 10^{18}).

Output

For each test case, print a single integer --- the maximum bitwise-or result xyx|y.

Samples

4
1 10
0 1
1023 1024
233 322
15
1
2047
511

五一欢乐训练赛

未参加
状态
已结束
规则
ACM/ICPC
题目
6
开始于
2023-5-2 14:00
结束于
2023-5-2 18:00
持续时间
4 小时
主持人
参赛人数
6