malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   ifstream in;   ofstream out;   const long long kk = 1000;   const long long ml = kk * kk;   const long long mod = ml * kk + 7;   const long long inf = ml * ml * ml + 7;   const long long gs = 500 * kk;   long n, m, i, j, k, ans;   vector<long> reb[gs + 10];   set<long long> all;   map<long long, vector<pair<long long, long long>>> mp;   vector<long long> z, st;   long long col[gs + 10];   long long tc[gs + 10];   bool viv = false;   void DFS(long v, long c) {     col[v] = c;     long l = reb[v].size();     for (long i = 0; i < l; i++) {       long s = reb[v][i];       if (col[s] == -1) {         DFS(s, c + 1);       }     }   }   void BFS(long v) {     vector<long> st;     st.push_back(v);     long s = 0;     tc[v] = 0;     while (s < st.size()) {       long e = st[s];       long l = reb[e].size();       for (long i = 0; i < l; i++) {         long s = reb[e][i];         if (tc[s] == -1) {           st.push_back(s);           tc[s] = tc[e] + 1;         }       }       s++;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> k;     for (i = 0; i < n; i++) {       long long a;       cin >> a;       z.push_back(a);     }     for (i = 0; i < m; i++) {       long a, b;       cin >> a >> b;       a--;       b--;       all.insert(z[a] ^ z[b]);       mp[z[a] ^ z[b]].push_back({a, b});     }     for (i = 0; i < n; i++) col[i] = -1;     st.push_back(1);     for (i = 0; i < ml; i++) st.push_back((st.back() * 2) % mod);     ans = 0;     ans = (((st[k] - all.size() + mod) % mod) * (st[n])) % mod;     for (auto x : all) {       set<long long> ver;       for (auto e : mp[x]) ver.insert(e.first), ver.insert(e.second);       for (auto v : ver) reb[v].clear(), col[v] = -1;       for (auto e : mp[x])         reb[e.first].push_back(e.second), reb[e.second].push_back(e.first);       long long comp = 0;       for (auto v : ver)         if (col[v] == -1) DFS(v, 1), comp++;       comp += n - ver.size();       ans += st[comp];       ans %= mod;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long int n, i;     cin >> n;     vector<long long int> a(n), b, c;     for (i = 0; i < n; i++) cin >> a[i];     sort(a.begin(), a.end());     for (i = 0; i < n; i++) {       if (a[i] % 2 == 0)         b.push_back(a[i]);       else         c.push_back(a[i]);     }     long long int s = b.size(), f = c.size();     long long int check = 0, j;     if (s % 2 == 0 && f % 2 == 0)       cout <<  YES  << endl;     else if (s % 2 != 0 && f % 2 != 0) {       for (i = 0; i < b.size(); i++) {         for (j = 0; j < c.size(); j++) {           if (abs(b[i] - c[j]) == 1) {             check = 1;             break;           }         }         if (check == 1) break;       }       if (check == 1)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     } else {       cout <<  NO  << endl;     }   }   int main() {     long long int t;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   long long POW(long long a, long long b, long long MMM = MOD) {     long long ret = 1;     for (; b; b >>= 1, a = (a * a) % MMM)       if (b & 1) ret = (ret * a) % MMM;     return ret;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long lcm(long long a, long long b) {     if (a == 0 || b == 0) return a + b;     return a * (b / gcd(a, b));   }   int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};   int ddx[] = {-1, -2, 1, -2, 2, -1, 2, 1}, ddy[] = {-2, -1, -2, 1, -1, 2, 1, 2};   pair<int, int> a[200000];   int c[20], b[200000];   int n;   bool ok(int k) {     for (int(i) = (0); (i) <= (n - 1); (i) += (1))       a[i] = make_pair(b[i] >= (1 << k) ? 0 : b[i], i);     for (int(i) = (k - 1); (i) >= (0); (i) -= (1)) {       int t = max_element(a, a + n) - a;       swap(a[0], a[t]);       if (a[0].first == 0) return 0;       if (31 - __builtin_clz(a[0].first) != i) return 0;       c[i] = b[a[0].second];       for (int(j) = (n - 1); (j) >= (0); (j) -= (1))         if (a[j].first & (1 << i)) a[j].first ^= a[0].first;     }     printf( %d n , k);     int now = 0;     for (int(i) = (1); (i) <= (1 << k); (i) += (1)) {       printf( %d  , now);       now ^= (c[__builtin_ctz(i)]);     }     return 1;   }   int main() {     scanf( %d , &n);     for (int(i) = (0); (i) <= (n - 1); (i) += (1)) {       scanf( %d , &b[i]);     }     for (int(k) = (18); (k) >= (1); (k) -= (1)) {       if (ok(k)) return 0;     }     puts( 0 n0 );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       string s;       cin >> n;       cin >> s;       int l = 0, r = n - 1, x = 0, y = 0;       while (s[l] ==  < ) {         l++;         x++;       }       while (s[r] ==  > ) {         r--;         y++;       }       cout << min(x, y) << endl;       ;     }     return 0;   }
#include <bits/stdc++.h>   struct stack {     char a[1000010];     int top;   } st;   void push(char val) { st.a[st.top++] = val; }   int pop() { return st.a[--st.top]; }   int empty() { return st.top == 0; }   char s[1000010];   int main() {     char t;     int i, cnt = 0;     gets(s);     st.top = 0;     for (i = 0; s[i]; i++) {       if (s[i] ==  [  || s[i] ==  <  || s[i] ==  (  || s[i] ==  { )         push(s[i]);       else {         if (empty()) {           printf( Impossible );           return 0;         }         t = pop();         if (t ==  (  && s[i] !=  )  || t ==  <  && s[i] !=  >  ||             t ==  [  && s[i] !=  ]  || t ==  {  && s[i] !=  } )           cnt++;       }     }     if (!empty()) {       printf( Impossible );       return 0;     }     printf( %d , cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   char c[5005];   int l[5005];   int r[5005];   int solve(int x) {     int a = 0, b = 0;     for (int i = 0; i < n; i++) {       if (x < l[i] || x > r[i])         continue;       else {         if (c[i] ==  M )           a++;         else           b++;       }     }     return min(a, b);   }   int main() {     cin >> n;     for (int i = 0; i < n; i++) cin >> c[i] >> l[i] >> r[i];     int ans = 0;     for (int i = 0; i < 370; i++) {       ans = max(ans, 2 * solve(i));     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, i, j, sum = 0, x, y, b;     cin >> n >> m;     int a[n][m];     vector<pair<int, int>> v;     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         cin >> a[i][j];         sum += a[i][j];         if (a[i][j] == 0) v.push_back(make_pair(i, j));       }     }     for (i = v.size() - 1; i >= 0; i--) {       x = v[i].first;       y = v[i].second;       a[x][y] = min(a[x + 1][y], a[x][y + 1]);       a[x][y] -= 1;       sum += a[x][y];     }     for (i = 0; i < n - 1; i++) {       for (j = 0; j < m - 1; j++) {         if (a[i][j] >= a[i + 1][j] || a[i][j] >= a[i][j + 1]) {           cout << -1;           return 0;         }       }     }     for (i = 0; i < m - 1; i++) {       if (a[n - 1][i] >= a[n - 1][i + 1]) {         cout << -1;         return 0;       }     }     for (j = 0; j < n - 1; j++) {       if (a[j][m - 1] >= a[j + 1][m - 1]) {         cout << -1;         return 0;       }     }     cout << sum;   }
#include <bits/stdc++.h>   using namespace std;   map<int, int> M;   int n, cnt, a[5001], ans[5001];   int m, k, b[5001];   bool vis[10001], used[5001];   void init() {     for (int i = 2; i < 10001; i++) {       if (!vis[i]) {         for (int j = i + i; j < 10001; j += i) {           vis[j] = true;         }         b[++m] = i * i;       }     }   }   int main() {     init();     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       if (a[i] != 0) {         bool minus = a[i] < 0;         if (minus) {           a[i] = -a[i];         }         for (int j = 1; j <= m && b[j] <= a[i]; j++) {           while (a[i] % b[j] == 0) {             a[i] /= b[j];           }         }         if (minus) {           a[i] = -a[i];         }         int t = M[a[i]];         if (t == 0) {           M[a[i]] = ++k;           a[i] = k;         } else {           a[i] = t;         }       } else {         a[i] = 0;       }     }     for (int i = 1; i <= n; i++) {       cnt = 0;       memset(used, false, sizeof(used));       for (int j = i; j <= n; j++) {         if (used[a[j]] == false && a[j] != 0) {           cnt++;           used[a[j]] = true;         }         ans[((cnt) > (1) ? (cnt) : (1))]++;       }     }     for (int i = 1; i <= n; i++) {       printf( %d , ans[i]);       if (i == n) {         printf(  n );       } else {         printf(   );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int N = 1e5 + 10;   int n;   ll d, m;   ll a[N], sum[N];   int main() {     cin >> n >> d >> m;     for (int i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     ll tmp = 0;     int ptr = -1;     for (int i = 0; i < n; i++) {       if (a[i] <= m)         tmp += a[i];       else {         reverse(a, a + i);         ptr = i - 1;         break;       }     }     sum[0] = a[0];     for (int i = 1; i < n; i++) sum[i] = sum[i - 1] + a[i];     ll ans = tmp + (a[n - 1] > m ? a[n - 1] : 0), here = 0;     for (int i = n - 1; i > ptr; i--) {       here += a[i];       int need = (n - i) * (d + 1) - d;       int p = min(n - 1 - need, ptr);       if (need > n) break;       ans = max(ans, here + (p >= 0 ? sum[p] : 0));     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> vec;     double ans = 0;     int n;     cin >> n;     vec.resize(n);     for (int i = 0; i < n; cin >> vec[i++])       ;     sort(vec.rbegin(), vec.rend());     for (int i = 0; i < n; i += 2) ans += vec[i] * vec[i];     for (int i = 1; i < n; i += 2) ans -= vec[i] * vec[i];     ans *= 3.1415926536;     cout << fixed << setprecision(11) << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, i, j, ans, k;   int main() {     scanf( %I64d%I64d , &n, &k);     ans = 1;     for (i = 2; i <= n; i++) {       if (i == 1)         ans = (ans * (k - 1)) % 1000000007;       else if (i <= k)         ans = (ans * (k)) % 1000000007;       else         ans = (ans * (n - k)) % 1000000007;     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mxn = 1e6 + 7;   const long long mod = 1e9 + 7;   const long long inf = 1e18 + 7;   int dx[] = {+1, -1, 0, 0};   int dy[] = {0, 0, -1, +1};   pair<int, int> p[mxn];   map<long long, long long> f, s;   int n;   int a[mxn], ls[mxn];   long long ans;   void upd1(int x, int val) {     while (x <= (int)1e8) {       f[x] += val;       x = (x | (x + 1));     }   }   void upd2(int x) {     while (x <= (int)1e8) {       s[x]++;       x = (x | (x + 1));     }   }   long long sum1(int x) {     long long res = 0;     while (x > 0) {       res += f[x];       x = (x & (x + 1)) - 1;     }     return res;   }   int sum2(int x) {     int res = 0;     while (x > 0) {       res += s[x];       x = (x & (x + 1)) - 1;     }     return res;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> p[i].first;     }     for (int i = 1; i <= n; i++) {       cin >> p[i].second;       ls[i] = p[i].second;     }     sort(p + 1, p + n + 1);     sort(ls + 1, ls + n + 1);     for (int i = 1; i <= n; i++) {       p[i].second = lower_bound(ls + 1, ls + n + 1, p[i].second) - ls;     }     for (int i = 1; i <= n; i++) {       ans += (1LL * p[i].first * sum2(p[i].second)) - sum1(p[i].second);       upd1(p[i].second, p[i].first);       upd2(p[i].second);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void warp() {     cin.tie(0);     cout.tie(0);     ios_base::sync_with_stdio(false);   }   long long get(vector<long long> &a, vector<long long> &b) {     long long ans = 0;     long long all = 0;     long long n = a.size();     for (long long i = 0; i < n; i++) all += b[i];     long long cur = b[0], tar = 0;     while (cur < all - cur) {       tar++;       cur += b[tar];     }     for (long long i = 0; i < n; i++) {       ans += b[i] * abs(a[i] - a[tar]);     }     return ans;   }   long long check(long long need, vector<long long> a) {     long long ans = 0;     long long n = a.size();     vector<long long> cur;     vector<long long> b;     long long s = 0;     for (long long i = 0; i < n; i++) {       a[i] %= need;       if (a[i]) {         cur.push_back(i);         b.push_back(a[i]);       }       s += a[i];       if (s >= need && b.size()) {         b.back() -= (s - need);         ans += get(cur, b);         cur.clear();         b.clear();         s -= need;         if (s == 0) continue;         cur.push_back(i);         b.push_back(s);       }     }     return ans;   }   long long solve(long long n, vector<long long> a) {     long long cnt = 0;     for (long long i = 0; i < n; i++) cnt += a[i];     if (cnt == 1) {       return -1;     }     long long ans = check(cnt, a);     vector<bool> prime(1e6 + 1, true);     for (long long i = 2; i * i <= cnt; i++) {       if (cnt % i) continue;       while (cnt % i == 0) cnt /= i;       ans = min(ans, check(i, a));     }     if (cnt > 1) ans = min(ans, check(cnt, a));     return ans;   }   const long long maxn = 1e6;   void gen(vector<long long> &a) {     long long n = a.size();     for (long long i = 0; i < n; i++) a[i] = rand() % 20;     long long s = 0;     for (long long i = 0; i < n; i++) s += a[i];     if (s == 0) a[0] = 1;   }   signed main() {     warp();     long long n;     cin >> n;     vector<long long> a(n);     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     cout << solve(n, a) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Person {     int num;     string n1, n2;     string final;     Person(int num = -1) { this->num = num; }     void read(int num = -1) {       this->num = num;       cin >> n1 >> n2;     }   };   const int N = 200000;   Person b[N], a[N];   int p[N];   int n;   bool smaller(Person f, Person s) { return p[f.num] < p[s.num]; }   void fail() {     printf( NO n );     exit(0);   }   const bool D = 0;   int main() {     if (D) {       freopen( test.in ,  r , stdin);       freopen( test.out ,  w , stdout);     } else {     }     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       b[i].read(i);     }     for (int i = 0; i < n; ++i) {       scanf( %d , &p[i]);       --p[i];     }     for (int i = 0; i < n; ++i) {       a[i] = b[p[i]];     }     a[0].final = min(a[0].n1, a[0].n2);     for (int i = 1; i < n; ++i) {       a[i].final = min(a[i].n1, a[i].n2);       if (a[i].final <= a[i - 1].final) {         a[i].final = max(a[i].n1, a[i].n2);         if (a[i].final <= a[i - 1].final) fail();       }     }     printf( YES n );     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, i, j, temp;     scanf( %d , &n);     char s[n];     scanf( %s , &s);     for (i = 0; i < n; i++) {       if (s[i] > s[i + 1] && i + 1 < n) {         printf( YES n );         printf( %d %d , i + 1, i + 2);         return 0;       }     }     printf( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void pr(vector<T> &v) {     for (int i = 0; i < (int)(v).size(); i++) cout << v[i] <<    ;     cout <<   n ;     ;   }   template <typename T>   void pr(vector<vector<T>> &v) {     for (int i = 0; i < (int)(v).size(); i++) {       pr(v[i]);     }   }   template <typename T>   void re(T &x) {     cin >> x;   }   template <typename T>   void re(vector<T> &a) {     for (int i = 0; i < (int)(a).size(); i++) re(a[i]);   }   template <class Arg, class... Args>   void re(Arg &first, Args &...rest) {     re(first);     re(rest...);   }   template <typename T>   void pr(T x) {     cout << x <<   n ;     ;   }   template <class Arg, class... Args>   void pr(const Arg &first, const Args &...rest) {     cout << first <<    ;     pr(rest...);     cout <<   n ;     ;   }   void ps() {     cout <<   n ;     ;   }   template <class T, class... Ts>   void ps(const T &t, const Ts &...ts) {     cout << t;     if (sizeof...(ts)) cout <<    ;     ps(ts...);   }   const long long MOD = 1000000007;   long double PI = 4 * atan(1);   long double eps = 1e-12;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long long n, k;     cin >> n >> k;     long long powk = k;     long long exp = 1;     long long nexp = n - 1;     if (k == 1) {       nexp = n;     }     if (k != 0 && k != 1) {       while (powk % n != 1) {         powk *= k;         powk %= n;         exp++;       }       nexp = (n - 1) / exp;     }     long long powp = 1;     for (int i = 0; i < nexp; i++) {       powp *= n;       powp %= MOD;     }     cout << powp <<   n ;     ;   }
#include <bits/stdc++.h>   using namespace std;   int s[10000], g[10000];   set<int> v;   int main() {     int k, n;     cin >> k >> n;     for (int i = 0; i < n; i++) {       cin >> s[i] >> g[i];     }     for (int i = 1; i <= 100; i++) {       bool f = 1;       for (int j = 0; j < n; j++) {         if ((s[j] + i - 1) / i != g[j]) {           f = 0;           break;         }       }       if (f) {         v.insert((k + i - 1) / i);       }     }     if (v.size() != 1) {       cout << -1;     } else {       cout << *v.begin();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n1 = 0;       int n2 = 0;       int n4 = 0;       int n8 = 0;       int n16 = 0;       int n32 = 0;       int n64 = 0;       int n128 = 0;       int n256 = 0;       int n512 = 0;       int n1024 = 0;       int n2048 = 0;       bool flag = false;       int n;       cin >> n;       for (int i = 0; i < n; i++) {         int temp;         cin >> temp;         if (temp == 2048) {           n2048++;           flag = true;         }         if (flag == false) {           if (temp == 1)             n1++;           else if (temp == 2)             n2++;           else if (temp == 4)             n4++;           else if (temp == 8)             n8++;           else if (temp == 16)             n16++;           else if (temp == 32)             n32++;           else if (temp == 64)             n64++;           else if (temp == 128)             n128++;           else if (temp == 256)             n256++;           else if (temp == 512)             n512++;           else if (temp == 1024)             n1024++;         }       }       if (n2048 >= 1) {         cout <<  YES  << endl;         continue;       }       int temp;       temp = n1 / 2;       n2 += temp;       temp = n2 / 2;       n4 += temp;       temp = n4 / 2;       n8 += temp;       temp = n8 / 2;       n16 += temp;       temp = n16 / 2;       n32 += temp;       temp = n32 / 2;       n64 += temp;       temp = n64 / 2;       n128 += temp;       temp = n128 / 2;       n256 += temp;       temp = n256 / 2;       n512 += temp;       temp = n512 / 2;       n1024 += temp;       temp = n1024 / 2;       n2048 += temp;       if (n2048 >= 1) {         cout <<  YES  << endl;       } else {         cout <<  NO  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int c[200010];   int v[200010];   set<int> not_full;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, m, q, p, x, k;     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> c[i];       not_full.insert(i);     }     cin >> m;     while (m--) {       cin >> q;       if (q == 1) {         cin >> p >> x;         while (x > 0) {           if (not_full.find(p) == not_full.end()) {             set<int>::iterator it = not_full.upper_bound(p);             if (it == not_full.end()) {               break;             } else {               p = *it;             }           } else if (v[p] + x < c[p]) {             v[p] += x;             x = 0;           } else {             x = x - (c[p] - v[p]);             v[p] = c[p];             not_full.erase(p);           }         }       } else {         cin >> k;         cout << v[k] <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> p(n, 0);     for (int i = 0; i < n; i++) {       int aux;       cin >> aux;       p[i] = aux - 1;     }     vector<long long int> dp(n + 1, 0);     for (int i = 1; i < n + 1; i++) {       dp[i] = (long long int)(dp[i - 1] * (long long int)2 - dp[p[i - 1]] + 2 +                               1000000007) %               1000000007;     }     cout << dp[n] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> V[300300][30];   int Lar[300300];   vector<int> Map[300300];   struct tree {     tree *L[27];     tree() {       for (int i = 0; i < 27; i++) L[i] = NULL;     }   } root, *point, *point2;   int mm[300300], C[300300], depht[300300];   int MAX = 1;   tree *Pos[300300];   void dfs(int x) {     tree *ant = point;     C[x] = 1;     mm[x] = -1;     Pos[x] = point;     pair<int, int> *p;     for (int i = 0; i < Lar[x]; i++) {       p = &V[x][i];       if (point->L[p->second] == NULL) {         point->L[p->second] = new tree;         point = point->L[p->second];       } else {         point = point->L[p->second];       }       depht[p->first] = depht[x] + 1;       if (depht[p->first] > MAX) MAX = depht[p->first];       dfs(p->first);       C[x] += C[p->first];       if (mm[x] == -1) {         mm[x] = p->first;       } else if (C[p->first] > C[mm[x]]) {         mm[x] = p->first;       }       point = ant;     }     Map[depht[x]].push_back(x);   }   bool flag;   int Nodo;   void dfs2(int y) {     bool aflag = flag;     tree *ap2 = point2;     tree *ap1 = point;     pair<int, int> *p;     for (int i = 0; i < Lar[y]; i++) {       p = &V[y][i];       if (flag) {         if (point2->L[p->second] != NULL) {           point2 = point2->L[p->second];         } else {           flag = false;         }       }       if (point->L[p->second] != NULL) {         point = point->L[p->second];       } else {         point->L[p->second] = new tree;         point = point->L[p->second];         if (!flag) Nodo++;       }       dfs2(p->first);       point2 = ap2;       point = ap1;       flag = aflag;     }     flag = aflag;   }   int Sol[300300];   int main() {     int N, x, y;     char l[5];     scanf( %d , &N);     for (int i = 1; i < N; i++) {       scanf( %d%d%s , &x, &y, l);       V[x][Lar[x]] = pair<int, int>(y, l[0] -  a );       Lar[x]++;     }     depht[1] = 1;     point = &root;     Pos[1] = point;     dfs(1);     int X, Y;     for (int i = 1; i < MAX; i++) {       Sol[i] = 0;       for (vector<int>::iterator p = Map[i].begin(); p != Map[i].end(); p++) {         X = *p;         if (Lar[X] == 1) {           Sol[i]++;           continue;         } else if (Lar[X] == 0) {           continue;         }         tree *ante;         point = ante = new tree;         Nodo = C[mm[X]];         pair<int, int> *q;         for (int i = 0; i < Lar[X]; i++) {           q = &V[X][i];           Y = q->first;           if (Y != mm[X]) {             point2 = Pos[mm[X]];             flag = true;             dfs2(Y);             point = ante;           }         }         Sol[i] += (C[X]) - Nodo;       }     }     int XSol = 0;     for (int i = 1; i < MAX; i++) {       if (Sol[XSol] < Sol[i]) {         XSol = i;       }     }     printf( %d n%d n , N - Sol[XSol], XSol);     return 0;   }