fork(1) download
/*"The Woods are lovely dark and deep,
But i have promises to keep,
Miles to go before i sleep and Miles to go before i Sleep"
*/
#include<bits/stdc++.h>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<string.h>
#define pb(n) push_back(n)
unsigned long long mod=1000000007;
using namespace std;
#define GI ({int t;scanf("%d",&t);t;})
#define all(x) x.begin(),x.end() //sort(all(x))
#define sz(h1) h1.size()
 long long int arr[1000009];
int main() 
{
        int t=GI;
      // int t=100000;
        long long int a,b;
        long long int cnt=0;
        while(t--)
          {
          cnt=0;
           a=GI;
           b=GI;
           //a=b=1000000000;
           for(;a!=b;)
             {
             
             cnt++;
               if(a>b)
                 a/=2;
               
                else if(b>a)
                 b=b/2;
                
             
             }
           cout<<cnt<<endl;   
          }
 
              
              
              
              
              
return 0;
}
 
Success #stdin #stdout 0s 11160KB
stdin
3
1 2
2 3
4 3
stdout
1
2
3