Range Queries
Submissions: 0   Accuracy:

0%

  Max. Score:

75

 

 

Given Q queries, with each query consisting of two integers L and R, the task is to find the total numbers between L and R (Both inclusive), having less than or equal to two set bits in their binary representation.  

Input:
The first line of input contains number of testcases T. The 1st line of each testcase, contains a single integer Q denoting the number of queries. Each of the next Q lines, contain two space separated integers L and R denoting the range for that query.

Output:
For each query you need to print the total numbers between L and R having less than 2 set bits in their binary representation.

Constraints:
1 <= T <= 5
1 <= Q <= 105
0 <= L,R <= 1018
 
Example:
Input:
1
1
3 7
Output:
4
Explanation:
Self Explanatory


to report an issue on this page.