malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int n, m;   int a[200010], b[200010], fail[200010];   int main() {     scanf( %d %d , &m, &n);     --n;     --m;     int x, y;     scanf( %d , &x);     for (int i = 0; i < m; ++i) {       scanf( %d , &y);       b[i] = y - x;       x = y;     }     scanf( %d , &x);     for (int i = 0; i < n; ++i) {       scanf( %d , &y);       a[i] = y - x;       x = y;     }     if (!n) return 0 * printf( %d n , m + 1);     if (!m) return 0 * printf( 0 n );     fail[0] = 0;     for (int i = 1; i < n; ++i) {       for (x = fail[i]; x && a[x] != a[i]; x = fail[x])         ;       fail[i + 1] = (a[x] == a[i]) ? x + 1 : 0;     }     x = y = 0;     for (int i = 0; i < m; ++i) {       for (; x && (a[x] != b[i] || x >= n); x = fail[x])         ;       if (a[x] == b[i])         if (++x == n) ++y;     }     printf( %d n , y);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1010;   int dp[N], c[N];   long long ncr[N][N];   void pascal() {     ncr[0][0] = 1;     for (int i = 1; i < N; i++) {       ncr[i][0] = 1;       for (int j = 1; j <= i; j++) {         ncr[i][j] = (ncr[i - 1][j] + ncr[i - 1][j - 1]) % 1000000007;       }     }   }   int main() {     pascal();     int k;     cin >> k;     for (int i = 0; i < (int)(k); ++i) cin >> c[i];     long long res = 1, total = 0;     for (int i = 0; i < (int)(k); ++i) {       res = (res * ncr[(total + c[i] - 1)][c[i] - 1]) % 1000000007;       total += c[i];     }     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   int MSB1(long long x) {     int d = 0;     while ((1LL << d) <= x) d++;     return d;   }   int main() {     int n, m;     cin >> n >> m;     struct Elm {       int l, r, x;     };     vector<vector<Elm>> vals(n);     while (m--) {       int op;       cin >> op;       if (op == 1) {         int t, l, r, x;         cin >> t >> l >> r >> x, t--;         vals[t].emplace_back(Elm{l, r, x});         continue;       }       int t, v;       cin >> t >> v, t--;       set<int> se;       for (int l = v, r = v; t < n; t++, l += MSB1(l - 1), r += MSB1(r)) {         for (auto &e : vals[t])           if (e.l <= r && l <= e.r) se.emplace(e.x);       }       cout << se.size() << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool isprime(int n) {     for (int i = (2); i < (sqrt(n) + 1); ++i)       if (n % i == 0) return false;     return true;   }   int main() {     vector<int> ans;     int h[400] = {0};     for (int i = 4; i < 400; i += 2) h[i] = 1;     h[2] = 0;     h[1] = 1;     for (int i = 3; i < 400; i += 2)       if (!h[i]) {         for (int j = i; j * i < 400; j += 2)           if (!h[j * i]) h[j * i] = 1;       }     int n, sp, diff;     scanf( %d , &n);     if (n == 3) {       printf( 1 n3 );       return 0;     }     for (int i = (n - 1); i >= (2); --i)       if (isprime(i)) {         sp = i;         break;       }     ans.push_back(sp);     diff = n - sp;     if (!h[diff])       ans.push_back(diff);     else {       for (int i = (2); i < (diff); ++i)         if (!h[i] && !h[diff - i]) {           ans.push_back(i), ans.push_back(diff - i);           break;         }     }     printf( %d n , ans.size());     for (int i = (0); i < (ans.size()); ++i) printf( %d  , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     vector<pair<long double, long double> > v(n);     int k = 0;     for (int i = 0; i < n; ++i) {       long double a, b, c;       cin >> a >> b >> c;       if (c == 0) ++k;       long double m = a * a + b * b;       v[i].first = -a * c / m;       v[i].second = -b * c / m;     }     int ans = 0;     for (int i = 0; i < n; ++i) {       if (v[i].first != 0 || v[i].second != 0 || k < 2) {         map<double, int> m;         int inf = 0;         for (int j = i + 1; j < n; ++j) {           long double dy = v[i].second - v[j].second,                       dx = v[i].first - v[j].first;           if (dx == 0)             ++inf;           else             ++m[double(dy / dx)];         }         ans += (inf * (inf - 1)) / 2;         for (auto it = m.begin(); it != m.end(); ++it) {           ans += ((it->second) * (it->second - 1)) / 2;         }       } else {         --k;         map<double, int> m;         int inf = 0;         for (int j = i + 1; j < n; ++j) {           long double dy = v[i].second - v[j].second,                       dx = v[i].first - v[j].first;           if (dx == 0)             ++inf;           else             ++m[double(dy / dx)];         }         ans += ((inf - 1) * (inf - 2)) / 2;         for (auto it = m.begin(); it != m.end(); ++it) {           ans += ((it->second) * (it->second - 1)) / 2;         }         ans += n - i - 2;       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const int N = 52;   int n, T;   int t[N], x[N], c[5];   long long f[2][N][N][N * N + 50];   long long g[2][N][N * N];   long long cnt[N][N][N];   long long dp[N][N][N][4], fac[N];   int main() {     fac[0] = 1;     for (int i = 1; i < N; i++) fac[i] = 1LL * fac[i - 1] * i % MOD;     scanf( %d%d , &n, &T);     for (int i = 1; i <= n; i++) scanf( %d%d , &t[i], &x[i]), c[x[i]]++;     f[0][0][0][0] = 1, g[0][0][0] = 1;     for (int i = 1; i <= n; i++) {       if (x[i] == 1 || x[i] == 2) {         memset(f[1], 0, sizeof(f[1]));         for (int j = 0; j <= c[1]; j++) {           for (int k = 0; k <= c[2]; k++) {             for (int s = 0; s <= 2500; s++) {               if (s + t[i] <= 2500) {                 if (x[i] == 1) (f[1][j + 1][k][s + t[i]] += f[0][j][k][s]) %= MOD;                 if (x[i] == 2) (f[1][j][k + 1][s + t[i]] += f[0][j][k][s]) %= MOD;               }               (f[1][j][k][s] += f[0][j][k][s]) %= MOD;             }           }         }         for (int j = 0; j <= c[1]; j++)           for (int k = 0; k <= c[2]; k++)             for (int s = 0; s <= 2500; s++) f[0][j][k][s] = f[1][j][k][s];       } else {         memset(g[1], 0, sizeof(g[1]));         for (int j = 0; j <= c[3]; j++) {           for (int s = 0; s <= 2500; s++) {             (g[1][j + 1][s + t[i]] += g[0][j][s]) %= MOD;             (g[1][j][s] += g[0][j][s]) %= MOD;           }         }         for (int j = 0; j <= c[3]; j++)           for (int s = 0; s <= 2500; s++) g[0][j][s] = g[1][j][s];       }     }     long long ans = 0;     for (int j = 0; j <= c[1]; j++) {       for (int k = 0; k <= c[2]; k++) {         for (int s1 = 0; s1 <= T; s1++) {           for (int l = 0; l <= c[3]; l++) {             int s2 = T - s1;             if (f[0][j][k][s1] && g[0][l][s2]) {               (cnt[j][k][l] += 1LL * f[0][j][k][s1] * g[0][l][s2]) %= MOD;             }           }         }       }     }     dp[0][0][0][0] = 1;     for (int i = 0; i <= c[1]; i++) {       for (int j = 0; j <= c[2]; j++) {         for (int k = 0; k <= c[3]; k++) {           for (int l = i == 0 ? 0 : 1; l <= 3; l++) {             if (i < c[1] && l != 1) (dp[i + 1][j][k][1] += dp[i][j][k][l]) %= MOD;             if (j < c[2] && l != 2) (dp[i][j + 1][k][2] += dp[i][j][k][l]) %= MOD;             if (k < c[3] && l != 3) (dp[i][j][k + 1][3] += dp[i][j][k][l]) %= MOD;           }         }       }     }     for (int i = 0; i <= c[1]; i++)       for (int j = 0; j <= c[2]; j++)         for (int k = 0; k <= c[3]; k++)           for (int l = 1; l <= 3; l++) {             if (cnt[i][j][k] && dp[i][j][k][l]) {               ans = ans + 1LL * dp[i][j][k][l] * cnt[i][j][k] % MOD * fac[i] %                               MOD * fac[j] % MOD * fac[k] % MOD;               ans = ans % MOD;             }           }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int s = 1e6;   int vis[s];   int main() {     int n, t;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &t);       vis[t] = 1;     }     printf( %d n , n);     int num = 0;     for (int i = 0; i < s + 2; i++) {       if (vis[i] == 1) {         if (vis[s - i + 1] == 0) {           printf( %d  , s - i + 1);           num++;         }       }     }     for (int i = 1; num < n; i++) {       if (vis[i] == 0 && vis[s - i + 1] == 0) {         printf( %d %d  , s - i + 1, i);         num += 2;       }     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, cnt = 0, cnt2 = 0;     cin >> n;     int w;     for (int i = 0; i < n; i++) {       cin >> w;       if (w == 100) cnt++;       if (w == 200) cnt2++;     }     if (cnt == 0 && cnt2 % 2 != 0) {       cout <<  NO ;       return 0;     }     if (cnt % 2 == 0)       cout <<  YES ;     else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int maxn = 1e6 + 6;   int a[maxn];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     int pt = 0;     if (n & 1) {       for (int i = 2; i <= n; i += 2) {         a[pt++] = i;       }       for (int i = n - 1; i >= 2; i -= 2) {         a[pt++] = i;       }       for (int i = 1; i <= n; i += 2) {         a[pt++] = i;       }       for (int i = n - 2; i >= 1; i -= 2) {         a[pt++] = i;       }       a[pt++] = n;     } else {       for (int i = 1; i <= n; i += 2) {         a[pt++] = i;       }       for (int i = n - 1; i >= 1; i -= 2) {         a[pt++] = i;       }       for (int i = 2; i <= n; i += 2) {         a[pt++] = i;       }       for (int i = n - 2; i >= 2; i -= 2) {         a[pt++] = i;       }       a[pt++] = n;     }     for (int i = 0; i < pt; i++) {       cout << a[i] <<    ;     }     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   inline int ni() {     int a;     scanf( %d , &a);     return a;   }   inline double nf() {     double a;     scanf( %lf , &a);     return a;   }   template <class T>   void out(T a, T b) {     bool first = true;     for (T i = a; i != b; i++) {       if (!first) printf(   );       first = false;       cout << *i;     }     puts(  );   }   template <class T>   void outl(T a, T b) {     for (T i = a; i != b; i++) cout << *i <<   n ;   }   const int MAXN = 5010;   int gcd(int x, int y) {     while (x) {       y %= x;       swap(x, y);     }     return y;   }   int n, m;   int a[MAXN], b[MAXN], g[MAXN];   long long d[MAXN];   long long balance[MAXN], gb[MAXN];   int main() {     n = ni();     m = ni();     for (int i = 0; i < (int)(n); i++) a[i] = ni();     for (int i = 0; i < (int)(m); i++) b[i] = ni();     sort(b, b + m);     g[0] = a[0];     for (int i = 1; i < n; i++) g[i] = gcd(g[i - 1], a[i]);     for (int i = 0; i < (int)(n); i++) {       int c = a[i];       for (int j = 2; j * j <= c; j++) {         if (c % j) continue;         bool flag = binary_search(b, b + m, j);         while (c % j == 0) {           if (flag)             balance[i]--;           else             balance[i]++;           c /= j;         }       }       if (c != 1) {         bool flag = binary_search(b, b + m, c);         if (flag)           balance[i]--;         else           balance[i]++;       }     }     for (int i = 0; i < (int)(n); i++) {       int c = g[i];       for (int j = 2; j * j <= c; j++) {         if (c % j) continue;         bool flag = binary_search(b, b + m, j);         while (c % j == 0) {           if (flag)             gb[i]--;           else             gb[i]++;           c /= j;         }       }       if (c != 1) {         bool flag = binary_search(b, b + m, c);         if (flag)           gb[i]--;         else           gb[i]++;       }     }     for (int i = n - 1; i >= 0; i--) {       d[i] = -(1LL << 60);       long long sum = 0;       for (int j = i; j < n; j++) {         sum += balance[j];         d[i] = max(d[i], d[j + 1] + sum - ((j - i + 1) * 1LL) * gb[j]);       }       d[i] = max(d[i], sum);     }     cout << d[0] << endl;   }
#include <bits/stdc++.h>   const int INF_INT = 0x3f3f3f3f;   const long long INF_LL = 0x7f7f7f7f;   const int MOD = 1e9 + 7;   const double eps = 1e-10;   const double pi = acos(-1);   using namespace std;   int n;   int a[30];   int vis[30];   bool dfs(int root, int cnt, int son) {     if (root == n + 1) return true;     if (cnt + 1 == a[root]) {       if (son != 1 && dfs(root + 1, 0, 0)) return true;       return false;     }     int same = 0;     for (int i = 1; i <= n; i++) {       if (!vis[i] && cnt + a[i] < a[root] && a[i] != same) {         same = a[i];         vis[i] = 1;         if (dfs(root, cnt + a[i], son + 1)) return true;         vis[i] = 0;       }     }     return false;   }   int main(int argc, char const *argv[]) {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     sort(a + 1, a + 1 + n);     memset(vis, 0, sizeof(vis));     if (a[n] != n)       puts( NO );     else {       if (dfs(1, 0, 0))         puts( YES );       else         puts( NO );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int arrx[100];   long long int arry[100];   long long int arr[10000];   map<long long int, bool> M;   void parr(long long int a[], long long int n);   int main() {     long long int x, y, l, r, ss, siz, sizx, sizy, mulx, muly, start, ans, fin,         ran, tempx, tempy, i, j, temp;     bool fx, fy;     scanf( %lld , &x);     scanf( %lld , &y);     scanf( %lld , &l);     scanf( %lld , &r);     sizx = 0;     sizy = 0;     mulx = 1;     muly = 1;     tempx = r / x;     tempy = r / y;     fx = 1;     fy = 1;     while (1) {       if (fx) {         arrx[sizx] = mulx;         sizx++;       }       if (fy) {         arry[sizy] = muly;         sizy++;       }       if (mulx > tempx && muly > tempy) break;       if (mulx <= tempx) {         mulx = mulx * x;       } else         fx = 0;       if (muly <= tempy) {         muly = muly * y;       } else         fy = 0;     }     siz = 0;     for (i = 0; i < sizx; i = i + 1) {       temp = r - arrx[i];       for (j = 0; j < sizy; j = j + 1) {         if (arry[j] > temp) break;         ss = arrx[i] + arry[j];         if (ss < l) continue;         if (M[ss]) continue;         arr[siz] = ss;         M[ss] = 1;         siz++;       }     }     sort(arr, arr + siz);     start = l;     ans = 0;     for (i = 0; i < siz; i = i + 1) {       fin = arr[i] - 1;       ran = fin - start + 1;       ans = max(ans, ran);       start = arr[i] + 1;     }     ran = r - start + 1;     ans = max(ans, ran);     printf( %lld n , ans);     return 0;   }   void parr(long long int a[], long long int n) {     long long int i;     for (i = 0; i < n; i = i + 1) {       printf( %lld  , a[i]);     }     printf(  n );   }
#include <bits/stdc++.h>   using namespace std;   vector<int> adj[300010];   bool vst[300010];   int dp[300010][2];   int root[300010];   int cnt[300010];   int dst[300010];   int find_root(int u) {     if (root[u] == u) return u;     return root[u] = find_root(root[u]);   }   void reunion(int u, int v) {     u = find_root(u);     v = find_root(v);     if (u == v) return;     if (cnt[u] < cnt[v]) swap(u, v);     cnt[u] += cnt[v];     root[v] = u;     dst[u] = max(dst[u], (dst[u] + 1) / 2 + (dst[v] + 1) / 2 + 1);     dst[u] = max(dst[u], dst[v]);   }   int val;   void dfs(int u, int fa = 0) {     vst[u] = 1;     for (int i = 0; i < adj[u].size(); i++) {       int v = adj[u][i];       if (v == fa) continue;       dfs(v, u);     }     vector<int> vt;     for (int i = 0; i < adj[u].size(); i++) {       int v = adj[u][i];       if (v == fa) continue;       vt.push_back(dp[v][0]);     }     sort(vt.begin(), vt.end());     reverse(vt.begin(), vt.end());     if (vt.size()) dp[u][0] = vt[0] + 1;     if (vt.size() > 1) dp[u][1] = vt[1] + 1;     val = max(val, dp[u][0] + dp[u][1]);   }   int main() {     int n, m, q;     scanf( %d%d%d , &n, &m, &q);     for (int i = 1; i <= n; i++) root[i] = i;     for (int i = 1; i <= m; i++) {       int u, v;       scanf( %d%d , &u, &v);       adj[u].push_back(v);       adj[v].push_back(u);       reunion(u, v);     }     for (int i = 1; i <= n; i++) {       if (!vst[i]) {         val = 0;         dfs(i);         int fa = find_root(i);         dst[fa] = val;       }     }     while (q--) {       int ok;       scanf( %d , &ok);       if (ok == 2) {         int u, v;         scanf( %d%d , &u, &v);         reunion(u, v);       } else {         int u;         scanf( %d , &u);         u = find_root(u);         printf( %d n , dst[u]);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double a, d;   double pre(double v) {     if (d >= (v * v) / (2.0 * a)) {       double x = v / a;       double y = d - ((v * v) / (2.0 * a));       double out = x + (y / (v));       return out;     } else {       double out = sqrt((2.0 * d) / a);       return out;     }   }   int main() {     int n;     cin >> n >> a >> d;     double arr[n][2];     double time[n];     for (int i = 0; i < n; i++) {       scanf( %lf%lf , &arr[i][0], &arr[i][1]);       double x = pre(arr[i][1]);       time[i] = x + arr[i][0];       if (i != 0 && time[i] < time[i - 1]) {         time[i] = time[i - 1];       }       printf( %.6f n , time[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool sushu(long long n) {     long long t = sqrt(n);     for (long long i = 2; i <= t; i++) {       if (n % i == 0) return false;     }     return true;   }   long long ret(long long n) {     long long ne = 0;     while (n != 0) {       ne = ne * 10 + n % 10;       n = n / 10;     }     return ne;   }   int main() {     long long n, ans;     long long a[11190];     long long i, num = 0;     for (i = 13;; i++) {       if (sushu(i) && sushu(ret(i)) && i != ret(i)) {         a[num++] = i;         if (num == 11184) break;       }     }     while (cin >> n) {       cout << a[n - 1] << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   void ckmx(int &x, int y) { x = max(x, y); }   const int N = 100050;   const int L = 17;   const int M = 2 * N;   int root, ls[M], rs[M], tsz, mx[M], lzy[M];   void Build(int &c, int ss, int se, int a[]) {     c = ++tsz;     lzy[c] = 0;     if (ss == se) {       mx[c] = a[ss];       return;     }     int mid = ss + se >> 1;     Build(ls[c], ss, mid, a);     Build(rs[c], mid + 1, se, a);     mx[c] = max(mx[ls[c]], mx[rs[c]]);   }   void Add(int c, int ss, int se, int qs, int qe, int f) {     if (qs > qe || qs > se || ss > qe) return;     if (qs <= ss && qe >= se) {       lzy[c] += f;       mx[c] += f;       return;     }     int mid = ss + se >> 1;     Add(ls[c], ss, mid, qs, qe, f);     Add(rs[c], mid + 1, se, qs, qe, f);     mx[c] = max(mx[ls[c]], mx[rs[c]]) + lzy[c];   }   int Get(int c, int ss, int se, int qs, int qe) {     if (qs > qe || qs > se || ss > qe) return -1e9;     if (qs <= ss && qe >= se) return mx[c];     int mid = ss + se >> 1;     return max(Get(ls[c], ss, mid, qs, qe), Get(rs[c], mid + 1, se, qs, qe)) +            lzy[c];   }   vector<int> E[N];   int dep[N], par[N][L], lid[N], rid[N], tid, h[N], ans[N];   void DFS(int u, int p) {     par[u][0] = p;     dep[u] = dep[p] + 1;     lid[u] = ++tid;     h[lid[u]] = dep[u];     for (int i = 1; i < L; i++) par[u][i] = par[par[u][i - 1]][i - 1];     for (int v : E[u])       if (v != p) DFS(v, u);     rid[u] = tid;   }   int LCA(int u, int v) {     if (dep[u] < dep[v]) swap(u, v);     for (int i = L - 1; ~i; i--)       if (dep[par[u][i]] >= dep[v]) u = par[u][i];     for (int i = L - 1; ~i; i--)       if (par[u][i] != par[v][i]) u = par[u][i], v = par[v][i];     return u == v ? v : par[v][0];   }   int Dist(int u, int v) { return dep[u] + dep[v] - 2 * dep[LCA(u, v)]; }   int Up(int u, int k) {     for (int i = 0; i < L; i++)       if (k >> i & 1) u = par[u][i];     return u;   }   struct Query {     int id, l, r;   };   vector<Query> Qs[N];   void Solve(int u, int p) {     Add(root, 1, tid, lid[u], rid[u], -2);     for (Query Q : Qs[u]) ckmx(ans[Q.id], Get(root, 1, tid, Q.l, Q.r) + dep[u]);     for (int v : E[u])       if (v != p) Solve(v, u);     Add(root, 1, tid, lid[u], rid[u], 2);   }   int main() {     int n, m;     scanf( %i , &n);     for (int i = 1, u, v; i < n; i++)       scanf( %i %i , &u, &v), E[u].push_back(v), E[v].push_back(u);     DFS(1, 0);     Build(root, 1, n, h);     scanf( %i , &m);     for (int i = 1; i <= m; i++) {       int u, v;       scanf( %i %i , &u, &v);       if (dep[u] < dep[v]) swap(u, v);       int w = Up(u, (Dist(u, v) - 1) / 2);       Qs[u].push_back((Query){i, lid[w], rid[w]});       Qs[v].push_back((Query){i, 1, lid[w] - 1});       Qs[v].push_back((Query){i, rid[w] + 1, n});     }     Solve(1, 0);     for (int i = 1; i <= m; i++) printf( %i n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 5, maxk = (1 << 20), inf = 1e9;   int dp[maxk][2];   int ind[20];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m, k;     cin >> n >> m >> k;     string a, b;     cin >> a >> b;     int c = 0, d = 0;     for (int i = 0; i < k; i++) {       if (a[i] ==  1 ) {         c += (1 << i);       }       if (b[i] ==  1 ) {         d += (1 << i);       }     }     for (int i = 0; i < maxk; i++) {       dp[i][0] = inf;       dp[i][1] = -inf;     }     dp[c][0] = 0;     dp[d][1] = 0;     int x, y;     int c1, d1;     for (int i = 0; i < k; i++) {       ind[i] = i;     }     for (int i = 0; i < n; i++) {       cin >> x >> y;       x--;       y--;       swap(ind[x], ind[y]);       c1 = 0;       d1 = 0;       for (int j = 0; j < k; j++) {         c1 += (1 << ind[j]) * (((1 << j) & c) > 0);         d1 += (1 << ind[j]) * (((1 << j) & d) > 0);       }       if (dp[c1][0] == inf) {         dp[c1][0] = i + 1;       }       dp[d1][1] = i + 1;     }     int uk = __builtin_popcount(c) + __builtin_popcount(d);     int sol = 0;     pair<int, int> range = {1, 1};     for (int i = (1 << k) - 1; i > -1; i--) {       if (dp[i][1] - dp[i][0] >= m) {         if (sol < k + __builtin_popcount(i) * 2 - uk) {           sol = k + __builtin_popcount(i) * 2 - uk;           range = {dp[i][0] + 1, dp[i][1]};         }       }       for (int j = 0; j < k; j++) {         if (i & (1 << j)) {           dp[i ^ (1 << j)][0] = min(dp[i ^ (1 << j)][0], dp[i][0]);           dp[i ^ (1 << j)][1] = max(dp[i ^ (1 << j)][1], dp[i][1]);         }       }     }     cout << sol <<   n ;     cout << range.first <<     << range.second <<   n ;     return 0;   }