Codeforces Round 949 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

brute force

greedy

math

*800

No tag edit access

The problem statement has recently been changed. View the changes.

×
A. Turtle and Piggy Are Playing a Game

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputTurtle and Piggy are playing a number game.

First, Turtle will choose an integer $$$x$$$, such that $$$l \le x \le r$$$, where $$$l, r$$$ are given. It's also guaranteed that $$$2l \le r$$$.

Then, Piggy will keep doing the following operation until $$$x$$$ becomes $$$1$$$:

- Choose an integer $$$p$$$ such that $$$p \ge 2$$$ and $$$p \mid x$$$ (i.e. $$$x$$$ is a multiple of $$$p$$$).
- Set $$$x$$$ to $$$\frac{x}{p}$$$, and the score will increase by $$$1$$$.

The score is initially $$$0$$$. Both Turtle and Piggy want to maximize the score. Please help them to calculate the maximum score.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.

The first line of each test case contains two integers $$$l, r$$$ ($$$1 \le l \le r \le 10^9, 2l \le r$$$) — The range where Turtle can choose the integer from.

Output

For each test case, output a single integer — the maximum score.

Example

Input

52 43 62 156 22114514 1919810

Output

2 2 3 4 20

Note

In the first test case, Turtle can choose an integer $$$x$$$, such that $$$2 \le x \le 4$$$. He can choose $$$x = 4$$$. Then Piggy can choose $$$p = 2$$$ for $$$2$$$ times. After that, $$$x$$$ will become $$$1$$$, and the score will be $$$2$$$, which is maximized.

In the second test case, Turtle can choose an integer $$$3 \le x \le 6$$$. He can choose $$$x = 6$$$. Then Piggy can choose $$$p = 2$$$, then choose $$$p = 3$$$. After that, $$$x$$$ will become $$$1$$$, and the score will be $$$2$$$, which is maximum.

In the third test case, Turtle can choose $$$x = 12$$$.

In the fourth test case, Turtle can choose $$$x = 16$$$.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/24/2024 03:07:11 (l3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|