#include<bits/stdc++.h>
using namespace std;
int BinaryConcatenation(int x,int y){
string binx = bitset<30>(x).to_string();
binx = binx.erase(0, min(binx.find_first_not_of('0'), binx.size()-1));
string biny = bitset<30>(y).to_string();
biny = biny.erase(0, min(biny.find_first_not_of('0'), biny.size()-1));
string binxplusy = binx+biny;
string binyplusx = biny+binx;
//int xplusy = stoi(binxplusy, nullptr, 2);
//int yplusx = stoi(binyplusx, nullptr, 2);
unsigned long long xplusy = bitset<60>(binxplusy).to_ullong();
unsigned long long yplusx = bitset<60>(binyplusx).to_ullong();
return (xplusy - yplusx);
}
int main() {
int t;
scanf("%d",&t);
while(t--){
int n,i,j,max=INT_MIN,res;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
for(j=i;j<n;j++){
res=BinaryConcatenation(a[i],a[j]);
if(res>max){
max=res;
}
}
}
printf("%d\n",max);
}
return 0;
}
this is my code and it is working fine for the given test cases but gives wrong answer after submission , i am only trying to pass subtask 1 through this but am not able to