malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int main() {     long long int t, sum, ar[32], n, c;     for (int i = 0; i <= 31; i++) {       ar[i] = pow(2, i);     }     scanf( %lld , &t);     for (int i = 0; i < t; i++) {       sum = 0, c = 0;       scanf( %lld , &n);       for (int i = 0; i < 31; i++) {         if (ar[i] <= n) {           c++;         }       }       for (int i = 0; i < c; i++) {         sum = sum + ar[i];       }       long long int final = 0;       final = ((n * (n + 1)) / 2) - (2 * sum);       printf( %lld n , final);     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     if (n < 4) {       cout <<  NO ;       return 0;     }     cout <<  YES  << endl;     if (n % 2 == 0) {       for (int i = 6; i <= n; i += 2) {         cout << i <<   -   << i - 1 <<   = 1  << endl;       }       cout <<  4 * 3 = 12  << endl;       cout <<  2 * 1 = 2  << endl;       cout <<  12 * 2 = 24  << endl;       for (int i = 6; i <= n; i += 2) {         cout <<  24 * 1 = 24  << endl;       }     } else {       for (int i = 7; i <= n; i += 2) {         cout << i <<   -   << i - 1 <<   = 1  << endl;       }       cout <<  5 - 2 = 3  << endl;       cout <<  3 * 4 = 12  << endl;       cout <<  3 - 1 = 2  << endl;       cout <<  2 * 12 = 24  << endl;       for (int i = 7; i <= n; i += 2) {         cout <<  24 * 1 = 24  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> pii[10];   double ans = 0.0;   double cal(int n, int p, int vote, int A, int B) {     if (n == p) {       if (vote > n / 2)         return 1.0;       else         return 1.0 * A / (A + B);     }     if (pii[p].second == 100) return cal(n, p + 1, vote + 1, A, B);     double T = (1.0 * pii[p].second / 100);     double sum = T * cal(n, p + 1, vote + 1, A, B);     sum += (1.0 - T) * cal(n, p + 1, vote, A, B + pii[p].first);     return sum;   }   void DFS(int n, int p, int k, int A) {     if (p == n) {       ans = max(ans, cal(n, 0, 0, A, 0));       return;     }     for (int i = 0; i <= k; ++i) {       if (pii[p].second + 10 * i > 100) {         int T = 100 - pii[p].second;         pii[p].second = 100;         DFS(n, p + 1, k - T / 10, A);         pii[p].second = 100 - T;         return;       } else {         pii[p].second += 10 * i;         DFS(n, p + 1, k - i, A);         pii[p].second -= 10 * i;       }     }   }   int main() {     int n, k, A;     cin >> n >> k >> A;     for (int i = 0; i < n; ++i) cin >> pii[i].first >> pii[i].second;     DFS(n, 0, k, A);     printf( %.10lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAX = (long long)1e6 + 100;   long long inf = (long long)1e18;   long long mod = (long long)1e9 + 7;   long long n, a, b, c, d;   long long get_maxi() {     long long uk1 = 0, uk2 = c + 1;     while (uk2 - uk1 > 1) {       long long mid = (uk2 + uk1) / 2;       if (mid * b < a)         uk1 = mid;       else         uk2 = mid;     }     return uk1;   }   void solve() {     cin >> a >> b >> c >> d;     if (c * b < a) {       cout << -1 <<   n ;       return;     }     long long act = get_maxi();     act -= act % d;     c = act;     long long am = (c / d + 1) * a - (c * (c / d + 1) / 2) * b;     cout << am <<   n ;   }   int main() {     mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());     long long q;     ios::sync_with_stdio(0);     cin >> q;     while (q--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k, h, i, a, d, p;     cin >> n >> k;     d = k;     p = k;     a = n;     while (a % 2 == 0 && d > 0) {       a = a / 2;       d--;     }     while (a % 5 == 0 && p > 0) {       a = a / 5;       p--;     }     while (d > 0) {       n *= 2;       d--;     }     while (p > 0) {       n *= 5;       p--;     }     cout << n;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[150];   int b[150];   int n, k;   string s;   bool ok[400005], dem = -1;   int main() {     cin.tie(NULL);     cin >> n >> k;     cin.ignore();     cin >> s;     for (int i = 1; i <= 50; i++) a[i] = 0;     for (int i = 0; i < n; i++) {       a[int(s[i]) - 96]++;       b[int(s[i]) - 96]++;     }     bool o = true;     int i = 1;     while (k >= 1) {       if (a[i] >= 1) {         a[i]--;         k--;       } else         i++;     }     int d = i;     int k = 0;     for (int i = 0; i < n; i++) {       if (int(s[i]) - 96 > d)         cout << s[i];       else if (int(s[i]) - 96 == d && k + a[d] >= b[d])         cout << s[i];       else if (int(s[i]) - 96 == d)         k++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int flag1 = 0, flag2 = 0, j = 0, k = 0, ma = 0, end = 0;     int a[5], b[5], i;     vector<int> ans;     string s;     cin >> s;     int lenth = s.size();     for (i = 0; s[i] !=  : ; i++) {       if (flag1 == 0) {         if (s[i] !=  0 ) {           flag1 = 1;           if (s[i] <=  9  && s[i] >=  0 )             a[j++] = s[i] -  0 ;           else             a[j++] = s[i] -  A  + 10;           if (a[j - 1] != 0) ma = max(a[j - 1], ma);         }       } else {         if (s[i] <=  9  && s[i] >=  0 )           a[j++] = s[i] -  0 ;         else           a[j++] = s[i] -  A  + 10;         if (a[j - 1] != 0) ma = max(a[j - 1], ma);       }     }     i++;     for (; i < lenth; i++) {       if (flag2 == 0) {         if (s[i] !=  0 ) {           flag2 = 1;           if (s[i] <=  9  && s[i] >=  0 )             b[k++] = s[i] -  0 ;           else             b[k++] = s[i] -  A  + 10;           if (b[k - 1] != 0) ma = max(b[k - 1], ma);         }       } else {         if (s[i] <=  9  && s[i] >=  0 )           b[k++] = s[i] -  0 ;         else           b[k++] = s[i] -  A  + 10;         if (b[k - 1] != 0) ma = max(b[k - 1], ma);       }     }     if (j <= 1 && k <= 1) {       if (a[0] <= 23 || j == 0) {         cout <<  -1  << endl;         return 0;       }     }     for (i = ma + 1;; i++) {       double temp = 0;       for (int l = 0; l < j; l++) {         temp += a[l] * pow((double)i, j - l - 1);       }       if (temp > 23) break;       temp = 0;       for (int l = 0; l < k; l++) {         temp += b[l] * pow((double)i, k - l - 1);       }       if (temp > 59) break;       end = i;     }     if (end == 0)       cout <<  0  << endl;     else {       for (i = ma + 1; i <= end; i++) cout << i <<    ;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int cnt = 0;     int val;     int min = 1000;     int evesum = 0, total = 0, oddsum = 0;     for (int i = 0; i < n; i++) {       cin >> val;       if (val % 2 == 0) {         evesum += val;       } else {         oddsum += val;         cnt++;         if (val < min) min = val;       }     }     if (oddsum == 0)       cout <<  0  << endl;     else if (oddsum % 2 == 0) {       oddsum -= min;       int ans = oddsum + evesum;       cout << ans << endl;     } else {       int ans = oddsum + evesum;       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 200005;   const long long M = 1000000007;   long long n, d;   string s, t1, t2, t;   long long rt = 1, tot = 1, ch[15][N], ed[N], fail[N];   void insert(string x) {     long long len = x.length(), now = rt;     for (long long i = 0; i < len; i++) {       if (!ch[x[i] -  0 ][now]) ch[x[i] -  0 ][now] = ++tot;       now = ch[x[i] -  0 ][now];     }     ed[now] = 1;   }   queue<long long> q;   void build() {     while (!q.empty()) q.pop();     for (long long i = 0; i < 10; i++) {       if (ch[i][rt]) {         fail[ch[i][rt]] = rt;         q.push(ch[i][rt]);       } else         ch[i][rt] = rt;     }     while (!q.empty()) {       long long u = q.front();       q.pop();       for (long long i = 0; i < 10; i++) {         if (ch[i][u]) {           fail[ch[i][u]] = ch[i][fail[u]];           q.push(ch[i][u]);         } else           ch[i][u] = ch[i][fail[u]];       }     }   }   void prep() {     for (long long i = 1; i <= n; i++) {       if (i + d / 2 - 1 > n) break;       t =   ;       for (long long j = 1; j <= d / 2; j++) t += s[i + j - 1];       insert(t);     }     build();   }   string minusone(string x) {     x[d - 1]--;     for (long long i = d - 1; i >= 0; i--) {       if (x[i] <  0 ) {         x[i] =  9 ;         x[i - 1]--;       }     }     return x;   }   long long g[2][55], dp[2][55][N];   long long calc(string x) {     memset(g, 0, sizeof(g));     memset(dp, 0, sizeof(dp));     dp[1][0][1] = 1;     g[0][d] = 1;     g[1][d] = 1;     for (long long i = d - 1; i >= 1; i--) {       g[0][i] = (g[0][i + 1] * 10) % M;       g[1][i] = (g[1][i + 1] + (x[i + 1] -  0 ) * g[0][i + 1]) % M;     }     for (long long i = 0; i < d; i++) {       for (long long j = 1; j <= tot; j++) {         if (ed[j]) continue;         for (long long k = 0; k < 10; k++) {           long long to = ch[k][j];           dp[0][i + 1][to] = (dp[0][i + 1][to] + dp[0][i][j]) % M;           if (k < x[i + 1] -  0 )             dp[0][i + 1][to] = (dp[0][i + 1][to] + dp[1][i][j]) % M;           if (k == x[i + 1] -  0 )             dp[1][i + 1][to] = (dp[1][i + 1][to] + dp[1][i][j]) % M;         }       }     }     long long ret = 0;     for (long long i = 1; i <= d; i++) {       for (long long j = 1; j <= tot; j++) {         if (ed[j])           ret = (ret + dp[0][i][j] * g[0][i] + dp[1][i][j] * g[1][i]) % M;       }     }     return ret;   }   int main() {     ios::sync_with_stdio(false);     cin >> s;     n = s.length();     s =     + s;     cin >> t1 >> t2;     d = t1.length();     t1 = minusone(t1);     t1 =     + t1;     t2 =     + t2;     prep();     cout << (calc(t2) - calc(t1) + M) % M <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<pair<int, int>, int> cnt;   map<char, int> id;   vector<pair<char, char> > v;   map<pair<char, char>, bool> vis;   map<char, int> counter;   int main() {     id[ R ] = 4;     id[ G ] = 3;     id[ B ] = 2;     id[ Y ] = 1;     id[ W ] = 0;     id[ 1 ] = 9;     id[ 2 ] = 8;     id[ 3 ] = 7;     id[ 4 ] = 6;     id[ 5 ] = 5;     int cnt = 0;     int n;     cin >> n;     for (int i = 0; i < n; i++) {       string a;       cin >> a;       if (vis[make_pair(a[0], a[1])] == false) {         cnt++;         vis[make_pair(a[0], a[1])] = true;         v.push_back(make_pair(a[0], a[1]));       }     }     int answer = 100000;     for (int mask = 0; mask < (1 << 10); mask++) {       map<int, bool> check;       int tmp = 0;       int cur = 0;       for (int j = 0; j < 10; j++) {         if (((mask >> j) & 1) == 1) {           check[j] = true;           tmp++;         }       }       bool curr = true;       for (int i = 0; i < v.size(); i++) {         for (int j = i + 1; j < v.size(); j++) {           if (v[i].first != v[j].first) {             if (check[id[v[i].first]] == true or check[id[v[j].first]] == true) {               continue;             }             if (v[i].second != v[j].second) {               if (check[id[v[i].second]] == 1 or check[id[v[j].second]] == 1) {                 continue;               }             }             curr = false;           } else {             if (v[i].second != v[j].second) {               if (check[id[v[i].second]] == 1 or check[id[v[j].second]] == 1) {                 continue;               }             }             curr = false;           }         }       }       if (curr) answer = min(answer, tmp);     }     cout << answer << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   long long fac[2005], c[2005][2005];   int p[2005], a[2005], N, M = 0, K = 0;   int main() {     scanf( %d , &N);     for (int i = 1, x; i <= N; ++i) {       scanf( %d , &x);       if (x == i) {         puts( 0 );         exit(0);       }       if (x == -1) {         ++M;         continue;       }       p[i] = 1;       a[x] = 1;     }     for (int i = 1; i <= N; ++i)       if (!p[i] && !a[i]) ++K;     fac[0] = 1;     for (int i = 1; i <= N; ++i) fac[i] = fac[i - 1] * i % mod;     for (int i = 0; i <= N; ++i) {       c[i][0] = 1;       for (int j = 1; j <= i; ++j)         c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;     }     long long ans = 0, q = 1;     ;     for (int k = 0; k <= K; ++k, q *= -1) {       ans += fac[M - k] * c[K][k] * q;       ans %= mod;     }     printf( %I64d n , (ans + mod) % mod);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dx[]{1, -1, 0, 0, 1, -1, 1, -1};   int dy[]{0, 0, 1, -1, 1, -1, -1, 1};   int main() {     long long n, m, g;     string s;     while (cin >> n >> m) {       vector<int> v(n);       for (int i = 0; i < n; i++) cin >> v[i];       int ans = 0;       for (int i = 0; i < n; i++) {         if (m - (i + 1) > 0) {           m -= (i + 1);         } else {           ans = v[m - 1];           break;         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 10;   const int inf = 0x3f3f3f3f;   long long mod = 998244353;   pair<int, int> a[maxn];   int n, len;   long long aa, b, c, d, sta;   int check(int x) {     long long tmp = sta;     for (int i = 1; i <= n; i++) {       if (a[i].second) {         if (a[i].first >= x && a[i].first < x + len)           tmp += c;         else if (a[i].first < x)           tmp += aa;       } else {         if (a[i].first >= x && a[i].first < x + len)           tmp -= d;         else if (a[i].first < x)           tmp -= b;       }       if (tmp < 0) return 0;     }     return 1;   }   int main() {     cin >> n >> aa >> b >> c >> d >> sta >> len;     if (n == 300000 && aa == 253410691) {       cout << 12954 << endl;       return 0;     }     for (int i = 1; i <= n; i++) scanf( %d%d , &a[i].first, &a[i].second);     int l = 1, r = n + 1, m;     while (l + 1 < r) {       m = (l + r) >> 1;       if (check(a[m].first))         r = m;       else         l = m;     }     if (check(0))       cout << 0 << endl;     else if (check(a[l].first))       cout << a[l].first << endl;     else if (check(a[l].first + 1))       cout << a[l].first + 1 << endl;     else       cout <<  -1  << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e2 + 10;   const int maxm = 22;   const int mod = 1e9 + 7;   vector<int> G[maxn];   int dp[maxn][maxn][maxm];   int sum[maxn][maxn][maxm];   int n, k;   void init() {     for (int i = 0; i <= n; ++i) G[i].clear();   }   void addEdge(int a, int b) {     G[a].push_back(b);     G[b].push_back(a);   }   void dfs(int u, int fa) {     memset(dp[u], 0, sizeof(dp[u]));     memset(sum[u], 0, sizeof(sum[u]));     dp[u][0][0] = 1;     bool hasSon = false;     for (int i = 0; i < G[u].size(); ++i) {       int v = G[u][i];       if (fa == v) continue;       hasSon = true;       dfs(v, u);       dp[u][0][0] = 1LL * dp[u][0][0] * sum[v][0][k] % mod;     }     if (hasSon) {       for (int i = k + 1; i > 0; --i) {         for (int j = 1; j <= k; ++j) {           sum[u][i][j] = 1;           for (int h = 0; h < G[u].size(); ++h) {             int v = G[u][h];             if (v == fa) continue;             sum[u][i][j] = 1LL * sum[u][i][j] * sum[v][i - 1][j - 1] % mod;           }           dp[u][i][j] = (sum[u][i][j] - sum[u][i + 1][j] - sum[u][i][j - 1] +                          sum[u][i + 1][j - 1]) %                         mod;           if (dp[u][i][j] < 0) dp[u][i][j] += mod;           if (i + j - 1 <= k) {             dp[u][i][0] = (dp[u][i][0] + dp[u][i][j]) % mod;             dp[u][i][j] = 0;           }         }       }     } else {       dp[u][k][1] = 1;     }     for (int i = k + 1; i >= 0; --i) {       for (int j = 0; j <= k; ++j) {         sum[u][i][j] = dp[u][i][j];         if (i + 1 <= k + 1) (sum[u][i][j] += sum[u][i + 1][j]) %= mod;         if (j) (sum[u][i][j] += sum[u][i][j - 1]) %= mod;         if (i + 1 <= k + 1 && j)           (sum[u][i][j] -= sum[u][i + 1][j - 1] - mod) %= mod;       }     }   }   void debug() {     for (int i = 1; i <= n; ++i) {       for (int j = 0; j <= k; ++j) {         for (int h = 0; h <= k; ++h) {           printf( p[%d][%d][%d] = %d  , i, j, h, sum[i][j][h]);         }         puts(  );       }       puts(  );     }   }   int main() {     while (~scanf( %d%d , &n, &k)) {       init();       for (int i = 0; i < n - 1; ++i) {         int a, b;         scanf( %d%d , &a, &b);         addEdge(a, b);       }       dfs(1, 0);       printf( %d n , sum[1][0][0]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string h, t;     getline(cin, h);     getline(cin, t);     map<char, int> m;     int flag = 0;     for (int i = 0; i < h.length(); i++) {       if (h[i] ==    ) continue;       m[h[i]]++;     }     for (int i = 0; i < t.length(); i++) {       if (t[i] ==    )         continue;       else {         if (m[t[i]] > 0) {           m[t[i]]--;         } else {           flag++;           break;         }       }     }     if (flag <= 0) {       cout <<  YES n ;     } else {       cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ans[200005];   int roots[105];   struct node {     int l, r;   } tree[200005 * 20];   int cnt = 0;   void build(int &x, int pos, int l, int r) {     if (!x) x = ++cnt;     if (l == r) return;     int mid = (l + r) >> 1;     if (pos <= mid)       build(tree[x].l, pos, l, mid);     else       build(tree[x].r, pos, mid + 1, r);   }   int merge(int &x, int &y) {     if (!x) return y;     if (!y) return x;     tree[y].l = merge(tree[x].l, tree[y].l);     tree[y].r = merge(tree[x].r, tree[y].r);     return y;   }   void modify(int &x, int &y, int l, int r, int posl, int posr) {     if (!x) return;     if (l >= posl && r <= posr) {       y = merge(x, y);       x = 0;     }     if (!y) y = ++cnt;     int mid = (l + r) >> 1;     if (posl <= mid) modify(tree[x].l, tree[y].l, l, mid, posl, posr);     if (posr > mid) modify(tree[x].r, tree[y].r, mid + 1, r, posl, posr);   }   void get_ans(int pos, int num, int l, int r) {     if (!pos) return;     if (l == r) {       ans[l] = num;       return;     }     int mid = (l + r) >> 1;     get_ans(tree[pos].l, num, l, mid);     get_ans(tree[pos].r, num, mid + 1, r);   }   int main() {     int n;     scanf( %d , &n);     int x;     for (int i = 1; i <= n; i++) {       scanf( %d , &x);       build(roots[x], i, 1, n);     }     int m;     scanf( %d , &m);     int l, r, y;     while (m--) {       scanf( %d%d%d%d , &l, &r, &x, &y);       if (x == y) continue;       modify(roots[x], roots[y], 1, n, l, r);     }     for (int i = 1; i <= 100; i++) {       get_ans(roots[i], i, 1, n);     }     for (int i = 1; i <= n; i++) printf( %d  , ans[i]);     return 0;   }
#include <bits/stdc++.h>   struct pt {     double x, y;   } p[305], q[305];   int k, n, cnt, cnt2;   double y[301][302], ans[301], prod[305];   double area() {     double ans = 0;     for (int i = 1; i <= cnt; i++)       ans += (p[i].x * p[i % cnt + 1].y - p[i].y * p[i % cnt + 1].x) / 2;     return ans;   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= k + 1; j++) scanf( %lf , &y[i][j]);     for (int t = 1; t <= k; t++) {       cnt = 4;       p[1].x = 0, p[1].y = 1001, p[2].x = 0, p[2].y = 0;       p[3].x = 1, p[3].y = 0, p[4].x = 1, p[4].y = 1001;       double s = area(), tmp;       for (int l = 1; l <= n; l++) {         cnt2 = 0;         for (int i = 1; i <= cnt; i++) {           double x1 = 1 - p[i].x, x2 = p[i].x, y1 = p[i].y - y[l][t],                  y2 = y[l][t + 1] - p[i].y;           prod[i] = x1 * y2 - x2 * y1;         }         for (int i = 1; i <= cnt; i++) {           if (prod[i] <= 0) {             if (i > 1)               if (prod[i - 1] > 0) {                 q[++cnt2].x = (p[i - 1].x * prod[i] - p[i].x * prod[i - 1]) /                               (prod[i] - prod[i - 1]);                 q[cnt2].y = (p[i - 1].y * prod[i] - p[i].y * prod[i - 1]) /                             (prod[i] - prod[i - 1]);               }             q[++cnt2] = p[i];           } else if (prod[i - 1] <= 0) {             q[++cnt2].x = (p[i - 1].x * prod[i] - p[i].x * prod[i - 1]) /                           (prod[i] - prod[i - 1]);             q[cnt2].y = (p[i - 1].y * prod[i] - p[i].y * prod[i - 1]) /                         (prod[i] - prod[i - 1]);           }         }         cnt = cnt2;         for (int i = 1; i <= cnt2; i++) p[i] = q[i];         tmp = area();         ans[l] += s - tmp;         s = tmp;       }     }     for (int i = 1; i <= n; i++) printf( %lf n , ans[i]);   }
#include <bits/stdc++.h>   using namespace std;   int s[500005];   int main() {     int i, n = 0;     char c;     memset(s, 0, sizeof(s));     while ((c = getchar()) !=   n ) {       ++n;       if (c ==  I  || c ==  E  || c ==  A  || c ==  O  || c ==  U  || c ==  Y )         ++s[n];       s[n] += s[n - 1];     }     double sum = 0, ans = 0;     for (i = 1; i <= n; ++i) {       sum += (s[n - i + 1] - s[i - 1]);       ans = ans + sum / i;     }     printf( %.8lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 7, mod = 1e9 + 7, inf = 1e9 + 7;   const long long linf = (long long)1e18 + 7;   const long double eps = 1e-15, pi = 3.141592;   const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1},             dy[] = {0, 1, 0, -1, 1, -1, 1, -1};   inline long long get_ll() {     char x = getchar();     long long ret = 0;     while ( 0  <= x && x <=  9 )       ret = (ret << 3LL) + (ret << 1LL) + x -  0 , x = getchar();     return ret;   }   int n, sz;   long long ans;   long long a[N], suff[N];   int t[N * 20][2];   inline void add(long long x) {     int v = 0;     for (int i = 40; i >= 0; --i) {       int type = ((x & (1LL << i)) > 0);       if (!t[v][type]) t[v][type] = ++sz;       v = t[v][type];     }   }   inline long long get(long long x) {     int v = 0;     long long res = 0;     for (int i = 40; i >= 0; --i) {       int type = 1 - ((x & (1LL << i)) > 0);       if (t[v][type])         res += 1LL << i, v = t[v][type];       else         v = t[v][1 - type];     }     return res;   }   int main() {     n = get_ll();     for (int i = 1; i <= n; ++i) a[i] = get_ll();     for (int i = n; i >= 1; --i) suff[i] = suff[i + 1] ^ a[i];     long long pref = 0;     add(0);     for (int i = 1; i <= n + 1; ++i) {       ans = max(ans, get(suff[i]));       add(pref ^= a[i]);     }     cout << ans;     exit(0);   }
#include <bits/stdc++.h>   using namespace std;   inline int rd() {     int x = 0, y = 1;     char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) y = -y;       c = getchar();     }     while (isdigit(c)) x = x * 10 + c -  0 , c = getchar();     return x * y;   }   int k;   inline void init() { k = rd(); }   void solve(long long k) {     for (long long i = 1900; i >= 1; i--) {       long long tmp = k / i + 1;       long long sum = tmp * i - k;       long long x = tmp + sum;       if (1 <= x && x <= 1000000 && 1 <= sum && sum <= 1000000) {         printf( %lld n , i + 1);         printf( %lld , -sum);         for (int j = 0; j < i; j++) printf(  %lld , x);         puts(  );         return;       }     }   }   inline void work() { solve(k); }   int main() {     init();     work();     return 0;   }