MAXARXOR - Editorial

True. 2^N can be calculated by (1 << N).

1 Like

a simple O(T) solution:

Spolier
long int fun(long int a, long int b)
{
    long int ans=0;
    long int k=min((long int)(1<<(a-1)),b);
    ans+=2*k*((1<<a)-1);
    return ans;
}
void solve()
{
   long int a,b;
    cin>>a>>b;
    cout<<fun(a,b)<<"\n";
}