XOR profit problem not passing testcases

here’s my code

#include
#include
#include
#include
#include
#include
#define ll long long int
#define li long int
using namespace std;

int main() {

ll x,y;
cin>>x;
cin>>y;

ll max_temp = 0;

ll a=x;
ll b=y;
while(a<=b)
{
ll tmp = a^b;

   max_temp = max(tmp,max_temp);
   
   a++;
   b--;

}

cout<<max_temp;
return 0;
}

its not passing testcases i am not able to find what’s wrong in it.

Hey Vishnupriya, for this problem you have to use 2 loops as your current loop is not able to find to max xor for all cases. So, i have just edited your code, replace your while loop with the code snippet given below

for(a = x; a <= y; a++){
        for(b = a; b <= y; b++){
            ll tmp = a^b;
            max_temp = max(tmp,max_temp);
        }
}

yeah i got it, thanks