#include<bits/stdc++.h>
using namespace std;
int getPositionBit(int n){ //Get bit position of in the number
int pos=0;
while((n&1)==1){
pos++;
n=n>>1;
}
return pos;
}
int getFirstUnique(int XORed,int*arr)
{
int x = getPositionBit(XORed);
int ans=0;
for (int i=0; i<sizeof(arr)/sizeof(int); i++)
{
if((arr[i]&(1<<x))>0)
{
ans= ans^arr[i];
}
}
return ans;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n,xored=0,arr[1000000];
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
xored=xored^arr[i];
}
int x=getFirstUnique(xored,arr);
int y=xored^x;
if (x>y){
cout<<y<<" "<<x;
}
else{
cout<<x<<" "<<y;
}
}
For some reason, the code above is testing incorrect, may i know why?