Why am I getting the correct answer during compilation and the wrong answer during submission?

#include
using namespace std;

int main() {

int n,arr[100000];
cin>>n;

int Xor=0;

for(int i=0 ; i<n ; i++)
{
	cin>>arr[i];
	Xor=Xor^arr[i];
}

int temp=Xor;
int pos=0;

while( (temp&1)!=1)
{
	pos++;
	temp=temp>>1;
}

int mask=1<<pos;

int x=0,y=0;

for(int i=0 ; i<n ; i++)
{
	if(arr[i]&mask>0)
	{
		x=x^arr[i];
	}
}

y=x^Xor;

cout<<min(x,y)<<endl<<max(x,y);

return 0;

}

@amangupta please share your code by saving it on ide.codingblocks.com

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.