malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:167772160000 )   using namespace std;   long long dp[5100][5100];   long long x[5100];   int a[5100], b[5100], c[5100], d[5100];   int main() {     int leftminright = 0;     int n, s, e;     cin >> n >> s >> e;     s--;     e--;     for (int i = 0; i < n; i++) cin >> x[i];     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) cin >> b[i];     for (int i = 0; i < n; i++) cin >> c[i];     for (int i = 0; i < n; i++) cin >> d[i];     x[n] = 0;     for (int i = 0; i < n + 2; i++)       for (int j = 0; j < n + 2; j++) dp[i][j] = 1E18;     dp[0][0] = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (i != 0) {           if (j == 0 && leftminright != 1) continue;         }         if (i == s) {           leftminright--;           long long now = dp[i][j];           now += d[i];           dp[i + 1][j + 1] =               min(dp[i + 1][j + 1],                   now + (x[i + 1] - x[i]) * ((j + 1) * 2 + leftminright));           now -= d[i];           now += c[i];           if (j + leftminright + 1 > 0)             dp[i + 1][j] = min(dp[i + 1][j],                                now + (x[i + 1] - x[i]) * (j * 2 + leftminright));           leftminright++;           continue;         }         if (i == e) {           leftminright++;           long long now = dp[i][j];           now += b[i];           dp[i + 1][j] =               min(dp[i + 1][j], now + (x[i + 1] - x[i]) * (j * 2 + leftminright));           now -= b[i];           now += a[i];           if (j == 0) {             leftminright--;             continue;           }           dp[i + 1][j - 1] =               min(dp[i + 1][j - 1],                   now + (x[i + 1] - x[i]) * (2 * (j - 1) + leftminright));           leftminright--;           continue;         }         long long now = dp[i][j];         now += b[i];         now += d[i];         dp[i + 1][j + 1] =             min(dp[i + 1][j + 1],                 now + (x[i + 1] - x[i]) * ((j + 1) * 2 + leftminright));         now -= d[i];         now += c[i];         if (j + leftminright > 0)           dp[i + 1][j] =               min(dp[i + 1][j], now + (x[i + 1] - x[i]) * (j * 2 + leftminright));         now -= b[i];         now += a[i];         now -= c[i];         now += d[i];         if (j > 0)           dp[i + 1][j] =               min(dp[i + 1][j], now + (x[i + 1] - x[i]) * (j * 2 + leftminright));         now -= d[i];         now += c[i];         if (j > 0 && j + leftminright > 0)           dp[i + 1][j - 1] =               min(dp[i + 1][j - 1],                   now + (x[i + 1] - x[i]) * ((j - 1) * 2 + leftminright));       }       if (i == s) leftminright--;       if (i == e) leftminright++;     }     cout << dp[n][0];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double EPS = 1e-8;   const long long INF = 0x3f3f3f3f3f3f3f3f;   inline long long readll() {     long long x(0), op(1);     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) op = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) x = x * 10 + ch -  0 , ch = getchar();     return x * op;   }   const int sz = 2e5 + 9;   long long a[sz], n;   long long solve(long long a, long long b) {     if (a == 0 || a == b) return 0;     int l = 1, r = n;     if (b) {       if (b < a)         l = b + 1;       else         r = b - 1;     }     return (a - l + 1) * (r - a + 1);   }   int main() {     n = readll();     for (int i = 1; i < n + 1; ++i) a[i] = readll();     a[0] = a[n + 1] = 0;     long long ans = 0;     for (int i = 0; i < n + 1; ++i) {       ans += solve(a[i], a[i + 1]);       ans += solve(a[i + 1], a[i]);     }     cout << ans / 2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int max_n = 200222, inf = 1000111222;   int n, m, a[max_n];   bool check(int cnt) {     long long sum = 0;     int last = 1;     for (int i = 0; i < n; ++i) {       if (i % cnt == 0) --last;       if (a[i] + last < 0) break;       sum += (a[i] + last);     }     return sum >= m;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; ++i) scanf( %d , &a[i]);     sort(a, a + n);     reverse(a, a + n);     int l = 0, r = n + 1;     while (r - l > 1) {       int mid = (l + r) / 2;       if (check(mid))         r = mid;       else         l = mid;     }     if (r > n)       puts( -1 );     else       printf( %d n , r);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long t[4 * 100100], dp[100100], a[100100], b[100100];   long long K = 1, n, m;   void build() {     while (K < m + 2) K <<= 1;   }   long long query(long long l, long long r) {     long long ans = 0;     for (l += K - 1, r += K + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {       if (~l ^ 1) ans = ((ans) >= (t[l + 1]) ? (ans) : (t[l + 1]));       if (r ^ 1) ans = ((ans) >= (t[r - 1]) ? (ans) : (t[r - 1]));     }     return ans;   }   void update(long long id, long long v) {     for (t[id += K] = v, id >>= 1; id >= 1; id >>= 1)       t[id] = max(t[id << 1 | 1], t[id << 1]);   }   long long get_id(long long x) {     long long l = 1, r = m, mid;     while (l < r) {       mid = (l + r + 1) >> 1;       if (b[mid] > x)         r = mid - 1;       else         l = mid;     }     return l;   }   void unique() {     m = 1;     for (long long i = 2; i <= n; i++)       if (b[i] != b[m]) b[++m] = b[i];   }   void input() {     scanf( %I64d , &n);     for (long long i = 1, r, h; i <= n; i++) {       scanf( %I64d%I64d , &r, &h);       a[i] = b[i] = r * r * h;     }     return;   }   void init() {     sort(b + 1, b + n + 1);     unique();     build();     return;   }   void work() {     for (long long i = 1; i <= n; i++) {       long long id = get_id(a[i]);       dp[i] = query(1, id - 1) + a[i];       update(id, dp[i]);     }     return;   }   void output() {     printf( %.15lf , query(1, m) * M_PI);     return;   }   int main() {     input();     init();     work();     output();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, c[100005], visit[100005], tp = 0;   vector<int> a[100005], ans;   bool ok[100005];   void dfs(int u) {     visit[u] = tp;     for (int i = 0; i < a[u].size(); i++) {       int v = a[u][i];       if (ok[v]) continue;       if (visit[v] == tp) {         cout << -1;         exit(0);       } else         dfs(v);     }     ans.push_back(u);     ok[u] = 1;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> k;     for (int i = 1; i <= k; i++) cin >> c[i];     for (int i = 1; i <= n; i++) {       int t;       cin >> t;       while (t--) {         int u;         cin >> u;         a[i].push_back(u);       }     }     for (int i = 1; i <= k; i++) {       if (!visit[c[i]]) {         tp++;         dfs(c[i]);       }     }     cout << ans.size() <<   n ;     for (int i = 0; i < ans.size(); i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n;     cin >> n;     long long int sum = n * (n - 1) / 2;     if (n == 0) {       cout << 0;       return 0;     }     if ((n % 2 == 0 && n % 4 != 0) || (n % 2 == 1 && n % 4 != 3))       cout << 1;     else       cout << 0;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename F, typename S>   ostream &operator<<(ostream &os, const pair<F, S> &p) {     return os <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <typename T>   ostream &operator<<(ostream &os, const vector<T> &v) {     os <<  { ;     typename vector<T>::const_iterator it;     for (it = v.begin(); it != v.end(); it++) {       if (it != v.begin()) os <<  ,  ;       os << *it;     }     return os <<  } ;   }   template <typename T>   ostream &operator<<(ostream &os, const set<T> &v) {     os <<  [ ;     typename set<T>::const_iterator it;     for (it = v.begin(); it != v.end(); it++) {       if (it != v.begin()) os <<  ,  ;       os << *it;     }     return os <<  ] ;   }   template <typename F, typename S>   ostream &operator<<(ostream &os, const map<F, S> &v) {     os <<  [ ;     typename map<F, S>::const_iterator it;     for (it = v.begin(); it != v.end(); it++) {       if (it != v.begin()) os <<  ,  ;       os << it->first <<   =   << it->second;     }     return os <<  ] ;   }   int n, m;   string hor, ver;   int give_dir(char ch) {     if (ch ==  >  || ch ==  v )       return 1;     else       return -1;   }   bool valid(int x, int y) {     if (x < 0 || y < 0 || x >= n || y >= m) return false;     return true;   }   void dfs(int x, int y, vector<vector<bool> > &visited) {     visited[x][y] = true;     int nx, ny;     nx = x + give_dir(ver[y]);     ny = y + give_dir(hor[x]);     if (valid(nx, y) && !visited[nx][y]) dfs(nx, y, visited);     if (valid(x, ny) && !visited[x][ny]) dfs(x, ny, visited);   }   int main() {     cin >> n >> m;     cin >> hor >> ver;     for (int k = 0; k < (n); k++) {       for (int l = 0; l < (m); l++) {         vector<vector<bool> > visited(n, vector<bool>(m, false));         dfs(k, l, visited);         for (int i = 0; i < (n); i++) {           for (int j = 0; j < (m); j++) {             if (!visited[i][j]) {               cout <<  NO  << endl;               return 0;             }           }         }       }     }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   template <class T>   void cxk(T& a, T b) {     a = a > b ? a : b;   }   template <class T>   void cnk(T& a, T b) {     a = a < b ? a : b;   }   long long gi() {     long long x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) f ^= ch ==  - , ch = getchar();     while (isdigit(ch)) x = x * 10 + ch -  0 , ch = getchar();     return f ? x : -x;   }   int col[200010], f[200010][2][2][2], p2[400010];   void inc(int& x, int y) {     x = x + y >= 1000000007 ? x + y - 1000000007 : x + y;   }   int main() {     int n = gi(), p = gi();     for (int i = 1; i <= n; ++i) col[i] = gi();     p2[0] = 1;     for (int i = 1; i <= n + n; ++i) p2[i] = 2 * p2[i - 1] % 1000000007;     f[1][0][0][0] = 1;     for (int i = 1; i <= n; ++i)       for (int j = 0; j < 2; ++j)         for (int k = 0; k < 2; ++k)           for (int l = 0; l < 2; ++l)             if (f[i][j][k][l]) {               if (col[i] != 1) {                 inc(f[i + 1][1][k][!l],                     1ll * p2[i - 1 - !!k] * f[i][j][k][l] % 1000000007);                 if (k)                   inc(f[i + 1][j][k][l],                       1ll * p2[i - 2] * f[i][j][k][l] % 1000000007);               }               if (col[i] != 0) {                 inc(f[i + 1][j][1][!l],                     1ll * p2[i - 1 - !!j] * f[i][j][k][l] % 1000000007);                 if (j)                   inc(f[i + 1][j][k][l],                       1ll * p2[i - 2] * f[i][j][k][l] % 1000000007);               }             }     int ans = 0;     for (int i = 0; i < 2; ++i)       for (int j = 0; j < 2; ++j) inc(ans, f[n + 1][i][j][p]);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define me(a, b) memset(a, b, sizeof(a))   #define IOS() ios::sync_with_stdio(false), cin.tie(0)   #define endl   n       typedef long long ll;   typedef pair<ll, ll> pll;   typedef pair<int, int> pii;   const int INF = 0x3f3f3f3f;   const int maxn = 2e5 + 5;   const ll mod = 1e9 + 7;      int cnt[26];   int n, k;   vector<pii> ans;   int check()   {    ans.clear();    int sum = 0;    for(int i = 0; i < 26; ++i) {     int r = cnt[i] % k;     if(r){      ans.push_back(pii(i, k - r));      sum += k - r;     }    }    return sum;   }      void solve()   {    me(cnt, 0);    string s;    cin >> n >> k >> s;    for(char &c : s)     ++cnt[c -  a ];    if(check() == 0) {     cout << s << endl;     return ;    }    for(int i = s.size()-1; i >= 0; --i) {     char &c = s[i];     --cnt[c -  a ];     for(int j = s[i] -  a  + 1; j < 26; ++j) {      c = j +  a ;      ++cnt[j];      int sum = s.size()-i-1 - check();      --cnt[j];      if(sum >= 0 && sum % k == 0) {       string t;       for(int p = 0; p <= i; ++p)        t.push_back(s[p]);       t.append(sum,  a );       for(pii p : ans) {        t.append(p.second, p.first+ a );       }       cout << t << endl;       return ;      }        }    }    cout <<  -1 n ;   }         int main()   {    IOS();    int T;    cin >> T;    while(T--)     solve();    return 0;   }
#include <bits/stdc++.h>   using namespace std;   int f[100001], g[100001], h[100001];   int n, cnt;   bool work() {     cnt = -1;     for (int i = 0; i < n; ++i) {       if (g[i] != -1) {         if (f[i] != i) return false;       } else {         if (g[f[i]] == -1) {           g[i] = ++cnt;           h[cnt] = f[i];           g[f[i]] = cnt;         } else {           if (h[g[f[i]]] != f[i]) return false;           h[g[f[i]]] = f[i];           g[i] = g[f[i]];         }       }     }     return true;   }   int main() {     cin >> n;     for (int i = 0; i < n; ++i) cin >> f[i];     for (int i = 0; i < n; ++i) --f[i];     for (int i = 0; i < n; ++i) g[i] = h[i] = -1;     if (work()) {       cout << ++cnt << endl;       for (int i = 0; i < n; ++i) cout << ++g[i] <<    ;       cout << endl;       for (int i = 0; i < cnt; ++i) cout << ++h[i] <<    ;     } else       cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxl = 200005;   int T, n, mk, seq[maxl];   char s[maxl];   inline char read() {     char ch = getchar();     while (ch !=  <  && ch !=  > ) ch = getchar();     return ch;   }   int main() {     scanf( %d , &T);     while (T--) {       scanf( %d , &n);       mk = 0;       memset(seq, 0, sizeof(seq));       for (register int i = 1; i < n; i++) s[i] = read();       s[0] =  > ;       s[n] =  < ;       for (register int i = n; i; i--)         if (s[i - 1] ==  >  && s[i] ==  < ) seq[i] = ++mk;       mk = n;       for (register int i = 1, j, tmp; i <= n; i++) {         if (seq[i]) continue;         if (s[i - 1] ==  > )           seq[i] = mk--;         else {           for (j = i; s[j] !=  >  && j < n; j++)             ;           tmp = j;           for (; j >= i; j--) seq[j] = mk--;           i = tmp;         }       }       for (register int i = 1; i <= n; i++) printf( %d  , seq[i]);       printf(  n );       memset(seq, 0, sizeof(seq));       mk = 0;       for (register int i = 1; i <= n; i++)         if (s[i - 1] ==  >  && s[i] ==  < ) seq[i] = ++mk;       mk = n;       for (register int i = n, j, tmp; i; i--) {         if (seq[i]) continue;         if (s[i] ==  < )           seq[i] = mk--;         else {           for (j = i; s[j - 1] !=  <  && j > 1; j--)             ;           tmp = j;           for (; j <= i; j++) seq[j] = mk--;           i = tmp;         }       }       for (register int i = 1; i <= n; i++) printf( %d  , seq[i]);       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ifstream in( date.in );     ofstream out( date.out );     long long nr2, k, rez[4001], con = 0, nr, n, pli[4001], plp[4001], inc[4001],                                  i, j;     cin >> n;     for (i = 1; i <= n; i++) cin >> pli[i] >> plp[i] >> inc[i];     for (i = 1; i <= n; i++) {       nr = nr2 = 0;       if (inc[i] >= 0) {         rez[++con] = i;         nr = pli[i];         for (j = i + 1; nr > 0 && j <= n; j++) {           if (inc[j] >= 0) {             inc[j] -= nr--;           } else {             if (pli[j]) {               inc[j] -= nr;               pli[j] = 0;               nr2 = plp[j];               for (k = j + 1; k <= n; k++) inc[k] -= nr2;             }           }         }       } else {         if (pli[i]) {           pli[i] = 0;           nr2 = plp[i];           for (k = i + 1; k <= n; k++) inc[k] -= nr2;         }       }     }     cout << con <<   n ;     for (j = 1; j <= con; j++) cout << rez[j] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   const int N = 128;   int num[N];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> num[i];     }     int m;     cin >> m;     for (int i = 0; i < m; ++i) {       int x, y;       cin >> x >> y;       num[x - 1] += y - 1;       num[x + 1] += num[x] - y;       num[x] = 0;     }     for (int i = 1; i <= n; ++i) {       cout << num[i] << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int p[3010000], n;   int main() {     scanf( %d , &n);     for (int i = 1; i < n + 1; i++) p[i] = i;     for (int i = 2; i < n + 1; i++) {       int s = p[i - 1], ns;       for (int j = i - 1; j <= n + i - 2; j += i) {         ns = p[j + i];         if (j + i <= n + i - 2)           p[j + i] = s;         else           p[n + i - 1] = s;         s = ns;       }     }     for (int i = 1; i < n + 1; i++) printf( %d  , p[n - 1 + i]);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 100;   long long arr[N], d[N], tree[N << 2], mx[N << 2];   void build(int rt, int l, int r) {     if (l == r) {       tree[rt] = mx[rt] = arr[l];       return;     }     int m = (l + r) / 2;     build(rt << 1, l, m);     build(rt << 1 | 1, m + 1, r);     tree[rt] = tree[rt << 1] + tree[rt << 1 | 1];     mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]);   }   void update(int L, int R, int rt, int l, int r) {     if (mx[rt] <= 2) return;     if (l == r) {       tree[rt] = mx[rt] = d[tree[rt]];       return;     }     int m = (l + r) >> 1;     if (L <= m) update(L, R, rt << 1, l, m);     if (R > m) update(L, R, rt << 1 | 1, m + 1, r);     tree[rt] = tree[rt << 1] + tree[rt << 1 | 1];     mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]);   }   long long query(int L, int R, int rt, int l, int r) {     if (L <= l && r <= R) {       return tree[rt];     }     int m = (l + r) >> 1;     long long ans = 0;     if (L <= m) ans += query(L, R, rt << 1, l, m);     if (R > m) ans += query(L, R, rt << 1 | 1, m + 1, r);     return ans;   }   int main() {     ios::sync_with_stdio(false);     int n, m, t, l, r;     for (int i = 1; i < N; i++) {       for (int j = i; j < N; j += i) d[j]++;     }     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> arr[i];     build(1, 1, n);     while (m--) {       cin >> t >> l >> r;       if (t == 1)         update(l, r, 1, 1, n);       else         cout << query(l, r, 1, 1, n) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int a[] = {0,   1,  1, 1, 2,  1, 2,  1, 5,  2, 2,  1, 5,  1, 2, 1,                    14,  1,  5, 1, 5,  2, 2,  1, 15, 2, 2,  5, 4,  1, 4, 1,                    51,  1,  2, 1, 14, 1, 2,  2, 14, 1, 6,  1, 4,  2, 2, 1,                    52,  2,  5, 1, 5,  1, 15, 2, 13, 2, 2,  1, 13, 1, 2, 4,                    267, 1,  4, 1, 5,  1, 4,  1, 50, 1, 2,  3, 4,  1, 6, 1,                    52,  15, 2, 1, 15, 1, 2,  1, 12, 1, 10, 1, 4,  2};   int main() {     int n;     cin >> n;     cout << a[n];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline bool fs(T &x) {     int c = getchar();     int sgn = 1;     while (~c && c <  0  || c >  9 ) {       if (c ==  - ) sgn = -1;       c = getchar();     }     for (x = 0; ~c &&  0  <= c && c <=  9 ; c = getchar()) x = x * 10 + c -  0 ;     x *= sgn;     return ~c;   }   int main() {     long long int n, m, cnt = 0;     fs(n);     fs(m);     for (long long int i = 1; i * i <= m; i++) {       if (m % i == 0 && m / i <= n) {         if (m / i != i) cnt++;         cnt++;       }     }     cout << cnt << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int solve(vector<pair<int, int> > v, int price) {     if (v.size() < 2) return 0;     vector<int> p, b;     for (int i = 0; i < v.size(); i++)       p.push_back(v[i].first), b.push_back(v[i].second);     int amx[v.size()];     amx[0] = b[0];     for (int i = 1; i < b.size(); i++) amx[i] = max(amx[i - 1], b[i]);     int ans = 0;     for (int i = 0; i < v.size(); i++) {       int id = upper_bound(p.begin(), p.begin() + i, price - p[i]) - p.begin();       id--;       if (id < 0 || id >= v.size()) continue;       if (id != i) ans = max(ans, b[i] + amx[id]);     }     return ans;   }   int main() {     int i, j, k;     int n, m;     int c, d;     int x, y;     char ch;     cin >> n >> c >> d;     int mc = 0, md = 0;     vector<pair<int, int> > coins, diamonds;     for (i = 0; i < n; i++) {       cin >> x >> y >> ch;       if (ch ==  C ) {         if (c >= y) mc = max(mc, x), coins.push_back({y, x});       } else {         if (d >= y) md = max(md, x), diamonds.push_back({y, x});       }     }     int ans = 0;     if (mc > 0 && md > 0) ans = mc + md;     sort(coins.begin(), coins.end());     sort(diamonds.begin(), diamonds.end());     ans = max(ans, solve(coins, c));     ans = max(ans, solve(diamonds, d));     printf( %d  , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int _, n;   char s[100005];   int main() {     scanf( %d , &_);     while (_--) {       scanf( %d , &n);       s[0] =  a ;       scanf( %s , s + 1);       int p = -1;       for (int i = n; i >= 1; i--) {         if (s[i] ==  0 ) {           p = i;           break;         }       }       bool f = 0;       for (int i = 1; i <= n; i++) {         if (s[i] ==  1 ) {           if (s[i + 1] ==  0 )             f = 1;           else             f = 0;           if (i < p) {             continue;           }           printf( 1 );         } else {           if (f) {             printf( 0 );             i = p;             continue;           }           printf( 0 );         }       }       puts(  );     }   }
#include <bits/stdc++.h>   using namespace std;   int n, ans, notOK;   map<int, int> M;   int main() {     cin >> n;     for (int i = 0, x; i < n; i++) cin >> x, M[x]++;     for (map<int, int>::iterator it = M.begin(); it != M.end(); it++) {       if (it->first) {         if (it->second == 2)           ans++;         else if (it->second > 2)           notOK = 1;       }     }     cout << (notOK ? -1 : ans);   }
#include <bits/stdc++.h>   using namespace std;   vector<int> cr1[27];   vector<int> cr2[27];   int s1[27];   int s2[27];   struct node {     int x;     int y;   };   int main() {     int n;     cin >> n;     char c;     for (int i = 0; i < n; i++) {       cin >> c;       if (c ==  ? ) {         s1[26]++;         cr1[26].push_back(i);       } else {         s1[c -  a ]++;         cr1[c -  a ].push_back(i);       }     }     for (int i = 0; i < n; i++) {       cin >> c;       if (c ==  ? ) {         s2[26]++;         cr2[26].push_back(i);       } else {         s2[c -  a ]++;         cr2[c -  a ].push_back(i);       }     }     int cnt = 0;     vector<node> nd;     for (int i = 0; i < 26; i++) {       int x = s1[i] - 1;       int y = s2[i] - 1;       while (x >= 0 && y >= 0) {         node n1;         n1.x = cr1[i][x];         n1.y = cr2[i][y];         nd.push_back(n1);         cnt++;         x--;         y--;       }       if (x >= 0 && y < 0) {         node n1;         while (x >= 0 && s2[26] > 0) {           n1.x = cr1[i][x];           n1.y = cr2[26][s2[26] - 1];           nd.push_back(n1);           cnt++;           s2[26]--;           x--;         }       } else if (x < 0 && y >= 0) {         node n1;         while (y >= 0 && s1[26] > 0) {           n1.x = cr1[26][s1[26] - 1];           n1.y = cr2[i][y];           nd.push_back(n1);           cnt++;           s1[26]--;           y--;         }       }     }     while (s1[26] > 0 && s2[26] > 0) {       node n1;       n1.x = cr1[26][s1[26] - 1];       n1.y = cr2[26][s2[26] - 1];       nd.push_back(n1);       cnt++;       s1[26]--;       s2[26]--;     }     cout << cnt << endl;     for (int i = 0; i < nd.size(); i++)       cout << nd[i].x + 1 <<     << nd[i].y + 1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   void actionFun() {     long long n;     cin >> n;     long long c = 2;     for (int i = 0; i < n; i++) {       cout << c <<    ;       ++c;     }     cout << endl;     return;   }   int main() {     int t;     cin >> t;     while (t--) {       actionFun();     }   }