where i am getting wrong?
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int tc;
cin>>tc;
while(tc–)
{
long long a,b;
cin>>a>>b;
long long x=floor(log2(a));
long long y=floor(log2(b));
long long ans=0;
if(x==y)
{
ans=a+(a&(a+1))*(b-a);
}
else
{
ans=(a&(a+1))*(pow(2,x+1)-a-1)+a;
}
cout<<ans%1000000007<<"\n";
}
return 0;
}