#include using namespace std; #define For(i, a, n) for(int i =a;i pii; template void dbg(Args&&... args){ ((cerr< pair operator+(const pair&a, const pair& b){ return {a.first +b.first, a.second + b.second}; } template ostream& operator<< (ostream& os, const pair& a){ return os<<"("< basic_ostream& operator<<(basic_ostream& os, const C&c){ for(auto it=begin(c); it!=end(c);++it){ os<<(it==begin(c)?"":" ")<<*it; } return os; } #define inf 1e18 void solve(){ ll n, k; cin >> n >> k; vec> pb(30); For(ind, 0, n){ ll a; cin >> a; For(i, 0, 30) if(a & (1 << i)) pb[i].push_back(ind); } For(i, 0, 30) { if(k & (1 << i)) pb[i].push_back(n); else pb[i].push_back(n); dbg(pb[i]); } vec vi(30, 0); ll res = 0; For(z, 0, n) { ll mi = 0, ma = n; For(i, 0, n) { if(1 <sync_with_stdio(0); cin.exceptions(cin.failbit); int t=1;//cin>>t; while(t--){ solve(); } }