I was solving GAMENUM problem from the Campus Chapters Contest 1.0 (CodeChef: Practical coding for everyone) .
#include<bits/stdc++.h>
using namespace std;
#define FAST_IO(value) ios :: sync_with_stdio(value); std :: cin.tie(value)
#define ll long long
ll numofbits(ll x){
return log2l(x);
}
int main(){
FAST_IO(0);
int t;
cin>>t;
while(t–){
ll a,b; int opcount=0;
cin>>a>>b;
ll left_shift= numofbits(max(a,b));
ll updated_b= b;
ll max_xor= a ^ b;
while(true){
ll bmod= updated_b & 1;
updated_b =(updated_b>>1 | bmod<< left_shift);
if(updated_b == b){
break;
}
if(max_xor < (a ^ updated_b))
{
max_xor = a ^ updated_b;
opcount++;
}
}
cout<<opcount<<" "<<max_xor;
cout<<'\n';
}
return 0;
}
This is my solution, the sample test case passes successfully but the rest is evaluated as WA. Can someone kindly help?