malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int t;     cin >> t;     while (t--) {       string s;       cin >> s;       string word =   ;       for (auto x : s) {         if (x ==  _ ) {           word =   ;         } else {           word = word + x;         }       }       if (word.substr(word.length() - 2) ==  po )         cout <<  FILIPINO n ;       else if (word.substr(word.length() - 4) ==  desu  ||                word.substr(word.length() - 4) ==  masu )         cout <<  JAPANESE n ;       else if (word.substr(word.length() - 5) ==  mnida )         cout <<  KOREAN n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     t = 1;     while (t--) {       long long int n;       cin >> n;       long long int x, y, i;       long long int suma = 0, sumb = 0;       bool found = false;       vector<char> v;       for (i = 0; i < n; i++) {         cin >> x >> y;         suma += x;         if (abs(suma - sumb) <= 500 && !found)           v.push_back( A );         else {           suma -= x;           sumb += y;           if (abs(suma - sumb) <= 500 && !found)             v.push_back( G );           else             found = true;         }       }       if (found)         cout <<  -1 n ;       else {         for (i = 0; i < v.size(); i++) cout << v[i];         cout <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   const int MOD = 1e9 + 7;   const int MAXN = 1e6 + 3;   long long gcd(long long a, long long b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   long long power(long long x, long long y) {     long long res = 1;     while (y > 0) {       if (y & 1) res = res * x;       y = y >> 1;       x = x * x;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       vector<long long> a(n + 1);       set<long long> st;       for (long long i = 1; i <= (n); ++i) {         cin >> a[i];         st.insert(a[i]);       }       if (st.size() == 1)         cout << n <<   n ;       else         cout << 1 <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 20;   const int MOD = 1e9 + 7;   const int INF = 0x3f3f3f3f;   const long long LLINF = 0x3f3f3f3f3f3f3f3f;   const double PI = acos(-1.0);   const double RATE = 0.995;   const double eps = 1e-4;   int arr[MAXN];   signed main() {     int n;     long long k;     scanf( %d%lld , &n, &k);     for (int i = 1; i <= n; ++i) {       scanf( %d , &arr[i]);     }     sort(arr + 1, arr + 1 + n);     long long ans = arr[n] - arr[1];     for (int i = 1; i < (n + 1) / 2; ++i) {       long long t =           min(1ll * (arr[n - i + 1] - arr[n - i] + arr[i + 1] - arr[i]), k / i);       ans -= t;       k -= i * t;     }     if (n % 2 == 0) {       long long t = min(1ll * (arr[n / 2 + 1] - arr[n / 2]), k / (n / 2));       ans -= t;     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mxN = (int)1e5 + 5;   int n, ar[mxN];   void solve() {     ar[0] = 0;     cin >> n;     for (int i = 1; i <= n; i++) cin >> ar[i];     int mx = 0;     for (int i = 1; i <= n; i++) {       mx = max(mx, ar[i]);     }     cout << mx;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int t = 1, i = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k, h[300005], tot;   map<pair<int, int>, int> c;   struct edge {     int to, nxt, val;   } e[300005 << 1];   void add(int x, int y, int z) {     e[++tot].nxt = h[x];     h[x] = tot;     e[tot].to = y;     e[tot].val = z;   }   priority_queue<pair<long long, int> > q;   vector<int> a[300005];   long long d[300005];   int v[300005], fa[300005];   void dij() {     memset(d, 0x3f, sizeof(d));     d[1] = 0;     q.push(make_pair(0, 1));     while (!q.empty()) {       int x = q.top().second;       q.pop();       v[x] = 1;       for (int i = h[x]; i; i = e[i].nxt)         if (d[x] + e[i].val < d[e[i].to]) {           d[e[i].to] = d[x] + e[i].val;           fa[e[i].to] = x;           q.push(make_pair(-d[e[i].to], e[i].to));         }       while (!q.empty() && v[q.top().second]) q.pop();     }     for (int i = 2; i <= n; i++) a[fa[i]].push_back(i);   }   void dfs(int x) {     if (k && x != 1) k--, printf( %d  , c[make_pair(fa[x], x)]);     if (!k) return;     for (int i = 0; i < (int)a[x].size(); i++) dfs(a[x][i]);   }   int main() {     scanf( %d%d%d , &n, &m, &k);     k = min(k, n - 1);     for (int i = 1; i <= m; i++) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       add(x, y, z);       add(y, x, z);       c[make_pair(x, y)] = c[make_pair(y, x)] = i;     }     dij();     printf( %d n , k);     dfs(1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int count = 0;     int n, d;     cin >> n >> d;     int arr[n];     for (int i = 0; i < n; i++) cin >> arr[i];     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (i == j) continue;         if (abs(arr[i] - arr[j]) <= d) count++;       }     }     cout << count << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   long long x = 0;   bool vis[100010] = {false};   vector<int> adj[100010];   long long pow(long long a, long long b, long long m) {     stack<int> k;     int j = 128;     int l = 1;     int an = 1;     while (b) {       if (b >= j) {         k.push(j);         b -= j;       }       j /= 2;     }     while (!k.empty()) {       if (k.top() == l) {         an = (an * a) % mod;         k.pop();       }       a = (a * a) % mod;       l *= 2;     }     return an;   }   long long gcd(long a, long b) {     return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     int n, m, k;     cin >> n >> m >> k;     int ma = 0, mi = 10000;     for (int i = 0; i < n; ++i) {       int t;       cin >> t;       if (t < mi) {         mi = t;       }     }     for (int i = 0; i < m; ++i) {       int t;       cin >> t;       if (t > ma) {         ma = t;       }     }     if (ma > mi) {       int j = k / mi;       k -= (j)*mi;       k += j * ma;     }     cout << k << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long MOD;   inline void modulas(long long a) { MOD = a; }   inline void normal(long long &a) {     a %= MOD;     (a < 0) && (a += MOD);   }   inline long long modMul(long long a, long long b) {     a %= MOD, b %= MOD;     normal(a), normal(b);     return (a * b) % MOD;   }   inline long long modAdd(long long a, long long b) {     a %= MOD, b %= MOD;     normal(a), normal(b);     return (a + b) % MOD;   }   inline long long modSub(long long a, long long b) {     a %= MOD, b %= MOD;     normal(a), normal(b);     a -= b;     normal(a);     return a;   }   inline long long modPow(long long b, long long p) {     long long r = 1;     while (p) {       if (p & 1) r = modMul(r, b);       b = modMul(b, b);       p >>= 1;     }     return r;   }   inline long long modInverse(long long a) { return modPow(a, MOD - 2); }   inline long long modDiv(long long a, long long b) {     return modMul(a, modInverse(b));   }   vector<bool> isPrime(10000010, true);   inline void seivePrime(long long L, long long R) {     long long lim = sqrt(R);     for (long long i = 2; i <= lim; ++i) {       for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)         isPrime[j - L] = false;     }     if (L == 1) isPrime[0] = false;   }   inline long long chckPrime(long long L, long long prme) {     return isPrime[prme - L];   }   inline long long cntPrime(long long L, long long R) {     return count(isPrime.begin(), isPrime.begin() + R - L + 1, true);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int t = 1;     cin >> t;     while (t--) {       int n;       cin >> n;       int ar[n];       for (int i = 0; i < n; i++) cin >> ar[i];       int s = 0, sum = 0;       for (int i = 0; i < n; i++) {         if (ar[i] == 0) {           ar[i] = 1;           s++;         }         sum += ar[i];       }       if (sum == 0) {         sort(ar, ar + n);         if (ar[n - 1] > 0)           cout << s + 1 <<   n ;         else if (ar[0] == -1)           cout << s + 2 <<   n ;         else           cout << s + 1 <<   n ;       } else         cout << s <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool solve() {     int n;     bool ret = false;     int m = 0;     scanf( %d , &n);     int a;     scanf( %d , &a);     while ((a & 1) == 0) a >>= 1;     while (a % 3 == 0) a /= 3;     m = a;     for (int i = 1; i < n; i++) {       int a;       scanf( %d , &a);       while ((a & 1) == 0) a >>= 1;       while (a % 3 == 0) a /= 3;       if (m != a) return false;     }     return true;   }   int main() {     if (solve())       puts( Yes );     else       puts( No );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int A[3][3], B[3][3];     for (int i = 0; i < 3; i++) {       for (int j = 0; j < 3; j++) {         cin >> A[i][j];         B[i][j] = 1;       }     }     for (int i = 0; i < 3; i++) {       for (int j = 0; j < 3; j++) {         if (A[i][j] % 2 != 0) {           B[i][j] = !B[i][j];           if (i >= 0 and i <= 2 and j - 1 >= 0 and j - 1 <= 2) {             B[i][j - 1] = !B[i][j - 1];           }           if (i >= 0 and i <= 2 and j + 1 >= 0 and j + 1 <= 2) {             B[i][j + 1] = !B[i][j + 1];           }           if (i - 1 >= 0 and i - 1 <= 2 and j >= 0 and j <= 2) {             B[i - 1][j] = !B[i - 1][j];           }           if (i + 1 >= 0 and i + 1 <= 2 and j >= 0 and j <= 2) {             B[i + 1][j] = !B[i + 1][j];           }         }       }     }     for (int i = 0; i < 3; i++) {       for (int j = 0; j < 3; j++) {         cout << B[i][j];       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T By(T x, T y, T P) {     T F1 = 0;     while (y) {       if (y & 1) {         F1 += x;         if (F1 < 0 || F1 >= P) F1 -= P;       }       x <<= 1;       if (x < 0 || x >= P) x -= P;       y >>= 1;     }     return F1;   }   template <class T>   T Mul(T x, T y, T P) {     T F1 = 1;     x %= P;     while (y) {       if (y & 1) {         F1 = By(F1, x, P);       }       x = By(x, x, P);       y >>= 1;     }     return F1;   }   template <class T>   T Gcd(T x, T y) {     if (y == 0) return x;     T z;     while (z = x % y) {       x = y, y = z;     }     return y;   }   struct EDGE {     int T;     EDGE *Nxt;   };   template <class T>   void UpdataMin(T &x, T y) {     if (y < x) {       x = y;     }   }   template <class T>   void UpdataMax(T &x, T y) {     if (x < y) {       x = y;     }   }   int F[100001];   int L, R, N, M, QN;   int main() {     cin >> N >> M;     QN = N;     for (int i = 1; i <= (N); ++i) {       cin >> F[i];     }     sort(F + 1, F + N + 1);     L = lower_bound(F + 1, F + N + 1, M) - F;     R = upper_bound(F + 1, F + N + 1, M) - F - 1;     while (L > (N + 1) / 2 || R < (N + 1) / 2) {       ++N;       ++R;     }     cout << N - QN << endl;     cin >> N;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = 1e18, minf = 1e18 * (-1);   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int k, b;     cin >> k >> b;     int xyr[k][2], xyb[b][2];     for (long long i = 0; i < k; i++) cin >> xyr[i][0] >> xyr[i][1];     for (long long i = 0; i < b; i++) cin >> xyb[i][0] >> xyb[i][1];     if (k != b)       cout <<  No ;     else       cout <<  Yes ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1 << 30;   const int N = 100100;   int n, a[N], q;   int main() {     int t;     scanf( %d , &t);     while (t--) {       scanf( %d , &n);       set<int> se;       for (int i = 1; i <= n; i++) {         scanf( %d , a + i);         se.insert(a[i]);       }       printf( %d n , (int)se.size());     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 2e9 + 10, MAXN = 1e5 + 10;   int seg[4][MAXN * 4];   int n, S, l;   void update(int ind) {     seg[1][ind] = min(seg[1][((ind)*2)], seg[1][(((ind)*2) + 1)]);     seg[2][ind] = max(seg[2][((ind)*2)], seg[2][(((ind)*2) + 1)]);     seg[3][ind] = min(seg[3][((ind)*2)], seg[3][(((ind)*2) + 1)]);   }   void add(int s, int e, int ind, int x, int val, int t) {     if (s > x or e <= x) return;     if (s + 1 == e) {       seg[t][ind] = val;       return;     }     int mid = (s + e) / 2;     add(s, mid, ((ind)*2), x, val, t);     add(mid, e, (((ind)*2) + 1), x, val, t);     update(ind);   }   int fin(int s, int e, int ind, int x, int y, int t) {     if (s >= y or e <= x) return (t == 1 or t == 3) ? inf : -inf;     if (s >= x and e <= y) return seg[t][ind];     int mid = (s + e) / 2;     if (t == 1 or t == 3)       return min(fin(s, mid, ((ind)*2), x, y, t),                  fin(mid, e, (((ind)*2) + 1), x, y, t));     return max(fin(s, mid, ((ind)*2), x, y, t),                fin(mid, e, (((ind)*2) + 1), x, y, t));   }   void show() {     for (int i = 0; i < n; i++)       cerr << fin(0, n, 1, i, i + 1, 1) <<     << fin(0, n, 1, i, i + 1, 2)            << endl;   }   int main() {     scanf( %d%d%d , &n, &S, &l);     fill(seg[1], seg[1] + MAXN * 4, inf);     fill(seg[3], seg[3] + MAXN * 4, inf);     for (int i = 0; i < n; i++) {       int x;       scanf( %d , &x);       add(0, n, 1, i, x, 1);       add(0, n, 1, i, x, 2);     }     for (int i = 0; i < n; i++) {       int s = -1, e = i;       while (e - s > 1) {         int mid = (s + e) / 2;         if (fin(0, n, 1, mid, i + 1, 2) - fin(0, n, 1, mid, i + 1, 1) <= S)           e = mid;         else           s = mid;       }       if (e == 0 and i + 1 >= l) {         int res = 1;         add(0, n, 1, i, res, 3);         if (i == n - 1) {           printf( 1 n );           return 0;         }       } else if (i - e + 1 >= l) {         int res = fin(0, n, 1, e - 1, i - l + 1, 3);         res = min(res + 1, inf);         add(0, n, 1, i, res, 3);         if (i == n - 1) {           if (res == inf)             printf( -1 n );           else             printf( %d n , res);           return 0;         }       }     }     printf( -1 n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, l = 0, res = 0, a[100005];   int main() {     scanf( %d , &n);     a[0] = 0;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       if (a[i] >= a[i - 1])         l++;       else {         res = max(res, l);         l = 1;       }     }     res = max(res, l);     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int modExp(long long int base, long long int power) {     if (power == 0) {       return 1;     } else {       long long int cur = modExp(base, power / 2);       cur = cur * cur;       cur = cur % 1000000007;       if (power % 2 == 1) cur = cur * base;       cur = cur % 1000000007;       return cur;     }   }   void solve() {     long long int n, k, l, r, sall, sk;     cin >> n >> k >> l >> r >> sall >> sk;     vector<long long int> ans;     long long int temp = sk / k;     long long int num = sk - temp * k;     for (long long int i = 0; i < num; i++) {       ans.push_back(temp + 1);     }     for (long long int i = 0; i < k - num; i++) {       ans.push_back(temp);     }     if (n - k != 0) {       temp = (sall - sk) / (n - k);       num = (sall - sk) - (temp * (n - k));       for (long long int i = 0; i < num; i++) {         ans.push_back(temp + 1);       }       for (long long int i = 0; i < n - k - num; i++) {         ans.push_back(temp);       }     }     sort(ans.begin(), ans.end());     for (long long int i = 0; i < n; i++) {       cout << ans[i] <<    ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int t;     t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct subject {     long long a, b;     int c, r, s;     bool operator<(subject const &T) const { return c < T.c; }   };   int n, m, rex, rey, fx[55][55][105], fy[55][55][105];   long long rat, val, tmp, old, dp[55][55][105], ret;   subject a[55];   void trace(int x, int y, int z) {     if (y) trace(fx[x][y][z], y - 1, fy[x][y][z]);     printf( %d %I64d n , a[x].r, a[x].a + z);   }   int main() {     scanf( %d%d%I64d , &n, &m, &rat);     for (int i = 0; i < m; i++) {       scanf( %I64d%I64d%d , &a[i].a, &a[i].b, &a[i].c);       a[i].r = i + 1;       a[i].s = a[i].b - a[i].a;     }     sort(a, a + m);     memset(dp, -1, sizeof(dp));     for (int i = 0; i < m; i++) {       for (int j = 0; j <= a[i].s; j++) {         dp[i][0][j] = val = a[i].a + j;         for (int k = 1; k <= i; k++) {           for (int l = 0; l < i; l++) {             if (a[l].c == a[i].c) continue;             if (val % rat == 0) {               tmp = val / rat - a[l].a;               if (0 <= tmp && tmp <= a[l].s) {                 old = dp[l][k - 1][tmp];                 if (old != -1 && dp[i][k][j] < old + val) {                   dp[i][k][j] = old + val;                   fx[i][k][j] = l;                   fy[i][k][j] = tmp;                 }               }             }             if (val > rat) {               tmp = val - rat - a[l].a;               if (0 <= tmp && tmp <= a[l].s) {                 old = dp[l][k - 1][tmp];                 if (old != -1 && dp[i][k][j] < old + val) {                   dp[i][k][j] = old + val;                   fx[i][k][j] = l;                   fy[i][k][j] = tmp;                 }               }             }           }         }         if (dp[i][n - 1][j] > ret) ret = dp[i][n - 1][j], rex = i, rey = j;       }     }     if (ret) {       printf( YES n , ret);       trace(rex, n - 1, rey);     } else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int b[100000], c = 0, d, e, f;     int a;     cin >> a;     f = a;     for (int i = 0; i < a; ++i) {       cin >> b[i];       if (i == b[i]) c = c + 1;     }     for (int i = 0; i < a; ++i) {       if (i != b[i]) {         if (b[b[i]] == i) {           c = c + 2;           cout << c;           return 0;         }       }     }     if (c == f)       cout << c;     else       cout << c + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007;   long long fast_exp(long long base, long long exp, long long mod) {     long long res = 1;     while (exp > 0) {       if (exp % 2 == 1) res = (res * base) % mod;       base = (base * base) % mod;       exp /= 2;     }     return res;   }   int n, k, a, b, q;   int ta[211111];   int tb[211111];   long long bita[211111];   long long flaga[211111];   long long bitb[211111];   long long flagb[211111];   void upd(long long* arr, int p, int v) {     for (; p <= n; p += (p & (-p))) arr[p] += v;   }   long long sum(long long* arr, int b) {     long long sm = 0;     for (; b > 0; b -= (b & (-b))) sm += arr[b];     return sm;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> k >> a >> b >> q;     while (q--) {       int type, d, ai;       cin >> type;       if (type == 1) {         cin >> d >> ai;         long long value = sum(bita, d) - sum(bita, d - 1);         if (value + ai <= a && !ta[d])           upd(bita, d, ai);         else {           ta[d] = 1;           upd(bita, d, -value);           long long fl = sum(flaga, d) - sum(flaga, d - 1);           if (fl == 0) upd(flaga, d, 1);         }         value = sum(bitb, d) - sum(bitb, d - 1);         if (value + ai <= b && !tb[d])           upd(bitb, d, ai);         else {           tb[d] = 1;           upd(bitb, d, -value);           long long fl = sum(flagb, d) - sum(flagb, d - 1);           if (fl == 0) upd(flagb, d, 1);         }       } else {         int p;         cin >> p;         long long before = sum(bitb, p - 1) + b * sum(flagb, p - 1);         long long after = sum(bita, n) - sum(bita, p + k - 1) +                           (sum(flaga, n) - sum(flaga, p + k - 1)) * a;         cout << (before + after) <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long A;   vector<pair<long long, int> > ls;   vector<long long> M2[100000];   vector<long long> ls2;   long long my_stp(long long first, int stp) {     if (stp == 0) {       return 1ll;     }     long long res = my_stp(first, stp / 2);     res = res * res;     if (stp & 1) {       res = res * first;     }     return res;   }   inline pair<bool, long long> sqrtn(long long first, int stp) {     long long t = (long long)pow((long double)first, (long double)1 / stp);     for (long long k = max(2ll, t - 1); k <= t + 1; k++) {       if (my_stp(k, stp) == first) {         return make_pair(true, k);       }     }     return make_pair(false, 0ll);   }   inline bool is_prime(long long first) {     for (long long i = 2; i * i <= first; i++) {       if (first % i == 0) return false;     }     return true;   }   void obr(long long term, int id) {     for (int i = 1; (1ll << i) <= term - 1; i++) {       pair<bool, long long> sq = sqrtn(term - 1, i);       if (sq.first && is_prime(sq.second)) {         ls2.push_back(sq.second);         M2[id].push_back(sq.second);         break;       }     }   }   vector<long long> ls3;   void bct(int k, long long mul, int id) {     if (k == (int)(ls).size()) {       obr(mul, id);       ls3[id] = mul;       return;     }     for (int j = 0; j <= ls[k].second; j++) {       bct(k + 1, mul, id * (ls[k].second + 1) + j);       mul *= ls[k].first;     }   }   vector<pair<int, int> > G[100000];   void bct2(int k, int mul1, int mul2) {     if (k == (int)(ls).size()) {       if (mul2 != mul1) G[mul1].push_back(make_pair(mul2 - mul1, mul2));       return;     }     for (int j = 0; j <= ls[k].second; j++) {       for (int j1 = j; j1 <= ls[k].second; j1++) {         bct2(k + 1, mul1 * (ls[k].second + 1) + j,              mul2 * (ls[k].second + 1) + j1);       }     }   }   int main() {     cin >> A;     long long cur = A;     for (long long i = 2; i * i <= cur; i++) {       int cnt = 0;       while (cur % i == 0) {         cnt++;         cur /= i;       }       if (cnt) {         ls.push_back(make_pair(i, cnt));       }     }     if (cur > 1) {       ls.push_back(make_pair(cur, 1));     }     int szls3 = 1;     for (auto first : ls) {       szls3 *= (first.second + 1);     }     ls3.resize(szls3);     bct(0, (long long)1, 0);     {       sort((ls2).begin(), (ls2).end()),           ls2.resize(unique((ls2).begin(), (ls2).end()) - ls2.begin());     };     bct2(0, 0, 0);     vector<vector<int> > DP((int)(ls3).size(),                             vector<int>((int)(ls2).size() + 1, 0));     DP[0][0] = 1;     for (int first = 0; first < (int)(ls3).size(); first++) {       for (auto& second : M2[first]) {         second = lower_bound((ls2).begin(), (ls2).end(), second) - ls2.begin();       }     }     for (int i = 0; i < (int)(ls3).size(); i++) {       for (int j = 0; j < (int)(ls2).size(); j++) {         DP[i][j + 1] += DP[i][j];       }       for (auto first : G[i]) {         for (int second : M2[first.first]) {           DP[first.second][second + 1] += DP[i][second];         }       }     }     cout << DP[(int)(ls3).size() - 1][(int)(ls2).size()] << endl;     return 0;   }