here is the link to the problem:

https://www.codechef.com/CENS2020/problems/CENS20D

Approach- I have iterate for every element A[i] in the array A and for each element i am calculating its AND with each of the next elements…and if the AND gets equal to my A[i],then i am incrementing my count variable…but it gives me WA …please someone help me out

#include<bits/stdc++.h>

using namespace std;

#define lli long long int

int main()

{

int t;

cin>>t;

while(t- -)

{

int n;

cin>>n;

long long int count=0;

int a[n];

for (int i=0;i<n;i++)

{

cin>>a[i];

}

for (int i=0;i<n;i++)

{

for (int j=i+1;j<n;j++)

{

if (a[i]&a[j]==a[i])

count++;

}

}

cout<<count<<endl;

}

}