malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<string> digits = { 1110111 ,  0010010 ,  1011101 ,  1011011 ,  0111010 ,                             1101011 ,  1101111 ,  1010010 ,  1111111 ,  1111011 };   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, k;     cin >> n >> k;     vector<string> s(n);     vector<vector<int>> dist(n, vector<int>(10));     for (int i = 0; i < n; i++) {       cin >> s[i];       for (int d = 0; d < 10; d++) {         for (int j = 0; j < 7; j++) {           char x = s[i][j];           char y = digits[d][j];           if (x ==  1  && y ==  0 ) {             dist[i][d] = -1;             break;           }           if (x ==  0  && y ==  1 ) {             ++dist[i][d];           }         }       }     }     vector<vector<int>> dp(n + 1, vector<int>(k + 1));     dp[n][0] = 1;     for (int i = n; i > 0; i--) {       for (int j = 0; j <= k; j++) {         if (dp[i][j]) {           for (int d = 0; d < 10; d++) {             if (dist[i - 1][d] != -1 && j + dist[i - 1][d] <= k) {               dp[i - 1][j + dist[i - 1][d]] = 1;             }           }         }       }     }     if (dp[0][k] == 0) {       cout << -1 <<   n ;       return 0;     }     for (int i = 0; i < n; i++) {       int now = -1;       for (int d = 9; d >= 0; d--) {         if (dist[i][d] != -1 && k >= dist[i][d] && dp[i + 1][k - dist[i][d]]) {           now = d;           k -= dist[i][d];           break;         }       }       assert(now != -1);       cout << now;     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:64000000 )   using namespace std;   inline unsigned long long gcd(unsigned long long a, unsigned long long b) {     if (a < b) {       a ^= b;       b ^= a;       a ^= b;     };     return (a > b) ? gcd(a - b, b) : a;   }   inline int abs(int x) { return x > 0 ? x : -x; }   void solve() {     const string s[33] = {          111111101010101111100101001111111 ,  100000100000000001010110001000001 ,          101110100110110000011010001011101 ,  101110101011001001111101001011101 ,          101110101100011000111100101011101 ,  100000101010101011010000101000001 ,          111111101010101010101010101111111 ,  000000001111101111100111100000000 ,          100010111100100001011110111111001 ,  110111001111111100100001000101100 ,          011100111010000101000111010001010 ,  011110000110001111110101100000011 ,          111111111111111000111001001011000 ,  111000010111010011010011010100100 ,          101010100010110010110101010000010 ,  101100000101010001111101000000000 ,          000010100011001101000111101011010 ,  101001001111101111000101010001110 ,          101101111111000100100001110001000 ,  000010011000100110000011010000010 ,          001101101001101110010010011011000 ,  011101011010001000111101010100110 ,          111010100110011101001101000001110 ,  110001010010101111000101111111000 ,          001000111011100001010110111110000 ,  000000001110010110100010100010110 ,          111111101000101111000110101011010 ,  100000100111010101111100100011011 ,          101110101001010000101000111111000 ,  101110100011010010010111111011010 ,          101110100100011011110110101110000 ,  100000100110011001111100111100000 ,          111111101101000101001101110010001 };     int a, b;     cin >> a >> b;     cout << s[a][b];   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     string s1( ABC ), s2( ACB ), s3( BAC ), s4( BCA ), s5( CAB ), s6( CBA );     int state = 0;     if (s.find(s1) != -1)       state = 1;     else if (s.find(s2) != -1)       state = 1;     else if (s.find(s3) != -1)       state = 1;     else if (s.find(s4) != -1)       state = 1;     else if (s.find(s5) != -1)       state = 1;     else if (s.find(s6) != -1)       state = 1;     else       state = 0;     if (state == 0)       cout <<  No  << endl;     else       cout <<  Yes  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int q;     cin >> q;     for (int qq = 0; qq < int(q); qq++) {       string s;       cin >> s;       int n;       cin >> n;       vector<int> b(n);       for (int i = 0; i < int(n); i++) cin >> b[i];       vector<vector<int>> groups;       while (true) {         vector<int> pos;         for (int i = 0; i < int(n); i++)           if (b[i] == 0) pos.push_back(i);         if (pos.empty()) break;         groups.push_back(pos);         for (int i = 0; i < int(n); i++)           if (b[i] == 0)             b[i] = INT_MAX;           else             for (int pp : pos) b[i] -= abs(i - pp);       }       map<char, int> cnts;       for (int i = 0; i < int(s.size()); i++) cnts[s[i]]++;       auto j = cnts.rbegin();       string t(n,  ? );       for (auto g : groups) {         while (j->second < g.size()) j++;         for (int pp : g) t[pp] = j->first;         j++;       }       cout << t << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1005;   int n, m, q, u, v, w, l, r, ans, par[N], col[N], mark[N];   vector<pair<int, pair<int, int> > > yal, edge[N * N];   vector<int> cmp[N];   void add(int x) {     for (int i = 0; i < edge[x].size(); i++) yal.push_back(edge[x][i]);   }   int Get_par(int u) {     if (par[u] < 0) return u;     return par[u] = Get_par(par[u]);   }   void query(int l, int r) {     r++;     for (l += m, r += m; l < r; l >>= 1, r >>= 1) {       if (l & 1) add(l++);       if (r & 1) add(--r);     }   }   void reset(int x) {     cmp[x].clear();     cmp[x].push_back(x);   }   void merge(int u, int v, int s) {     u = Get_par(u), v = Get_par(v);     if (par[u] > par[v]) swap(u, v);     for (int i = 0; i < cmp[v].size(); i++)       cmp[u].push_back(cmp[v][i]), col[cmp[v][i]] ^= s;     par[u] += par[v], par[v] = u;   }   void solve(int x) {     vector<pair<int, pair<int, int> > > vec;     for (int i = 0; i < edge[x].size(); i++)       par[edge[x][i].second.first] = par[edge[x][i].second.second] = -1,       reset(edge[x][i].second.first), reset(edge[x][i].second.second);     for (int i = 0; i < edge[x].size(); i++) {       u = edge[x][i].second.first, v = edge[x][i].second.second;       if (Get_par(u) == Get_par(v)) {         if (col[u] == col[v]) {           vec.push_back(edge[x][i]);           break;         }       } else         merge(u, v, col[u] == col[v]), vec.push_back(edge[x][i]);     }     edge[x].clear();     edge[x] = vec;   }   void merge_t(int u, int v, int an) {     int p1 = 0, p2 = 0;     while (p1 < edge[u].size() || p2 < edge[v].size()) {       if (p2 == edge[v].size() ||           (p1 < edge[u].size() && edge[u][p1].first > edge[v][p2].first))         edge[an].push_back(edge[u][p1++]);       else         edge[an].push_back(edge[v][p2++]);     }   }   void build() {     for (int i = m - 1; i >= 1; i--) {       merge_t(i * 2, i * 2 + 1, i);       solve(i);     }   }   void clear() {     ans = -1, yal.clear();     fill(col, col + N, 0);     fill(par, par + N, -1);     for (int i = 1; i < n + 1; i++) reset(i);   }   int main() {     cin >> n >> m >> q;     for (int i = 0; i < m; i++) {       scanf( %d%d , &u, &v);       ;       scanf( %d , &w);       ;       edge[i + m].push_back(make_pair(w, make_pair(u, v)));     }     build();     for (int io = 0; io < q; io++) {       clear();       scanf( %d%d , &l, &r);       ;       --l, --r;       query(l, r);       sort(yal.begin(), yal.end());       reverse(yal.begin(), yal.end());       for (int i = 0; i < yal.size(); i++) {         u = yal[i].second.first, v = yal[i].second.second;         if (Get_par(u) == Get_par(v)) {           if (col[u] == col[v]) {             ans = yal[i].first;             break;           }         } else           merge(u, v, col[u] == col[v]);       }       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   long long mod_v(long long num) {     if (num >= 0)       return (num % 1000000007);     else       return (num % 1000000007 + 1000000007) % 1000000007;   }   long long bigmod(long long b, long long p, long long m) {     long long res = 1 % m, x = b % m;     while (p) {       if (p & 1) res = (res * x) % m;       x = (x * x) % m;       p >>= 1;     }     return res;   }   class node {    public:     string str;     int a, b;     node() {}     node(string str, int a, int b) {       this->str = str;       this->a = a;       this->b = b;     }   };   vector<node> v;   map<string, bool> mark;   int main() {     int n, K, temp;     scanf( %d , &K);     n = 1 << K;     if (n == 1) {       printf( + n );       return 0;     }     string str =   ;     for (int i = 1; i <= n / 2; i++) str +=  + ;     for (int i = 1; i <= n / 2; i++) str +=  * ;     v.push_back(node(str, -1, -1));     mark[str] = 1;     int x = n / 4;     for (int i = 1; i <= x; i = i * 2) {       str =   ;       temp = 1;       for (int j = 1; j <= n; j += i) {         temp = (temp + 1) % 2;         for (int k = 0; k < i; k++) {           if (temp == 0)             str +=  + ;           else             str +=  * ;         }       }       v.push_back(node(str, -1, -1));       mark[str] = 1;     }     int ind = 0, len;     while (v.size() < n) {       bool flag = false;       for (int i = 0; i < v.size() && i < n; i++) {         if (v[ind].a == i || v[ind].b == i || ind == i) continue;         str =   ;         int o = 0, e = 0;         for (int j = 0; j < n; j++) {           if (v[ind].str[j] == v[i].str[j]) {             str +=  + ;             o++;           } else {             str +=  * ;             e++;           }         }         if (mark[str] == 1 || o != e) continue;         v.push_back(node(str, ind, i));         mark[str] = 1;         flag = true;       }       if (!flag) break;       ind++;     }     if (v.size() < n) {       str =   ;       for (int i = 0; i < n; i++) str +=  + ;       v.push_back(node(str, -1, -1));     }     for (int i = 0; i < v.size(); i++) cout << v[i].str <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char c = getchar();     while (c !=  -  && c < 48) c = getchar();     if (c ==  - ) f = -1, c = getchar();     while (c > 47) x = x * 10 + (c ^ 48), c = getchar();     return f * x;   }   const int maxn = 3e3 + 7;   const int inf = 0x3f3f3f3f;   const int mod = 1e9 + 7;   int t[maxn];   inline void Max(long long &x, long long y) {     if (x < y) x = y;   }   int main() {     int n = read(), k = read();     vector<vector<long long>> a(n + 1, vector<long long>(k + 1, 0));     for (int i = 1; i <= n; ++i) {       int t = read();       ::t[i] = t;       for (int j = 1; j <= t; ++j) {         int d = read();         if (j <= k) a[i][j] = a[i][j - 1] + d;       }     }     long long ans = 0;     function<void(int, int, vector<long long> &)> solve =         [&](int l, int r, vector<long long> &dp) {           if (l == r) {             for (int i = 0, up = min(k, t[l]); i <= up; ++i) {               Max(ans, dp[k - i] + a[l][i]);             }             return;           }           int m = (l + r) / 2;           vector<long long> dp1(dp);           for (int i = m + 1; i <= r; ++i) {             for (int j = k; j >= t[i]; --j) {               Max(dp1[j], dp1[j - t[i]] + a[i][t[i]]);             }           }           solve(l, m, dp1);           for (int i = l; i <= m; ++i) {             for (int j = k; j >= t[i]; --j) {               Max(dp[j], dp[j - t[i]] + a[i][t[i]]);             }           }           solve(m + 1, r, dp);         };     vector<long long> dp(k + 1, -1e18);     dp[0] = 0;     solve(1, n, dp);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int v[7], x[7];   int main() {     for (int i = 0; i < 6; ++i) scanf( %d , &v[i]);     int ans = -1;     for (int i = 0; i <= 100000; ++i) {       x[1] = v[1] - v[2] + v[3] - v[4] + 2 * i;       if (x[1] % 2 || x[1] < 0) continue;       x[2] = v[2] + v[4] - v[0] - 2 * i;       if (x[2] % 2 || x[2] < 0) continue;       x[3] = v[0] - v[2] - v[5] + v[3] + 2 * i;       if (x[3] % 2 || x[3] < 0) continue;       x[4] = v[2] + v[5] - v[1] - 2 * i;       if (x[4] % 2 || x[4] < 0) continue;       x[5] = v[4] + v[5] - v[3] - 2 * i;       if (x[5] % 2 || x[5] < 0) continue;       x[6] = v[0] - v[5] + v[1] - v[4] + 2 * i;       if (x[6] % 2 || x[6] < 0) continue;       ans = i;       break;     }     if (ans != -1) {       x[0] = ans;       int res = ans;       for (int i = 1; i <= 6; ++i) {         x[i] /= 2;         res += x[i];       }       printf( %d n , res);       for (int i = 0; i < res; ++i) printf( a );       printf(  n );       for (int i = 0; i < x[0] + x[1] + x[2]; ++i) printf( a );       for (int i = 0; i < x[3] + x[4] + x[5] + x[6]; ++i) printf( b );       printf(  n );       for (int i = 0; i < x[0]; ++i) printf( a );       for (int i = 0; i < x[1] + x[2]; ++i) printf( b );       for (int i = 0; i < x[3] + x[4]; ++i) printf( a );       for (int i = 0; i < x[5] + x[6]; ++i) printf( b );       printf(  n );       for (int i = 0; i < x[0]; ++i) printf( b );       for (int i = 0; i < x[1]; ++i) printf( a );       for (int i = 0; i < x[2]; ++i) printf( b );       for (int i = 0; i < x[3]; ++i) printf( a );       for (int i = 0; i < x[4]; ++i) printf( b );       for (int i = 0; i < x[5]; ++i) printf( a );       for (int i = 0; i < x[6]; ++i) printf( b );       printf(  n );     } else {       printf( -1 n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Direction[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};   const int Nmax = 303000;   long double n, m;   long double ans = 0;   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> m;     long double r = n * m;     for (int k = 1; k <= min(n, m); k++) {       long double add = 1. * k * k / (long double)n;       for (double i = n - k + 1; i <= n; i++)         add = (add * (long double)(i)) / (long double)(i - n + k);       for (double i = r - m - n + k + 1; i <= r - n; i++)         add = (add * (long double)(i)) / (long double)(i + n - k);       for (double i = 1; i <= k; i++)         add = (add) * (m - k + i) / (long double)(r - k + i);       ans += add;     }     cout.precision(16);     cout << fixed << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int a[n + 1];       int b[2 * n + 1];       int temp[2 * n + 1];       for (int i = 1; i <= 2 * n; i++) temp[i] = 0;       bool con1 = false, con2 = false;       for (int i = 1; i <= n; i++) {         cin >> a[i];         if (a[i] == 1) con1 = true;         if (a[i] == 2 * n) con2 = true;         temp[a[i]] = 1;       }       if (con1 == false or con2 == true)         cout <<  -1  << endl;       else {         int check = 0;         for (int i = 1; i <= n; i++) {           b[2 * i - 1] = a[i];           int j;           for (j = a[i] + 1; j <= 2 * n; j++) {             if (temp[j] == 0) {               temp[j] = 1;               b[2 * i] = j;               break;             }           }           if (j == 2 * n + 1) {             check = -1;           }         }         if (check != -1) {           for (int i = 1; i <= 2 * n; i++) cout << b[i] <<    ;           cout << endl;         } else           cout <<  -1  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 998244353;   double eps = 1e-8;   vector<int> b, c;   int vis[2100000], a[210000], ans[210000], x;   int read() {     int v = 0, f = 1;     char c = getchar();     while (c < 48 || 57 < c) {       if (c ==  - ) f = -1;       c = getchar();     }     while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();     return v * f;   }   void ins(int u) {     int t = u;     for (int &v : b) u = min(u, u ^ v);     if (u) {       b.push_back(u);       c.push_back(t);       for (int i = (int)(int)b.size() - 1; i >= (int)1; i--)         if (b[i] > b[i - 1])           swap(b[i], b[i - 1]);         else           break;     }   }   void dfs(int u, int s) {     ans[s] = u;     vis[u] = 1;     if (s == (1 << x) - 1) return;     for (int &v : c)       if (!vis[u ^ v]) {         dfs(u ^ v, s + 1);         return;       }   }   int main() {     int n = read();     for (int i = (int)1; i <= (int)n; i++) a[i] = read();     sort(a + 1, a + n + 1);     x = 0;     int j = 1;     for (int i = (int)1; i <= (int)19; i++) {       while (j <= n && a[j] <= ((1 << i) - 1)) {         ins(a[j]);         j++;       }       if (b.size() == i) x = i;     }     b.clear();     c.clear();     for (int i = (int)1; i <= (int)n; i++)       if (a[i] <= ((1 << x) - 1))         ins(a[i]);       else         break;     dfs(0, 0);     printf( %d n , x);     for (int i = (int)0; i <= (int)(1 << x) - 1; i++) printf( %d  , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = int64_t;   struct node {     int C[2];     ll good;     ll bad;     char mrk;     node() : C{0, 0}, good{0}, bad{0}, mrk{0} {}     int& operator[](int i) { return C[i]; }   };   using trie_t = vector<node>;   trie_t T;   string curr;   struct Guard {     Guard(char c) { curr.push_back(c); }     ~Guard() { curr.pop_back(); }   };   int insert(const string& s, int i = 0, int r = 0) {     if (i == s.size()) return r;     if (!T[r][s[i] -  0 ]) {       T[r][s[i] -  0 ] = T.size();       T.emplace_back();     }     return insert(s, i + 1, T[r][s[i] -  0 ]);   }   string read() {     string ans;     int a, b, c, d, x;     scanf(  %d.%d.%d.%d , &a, &b, &c, &d);     if (getchar() !=  / )       x = 32;     else       scanf( %d , &x);     ll num = a;     num = (num << 8) + b;     num = (num << 8) + c;     num = (num << 8) + d;     num >>= (32 - x);     for (; x > 0; x--, num >>= 1) ans.push_back( 0  + char(num & 1ll));     reverse(begin(ans), end(ans));     return ans;   }   void sum(int r) {     T[r].good = (T[r].mrk ==  + );     T[r].bad = (T[r].mrk ==  - );     if (T[r][0]) {       sum(T[r][0]);       T[r].good += T[T[r][0]].good;       T[r].bad += T[T[r][0]].bad;     }     if (T[r][1]) {       sum(T[r][1]);       T[r].good += T[T[r][1]].good;       T[r].bad += T[T[r][1]].bad;     }   }   bool imp = false;   vector<string> ans;   void solve(int r) {     if (T[r].good * T[r].bad == 0) {       if (T[r].bad > 0) {         ans.push_back(curr);       }       return;     }     if ((T[r].mrk ==  +  && T[r].bad > 0) || (T[r].mrk ==  -  && T[r].good > 0)) {       imp = true;       return;     }     if (T[r][0]) {       Guard g( 0 );       solve(T[r][0]);     }     if (T[r][1]) {       Guard g( 1 );       solve(T[r][1]);     }   }   void display(string s) {     int a, b, c, d, x;     x = s.size();     ll num = 0;     for (int i = 0; i < s.size(); i++) num = 2ll * num + (s[i] -  0 );     num <<= (32 - x);     d = num % (1 << 8);     num >>= 8;     c = num % (1 << 8);     num >>= 8;     b = num % (1 << 8);     num >>= 8;     a = num % (1 << 8);     num >>= 8;     printf( %d.%d.%d.%d/%d n , a, b, c, d, x);   }   int main() {     int n;     int root = 0;     T.emplace_back();     scanf(  %d , &n);     for (int i = 0; i < n; i++) {       char c;       while (isspace(c = getchar()))         ;       int leaf = insert(read());       if (T[leaf].mrk) {         if (T[leaf].mrk != c) imp = true;       } else         T[leaf].mrk = c;     }     sum(root);     solve(root);     if (imp) {       puts( -1 );       return 0;     }     printf( %d n , ans.size());     for (auto s : ans) display(s);   }
#include <bits/stdc++.h>   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     long long n, k;     cin >> n >> k;     vector<vector<char>> board(n, vector<char>(n,  . ));     vector<vector<long long>> cnt(n, vector<long long>(n, 0));     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < n; j++) {         cin >> board[i][j];       }     }     for (long long i = 0; i < n; i++) {       for (long long j = 0; j <= n - k; j++) {         bool flag = true;         for (long long x = j; x < j + k; x++) {           if (board[i][x] !=  . ) {             flag = false;             break;           }         }         if (!flag) continue;         for (long long x = j; x < j + k; x++) {           cnt[i][x]++;         }       }     }     for (long long i = 0; i <= n - k; i++) {       for (long long j = 0; j < n; j++) {         bool flag = true;         for (long long x = i; x < i + k; x++) {           if (board[x][j] !=  . ) {             flag = false;             break;           }         }         if (!flag) continue;         for (long long x = i; x < i + k; x++) {           cnt[x][j]++;         }       }     }     long long mxX = 0, mxY = 0;     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < n; j++) {         if (cnt[i][j] > cnt[mxX][mxY]) {           mxX = i;           mxY = j;         }       }     }     cout << mxX + 1 <<     << mxY + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int const N = 1e5 + 10;   using ll = long long;   ll const INF = 0x3f3f3f3f3f3f3f3fll;   struct edge {     ll to, cost, id;     edge(ll to = 0, ll cost = 0, ll id = 0) : to(to), cost(cost), id(id) {}   };   vector<edge> e[N];   ll d[N];   vector<ll> p[N];   ll n, m, k;   queue<ll> q;   bool inq[N];   bool v[N];   bool can_change[N];   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m >> k;     for (ll i = 0, u, v, w; i < m; ++i) {       cin >> u >> v >> w;       e[u].push_back(edge(v, w, i + 1));       e[v].push_back(edge(u, w, i + 1));     }     for (ll i = 0, s, y; i < k; ++i) {       cin >> s >> y;       e[1].push_back(edge(s, y, m + i + 1));       e[s].push_back(edge(1, y, m + i + 1));     }     memset(d, 0x3f, sizeof(d));     memset(can_change, true, sizeof(can_change));     d[1] = 0;     q.push(1);     inq[1] = true;     while (!q.empty()) {       ll x = q.front();       q.pop();       inq[x] = false;       for (auto &ed : e[x]) {         ll y = ed.to, w = ed.cost, id = ed.id;         if (d[y] > d[x] + w) {           d[y] = d[x] + w;           p[y].clear();           if (id > m) {             can_change[y] = true;             p[y].push_back(id);           } else {             can_change[y] = false;           }           if (!inq[y]) {             inq[y] = true;             q.push(y);           }         } else if (d[y] == d[x] + w) {           if (id > m) {             if (can_change[y]) p[y].push_back(id);           } else {             can_change[y] = false;             p[y].clear();           }         }       }     }     for (ll i = 1; i <= n; ++i)       if (!p[i].empty()) {         bool skip = false;         for (auto id : p[i]) {           if (v[id - m]) {             skip = true;             break;           }         }         if (!skip) v[p[i].front() - m] = true;       }     ll cnt = 0;     for (ll i = 1; i <= k; ++i)       if (!v[i]) ++cnt;     cout << cnt << endl;     return 0;   }