// Mohib Manva #include using namespace std; #define mod 1000000007 #define LOCAL 0 #define pb push_back #define ll long long ll po(ll a,ll b){ ll x = 1,y=a; while(b>0){ if(b%2){ x = x*y; x %= mod; } y=y*y; y%=mod; b/=2; } return x; } int main(){ if(LOCAL){ freopen("C:/Users/gold/Desktop/sublime IO/input.txt","r",stdin); freopen("C:/Users/gold/Desktop/sublime IO/output.txt","w",stdout); } int T = 1; scanf("%d",&T); while(T--){ int x,y; scanf("%d %d",&x,&y); ll num = y - x + 1; long long ans = 0ll; for(int i=30;i>=0;i--){ //printf("%d %d\n",x,y); if((x&(1<