malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   struct item_t {     int cost;     int gain;     int when;     bool operator<(const item_t& other) const { return when < other.when; }     bool operator<(const int t) const { return when < t; }   } item[4000];   bool operator<(int v, const item_t& item) { return v < item.when; }   struct dp_t {     int maxgain[4000 + 1];     void update(int c, int g) {       for (int b = 4000; b >= 0; b--)         if (b + c <= 4000) maxgain[b + c] = max(maxgain[b + c], maxgain[b] + g);     }   } toleft[4000], toright[4000];   int main() {     int n, window;     scanf( %d %d , &n, &window);     for (int i = 0; i < n; i++) {       scanf( %d %d %d , &item[i].cost, &item[i].gain, &item[i].when);     }     sort(item, item + n);     memset(toleft, 0, sizeof(toleft));     memset(toright, 0, sizeof(toright));     for (int i = 0; i < n; i++) {       if (i - 1 >= 0 && item[i - 1].when / window == item[i].when / window)         toleft[i] = toleft[i - 1];       toleft[i].update(item[i].cost, item[i].gain);     }     for (int i = n - 1; i >= 0; i--) {       if (i + 1 < n && item[i + 1].when / window == item[i].when / window)         toright[i] = toright[i + 1];       toright[i].update(item[i].cost, item[i].gain);     }     int nq;     scanf( %d , &nq);     for (int q = 0; q < nq; q++) {       int vis_when, budget;       scanf( %d %d , &vis_when, &budget);       int b = vis_when;       int a = b - window + 1;       int lb = lower_bound(item, item + n, a) - item;       int _ub = upper_bound(item, item + n, b) - item;       int gain;       if (lb == _ub)         gain = 0;       else {         int ub1 = _ub - 1;         if (item[lb].when / window != item[ub1].when / window) {           gain = 0;           for (int lbud = 0; lbud <= budget; lbud++)             gain = max(gain, toright[lb].maxgain[lbud] +                                  toleft[ub1].maxgain[budget - lbud]);         } else {           if (item[ub1].when / window == b / window)             gain = toleft[ub1].maxgain[budget];           else             gain = toright[lb].maxgain[budget];         }       }       printf( %d n , gain);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string lines[10000];   int scheme[4];   int quart = -1;   bool is_vowel(char c) {     return c ==  a  || c ==  e  || c ==  i  || c ==  o  || c ==  u ;   }   bool rhyme(int s, int a, int b) {     int A = lines[s + a].length() - scheme[a];     int B = lines[s + b].length() - scheme[b];     if (A != B) {       return false;     }     return lines[s + a].substr(scheme[a]) == lines[s + b].substr(scheme[b]);   }   int main() {     int n, k;     cin >> n >> k;     for (int i = 0; i < 4 * n; i++) {       cin >> lines[i];     }     for (int i = 0; i < n; i++) {       int s = i * 4;       for (int x = 0; x < 4; x++) {         scheme[x] = -1;         int v = 0;         for (int j = lines[s + x].length() - 1; j >= 0; j--) {           if (is_vowel(lines[s + x][j])) {             v++;             if (v == k) {               scheme[x] = j;               break;             }           }         }         if (scheme[x] == -1) {           cout <<  NO  << endl;           return 0;         }       }       bool ab = rhyme(s, 0, 1);       bool ac = rhyme(s, 0, 2);       bool ad = rhyme(s, 0, 3);       bool bc = rhyme(s, 1, 2);       bool bd = rhyme(s, 1, 3);       bool cd = rhyme(s, 2, 3);       int nq;       if (ab && bc && cd) {         nq = 0;       } else if (ab && cd) {         nq = 1;       } else if (ac && bd) {         nq = 2;       } else if (ad && bc) {         nq = 3;       } else {         cout <<  NO  << endl;         return 0;       }       if (quart == -1 || quart == 0) {         quart = nq;       } else if (nq == 0 || nq == quart) {         continue;       } else {         cout <<  NO  << endl;         return 0;       }     }     if (quart == 0) {       cout <<  aaaa  << endl;     } else if (quart == 1) {       cout <<  aabb  << endl;     } else if (quart == 2) {       cout <<  abab  << endl;     } else if (quart == 3) {       cout <<  abba  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007;   const long long INF = 1e15;   using Graph = vector<vector<long long>>;   signed main() {     long long T;     cin >> T;     for (long long t = 0; t < T; t++) {       long long N;       cin >> N;       vector<long long> A(N);       for (long long i = 0; i < N; i++) cin >> A[i];       sort(A.begin(), A.end());       long long ans = 1000000;       for (long long i = 1; i < N; i++) {         ans = min(ans, A[i] - A[i - 1]);       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   struct node {     int v, next;   } p[200005 << 1];   int head[200005], n, k;   long long dp[200005][10], size[200005], ans;   void dfs(int x, int fa, int depth) {     size[x] = dp[x][depth % k] = 1;     for (int i = head[x]; ~i; i = p[i].next) {       if (p[i].v == fa) continue;       dfs(p[i].v, x, depth + 1);       for (int a = 0; a < k; a++) {         for (int b = 0; b < k; b++) {           int dis = ((a + b) % k - (depth * 2) % k + k) % k;           ans += ((k - dis) % k) * dp[x][a] * dp[p[i].v][b];         }       }       for (int a = 0; a < k; a++) {         dp[x][a] += dp[p[i].v][a];       }       ans += size[p[i].v] * (n - size[p[i].v]);       size[x] += size[p[i].v];     }   }   int main() {     scanf( %d%d , &n, &k);     memset(head, -1, sizeof(head));     int len = 0;     for (int i = 0; i < n - 1; i++) {       int u, v;       scanf( %d%d , &u, &v);       p[len].v = v;       p[len].next = head[u];       head[u] = len++;       p[len].v = u;       p[len].next = head[v];       head[v] = len++;     }     dfs(1, 0, 0);     printf( %lld n , ans / k);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10, M = 1 << 20 | 10;   const int mod = 1e9 + 7;   long long n, m, sum;   int a[M];   int main() {     scanf( %lld%lld , &n, &m);     for (int i = 1; i <= n; i++) a[i] = i, sum += i;     if (sum > m) return puts( -1 ), 0;     for (int i = 1, j = n; i <= j;) {       if (sum + j - i <= m)         swap(a[i], a[j]), sum += j - i, i++, j--;       else         j--;     }     printf( %lld n , sum);     for (int i = 1; i <= n; i++) printf( %d  , i);     puts(  );     for (int i = 1; i <= n; i++) printf( %d  , a[i]);     puts(  );   }
#include <bits/stdc++.h>   using namespace std;   const int Dian = 200005;   const int Bian = Dian * 2;   const int M = Dian;   const int Segment_Size = Dian * 4;   int fir[Dian], ne[Bian], to[Bian], cnt, n, m;   int dp[Dian], depth[Dian], fa[Dian], Bigson[Dian], top[Dian], S[Dian],       dep[Dian], info[Dian];   struct One {     int from, to, C, LCA;   } Road[M];   vector<One> G[Dian];   void add(int x, int y) {     ne[++cnt] = fir[x];     fir[x] = cnt;     to[cnt] = y;   }   void link(int x, int y) {     add(x, y);     add(y, x);   }   void getinfo(int x, int f) {     S[x] = 1;     dep[x] = dep[f] + 1;     int mx = -1;     for (int i = fir[x]; i; i = ne[i]) {       int V = to[i];       if (V == f) continue;       getinfo(V, x);       if (S[V] > mx) Bigson[x] = V, mx = S[V];       S[x] += S[V];     }   }   void getidx(int x, int T) {     top[x] = T;     if (Bigson[x]) getidx(Bigson[x], T);     for (int i = fir[x]; i; i = ne[i]) {       int V = to[i];       if (V == fa[x] || V == Bigson[x]) continue;       getidx(V, V);     }   }   int LCA(int x, int y) {     while (top[x] != top[y]) {       if (dep[top[x]] < dep[top[y]]) swap(x, y);       x = fa[top[x]];     }     if (dep[y] < dep[x]) return y;     return x;   }   void read(void) {     scanf( %d%d , &n, &m);     for (int i = 2; i <= n; i++) {       scanf( %d , &fa[i]);       link(i, fa[i]);     }     getinfo(1, 0);     getidx(1, 1);     for (int i = 1; i <= m; i++) {       scanf( %d%d%d , &Road[i].from, &Road[i].to, &Road[i].C);       Road[i].LCA = LCA(Road[i].from, Road[i].to);       G[Road[i].LCA].push_back(Road[i]);     }   }   int getans(One Query) {     int x = Query.from, y = Query.to, now = Query.C;     while (top[x] != top[y]) {       if (dep[top[x]] < dep[top[y]]) swap(x, y);       now = now + info[top[x]] - info[Bigson[x]];       x = fa[top[x]];     }     if (dep[x] > dep[y]) swap(x, y);     now = now + info[x] - info[Bigson[y]];     return now;   }   int dfs(int x, int f) {     int sum = 0;     for (int i = fir[x]; i; i = ne[i]) {       int V = to[i];       if (V == f) continue;       sum += dfs(V, x);     }     info[x] = info[Bigson[x]] + sum;     dp[x] = sum;     for (int i = 0; i < (int)G[x].size(); i++)       dp[x] = max(dp[x], getans(G[x][i]));     info[x] -= dp[x];     return dp[x];   }   void doit(void) { printf( %d n , dfs(1, 0)); }   int main(void) {     read();     doit();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long t;     cin >> t;     while (t--) {       long long n, i, j;       string s;       cin >> s;       long long x;       cin >> x;       n = s.length();       string w = s;       for (i = 0; i < n; i++) {         w[i] =  1 ;       }       for (i = 0; i < n; i++) {         if (s[i] ==  0 ) {           if (i - x >= 0) {             w[i - x] =  0 ;           }           if (i + x < n) {             w[i + x] =  0 ;           }         }       }       bool con = true;       for (i = 0; i < n; i++) {         if (s[i] ==  1 ) {           long long c1 = 0;           long long c2 = 0;           if (i - x >= 0) {             c1 = w[i - x] -  0 ;           }           if (i + x < n) {             c2 = w[i + x] -  0 ;           }           long long num = c1 | c2;           if (num != 1) {             con = false;             break;           }         }       }       if (con)         cout << w <<   n ;       else         cout <<  -1  n ;     }   }
#include <bits/stdc++.h>   using namespace std;   inline long long getnum() {     char c = getchar();     long long num, sign = 1;     for (; c <  0  || c >  9 ; c = getchar())       if (c ==  - ) sign = -1;     for (num = 0; c >=  0  && c <=  9 ;) {       c -=  0 ;       num = num * 10 + c;       c = getchar();     }     return num * sign;   }   int nxt[400005], A[400005], store[400005], at[400005];   set<int> Set;   set<pair<long long, long long> > Cur;   int main() {     int n = getnum(), k = getnum(), ans = 0;     for (int i = 1; i <= n; i++) A[i] = getnum();     for (int i = n; i >= 1; i--) {       if (store[A[i]] != 0)         nxt[i] = store[A[i]];       else         nxt[i] = n + 1;       store[A[i]] = i;     }     for (int i = 1; i <= n; i++) {       if (Set.find(A[i]) == Set.end()) {         ans++;         if (Set.size() == k) {           auto it = Cur.end();           it--;           Set.erase(it->second);           Cur.erase(it);         }         Set.insert(A[i]);         Cur.insert({nxt[i], A[i]});         at[A[i]] = i;       } else {         Cur.erase({nxt[at[A[i]]], A[i]});         Cur.insert({nxt[i], A[i]});         at[A[i]] = i;       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int n, ar[N];   char mark[N] = {};   int sz[N] = {};   priority_queue<pair<int, int>, vector<pair<int, int> > > pq;   int main(void) {     cin.tie(0);     ios::sync_with_stdio(0);     cin >> n;     for (int i = 0; i < n; ++i) cin >> ar[i];     for (int i = 0; i < n; ++i) {       if (ar[i] != 0) {         pq.push(make_pair(ar[i], i));       } else {         sz[i] = min(3, (int)pq.size());         int tmp = sz[i];         while (tmp--) {           pair<int, int> x = pq.top();           pq.pop();           mark[x.second] = 1;         }         while (pq.size()) pq.pop();       }     }     int flag = 0;     for (int i = 0; i < n; ++i) {       if (ar[i] != 0) {         if (mark[i]) {           switch (flag) {             case 0:               cout <<  pushStack n ;               break;             case 1:               cout <<  pushQueue n ;               break;             case 2:               cout <<  pushFront n ;               break;           }           flag = (flag + 1) % 3;         } else           cout <<  pushBack n ;       } else {         int k = sz[i];         cout << k;         while (k--) {           flag = (flag - 1 + 3) % 3;           switch (flag) {             case 0:               cout <<   popStack ;               break;             case 1:               cout <<   popQueue ;               break;             case 2:               cout <<   popFront ;               break;           }         }         cout <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5 * 1e5 + 10;   int n, a[N];   int s[] = {4, 8, 15, 16, 23, 42};   int counts[50];   int mu[7];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     if (n < 6) {       cout << n << endl;       return 0;     }     for (int i = 1; i <= n; i++) {       if (a[i] == s[0]) {         mu[1]++;       } else if (a[i] == s[1] && mu[1] > 0 && mu[1] > mu[2]) {         mu[2]++;       } else if (a[i] == s[2] && mu[2] > 0 && mu[2] > mu[3]) {         mu[3]++;       } else if (a[i] == s[3] && mu[3] > 0 && mu[3] > mu[4]) {         mu[4]++;       } else if (a[i] == s[4] && mu[4] > 0 && mu[4] > mu[5]) {         mu[5]++;       } else if (a[i] == s[5] && mu[5] > 0 && mu[5] > mu[6]) {         mu[6]++;       }     }     int cnt = mu[1];     for (int i = 1; i <= 6; i++) {       cnt = min(cnt, mu[i]);     }     cout << (n - 6 * cnt) << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5e2 + 10;   int ans, mac, n;   int main() {     ios_base::sync_with_stdio(false);     cin >> n;     while (ans < n) {       mac += 5;       int x = mac;       while (x % 5 == 0) {         x /= 5;         ans++;       }     }     if (ans == n) {       cout << 5 <<   n ;       for (int i = mac; i < mac + 5; ++i) {         cout << i <<    ;       }       cout <<   n ;       return 0;     }     cout << 0 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1000000007;   long long q;   long long md[255][255] = {0};   long long a[500005] = {0};   int main() {     long long op, x, y;     scanf( %lld , &q);     while (q--) {       scanf( %lld %lld %lld , &op, &x, &y);       if (op == 1) {         for (long long i = 1; i <= 250; i++) md[i][x % i] += y;         a[x] += y;       }       if (op == 2) {         long long ans = 0;         if (x > 250) {           for (long long i = y; i <= 500000; i += x) ans += a[i];         } else           ans = md[x][y];         printf( %lld n , ans);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, d[22];   int f[22], g[22], L[22], memF[22];   void moveG(int n, int a, int b, int c) {     if (n == 0) return;     moveG(n - L[n], a, c, b);     for (int i = 0; i < L[n]; i++) printf( %d %d n , a, c);     moveG(n - L[n], b, a, c);   }   void moveF(int n, int a, int b, int c) {     if (n == 0) return;     if (memF[n] == 0) {       moveG(n - 1, a, c, b);       printf( %d %d n , a, c);       moveG(n - 1, b, a, c);     } else {       int k = memF[n];       moveG(n - k, a, b, c);       for (int i = 0; i < k; i++) printf( %d %d n , a, b);       moveG(n - k, c, b, a);       for (int i = 0; i < k; i++) printf( %d %d n , b, c);       moveF(n - k, a, b, c);     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &d[i]);     reverse(d + 1, d + 1 + n);     for (int i = 1; i <= n; i++) {       L[i] = 1;       while (i - L[i] >= 1 && d[i - L[i]] == d[i]) L[i]++;     }     for (int i = 1; i <= n; i++) {       f[i] = 2 * g[i - 1] + 1;       memF[i] = 0;       for (int k = 1; k <= L[i]; k++) {         int tmp = 2 * g[i - k] + f[i - k] + 2 * k;         if (tmp < f[i]) f[i] = tmp, memF[i] = k;       }       g[i] = 2 * g[i - L[i]] + L[i];     }     printf( %d n , f[n]);     moveF(n, 1, 2, 3);   }
#include <bits/stdc++.h>   using namespace std;   long long p;   long long base;   char s[20];   long long a;   long long d;   int main(int argc, const char* argv[]) {     int T;     cin >> T;     while (T--) {       base = 1989;       d = 10;       scanf( %s , s);       int i;       for (i = 0, a = 0; s[i + 4] >=  0  && s[i + 4] <=  9 ; i++)         a = a * 10 + (long long)(s[i + 4] -  0 );       for (int j = 2; j <= i; j++) {         base += d;         d *= 10;       }       for (i = 0; i * d + a < base; i++)         ;       cout << i * d + a << endl;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   vector<vector<pair<int, int>>> g;   vector<pair<int, pair<int, int>>> edg;   int cp[100010];   int find(int x) { return cp[x] = cp[x] == x ? x : find(cp[x]); }   void union_(int x, int y) { cp[find(x)] = find(y); }   int h[100010];   int anc[100010][18];   int val[100010][18];   void dfs_preprocess(int u, int p = -1) {     anc[u][0] = p;     if (~p) {       h[u] = h[p] + 1;     }     for (int i = 1; i < 18; ++i) {       if (~anc[u][i - 1]) {         anc[u][i] = anc[anc[u][i - 1]][i - 1];         val[u][i] = max(val[anc[u][i - 1]][i - 1], val[u][i - 1]);       }     }     for (auto v : g[u]) {       if (v.second != p) {         val[v.second][0] = v.first;         dfs_preprocess(v.second, u);       }     }   }   int LCA(int v, int u) {     if (h[v] < h[u]) swap(u, v);     int val_ans = 0;     for (int i = 18 - 1; i >= 0; --i) {       if (anc[v][i] + 1 && h[anc[v][i]] >= h[u]) {         val_ans = max(val_ans, val[v][i]);         v = anc[v][i];       }     }     if (v == u) return val_ans;     for (int i = 18 - 1; i >= 0; --i) {       if (anc[v][i] != anc[u][i]) {         val_ans = max({val_ans, val[v][i], val[u][i]});         v = anc[v][i];         u = anc[u][i];       }     }     val_ans = max({val_ans, val[v][0], val[u][0]});     return val_ans;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < n; ++i) cp[i] = i;     g.assign(n, vector<pair<int, int>>());     map<pair<int, int>, int> mp;     int id = 0;     for (int i = 0; i < m; ++i) {       int u, v, w;       cin >> u >> v >> w;       u--, v--;       mp[{u, v}] = id++;       edg.push_back({w, {u, v}});     }     sort((edg).begin(), (edg).end());     vector<int> mst(m, 0);     memset(anc, -1, sizeof(anc));     for (int i = 0; i < m; ++i) {       int u = edg[i].second.first, v = edg[i].second.second, w = edg[i].first;       if (find(u) != find(v)) {         union_(u, v);         g[u].push_back({w, v});         g[v].push_back({w, u});         mst[i] = 1;       }     }     dfs_preprocess(0);     vector<int> ans(m, -1);     for (int i = 0; i < m; ++i) {       if (!mst[i]) {         ans[mp[edg[i].second]] = LCA(edg[i].second.first, edg[i].second.second);       }     }     for (int u : ans) {       if (u + 1) cout << u <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   struct NODE {     char w[4];   };   NODE tmp;   vector<NODE> st, stt;   bool use[10];   int bull, cow;   char ss[6];   void back(int index) {     if (index == 4) {       int i, j, b, c;       for (i = 0, b = 0, c = 0; i < 4; ++i)         for (j = 0; j < 4; ++j)           if (tmp.w[i] == ss[j]) {             if (i == j)               b++;             else               c++;           }       if (b == bull && c == cow) {         st.push_back(tmp);       }     } else {       int i;       for (i = 0; i < 10; ++i) {         if (use[i]) continue;         tmp.w[index] =  0  + i;         use[i] = true;         back(index + 1);         use[i] = false;       }     }   }   int main() {     int i, k, j, num, m, n, b, c;     while (scanf( %d , &num) == 1) {       st.clear();       scanf( %s %d %d , ss, &bull, &cow);       memset(use, 0, sizeof(use));       back(0);       for (i = 2; i <= num; ++i) {         scanf( %s %d %d , ss, &bull, &cow);         stt.clear();         for (j = 0, k = st.size(); j < k; ++j) {           for (m = 0, b = 0, c = 0; m < 4; ++m) {             for (n = 0; n < 4; ++n) {               if (st[j].w[m] == ss[n]) {                 if (m == n)                   ++b;                 else                   ++c;               }             }           }           if (b == bull && c == cow) stt.push_back(st[j]);         }         st.clear();         for (j = 0, k = stt.size(); j < k; ++j) st.push_back(stt[j]);       }       if (st.size() > 1)         puts( Need more data );       else if (st.size() < 1)         puts( Incorrect data );       else {         for (i = 0; i < 4; ++i) printf( %c , st[0].w[i]);         putchar(  n );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t, a, b;     cin >> t;     while (t--) {       cin >> a >> b;       if (a == b) {         cout << 0 <<   n ;       } else if (abs(a - b) <= 10) {         cout << 1 <<   n ;       } else if (abs(a - b) % 10 != 0) {         cout << (abs(b - a) / 10) + 1 <<   n ;       } else {         cout << (abs(a - b) / 10) <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 100010;   long long MAX = 0;   vector<int> maxs;   vector<int> A[M];   map<pair<int, int>, int> mep;   map<pair<int, int>, int> tmpmep;   map<int, vector<pair<int, int> > > edges;   int weight[M];   int parent[M];   int compsize[M];   int visited[M];   int dp[M];   int f(int first) {     return parent[first] = parent[first] == first ? first : f(parent[first]);   }   void add(int a, int b) {     int first = f(a), second = f(b);     if (first != second) {       parent[first] = second;       compsize[second] += compsize[first];     }   }   int dfs1(int first) {     visited[first] = true;     int sum = 0;     for (int second : A[first])       if (!visited[second]) sum += dfs1(second);     return sum + compsize[first];   }   int dfs2(int first, int p, int total) {     visited[first] = true;     int sum = compsize[first];     for (int second : A[first])       if (!visited[second]) sum += dfs2(second, first, total);     long long trees = (long long)sum * (long long)(total - sum);     if (trees > MAX)       MAX = trees, maxs.clear(),       maxs.push_back(tmpmep[make_pair(min(p, first), max(p, first))]);     else if (trees == MAX)       maxs.push_back(tmpmep[make_pair(min(p, first), max(p, first))]);     return sum;   }   int main() {     ios_base::sync_with_stdio(false);     int i, j, k, n;     scanf( %d , &n);     for (int _ = 1; _ < n; _++) {       scanf( %d%d%d , &i, &j, &k);       mep[make_pair(min(i, j), max(i, j))] = _;       edges[k].push_back(make_pair(min(i, j), max(i, j)));       weight[_] = k;     }     for (i = 0; i <= n; i++) parent[i] = i, compsize[i] = 1;     for (auto elm : edges) {       set<int> nodes;       tmpmep.clear();       for (auto e : elm.second) {         int first = f(e.first), second = f(e.second);         nodes.insert(first);         nodes.insert(second);         A[first].push_back(second);         A[second].push_back(first);         tmpmep[make_pair(min(first, second), max(first, second))] = mep[e];       }       vector<pair<int, int> > roots;       for (auto first : nodes)         if (!visited[first]) roots.push_back(make_pair(first, dfs1(first)));       for (auto first : nodes) visited[first] = false;       for (auto p : roots) dfs2(p.first, -1, p.second);       for (auto e : elm.second) add(e.first, e.second);       for (auto first : nodes) {         A[first].clear();         visited[first] = false;       }     }     sort((maxs).begin(), (maxs).end());     printf( %lld %d n , 2 * MAX, (int)maxs.size());     for (auto m : maxs) printf( %d  , m);     printf(  n );     return 0;   }