https://www.codechef.com/LTIME85B/problems/MAXAND18

```
#include "bits/stdc++.h"
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define lld long long int
bool sortinrev(const pair<lld,lld> &a,
const pair<lld,lld> &b)
{
return (a.first > b.first);
}
int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
lld bits[36];
int n,k;
cin>>n>>k;
long arr[100001];
for(int i=0;i<n;i++)
{
cin>>arr[i];
for(int j=0;j<=35;j++)
{
lld temp=arr[i];
bits[j]+=(1 & temp>>j);
}
}
vector <pair <lld,lld> > v;
lld power=1;
for(int i=0;i<=35;i++)
{
v.push_back({bits[i]*power,i});
power*=2;
}
sort(v.begin(),v.end(),sortinrev);
int mark[36]={0};
//for(int i=0;i<34;i++)
// cout<<v[i].first<<" "<<v[i].second<<"\n";
int ptr=0;
set <int> :: iterator it1;
if(k>0)
{
for(int i=0;i<v.size();i++)
{
if(k<=0)
break;
set <int> s;
lld val=v[i].first;
lld in=v[i].second;
s.insert(in);
while(i+1<v.size()&&v[i+1].first==val)
{
i++;
s.insert(v[i].second);
}
for(it1=s.begin();it1!=s.end();it1++)
{
if(k<=0)
break;
mark[*it1]=1;
k--;
}
s.clear();
}
}
lld ans=0;
power=1;
for(int i=0;i<=35;i++)
{
if(mark[i]==1)
{
ans+=power;
}
power*=2;
}
cout<<ans<<"\n";
}
}
```

Two TC are passing and two WA. Why my code fails?

@galencolin @akshitm16