malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 1e5 + 10, maxe = 15;   long long n, k, x, ans = -1;   long long fact[maxe], A[maxe], use[maxe];   void lucky_generator(long long a) {     if (a > x) return;     ans++;     lucky_generator(a * 10 + 4);     lucky_generator(a * 10 + 7);   }   bool is_lucky(long long a) {     if (a < 3) return 0;     a++;     while (a) {       if (a % 10 != 4 && a % 10 != 7) return 0;       a /= 10;     }     return 1;   }   void solve(long long index, long long size) {     if (index == size) return;     int a = k / fact[size - index - 1] + 1, i = 0;     k -= (a - 1) * fact[size - index - 1];     for (;; i++) {       if (!use[i]) {         a--;         if (!a) break;       }     }     A[index] = i;     use[i] = 1;     if (is_lucky(index + x) && is_lucky(i + x)) {       ans++;     }     solve(index + 1, size);   }   int main() {     fact[0] = 1;     for (int i = 1; i < maxe + 1; i++) fact[i] = i * fact[i - 1];     cin >> n >> k;     k--;     if (n < maxe && k >= fact[n]) {       cout <<  -1 n ;       return 0;     }     x = max(0ll, n - maxe);     lucky_generator(0);     solve(0ll, n - x);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)2e9;   const long long INFL = (long long)9e18;   const int MAXINT = ((~0) ^ (1 << 31));   const long long MAXLL = ((~0) ^ ((long long)1 << 63));   template <class T>   inline T pow2(T a) {     return a * a;   }   template <class T>   inline bool mineq(T& a, T b) {     return (a > b) ? (a = b, true) : false;   }   template <class T>   inline bool maxeq(T& a, T b) {     return (a < b) ? (a = b, true) : false;   }   const int maxn = (int)1111;   ;   int n;   struct human {     int h, w;     void input() { cin >> w >> h; }     bool operator<(const human& a) const { return h - w < a.h - a.w; }   } num[maxn];   bool used[maxn];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 0; i < (int)(n); i++) num[i].input();     sort(num, num + n);     long long ans = INF;     for (int maxh = 1; maxh < (int)(maxn); maxh++) {       fill(used, used + n, false);       long long cnt = 0, width = 0, f = 1;       for (int i = 0; i < (int)(n); i++) {         if (num[i].h > maxh && num[i].w > maxh) f = false;         if (num[i].h > maxh) {           used[i] = true;           cnt++;         }       }       for (int i = 0; i < (int)(n); i++) {         if (!used[i] && cnt + 1 <= n / 2 && num[i].h < num[i].w &&             num[i].w <= maxh) {           used[i] = true;           cnt++;         }         if (used[i])           width += num[i].h;         else           width += num[i].w;       }       if (f && cnt <= n / 2) mineq(ans, maxh * width);     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000006;   int n, k;   int main() {     int i, j;     cin >> n >> k;     if (k > n) {       printf( -1 );       return 0;     }     if (k == 1 && n == 1) {       printf( a );       return 0;     }     if (k == 1 && n > 1) {       puts( -1 );       return 0;     }     int e = k - 2;     if (e >= 0) {       for (i = 0; i < n - e; i++)         if (i & 1)           printf( b );         else           printf( a );       for (i = 0; i < e; i++) printf( %c ,  c  + i);     } else if (e < 0) {       for (i = 0; i < n; i++)         if (i & 1)           printf( b );         else           printf( a );     }   }
#include <bits/stdc++.h>   using namespace std;   int const N = 1e5 + 20, INF = 1e9 + 20;   int n, h[N], pmx[N], pmn[N], ans;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n;     for (int i = 0; i < n; i++) cin >> h[i];     for (int i = 0; i < n; i++) pmx[i] = i ? max(h[i], pmx[i - 1]) : h[i];     pmn[n] = INF;     for (int i = n - 1; ~i; i--) pmn[i] = min(h[i], pmn[i + 1]);     for (int i = 0; i < n; i++) {       if (pmx[i] <= pmn[i + 1]) ans++;     }     return cout << ans, 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     vector<map<int, vector<string> > > A(m + 1);     for (int x = 0; x < n; x++) {       string name;       int r, points;       cin >> name >> r >> points;       A[r][points].push_back(name);     }     for (int x = 1; x <= m; x++) {       vector<string> tmp;       for (auto it = A[x].rbegin(); it != A[x].rend(); it++) {         for (string s : it->second) tmp.push_back(s);         if (tmp.size() >= 2) break;       }       if (tmp.size() > 2)         cout <<  ? n ;       else         cout << tmp[0] <<     << tmp[1] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int a[5005];   int q, x;   bool bfind(int p) {     int lf = 0;     int rt = n - 1;     int mid;     while (lf <= rt) {       mid = (lf + rt) / 2;       if (a[mid] < p) {         lf = mid + 1;       } else if (a[mid] > p) {         rt = mid - 1;       } else         return true;     }     return false;   }   int main() {     while (scanf( %d %d , &n, &k) != EOF) {       for (int i = 0; i < n; i++) {         scanf( %d , &a[i]);       }       scanf( %d , &q);       while (q--) {         int mn = k + 1;         scanf( %d , &x);         for (int i = n - 1; i >= 0; i--) {           for (int j = 0; j <= k; j++) {             if (a[i] * j == x) {               mn = min(mn, j);               break;             }             if (a[i] * j > x) break;             for (int m = 1; m <= k - j; m++) {               if ((x - a[i] * j) % m != 0) continue;               int tmp = (x - a[i] * j) / m;               if (bfind(tmp)) mn = min(mn, j + m);             }           }         }         if (mn > k)           printf( -1 n );         else           printf( %d n , mn);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     long long n, m, k, s;     cin >> n >> m >> k >> s;     vector<vector<long long>> a(2, vector<long long>(n));     for (long long i = 0; i < 2; ++i) {       for (long long j = 0; j < n; ++j) {         cin >> a[i][j];       }     }     vector<vector<pair<long long, long long>>> g(2);     for (long long i = 0; i < m; ++i) {       long long x, y;       cin >> x >> y;       g[x - 1].push_back({y, i});     }     for (long long i = 0; i < 2; ++i) {       sort(g[i].begin(), g[i].end());     }     auto ok = [&](long long q) {       vector<long long> p(2, numeric_limits<long long>::max());       vector<long long> day(2, -1);       for (long long i = 0; i <= q; ++i) {         for (long long j = 0; j < 2; ++j) {           if (p[j] > a[j][i]) {             p[j] = a[j][i];             day[j] = i;           }         }       }       assert(day[0] != -1 && day[1] != -1);       long long i = 0, j = 0;       vector<pair<long long, long long>> ans;       long long ss = s;       auto buyi = [&]() {         ss -= p[0] * g[0][i].first;         ans.push_back({g[0][i].second, day[0]});         ++i;       };       auto buyj = [&]() {         ss -= p[1] * g[1][j].first;         ans.push_back({g[1][j].second, day[1]});         ++j;       };       while ((i < g[0].size() || j < g[1].size()) && ans.size() < k) {         if (i >= g[0].size()) {           buyj();         } else if (j >= g[1].size()) {           buyi();         } else {           if (p[0] * g[0][i].first < p[1] * g[1][j].first)             buyi();           else             buyj();         }       }       if (ss < 0 || ans.size() < k) ans.clear();       return ans;     };     if (ok(n - 1).size() == 0) {       cout <<  -1 n ;       return 0;     }     long long l = 0, r = n - 1;     while (r - l > 1) {       long long mid = (l + r) >> 1;       if (ok(mid).size()) {         r = mid;       } else {         l = mid + 1;       }     }     if (!ok(l).size()) {       l = r;     }     cout << l + 1 <<   n ;     for (auto [x, y] : ok(l)) {       cout << x + 1 <<     << y + 1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   set<int> v;   int num[300005];   int main() {     int n, m;     scanf( %d%d , &n, &m);     int l, r, x;     memset(num, 0, sizeof(num));     for (int i = 1; i <= n; i++) {       v.insert(i);     }     set<int>::iterator it, s;     bool flag = true;     for (int i = 0; i < m; i++) {       flag = true;       scanf( %d%d%d , &l, &r, &x);       it = v.upper_bound(l - 1);       s = it;       while (it != v.end() && (*it) <= r) {         flag = false;         num[*it] = x;         it++;       }       v.erase(s, it);       if (!flag) v.insert(x);     }     num[x] = 0;     printf( %d , num[1]);     for (int i = 2; i <= n; i++) printf(  %d , num[i]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mx = 100005;   const int mod = 998244353;   int a[mx], y, z;   long long sum[mx];   int as[mx], bs[mx];   bool v[mx];   map<int, int> r[mx];   int query(long long i, int x) {     long long ans = 0;     if (i == 0) return 0;     if (x == 1) return sum[i];     if (x < 20) {       int d = r[i][x];       if (d != 0) return d;     }     if (x == as[i]) {       return bs[i];     }     if (a[i] <= x)       z = a[i];     else {       y = (x + a[i] - 1) / x;       ans = (ans + i * (y - 1)) % mod;       z = a[i] / y;     }     int k = (ans + query(i - 1, z)) % mod;     if (x < 20) {       r[i][x] = k;     } else {       as[i] = x;       bs[i] = k;     }     return k;   }   void oyl(int n) {     long long ans = 0;     for (long long i = 1; i <= n; i++) {       scanf( %d , a + i);       sum[i] = (sum[i - 1] + i * a[i] - i) % mod;     }     for (int i = 1; i <= n; i++) {       ans = (ans + query(i - 1, a[i])) % mod;     }     printf( %lld n , ans);     return;   }   int main() {     int t, n;     scanf( %d , &t);     while (t--) {       scanf( %d , &n);       oyl(n);       if (t != 0)         for (int _ = 1; _ <= n; _++) {           r[_].clear();           as[_] = 0;           bs[_] = 0;         }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e6;   const int LOGN = 20;   int n, k;   vector<int> graph[MAXN + 5];   int pa[LOGN + 1][MAXN + 5];   int depth[MAXN + 5];   int par[MAXN + 5];   void dfs(int u, int p, int d) {     depth[u] = d;     par[u] = p;     pa[0][u] = p;     for (int j = 1; j <= LOGN; j++) {       if (pa[j - 1][u] != -1)         pa[j][u] = pa[j - 1][pa[j - 1][u]];       else         pa[j][u] = -1;     }     for (auto v : graph[u]) {       if (v != p) dfs(v, u, d + 1);     }   }   bool vis[MAXN + 5];   int main() {     int i, j, d;     scanf( %d%d , &n, &k);     for (int i = 0; i < n - 1; i++) {       int u, v;       scanf( %d%d , &u, &v);       graph[u].push_back(v);       graph[v].push_back(u);     }     dfs(n, -1, 0);     int rem = n - k;     vis[n] = true;     rem--;     for (int i = n; i >= 1; i--) {       if (vis[i]) continue;       int u = i;       for (int j = LOGN; j >= 0; j--) {         int par = pa[j][u];         if (par != -1) {           if (!vis[par]) u = par;         }       }       while (par[u] != -1 && !vis[par[u]]) u = par[u];       int cnt = (depth[i] - depth[u] + 1);       if (cnt <= rem) {         int curr = i;         while (!vis[curr]) {           vis[curr] = true;           curr = par[curr];         }         rem -= cnt;       }     }     int cntprint = 0;     for (int i = 1; i <= n; i++) {       if (!vis[i]) {         cntprint++;         printf( %d  , i);       }     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, i;     cin >> t;     for (i = 0; i < t; i++) {       int n, k1, k2, j, f;       cin >> n >> k1 >> k2;       int a[100], b[100], sum, hum;       for (j = 0; j < k1; j++) {         cin >> a[j];       }       sum = a[0];       for (j = 0; j < k1; j++) {         if (a[j] > sum) {           sum = a[j];         }       }       for (f = 0; f < k2; f++) {         cin >> b[f];       }       hum = b[0];       for (f = 0; f < k2; f++) {         if (b[f] > hum) {           hum = b[f];         }       }       if (sum > hum) {         cout <<  YES  << endl;       } else {         cout <<  NO  << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 100010;   int ans = -1, ansd, a[Maxn], b[Maxn], n, m;   inline int Pow(int x, int y, int mod) {     int s = 1;     for (; y; y >>= 1, x = 1ll * x * x % mod)       if (y & 1) s = 1ll * s * x % mod;     return s;   }   inline bool find(int *a, int n, int x) {     int t = lower_bound(a + 1, a + n + 1, x) - a;     return a[t] == x;   }   inline void sol(int *a, int n) {     if (n == 1) {       ans = a[1], ansd = 1;       return;     }     int tmp = a[2] - a[1], cnt = 0;     for (int i = 1; i <= n; i++)       if (find(a, n, (a[i] + tmp) % m)) cnt++;     ansd = 1ll * tmp * Pow(n - cnt, m - 2, m) % m;     int d = (m - ansd) % m;     for (int i = 1; i <= n; i++)       if (!find(a, n, (a[i] + d) % m)) {         if (ans == -1)           ans = a[i];         else {           ans = -1;           return;         }       }   }   int main() {     scanf( %d%d , &m, &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     sort(a + 1, a + n + 1);     if (n == 1 || n == m) return printf( %d %d n , a[1], 1), 0;     if (2 * n < m)       sol(a, n);     else {       int t = 0;       for (int i = 0; i < m; i++)         if (!find(a, n, i)) b[++t] = i;       sol(b, t);       if (ans != -1) (ans += 1ll * ansd * t % m) %= m;     }     if (ans == -1) return printf( -1 n ), 0;     return printf( %d %d n , ans, ansd), 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 10;   int arr[MAXN];   int main() {     int N, ans = 0;     cin >> N;     for (int i = 0; i < N; i++) cin >> arr[i];     sort(arr, arr + N);     for (int i = 0, j = 1; i < N; i++) {       while (arr[i] >= arr[j] && j <= N - 1) j++;       if (j == N) break;       ans++;       j++;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, x, y, dp[108][108][28], dis[108][108];   int DP(int s, int t, int w) {     if (dp[s][t][w -  a ] >= 0) return dp[s][t][w -  a ];     for (int i = 1; i <= n; ++i)       if (dis[s][i] >= w && (DP(t, i, dis[s][i]) == 0))         return dp[s][t][w -  a ] = 1;     return dp[s][t][w -  a ] = 0;   }   int main() {     char z;     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; ++i) {       scanf( %d %d %c , &x, &y, &z);       dis[x][y] = z;     }     memset(dp, -1, sizeof(dp));     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) DP(i, j,  a );     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= n; ++j) printf( %c , dp[i][j][0] ?  A  :  B );       puts(  );     }   }
#include <bits/stdc++.h>   using namespace std;   long long n, nn, p, pp, tt;   int k, _s, t;   char s[105];   int main() {     for (scanf( %d , &t); t--;) {       _s = k = 0;       p = 1;       scanf( %lld , &n);       nn = n;       while (nn) {         nn /= 4;         p *= 4;         k++;       }       p /= 4;       pp = n - p;       tt = pp / 3;       for (int i = 1; i <= k - 1; i++) {         if (tt % 4 == 0) {           s[_s++] =  0 ;           s[_s++] =  0 ;         } else if (tt % 4 == 1) {           if (pp % 3 == 0) {             s[_s++] =  1 ;             s[_s++] =  0 ;           } else if (pp % 3 == 1) {             s[_s++] =  0 ;             s[_s++] =  1 ;           } else {             s[_s++] =  1 ;             s[_s++] =  1 ;           }         } else if (tt % 4 == 2) {           if (pp % 3 == 0) {             s[_s++] =  0 ;             s[_s++] =  1 ;           } else if (pp % 3 == 1) {             s[_s++] =  1 ;             s[_s++] =  1 ;           } else {             s[_s++] =  1 ;             s[_s++] =  0 ;           }         } else {           if (pp % 3 == 0) {             s[_s++] =  1 ;             s[_s++] =  1 ;           } else if (pp % 3 == 1) {             s[_s++] =  1 ;             s[_s++] =  0 ;           } else {             s[_s++] =  0 ;             s[_s++] =  1 ;           }         }         tt /= 4;       }       if (pp % 3 == 0)         s[_s++] =  1 ;       else if (pp % 3 == 1) {         s[_s++] =  0 ;         s[_s++] =  1 ;       } else {         s[_s++] =  1 ;         s[_s++] =  1 ;       }       long long ans = 0;       for (int i = 0; i < _s; i++)         if (s[i] ==  1 ) {           ans |= 1LL << i;         }       printf( %lld n , ans);     }     return 0;   }
#include <bits/stdc++.h>   int main() {     int a, b, c;     std::cin >> a >> b >> c;     int weeks = std::min(a / 3, std::min(b / 2, c / 2));     a -= weeks * 3;     b -= weeks * 2;     c -= weeks * 2;     int ans(0);     for (int i = 1; i <= 7; ++i) {       int ac = a;       int bc = b;       int cc = c;       int zile(0);       int curr_zi = i;       while (ac || bc || cc) {         ++zile;         if (curr_zi == 8) curr_zi -= 7;         if (curr_zi == 1) {           ac--;         } else if (curr_zi == 2) {           bc--;         } else if (curr_zi == 3) {           cc--;         } else if (curr_zi == 4) {           ac--;         } else if (curr_zi == 5) {           cc--;         } else if (curr_zi == 6) {           bc--;         } else {           ac--;         }         if (ac < 0 || bc < 0 || cc < 0) {           zile--;           break;         }         curr_zi++;       }       ans = std::max(ans, zile);     }     std::cout << weeks * 7 + ans;   }
#include <bits/stdc++.h>   using namespace std;   map<string, int> ma;   vector<int> ind;   vector<int> adj[205];   string x[205], y;   int vis[205], ht[205];   void dfs(int u) {     vis[u] = 1;     for (int i = 0; i < adj[u].size(); i++) {       int cur = adj[u][i];       if (!vis[cur]) {         vis[cur] = 1;         ht[cur] = ht[u] + 1;         dfs(cur);       }     }   }   int main() {     int n;     string str[205];     cin >> n;     for (int i = 0; i < n + 1; i++) {       getline(cin, str[i]);       transform(str[i].begin(), str[i].end(), str[i].begin(), ::tolower);     }     string z[100];     ma[ polycarp ] = 1;     int k = 2;     ht[1] = 1;     for (int i = 1; i < n + 1; i++) {       for (int j = 0; j < str[i].size(); j++) {         if (str[i][j] ==    ) ind.push_back(j);       }       x[i] = str[i].substr(0, ind[0]);       y = str[i].substr(ind[0] + 1, ind[1] - ind[0] - 1);       z[i] = str[i].substr(ind[1] + 1, str[i].size() - ind[1]);       if (!ma[x[i]]) ma[x[i]] = k, k++;       if (!ma[z[i]]) ma[z[i]] = k, k++;       ind.clear();     }     for (int i = 1; i < n + 1; i++) {       adj[ma[z[i]]].push_back(ma[x[i]]);     }     dfs(1);     int *max1;     max1 = max_element(ht + 1, ht + 205);     cout << *max1 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010;   int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }   int rev(int num) {     int dig[10], tot = 0, s = 0;     for (; num; num /= 10) dig[tot++] = num % 10;     for (int i = 0; i < tot; i++) s = s * 10 + dig[i];     return s;   }   pair<int, int> p[maxn], r[maxn];   void init() {     for (int i = 1; i <= 100000; i++) {       int re = rev(i);       int g = gcd(re, i);       p[i] = make_pair(i / g, re / g);       r[i] = make_pair(re / g, i / g);     }   }   int main() {     init();     map<pair<int, int>, int> mx, my;     int nx, ny, w;     cin >> nx >> ny >> w;     for (int i = 1; i <= ny; i++) ++my[p[i]];     int x = -1, y = -1;     for (int i = 1, j = ny, k = 0; i <= nx; i++) {       ++mx[p[i]];       k += my[r[i]];       while (j > 0 && k >= w) {         if (x == -1 || (long long)x * y > (long long)i * j) {           x = i;           y = j;         }         my[p[j]]--;         k -= mx[r[j]];         j--;         if (k < w) {           j++;           my[p[j]]++;           k += mx[r[j]];           break;         }       }     }     if (x == -1) {       puts( -1 );     } else {       printf( %d %d n , x, y);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false), cin.tie(0);     int opx, t, c;     cin >> t >> c;     int dfx = 1;     long long lorenzo = 0;     while (c--) {       cin >> opx;       if (dfx != 1) lorenzo += t - dfx + 1;       dfx = opx + 1;     }     cout << lorenzo;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   using vi = vector<int>;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, m, c;     cin >> n >> m >> c;     vector<int> v1, v2;     for (int i = 0; i < m; i++) {       int t;       cin >> t;       if (t <= c / 2) {         int ind = upper_bound((v1).begin(), (v1).end(), t) - v1.begin();         if (ind == v1.size()) v1.emplace_back();         v1[ind] = t;         cout << ind + 1 << endl;       } else {         int ind = upper_bound((v2).begin(), (v2).end(), -t) - v2.begin();         if (ind == v2.size()) v2.emplace_back();         v2[ind] = -t;         cout << n - ind << endl;       }       if (v1.size() + v2.size() == n) return 0;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int bit[1000010] = {0};   long long int get_sum(int i) {     long long int ans = 0;     while (i > 0) {       ans += bit[i];       i -= i & (-i);     }     return ans;   }   void update(int i, int n) {     while (i <= n) {       bit[i] += 1;       i += i & (-i);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     long long int arr[n], small[n], big[n], tmp[n];     long long int max1 = 0;     for (int i = 0; i < n; i++) {       cin >> arr[i];       tmp[i] = arr[i];     }     sort(tmp, tmp + n);     for (int i = 0; i < n; i++) {       arr[i] = lower_bound(tmp, tmp + n, arr[i]) - tmp + 1;       if (arr[i] > max1) max1 = arr[i];     }     long long int ans = 0;     for (int i = (n - 1); i >= 0; i--) {       small[i] = get_sum(arr[i] - 1);       update(arr[i], max1);     }     for (int i = 0; i <= max1; i++) bit[i] = 0;     for (int i = 0; i < n; i++) {       big[i] = i - get_sum(arr[i]);       update(arr[i], max1);       ans += big[i] * small[i];     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, s, ans, a[200001], f[200001];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (register long long i = 1; i <= n; ++i) {       cin >> a[i];       s ^= a[i];       long long x = a[i];       for (register long long j = 60; j > -1; --j) {         if ((x >> j) < 1) continue;         if (f[j] < 1) {           f[j] = x;           break;         } else           x ^= f[j];       }       if (x > 0) ++ans;     }     if (s < 1)       cout <<  -1 n ;     else       cout << ans << endl;     return 0;   }