malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int INF = 1000000001;   const long long LINF = 1000000000000000001LL;   struct ITree {     vector<vector<long long>> T;     int p = 1;     int par(int x) { return (x - 1) / 2; }     ITree(vector<long long> &E) {       int n = (int)(E).size();       while (p < n) p *= 2;       T.resize(2 * p - 1);       for (int i = (0); i <= (n - 1); ++i) {         int v = i + p - 1;         T[v].push_back(E[i]);         while (v) {           v = par(v);           T[v].push_back(E[i]);         }       }       for (int i = (0); i <= ((int)(T).size() - 1); ++i)         sort(T[i].begin(), T[i].end());     }     int Count(int v, long long valL, long long valR) {       return upper_bound(T[v].begin(), T[v].end(), valR) -              lower_bound(T[v].begin(), T[v].end(), valL);     }     int Query(int l, int r, long long valL, long long valR) {       if (l > r) return 0;       l += p - 1;       r += p - 1;       int ans = Count(l, valL, valR);       if (l < r) ans += Count(r, valL, valR);       while (par(l) != par(r)) {         if (l % 2 == 1) ans += Count(l + 1, valL, valR);         if (r % 2 == 0) ans += Count(r - 1, valL, valR);         l = par(l);         r = par(r);       }       return ans;     }   };   void dfs(int v, vector<vector<pair<int, int>>> &g, vector<long long> &depth,            vector<int> &in, vector<int> &out, int &t) {     in[v] = ++t;     for (auto &e : g[v]) {       int u = e.first, len = e.second;       depth[u] = depth[v] + len;       dfs(u, g, depth, in, out, t);     }     out[v] = t;   }   vector<int> solve(int n, vector<int> &a, vector<vector<pair<int, int>>> &g) {     vector<long long> depth(n, 0);     vector<int> in(n), out(n);     int t = -1;     dfs(0, g, depth, in, out, t);     vector<long long> value(n);     for (int i = (0); i <= (n - 1); ++i) {       value[in[i]] = depth[i] - a[i];     }     ITree tree(value);     vector<int> ans(n);     for (int i = (0); i <= (n - 1); ++i) {       ans[i] = tree.Query(in[i] + 1, out[i], -LINF, depth[i]);     }     return ans;   }   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     vector<int> a(n);     for (int i = (0); i <= (n - 1); ++i) {       cin >> a[i];     }     vector<vector<pair<int, int>>> g(n);     for (int i = (1); i <= (n - 1); ++i) {       int p, len;       cin >> p >> len;       p--;       g[p].push_back({i, len});     }     vector<int> ans = solve(n, a, g);     for (int i = (0); i <= (n - 1); ++i) {       cout << ans[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename S, typename T>   ostream& operator<<(ostream& out, pair<S, T> const& p) {     out <<  (  << p.first <<  ,   << p.second <<  ) ;     return out;   }   template <typename T>   ostream& operator<<(ostream& out, vector<T> const& v) {     long long l = v.size();     for (long long i = 0; i < l - 1; i++) out << v[i] <<    ;     if (l > 0) out << v[l - 1];     return out;   }   template <typename T>   void trace(const char* name, T&& arg1) {     cout << name <<   :   << arg1 <<   n ;   }   template <typename T, typename... Args>   void trace(const char* names, T&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cout.write(names, comma - names) <<   :   << arg1 <<   |  ;     trace(comma + 1, args...);   }   int n, m;   int a[200], b[200];   vector<int> ans;   bool check(int no) {     for (int i = 0; i < n; i++) {       if (a[i] <= no and b[i] >= no) {         return true;       }     }     return false;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> a[i] >> b[i];     }     int c = 0;     for (int i = 1; i <= m; i++) {       if (check(i) == false) {         c++;         ans.push_back(i);       }     }     cout << c <<   n ;     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   class trip {    public:     long long first;     long long second;     long long third;     trip() {}   };   bool comp1(trip a, trip b) {     if (a.first == b.first) {       if (a.second == b.second) {         return a.third < b.third;       }       return a.second < b.second;     }     return a.first < b.first;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     t = 1;     while (t--) {       long long n;       cin >> n;       vector<trip> v;       for (int i = 0; i < n; i++) {         trip p;         cin >> p.first >> p.second;         p.third = i + 1;         v.push_back(p);       }       long long k;       cin >> k;       vector<pair<long long, long long> > r;       for (int i = 0; i < k; i++) {         pair<long long, long long> p;         cin >> p.first;         p.second = i + 1;         r.push_back(p);       }       sort((v).begin(), (v).end(), comp1);       sort((r).begin(), (r).end());       vector<pair<long long, long long> > ans;       long long sum = 0;       for (int i = 0; i < k; i++) {         long long mx = 0;         long long in = -1;         for (int j = 0; j < n; j++) {           if (v[j].first > r[i].first) {             break;           } else {             if (v[j].second > mx) {               mx = v[j].second;               in = j;             }           }         }         if (in != -1) {           sum += v[in].second;           pair<long long, long long> p;           p.first = v[in].third;           p.second = r[i].second;           ans.push_back(p);           v[in].second = -1;         }       }       cout << ans.size() <<     << sum <<   n ;       for (int i = 0; i < ans.size(); i++) {         cout << ans[i].first <<     << ans[i].second <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   set<int> vis;   vector<int> ans;   map<int, int> d;   int main() {     int n, m;     cin >> n >> m;     queue<int> q;     int count = 0;     for (int i = 0; i < n; i++) {       int x;       scanf( %d , &x);       q.push(x);       vis.insert(x);       d[x] = 0;     }     long long int res = 0;     while (count < m) {       int now = q.front();       q.pop();       if (d[now] != 0) {         res += d[now];         ans.push_back(now);         count++;       }       if (vis.find(now - 1) == vis.end()) {         q.push(now - 1);         vis.insert(now - 1);         d[now - 1] = d[now] + 1;       }       if (vis.find(now + 1) == vis.end()) {         q.push(now + 1);         vis.insert(now + 1);         d[now + 1] = d[now] + 1;       }     }     printf( %lld n , res);     for (int i = 0; i < ans.size(); i++) {       printf( %d  , ans[i]);     }     int zz = 0;     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   int A[1 << 20];   long long R[2][256][2];   long long S[256][2];   int main() {     int n;     scanf( %d , &n);     int i, j, k;     for (i = (0); i < (n); ++i) scanf( %d , &A[i]);     memset(R, 0, sizeof(R));     memset(S, 0, sizeof(S));     R[0][0][0] = 1;     for (i = (0); i < (n); ++i) {       int prev = i & 1;       int next = prev ^ 1;       memset(S, 0, sizeof(S));       for (j = (0); j < (201); ++j)         for (k = (0); k < (2); ++k)           S[j + 1][k] = (S[j][k] + R[prev][j][k]) % 998244353;       memset(R[next], 0, sizeof(R[next]));       for (j = (1); j < (201); ++j)         if (A[i] == -1 || A[i] == j) {           R[next][j][0] += S[201][0] - S[j + 1][0] + 998244353;           R[next][j][0] += R[prev][j][0] + R[prev][j][1];           R[next][j][1] += S[j][0] + S[j][1];           R[next][j][0] %= 998244353;           R[next][j][1] %= 998244353;         }     }     long long res = 0;     for (i = (1); i < (201); ++i) res += R[n & 1][i][0];     printf( %lld n , res % 998244353);     return 0;   };
#include <bits/stdc++.h>   using namespace std;   long long T = 0, n, t, a;   long long mu10(int b) {     long long c = 1;     for (int i = 1; i <= b; i++) c = c * 10;     return c;   }   long long solve(long long c) {     int m = 1;     long long T = 0;     while (T < c) {       T += ((mu10(m)) - (mu10(m - 1))) * m;       a = mu10(m) - 1;       m++;     }     m -= 1;     long long b = (T - c);     long long d = a - (b / m);     if (b % m == 0)       return d % 10;     else {       d /= mu10(b % m);       return d % 10;     }   }   int main() {     cin >> n;     cout << solve(n);     return 0;   }
#include <bits/stdc++.h>   int prime[20000000 + 1] = {0};   int palin[20000000 + 1] = {0};   bool check[20000000 + 1] = {1, 1, 0};   void primecheck() {     for (int i = 2; i <= 20000000; i++) {       if (check[i]) {         prime[i] = prime[i - 1];         continue;       }       prime[i] = prime[i - 1] + 1;       for (int j = 2; j * i <= 20000000; j++) check[j * i] = true;     }   }   void palincheck() {     for (int i = 1; i <= 20000000; i++) {       int j = i;       int counter = 0;       while (j > 0) {         counter = counter * 10 + j % 10;         j = j / 10;       }       if (i == counter)         palin[i] = palin[i - 1] + 1;       else         palin[i] = palin[i - 1];     }   }   int main() {     primecheck();     palincheck();     int p, q;     int left, right, mid;     left = 1, right = 20000000;     mid = (left + right) / 2;     scanf( %d %d , &p, &q);     for (int i = 20000000; i >= 1; i--)       if ((long long int)q * prime[i] <= (long long int)p * palin[i]) {         printf( %d n , i);         return 0;       }     return 0;   }
#include <bits/stdc++.h>   using db = double;   int read() {     int x;     scanf( %d , &x);     return x;   }   const int N = 50007;   const db eps = 1e-10;   db x, y, k[N], b[N], ans;   int n, c, t[N * 2], las[N], L[N * 2], R[N * 2];   struct node {     db ang;     int id;   } a[N * 2];   db sqr(db a) { return a * a; }   void add(int p, int v) {     for (; p <= c; p += p & -p) t[p] += v;   }   int ask(int p) {     int s = 0;     for (; p; p ^= p & -p) s += t[p];     return s;   }   int check(db r) {     db A, B, C, D, X, Y;     int s = 0;     c = 0;     for (int i = 1; i <= n; ++i) {       A = sqr(k[i]) + 1, B = -2 * x + 2 * k[i] * (b[i] - y),       C = sqr(x) + sqr(b[i] - y) - sqr(r);       if (B * B + eps <= 4 * A * C) continue;       D = sqrt(sqr(B) - 4 * A * C), A *= 2;       X = (D - B) / A, Y = k[i] * X + b[i], a[++c] = {atan2(Y - y, X - x), i};       X = (-D - B) / A, Y = k[i] * X + b[i], a[++c] = {atan2(Y - y, X - x), i};     }     std::sort(a + 1, a + c + 1,               [](const node& a, const node& b) { return a.ang < b.ang; });     for (int i = 1, id; i <= c; ++i)       las[id = a[i].id] ? s += ask(i) - ask(las[id]), add(las[id], -1),           las[id] = 0   : (add(i, 1), las[id] = i);     return s;   }   int pre[100010], nxt[100010], lst;   db cal(int i, int j) {     db X = (b[j] - b[i]) / (k[i] - k[j]), Y = X * k[i] + b[i];     return sqrt(sqr(X - x) + sqr(Y - y));   }   int main() {     db l = 0;     int m, s = 0;     n = read(), x = read() / 1000.0, y = read() / 1000.0, m = read();     for (int i = 1; i <= n; ++i) k[i] = read() / 1000.0, b[i] = read() / 1000.0;     for (db r = 1e13, mid, i = 100; i > 0; --i)       check(mid = (l + r) / 2) < m ? l = mid : r = mid;     check(l);     for (int i = 1, j = 0, p; i <= c; ++i)       if (las[a[i].id]) {         for (p = j; p > las[a[i].id]; p = L[p]) ++s, ans += cal(a[i].id, a[p].id);         R[L[p]] = R[p], L[R[p]] = L[p];         if (p == j) j = L[j];       } else         R[j] = i, L[i] = j, j = i, las[a[i].id] = i;     printf( %.10lf , ans + l * (m - s));   }
#include <bits/stdc++.h>   using namespace std;   static const double PI = acos(-1.0);   static const double EPS = 1e-9;   long long n;   long long a[200010];   long long dp[200010][2];   inline bool border(long long x) { return 0 <= x && x < n; }   long long dfs(long long x, long long step) {     if (dp[x][step] != -1) return dp[x][step];     dp[x][step] = -2;     if (step == 0) {       if (!border(x + a[x])) {         return dp[x][step] = a[x];       } else {         long long y = dfs(x + a[x], 1);         if (y == -2)           return dp[x][step] = -2;         else           return dp[x][step] = y + a[x];       }     } else if (step == 1) {       if (!border(x - a[x])) {         return dp[x][step] = a[x];       } else {         long long y = dfs(x - a[x], 0);         if (y == -2)           return dp[x][step] = -2;         else           return dp[x][step] = y + a[x];       }     }   }   int main() {     int i, j;     cin >> n;     for (i = 1; i < n; ++i) cin >> a[i];     for (i = 0; i < n; ++i)       for (j = 0; j < 2; ++j) dp[i][j] = -1;     for (i = 1; i < n; ++i)       for (j = 0; j < 2; ++j) dfs(i, j);     for (i = 1; i < n; ++i) {       if (dp[i][1] == -2)         puts( -1 );       else         printf( %I64d n , dp[i][1] + i);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t;     cin >> n >> t;     n--;     t--;     int arr[n];     for (int i = 0; i < n; i++) {       cin >> arr[i];     }     for (int i = 0; i <= n; i) {       if (i == t) {         cout <<  YES n ;         return 0;       } else {         if (i < n)           i += arr[i];         else           break;       }     }     cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     int n;     vector<int> pl;     vector<int> sum;     int a;     int otv = 0;     cin >> n;     int m = pow(2, n + 1) - 2;     pl.push_back(0);     for (int i = 1; i <= m; ++i) {       cin >> a;       pl.push_back(a);     }     for (int j = n; j > 0; j--)       for (int i = pow(2, j); i < pow(2, j + 1) - 1; i += 2) {         pl[i / 2 - 1] += max(pl[i - 1], pl[i]);         otv += abs(pl[i - 1] - pl[i]);       }     cout << otv;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int CONST =  z  -  a  + 1;   struct Node {     Node() {       chars.resize(CONST);       for (int i = 0; i < CONST; i++) chars[i].reset(nullptr);     }     vector<unique_ptr<Node> > chars;   };   int prefix(Node* node, const string& word, int index) {     while (true) {       if (index == word.size()) return word.size();       char c = word[index];       if (node->chars[c -  a ].get() == nullptr) return index + 1;       node = node->chars[c -  a ].get();       ++index;     }   }   void add(Node* node, const string& word, int index) {     while (true) {       if (index == word.size()) return;       char c = word[index];       if (node->chars[c -  a ].get() == nullptr)         node->chars[c -  a ].reset(new Node());       node = node->chars[c -  a ].get();       index++;     }   }   int main() {     int k;     cin >> k;     string T;     cin >> T;     for (int i = 0; i < T.size(); ++i) {       for (int j = 1; j < T.size(); j++) {         for (int l = i; l <= i + j * 4; l += j) {           if (l < T.size() && T[l] ==  * ) {             if (l == i + j * 4) {               cout <<  yes  << endl;               return 0;             }           } else {             break;           }         }       }     }     cout <<  no  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class A>   void pr(A a) {     cout << a;     cout <<   n ;   }   template <class A, class B>   void pr(A a, B b) {     cout << a <<    ;     pr(b);   }   template <class A, class B, class C>   void pr(A a, B b, C c) {     cout << a <<    ;     pr(b, c);   }   template <class A, class B, class C, class D>   void pr(A a, B b, C c, D d) {     cout << a <<    ;     pr(b, c, d);   }   template <class A>   void PR(A a, long long n) {     for (long long i = (long long)(0); i < (long long)(n); i++) {       if (i) cout <<    ;       cout << a[i];     }     cout <<   n ;   }   long long check(long long n, long long m, long long x, long long y) {     return x >= 0 && x < n && y >= 0 && y < m;   }   const long long MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},                   dy[4] = {0, 1, 0, -1};   void Main() {     int T;     cin >> T;     while (T--) {       long long n;       string s;       cin >> n >> s;       long long ans = n;       for (long long i = (long long)(0); i < (long long)(n); i++) {         if (s[i] ==  1 ) {           ans = max(ans, (i + 1) * 2);           ans = max(ans, (n - i) * 2);         }       }       pr(ans);     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     Main();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, m, i;     cin >> n >> m;     map<int, int> mp;     for (i = 0; i < 3; i++) {       int t;       cin >> t;       if (i == 0) mp[t] = 1;       if (i == 1) mp[t] = 2;       if (i == 2) mp[t] = 3;     }     for (i = 1; i < m; i++) {       int a, b, c;       cin >> a >> b >> c;       if (mp[a] == 0 && mp[b] == 0 && mp[c] == 0) {         mp[a] = 1;         mp[b] = 2;         mp[c] = 3;       } else {         if (mp[a] != 0) {           int cur = b;           for (int j = 1; j <= 3; j++) {             if (mp[a] != j) {               mp[cur] = j;               cur = c;             }           }         } else if (mp[b] != 0) {           int cur = a;           for (int j = 1; j <= 3; j++) {             if (mp[b] != j) {               mp[cur] = j;               cur = c;             }           }         } else {           int cur = a;           for (int j = 1; j <= 3; j++) {             if (mp[c] != j) {               mp[cur] = j;               cur = b;             }           }         }       }     }     for (i = 1; i <= n; i++) {       cout << mp[i] <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   int n, x, res, p[(1 << 20)];   int main() {     for (cin >> n; n--;) scanf( %d , &x), p[x]++;     for (int i = 0; i < (1 << 20); i++) res += p[i] & 1, p[i + 1] += p[i] / 2;     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void trace(T a) {     cout << a <<   n ;   }   template <typename T, typename... Args>   void trace(T a, Args... args) {     cout << a <<    ;     trace(args...);   }   int recNum = 0;   void prTabs() {     for (int i = 0; i < recNum; i++) cout <<       ;   }   template <typename... Args>   void recInit(Args... args) {     prTabs();     trace( rec( , args...,  ) );     recNum++;   }   template <typename T>   void recEnd(T a) {     prTabs();     trace( -> , a);     recNum--;   }   int n, m, a, b, c;   map<int, int> s;   map<int, int> sa;   int li[500001];   int freq[2][2000002];   int k;   int main() {     memset(freq, 0, sizeof freq);     scanf( %d %d %d %d , &m, &k, &n, &b);     for (int i = 1; i <= m; i++) {       scanf( %d , li + i);     }     for (int i = 0; i < b; i++) {       scanf( %d , &a);       if (s.count(a)) {         s[a]++;       } else {         s[a] = 1;       }     }     int il = 0, ir = 0;     for (int i = 0; i < n; i++) {       int dacerto = true;       while (ir < m - ((n - 1 - i) * k)) {         freq[1][li[++ir]]++;       }       while (il < k * i) {         freq[0][li[++il]]++;       }       for (map<int, int>::iterator it = s.begin(); it != s.end(); it++) {         if (freq[1][it->first] - freq[0][it->first] < it->second) {           dacerto = false;           break;         }       }       if (!dacerto) continue;       printf( %d n , m - (n * k));       int falta = k - b;       for (int j = k * i + 1; j <= m - ((n - 1 - i) * k); j++) {         if (sa[li[j]] < s[li[j]]) {           sa[li[j]]++;         } else if (falta) {           sa[li[j]]++;           falta--;         } else {           printf( %d  , j);         }       }       printf(  n );       return 0;     }     printf( -1 n );     return 0;   }
#include <bits/stdc++.h>   int A[1000000], i, j, k, l, m, n, a, b, c, d, e, f, g, B[500000];   int main() {     scanf( %d%d%d%d , &a, &b, &m, &A[0]);     for (i = 1; i <= 100005; i++) {       A[i] = (a * A[i - 1] + b) % m;       if (B[A[i]]) {         printf( %d , i - B[A[i]]);         return 0;       }       B[A[i]] = i;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int infinity = 9e18;   bool possible(long long int x1, long long int x2, long long int y1,                 long long int y2, long long int n, long long int m, string s,                 long long int dx, long long int dy) {     long long int a = m / n;     long long int b = m % n;     x1 += a * dx;     y1 += a * dy;     for (int i = 0; i < b; i++) {       if (s[i] ==  U ) y1++;       if (s[i] ==  D ) y1--;       if (s[i] ==  R ) x1++;       if (s[i] ==  L ) x1--;     }     if ((abs(y1 - y2) + abs(x1 - x2)) <= m) return 1;     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int x1, x2, y1, y2, n;     cin >> x1 >> y1 >> x2 >> y2 >> n;     string s;     cin >> s;     long long int dx = 0, dy = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  U ) dy++;       if (s[i] ==  D ) dy--;       if (s[i] ==  R ) dx++;       if (s[i] ==  L ) dx--;     }     long long int st = 0, end = 1e18;     while (st < end) {       long long int mid = (end + st) / 2;       if (possible(x1, x2, y1, y2, n, mid, s, dx, dy)) {         end = mid;       } else {         st = mid + 1;       }     }     if (st == 1e18)       cout << -1;     else       cout << st;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5;   vector<int> g[N], gr[N];   bool used[N];   vector<int> order, component;   pair<int, int> edge[N];   int par[N];   vector<int> v[N];   int f(int i) {     if (par[i] != i) par[i] = f(par[i]);     return par[i];   }   void merge(int a, int b) {     a = f(a), b = f(b);     if (a == b) return;     par[a] = b;   }   void dfs1(int v) {     used[v] = true;     for (size_t i = 0; i < g[v].size(); ++i)       if (!used[g[v][i]]) dfs1(g[v][i]);     order.push_back(v);   }   void dfs2(int v) {     used[v] = true;     component.push_back(v);     for (size_t i = 0; i < gr[v].size(); ++i)       if (!used[gr[v][i]]) dfs2(gr[v][i]);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       for (int i = 1; i <= n; i++)         g[i].clear(), gr[i].clear(), par[i] = i, v[i].clear();       order.clear();       component.clear();       for (int i = 1; i <= n; i++) used[i] = false;       for (int i = 0; i <= m - 1; i++) {         int a, b;         cin >> a >> b;         edge[i] = make_pair(a, b);         g[a].push_back(b);         gr[b].push_back(a);       }       for (int i = 1; i <= n; ++i)         if (!used[i]) dfs1(i);       for (int i = 1; i <= n; i++) used[i] = false;       for (int i = 0; i < n; ++i) {         int v = order[n - 1 - i];         if (!used[v]) {           dfs2(v);           int sz = component.size();           for (int i = 0; i <= sz - 1; i++) merge(component[0], component[i]);           component.clear();         }       }       for (int i = 1; i <= n; i++) v[i].clear();       set<int> s;       for (int i = 1; i <= n; i++) {         s.insert(f(i));       }       if (s.size() == 1) {         cout <<  No n ;       } else {         for (int i = 0; i <= m - 1; i++) {           if (f(edge[i].first) == f(edge[i].second)) continue;           v[f(edge[i].first)].push_back(f(edge[i].second));         }         set<int> s1;         for (int i = 1; i <= n; i++) {           if (v[f(i)].size() == 0) {             for (int j = 1; j <= n; j++) {               if (f(i) == f(j)) s1.insert(j);             }             break;           }         }         cout <<  Yes n ;         cout << s1.size() <<     << n - s1.size();         cout <<   n ;         for (__typeof(s1.begin()) it = s1.begin(); it != s1.end(); it++) {           cout << *it;           cout <<    ;         }         cout <<   n ;         for (int i = 1; i <= n; i++) {           if (!(s1.find(i) != s1.end())) {             cout << i;             cout <<    ;           }         }         cout <<   n ;       }     }     return 0;   }