Range Queries - Beta
Submissions: 0   Accuracy:


  Max. Score:



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 atmost three set bits in their binary representation. 

Input Format

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 Format

For each query you need to print the total numbers between L and R having at most 3 set bits in their binary representation.


1 <= T <= 5

1 <= Q <= 105

0 <= L, R <= 1018

Example :
Input :

3 7
Output :


to report an issue on this page.