Discussion About Perfect Pair

This is Discussion thread about Perfect Pair

hey!! I think i right the code right and it contain only 1 pair whose & operation is 0.But the test case in the question is give 5 for the given input.

exactly bro,
and fir that test case should be b/c of only pair 29,34

I’m also getting 1 for the given test case.

I am getting wrong ans in Test case 1 and 3 but i think my code is correct.
Can anyone please tell me how to solve this question.
The sample output is wrong i guess.
My code:-
#include<bits/stdc++.h>
using namespace std;
int main () {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int count=0;
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
if((a[i] & a[j]) == 0){
count++;
}
}
}
cout<<count<<endl;
}

same here bro i also getting one test case pass

It is probably a time limit exceeded error as the code would work in O(n^2) time. Since n is 10^5, n^2 would reach greater than a billion operations.

I have passed the 1st and 2nd test case but getting wrong ans in 3rd test case. Please help.