#include #include #include using namespace std; // #include // using namespace atcoder; // using mint = modint998244353; using ll = long long; #define fix(x) fixed << setprecision(x) #define rep(i, n) for(int i = 0; i < n; ++i) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> n >> k; k = k * 2 + n - 1; vector a(n); rep(i,n) cin >> a[i]; int ans = 0, mask = 0; for(int i=29;i>=0;--i){ mask |= 1< mp; ll cnt = 0; rep(j,n) ++mp[mask&a[j]]; for(auto [p,q]:mp){ cnt += q * mp[p^ans]; } if(cnt<=k){ k -= cnt; ans |= (1<