#P8567. [JRKSJ R6] Nothing

[JRKSJ R6] Nothing

Background

[An image should be here.]

Problem Description

We define f(x)f(x) as the position of the lowest 11 in the binary representation of xx (note that the lowest bit in binary is bit 00). The following is the code in C++ (without considering issues caused by data types):

int f(int x){
	int ans = 0;
	while (x % 2 == 0){
		x /= 2;
		ans += 1;
	}
	return ans;
}

There are TT queries. For each query, given an interval [l,r][l,r], find how many integers i[l,r]i\in [l,r] satisfy f(i)<f(i+1)f(i)< f(i+1).

Input Format

The first line contains a positive integer TT.
The next TT lines each contain two positive integers l,rl,r, representing one query.

Output Format

Output TT lines, each containing one integer, the answer.

2
3 5
15 20
2
3

Hint

Constraints

This problem uses bundled testdata.

Subtask\text{Subtask} TT\le Special constraints Score\text{Score}
11 10510^5 l=rl=r 1010
22 10410^4 rl103r-l\le10^3 3030
33 10510^5 r106r\le10^6 2020
44 None 4040

For 100%100\% of the testdata, 1T1051\le T\le 10^5, 1lr10181\le l\le r\le 10^{18}.

Translated by ChatGPT 5