This page is still under construction.

Parts of this page are still being built. What you see may change.

Bouncing Ball

Time limit1sMemory limit512 MB

Summary
Given drop height x and target w, find the smallest number of doublings that make x reach at least w.
Level

Easy2 of 10

Topics
Math
Solved
No attempts yet

Problem

Asia got a magic ball for her birthday. Whenever the ball is dropped from some height, it bounces back up to twice that height. Asia dropped the ball off a balcony from height xx.

Right after being dropped, the ball's (peak) height is xx, and every bounce doubles the peak height it reaches. So after kk bounces the peak height the ball reaches is x⋅2kx \cdot 2^{k}.

Determine after how many bounces the ball's height first becomes at least ww. The initial height xx, before any bounce, counts as a candidate; in particular, if w≤xw \le x the answer is 00.

Input

The first line contains the number of datasets nn (1≤n≤1061 \le n \le 10^{6}).

Each of the next nn lines contains two integers xx and ww (1≤x≤1091 \le x \le 10^{9}, 0≤w≤1090 \le w \le 10^{9}), where xx is the drop height and ww is the target height.

Output

For each dataset, print a single integer on its own line: the number of bounces after which the ball's height first reaches at least ww, i.e. the smallest non-negative integer kk such that x⋅2k≥wx \cdot 2^{k} \ge w.

Examples2

  1. Example 1

    Input
    2
    3 4
    2 6
    
    Expected output
    1
    2
    
  2. Example 2

    Input
    4
    5 5
    10 3
    7 0
    1 0
    
    Expected output
    0
    0
    0
    0