malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int nroot = floor(sqrt(n));       if (nroot * nroot >= n) {         cout << 2 * nroot - 2 <<   n ;       } else if ((nroot + 1) * nroot >= n) {         cout << 2 * nroot - 1 <<   n ;       } else {         cout << 2 * nroot <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   const int maxn = 100000;   struct point {     int x, y;   };   point p[maxn + 10];   int n, used[maxn + 10];   inline int one_line(int a, int b, int c) {     if ((a == 0) || (b == 0) || (c == 0)) {       return 1;     }     return 1ll * (p[c].x - p[a].x) * (p[b].y - p[a].y) ==            1ll * (p[c].y - p[a].y) * (p[b].x - p[a].x);   }   int check(int a, int b) {     memset(used, 0, sizeof used);     used[a] = used[b] = 1;     for (register int i = 1; i <= n; ++i) {       if ((!used[i]) && (one_line(a, b, i))) {         used[i] = 1;       }     }     int u = 0, v = 0, w = 0, flag = 1;     for (register int i = 1; i <= n; ++i) {       if (!used[i]) {         u = v;         v = w;         w = i;         if (!one_line(u, v, w)) {           flag = 0;           break;         }       }     }     return flag;   }   int main() {     scanf( %d , &n);     for (register int i = 1; i <= n; ++i) {       scanf( %d%d , &p[i].x, &p[i].y);     }     if (check(1, 2) || check(2, 3) || check(1, 3)) {       puts( YES );     } else {       puts( NO );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int T;     scanf( %d , &T);     while (T--) {       int x, n, m;       scanf( %d%d%d , &x, &n, &m);       while (n-- && x >= 20) x = floor(1.0 * x / 2) + 10;       while (m--) x -= 10;       printf(x <= 0 ?  YES n  :  NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200100;   const int INF = 1000 * 1000 * 100;   string s[N];   char ch[30];   int d[1000 * 3000 + 10], l[30], r[30];   int lcps(int x) {     int sz = s[x].size();     for (int i = sz - 1; i >= 0; i--)       r[i] = r[i + 1] + ((s[x][i] -  0 ) << (sz - i - 1));     l[0] = s[x + 1][0] -  0 ;     for (int i = 1; i < sz; i++) l[i] = l[i - 1] * 2 + (s[x + 1][i] -  0 );     for (int i = sz; i > 0; i--)       if (l[i - 1] == r[sz - i]) return i;     return 0;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %20s , ch);       for (int j = 0; j < 20 && (ch[j] ==  0  || ch[j] ==  1 ); j++)         s[i] += ch[j];     }     int sz = s[0].size(), p = (1 << (sz + 1)), all(0), tmp(0);     fill(d, d + p, INF);     d[p - 1] = 0;     for (int i = 0; i < n; i++) {       int t = sz, mn = INF, z;       if (i) {         t = lcps(i - 1);         for (int j = 0; j <= sz; j++) {           if (j == 0) {             mn = min(all + sz - tmp, mn);             if (s[i][0] ==  0 )               z = p - 2;             else               z = 1;           } else {             mn = min(d[z] + sz - j, mn);             z *= 2;             if (j < sz) z += s[i][j] -  0 ;             z %= p;           }         }         z = 0;         mn -= (sz - t);         d[p - 1] = min(d[p - 1], mn);         for (int j = sz - 1; j >= 0; j--) {           int v = (1 << (sz - j - 1));           if (s[i - 1][j] -  0  == 1) {             z &= ((1 << (sz - j)) - 1);             if ((z & v) == 0) z += v;           } else {             z |= ((p - 1) ^ ((1 << (sz - j)) - 1));             if ((z & v) != 0) z -= v;           }           d[z] = min(d[z], mn);         }         tmp += (sz - t);         all += (sz - t);         all = min(all, mn + tmp);       } else         all += sz, tmp += sz, d[p - 1] = sz;     }     cout << all << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const int MOD = 1e9 + 7;   int n, m;   vector<int> liga[200100];   vector<int> adj[200100];   int state[200100];   int id[200100], sz[200100];   int vis[200200];   vector<int> top;   int find(int x) {     if (id[x] == x) return x;     return id[x] = find(id[x]);   }   void join(int a, int b) {     a = find(a);     b = find(b);     if (a == b) return;     if (sz[a] < sz[b]) swap(a, b);     id[b] = a;     sz[a] += sz[b];   }   void dfs(int v) {     vis[v] = 1;     for (auto x : adj[v]) {       if (vis[x]) continue;       dfs(x);     }     top.push_back(v);   }   void dfs2(int v, int ori) {     vis[v] = 1;     for (auto x : adj[v]) {       if (vis[x]) continue;       join(ori, x);       dfs2(x, ori);     }   }   void add(int a, int b) { adj[a].push_back(b); }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> state[i];     for (int i = 1; i <= 2 * m; i++) {       id[i] = i;       sz[i] = 1;     }     for (int i = 1; i <= m; i++) {       int amt;       cin >> amt;       while (amt--) {         int x;         cin >> x;         liga[x].push_back(i);       }     }     for (int i = 1; i <= n; i++) {       int x = liga[i][0];       int y = liga[i][1];       if (state[i]) {         add(2 * x - 1, 2 * y - 1);         add(2 * y, 2 * x);         add(2 * y - 1, 2 * x - 1);         add(2 * x, 2 * y);       } else {         add(2 * x, 2 * y - 1);         add(2 * y, 2 * x - 1);         add(2 * x - 1, 2 * y);         add(2 * y - 1, 2 * x);       }     }     for (int i = 1; i <= 2 * m; i++)       if (!vis[i]) dfs(i);     reverse(top.begin(), top.end());     memset(vis, 0, sizeof(vis));     for (auto x : top)       if (!vis[x]) dfs2(x, x);     for (int i = 1; i <= m; i++) {       if (find(2 * i) == find(2 * i - 1)) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     while (cin >> n >> m) {       int tmp = 0, mid = (m + 1) / 2, res = mid;       while (n--) {         if (tmp % 2 == m % 2)           res -= tmp;         else           res += tmp;         if (tmp == m) tmp = 0, res = mid;         cout << res << endl;         tmp++;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int v[100010];   int j[100010];   string ss;   bool haha;   int m;   void jump(int n) {     if (n < 0 || n >= m) {       haha = true;       return;     } else if (j[n] == 1) {       haha = false;       return;     } else {       int p;       if (ss[n] ==  < )         p = -1;       else if (ss[n] ==  > )         p = 1;       j[n] = 1;       jump(n + p * v[n]);       return;     }   }   int main(int argc, const char* argv[]) {     memset(j, 0, sizeof(j));     memset(v, 0, sizeof(v));     int n;     cin >> n;     m = n;     cin >> ss;     haha = true;     for (int i = 0; i < n; i++) {       cin >> v[i];     }     jump(0);     if (haha) {       printf( FINITE n );     } else {       printf( INFINITE n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int Search[1001][1001], Target1[1001], Target2[1001], Attack = 0;   int main() {     int Data1, Data2;     cin >> Data1 >> Data2;     for (int i = 0; i < Data1; i++) {       for (int i2 = 0; i2 < Data2; i2++) {         char Test;         cin >> Test;         if (Test ==  * ) {           Search[i][i2] = 1, Attack++;         }         Target1[i] += Search[i][i2];         Target2[i2] += Search[i][i2];       }     }     for (int i = 0; i < Data1; i++) {       for (int i2 = 0; i2 < Data2; i2++) {         if (Search[i][i2] == 0 && Target1[i] + Target2[i2] == Attack)           return cout <<  YES  << endl << i + 1 <<     << i2 + 1, 0;         if (Search[i][i2] == 1 && Target1[i] + Target2[i2] == Attack + 1)           return cout <<  YES  << endl << i + 1 <<     << i2 + 1, 0;       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:256000000 )   using namespace std;   long long mulmod(long long a, long long b, long long MOD) {     if (b == 0) return 0;     long long res = mulmod(a, b >> 1, MOD);     res += res;     res %= MOD;     return (b & 1) ? (a + res) % MOD : res;   }   int gcd(int a, int b) {     while (a != 0 && b != 0) {       if (a > b) {         a %= b;       } else {         b %= a;       }     }     return a + b;   }   long long gcd(long long a, long long b) {     while (a != 0 && b != 0) {       if (a > b) {         a %= b;       } else {         b %= a;       }     }     return a + b;   }   long long next(long long i) {     long long a[13], j = 0;     memset(a, 0, sizeof(a));     while (i != 0) {       a[j] = i % 10;       i /= 10;       j++;     }     bool pp = 0;     for (int k = j - 1; k >= 0; k--) {       if (pp) {         a[k] = 4;         continue;       }       if (a[k] < 4) {         a[k] = 4;         pp = 1;         continue;       }       if (4 < a[k] && a[k] < 7) {         a[k] = 7;         pp = 1;         continue;       }       if (a[k] > 7) {         while (a[k + 1] == 7) {           k++;         }         if (a[k + 1] == 4) {           a[k + 1] = 7;         } else {           a[k + 1] = 4;         }         a[k] = 4;         pp = 1;         continue;       }     }     i = 0;     for (int j = 12; j >= 0; j--) {       i = i * 10 + a[j];     }     return i;   }   int main() {     ios::sync_with_stdio(0);     int n, k;     string s;     cin >> n >> k >> s;     for (int i = 0; i < n - 1; i++) {       if (i < 0) i = 0;       if (k <= 0) break;       if (s[i] ==  4  && s[i + 1] ==  7 ) {         if (i % 2 == 0) {           if (i + 2 < n && s[i + 2] ==  7 ) {             if (k % 2 == 1) {               s[i + 1] =  4 ;             }             k = 0;             break;           } else {             s[i + 1] =  4 ;             k--;           }         } else {           s[i] =  7 ;           i -= 2;           k--;         }       }     }     cout << s;     return 0;   }
#include <bits/stdc++.h>   namespace IO {   template <typename Tp>   inline Tp input() {     Tp x = 0, y = 1;     char c = getchar();     while ((c <  0  ||  9  < c) && c != EOF) {       if (c ==  - ) y = -1;       c = getchar();     }     if (c == EOF) return 0;     while ( 0  <= c && c <=  9 ) x = x * 10 + c -  0 , c = getchar();     return x *= y;   }   template <typename Tp>   inline void read(Tp &x) {     x = input<Tp>();   }   };  // namespace IO   using namespace IO;   namespace modular {   const int MOD = 1000000007;   inline int add(int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }   inline void inc(int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }   inline int mul(int x, int y) { return 1LL * x * y % MOD; }   inline int qpow(int x, int y) {     int ans = 1;     for (; y; y >>= 1, x = mul(x, x))       if (y & 1) ans = mul(ans, x);     return ans;   }   };  // namespace modular   int N, top, tot;   int a[2007], b[2007], c[3];   std::pair<int, int> ans[2007 * 2007];   bool cmp(int x, int y) { return a[x] < a[y]; }   int main() {     srand(0x66ccf);     read(N);     for (int i = 1; i <= N; ++i) read(a[i]);     top = N;     for (int i = 1; i <= top; ++i) b[i] = i;     std::sort(b + 1, b + N + 1, cmp);     std::reverse(b + 1, b + N + 1);     while (top && !a[b[top]]) top--;     if (top < 2) return puts( -1 ), 0;     while (top > 2) {       for (int i = 0; i <= 2; ++i) {         c[i] = rand() % (top - i) + i + 1;         std::swap(b[i + 1], b[c[i]]);         c[i] = b[i + 1];       }       std::sort(c, c + 3, cmp);       int k = a[c[1]] / a[c[0]], mx = 0;       for (int i = 0; i <= 21; ++i)         if (k >> i & 1) mx = i;       for (int i = 0; i <= 2; ++i) b[i + 1] = c[i];       for (int i = 0; i <= mx; ++i) {         if (k >> i & 1) {           ans[++tot] = std::pair<int, int>(c[0], c[1]);           a[c[1]] -= a[c[0]];           a[c[0]] *= 2;         } else {           ans[++tot] = std::pair<int, int>(c[0], c[2]);           a[c[2]] -= a[c[0]];           a[c[0]] *= 2;         }       }       if (!a[c[1]]) {         std::swap(b[top], b[2]);         top--;       }     }     printf( %d n , tot);     for (int i = 1; i <= tot; ++i) printf( %d %d n , ans[i].first, ans[i].second);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000000 + 9;   long long pow(long long a, int n, long long mod) {     long long res = 1;     while (n) {       if (n % 2) {         res *= a;         res %= mod;         --n;       } else {         a *= a;         a %= mod;         n /= 2;       }     }     return res;   }   inline long long dec(long long a, long long b) {     return ((a - b) % mod + mod) % mod;   }   int main() {     int n, m;     cin >> n >> m;     if (m < 26 && n > pow(2, m, mod) - 1) {       cout << 0;       return 0;     }     long long ans = dec(pow(2, m, mod), 1);     int i;     for (i = 1; i < n; ++i) {       ans *= dec(pow(2, m, mod), i + 1);       ans %= mod;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 105;   const int oo = 1000000000;   long long n, k;   long long a[N], b[N], c[N];   long long module = 1000000007;   void print(vector<vector<long long> > mat) {     for (int j = 0; j < mat.size(); j++) {       for (int k = 0; k < mat[j].size(); k++) cout << mat[j][k] <<    ;       cout << endl;     }   }   vector<vector<long long> > mul(vector<vector<long long> > mat1,                                  vector<vector<long long> > mat2) {     vector<vector<long long> > res;     for (int i = 0; i < mat1.size(); i++) {       vector<long long> row;       for (int k = 0; k < mat2[0].size(); k++) {         long long temp = 0;         for (int j = 0; j < mat1[0].size(); j++) {           temp = (temp + mat1[i][j] * mat2[j][k] % module) % module;         }         row.push_back(temp);       }       res.push_back(row);     }     return res;   }   vector<vector<long long> > pow(vector<vector<long long> > mat, long long t) {     vector<vector<long long> > res;     if (t == 0) {       for (int i = 0; i < 16; i++) {         vector<long long> row;         for (int j = 0; j < 16; j++) {           if (i == j)             row.push_back(1);           else             row.push_back(0);         }         res.push_back(row);       }       return res;     }     res = pow(mat, t / 2);     res = mul(res, res);     if (t % 2 == 0)       return res;     else       return mul(mat, res);   }   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];     vector<vector<long long> > base;     vector<long long> row;     row.push_back(1);     base.push_back(row);     for (int i = 1; i < 16; i++) {       row.resize(0);       row.push_back(0);       base.push_back(row);     }     base.push_back(row);     for (int i = 1; i <= n; i++) {       long long dist = 0;       if (i == n)         dist = k - a[i];       else         dist = b[i] - a[i];       vector<vector<long long> > mat;       for (int j = 0; j < 16; j++) {         vector<long long> row;         for (int k = 0; k < 16; k++) {           if (j <= c[i] && k <= c[i] && (k == j || k == j - 1 || k == j + 1))             row.push_back(1);           else             row.push_back(0);         }         mat.push_back(row);       }       base = mul(pow(mat, dist), base);     }     cout << base[0][0];     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:16777216 )   using namespace std;   int com(const void* a, const void* b) { return *(int*)a - *(int*)b; }   int main(void) {     int n, k, i;     cin >> n >> k;     if (n / 2 > k)       cout << -1;     else if (n == 1 && k != 0)       cout << -1;     else {       i = n / 2 - 1;       int l = k - i;       if (n > 1) {         cout << l <<     << l * 2 <<    ;         for (l = l * 2 + 1; i > 0; i--, l += 2) printf( %d %d  , l, l + 1);       }       if (n % 2) printf( %d , l);     }   }
#include <bits/stdc++.h>   using namespace std;   int a[200001];   int b[600001];   int n, L;   bool chk(int d) {     if (d * 2 >= L) return true;     int l = 0, r = 3 * n - 1;     while (b[l] < a[0] - d) l++;     while (b[r] > a[0] + d) r--;     for (int i = 1; i < n; i++) {       l++;       r++;       while (b[l] < a[i] - d) l++;       if (b[r] > a[i] + d) r--;     }     return l <= r;   }   void Init() {     scanf( %d%d , &n, &L);     for (int i = 0; i < n; i++) scanf( %d , a + i);     for (int i = 0; i < n; i++) scanf( %d , b + n + i);   }   void Solve() {     for (int i = 0; i < n; i++) {       b[i] = b[i + n] - L;       b[i + 2 * n] = b[i + n] + L;     }     sort(a, a + n);     sort(b, b + 3 * n);     int left = 0, right = L / 2 + 1;     while (left < right) {       int m = (left + right) / 2;       if (chk(m))         right = m;       else         left = m + 1;     }     printf( %d n , left);   }   int main() {     Init();     Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int A[2006];   int B[2005];   map<int, int> mp;   int main() {     int a, b, n, x;     while (cin >> n) {       mp.clear();       int t = 1, x1, y1;       for (int i = 0; i < n; i++) {         scanf( %d , &A[i]);         if (mp.count(A[i]) == 0) mp[A[i]] = t++;       }       for (int i = 0; i < n; i++) {         scanf( %d , &B[i]);         if (mp.count(B[i]) == 0) mp[B[i]] = t++;       }       int sum = 0;       for (int i = 0; i < n; i++) {         for (int j = 0; j < n; j++) {           if (i == j) {             x = A[i] ^ B[j];             if (mp.count(x) == 1) sum++;           } else {             x = A[i] ^ B[j];             if (mp.count(x) == 1) sum++;           }         }       }       if (sum % 2 == 0)         cout <<  Karen  << endl;       else         cout <<  Koyomi  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100005;   int n, a[MAXN * 3], u[MAXN * 3], v[MAXN * 3], front, rear;   int main() {     int Q;     long long x;     scanf( %d%d , &n, &Q);     front = 1;     rear = n;     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= 2 * n - 2; i++) {       u[i] = a[front], v[i] = a[front + 1];       if (u[i] < v[i])         a[++front] = v[i], a[++rear] = u[i];       else         a[++front] = u[i], a[++rear] = v[i];     }     while (Q--) {       cin >> x;       if (x > n - 1) x = x % (n - 1) + n - 1;       printf( %d %d n , u[x], v[x]);     }     return 0;   }
#include <bits/stdc++.h>   const long long INF = (long long)1e18 + 123;   const int inf = (int)2e9 + 123;   const int mod = 1e9 + 7;   using namespace std;   int n, m, d[8000011], a[1000011], b[1000011];   void upd(int id, int x, int v = 1, int tl = 1, int tr = 1000000) {     if (tl > id || tr < id) return;     if (tl == tr) {       d[v] = x;       return;     }     int mid = (tl + tr) / 2;     upd(id, x, v * 2, tl, mid);     upd(id, x, v * 2 + 1, mid + 1, tr);     d[v] = d[v * 2] + d[v * 2 + 1];   }   int get(int x, int v = 1, int tl = 1, int tr = 1000000) {     if (tl == tr) return tl;     int mid = (tl + tr) / 2;     if (d[v * 2] >= x) {       return get(x, v * 2, tl, mid);     } else       return get(x - d[v * 2], v * 2 + 1, mid + 1, tr);   }   int get_id(int id, int v = 1, int tl = 1, int tr = 1000000) {     if (tl == tr) return d[v];     int mid = (tl + tr) / 2;     if (id <= mid)       return get_id(id, v * 2, tl, mid);     else       return get_id(id, v * 2 + 1, mid + 1, tr);   }   int size = 0;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> m >> n;     vector<int> v;     for (int i = 1; i <= n; i++) {       cin >> b[i];     }     for (int i = 1; i <= m; i++) {       int type;       cin >> type;       if (type == -1) {         int SZ = d[1];         for (int j = 1; j <= n; j++) {           if (b[j] > SZ) break;           upd(get(b[j] - j + 1), 0);         }       } else {         a[++size] = type;         upd(size, 1);       }     }     for (int i = 1; i <= size; i++) {       if (get_id(i) > 0) v.push_back(a[i]);     }     if (!v.size()) {       cout <<  Poor stack! ;       return 0;     }     for (int i = 0; i < v.size(); i++) {       cout << v[i];     }     return 0;   }
#include <bits/stdc++.h>   namespace IO {   template <typename T>   inline void read(T &x) {     x = 0;     int f = 1;     char ch = getchar();     while (ch >  9  || ch <  0 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       x = (x << 3) + (x << 1) + ch -  0 , ch = getchar();     x *= f;     return;   }   template <typename T>   inline void write(T x = 0) {     T wr[51];     wr[0] = 0;     if (x < 0) putchar( - ), x = -x;     if (!x) putchar(48);     while (x) wr[++wr[0]] = x % 10, x /= 10;     while (wr[0]) putchar(48 + wr[wr[0]--]);     return;   }   }  // namespace IO   using IO::read;   using IO::write;   using namespace std;   const int N = 4e6 + 11;   int n, m, top, now, k;   int op[N], a[N], b[N], fa[N], sz[N], sa[N], sb[N], cur[N], ti[N];   vector<pair<int, int> > v[N];   void modify(int x, int y, int a, int b, int k, int l, int r) {     if (x <= l && r <= y) {       v[k].push_back(pair<int, int>(a, b));       return;     }     int mid = (l + r) >> 1;     if (x <= mid) modify(x, y, a, b, k << 1, l, mid);     if (mid < y) modify(x, y, a, b, k << 1 | 1, mid + 1, r);   }   int find(int x) { return fa[x] == x ? x : find(fa[x]); }   void merge(int x, int y) {     x = find(x), y = find(y);     if (x == y) return;     if (sz[x] < sz[y]) swap(x, y);     sa[++top] = x, sb[top] = y;     sz[x] += sz[y];     fa[y] = x;   }   void del(int tim) {     int x, y;     while (top > tim) {       x = sa[top], y = sb[top];       fa[y] = y, sz[x] -= sz[y];       --top;     }   }   void dfs(int k, int l, int r) {     int t = top;     for (auto s : v[k]) merge(s.first, s.second);     if (l == r) {       if (op[l] == 2) printf( %d n , sz[find(a[l])]);       del(t);       return;     }     int mid = (l + r) >> 1;     dfs(k << 1, l, mid), dfs(k << 1 | 1, mid + 1, r);     del(t);   }   int main() {     read(n);     read(m);     read(k);     for (int i = 1; i <= n; ++i) fa[i] = i, sz[i] = 1;     for (int i = 1; i <= m; ++i) {       read(op[i]);       if (op[i] == 1)         read(a[i]), read(b[i]), cur[i] = now;       else if (op[i] == 2)         read(a[i]), cur[i] = now;       else         ti[++now] = i, cur[i] = now;     }     for (int i = 1; i <= m; ++i)       if (op[i] == 1) {         if (cur[i] + k > now)           modify(i, m, a[i], b[i], 1, 1, m);         else           modify(i, ti[cur[i] + k], a[i], b[i], 1, 1, m);       }     dfs(1, 1, m);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     long long n;     cin >> n;     long long a[n];     map<long long, long long> m;     for (long long i = 0; i < n; i++) {       cin >> a[i];       m[a[i]]++;     }     long long ctr = 0, mx = 1;     for (auto i : m) {       ctr++;       if (i.second > 1) mx = max(mx, i.second);     }     cout << mx <<     << ctr;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 65;   const int M = 5e4 + 10;   int n, m, a[N], b[N], q, trans[M], ans;   vector<int> p[N * N];   template <class T>   void chkMax(T &x, T y) {     if (x < y) x = y;   }   int Do(int x, int y) {     int i = 0, j = 0, ret = 0, szx = p[x].size(), szy = p[y].size();     while (i < szx && j < szy) {       ++ret;       if (p[x][i] == p[y][j])         ++i, ++j;       else if (p[x][i] < p[y][j])         ++i;       else         ++j;     }     return ret + szx - i + szy - j;   }   int main() {     cin >> n >> m;     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < m; ++i) cin >> b[i];     memset(trans, -1, sizeof(trans));     q = 0;     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j) {         int tmp = a[i] + b[j] + 2e4 + 1;         if (trans[tmp] == -1) p[trans[tmp] = q++].clear();         p[trans[tmp]].push_back(i);         p[trans[tmp]].push_back(j + n);       }     for (int i = 0; i < q; ++i) {       sort(p[i].begin(), p[i].end());       p[i].resize(unique(p[i].begin(), p[i].end()) - p[i].begin());     }     ans = 0;     if (q == 1) ans = n + m;     for (int i = 0; i < q; ++i)       for (int j = i + 1; j < q; ++j) chkMax(ans, Do(i, j));     printf( %d n , ans);     return 0;   }