malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5;   int from[N], to[N];   int main() {     cin.tie(NULL);     ios_base::sync_with_stdio(0);     int n, m;     cin >> n >> m;     vector<pair<int, int> > mst;     set<pair<int, int> > freeEdges;     for (int i = 0; i < (int)(m); ++i) {       int w, isMST;       cin >> w >> isMST;       if (isMST) {         mst.push_back(make_pair(w, i));       } else {         freeEdges.insert(make_pair(w, i));       }     }     sort(mst.begin(), mst.end());     for (int i = 0; i < (int)(n - 1); ++i) {       int id = mst[i].second;       from[id] = i;       to[id] = i + 1;     }     int u = 0, v = 2;     for (int i = 0; i < (int)(m - n + 1); ++i) {       int cur = mst[v - 1].first;       auto it = freeEdges.lower_bound(make_pair(cur, -1));       if (freeEdges.empty() || it == freeEdges.end()) {         cout << -1;         return 0;       }       int id = it->second;       from[id] = u;       to[id] = v;       --u;       if (u == -1) {         u = v - 1;         ++v;       }       freeEdges.erase(it);     }     for (int i = 0; i < (int)(m); ++i) {       cout << 1 + from[i] <<     << 1 + to[i] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n, k;     scanf( %d , &t);     while (t-- && scanf( %d %d , &n, &k)) {       if ((k & 1) == (n & 1) && (long long)(k)*k <= n && n >= k)         printf( YES n );       else         printf( NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[128][128][15];   int board[128][128];   int dy[] = {-1, 1};   int N, M, K;   int solve(int x, int y, int k) {     if (dp[x][y][k] != -2) return dp[x][y][k];     if (x == 0) {       if (board[x][y] % K == k)         return dp[x][y][k] = board[x][y];       else         return dp[x][y][k] = -1;     }     int curr = board[x][y];     int ans = -1;     int req = (K + k - (curr % K)) % K;     for (int i = 0; i < 2; i++) {       int nx = x - 1, ny = y + dy[i];       if (nx < 0 || ny < 0 || nx >= N || ny >= M) continue;       int ret = solve(nx, ny, req);       if (ret != -1) {         ans = max(ans, curr + ret);       }     }     return dp[x][y][k] = ans;   }   void print(int x, int y, int k) {     int curr = board[x][y];     int req = (K + k - (curr % K)) % K;     for (int i = 0; i < 2; i++) {       int nx = x - 1, ny = y + dy[i];       if (nx < 0 || ny < 0 || nx >= N || ny >= M) continue;       if (dp[x][y][k] == curr + dp[nx][ny][req]) {         if (i == 0)           cout <<  L ;         else           cout <<  R ;         print(nx, ny, req);         return;       }     }   }   int main() {     cin >> N >> M >> K;     K += 1;     for (int i = 0; i < N; i++) {       string s;       cin >> s;       for (int j = 0; j < M; j++) board[i][j] = s[j] -  0 ;     }     for (int i = 0; i < N; i++)       for (int j = 0; j < M; j++)         for (int k = 0; k < K; k++) dp[i][j][k] = -2;     int ans = -1;     int maxI = 0;     for (int i = 0; i < M; i++) {       int ret = solve(N - 1, i, 0);       if (ret != -1 && ret > ans) {         ans = ret;         maxI = i;       }     }     if (ans == -1) {       cout << -1 << endl;       return 0;     }     cout << ans << endl;     cout << maxI + 1 << endl;     print(N - 1, maxI, 0);     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gr[110][110];   int main() {     int n, m, a[110], b[100];     cin >> n >> m;     int nn = 0;     int mm = 0;     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       nn ^= a[i];     }     for (int i = 0; i < m; i++) {       scanf( %d , &b[i]);       mm ^= b[i];     }     if (nn != mm) {       cout <<  NO n ;       return 0;     }     cout <<  YES n ;     memset(gr, 0, sizeof gr);     for (int i = 0; i < n; i++) {       gr[i][m - 1] = a[i];     }     for (int j = 0; j < m; j++) {       gr[n - 1][j] = b[j];     }     gr[n - 1][m - 1] = mm ^ b[m - 1] ^ a[n - 1];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         printf( %d  , gr[i][j]);       }       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   vector<long long> fib = {1, 2};   map<pair<long long, long long>, long long> dp;   long long f(long long n, int j) {     if (fib[j] > n) return 0;     if (fib[j] == n) return 1;     long long tot = 0;     for (int j2 = 0; j2 < j; j2++) {       tot += f(n - fib[j], j2);     }     return tot;   }   int f2(long long n) {     int sz = fib.size();     vector<bool> cur(sz);     for (int i = sz - 1; i >= 0; i--) {       if (n >= fib[i]) {         cur[i] = 1;         n -= fib[i];       }     }     queue<vector<bool>> q;     q.push(cur);     int ans = 0;     set<vector<bool>> vis;     vis.insert(cur);     while (q.size()) {       ans++;       cur = q.front();       q.pop();       for (int i = 2; i < sz; i++) {         if (cur[i] && !cur[i - 1] && !cur[i - 2]) {           auto cur2 = cur;           cur2[i] = 0;           cur2[i - 1] = 1;           cur2[i - 2] = 1;           auto it = vis.find(cur2);           if (it == vis.end()) {             vis.insert(cur2);             q.push(cur2);           }         }       }     }     return ans;   }   long long f3(long long n) {     int sz = fib.size();     vector<bool> cur(sz);     vector<int> v;     for (int i = sz - 1; i >= 0; i--) {       if (n >= fib[i]) {         cur[i] = 1;         v.push_back(i);         n -= fib[i];       }     }     reverse(v.begin(), v.end());     int m = v.size();     vector<long long> dp1(m), dp2(m);     dp1[0] = 1;     dp2[0] = v[0] / 2;     for (int i = 1; i < m; i++) {       dp1[i] = dp1[i - 1] + dp2[i - 1];       dp2[i] = ((v[i] - v[i - 1]) / 2) * dp2[i - 1] +                ((v[i] - v[i - 1] - 1) / 2) * dp1[i - 1];     }     return dp1[m - 1] + dp2[m - 1];   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     while (fib.back() < 1e18) {       int n = fib.size();       fib.push_back(fib[n - 1] + fib[n - 2]);     }     int t;     cin >> t;     while (t--) {       long long n;       cin >> n;       long long ans = 0;       cout << f3(n) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(void) {     int n;     scanf( %d , &n);     vector<vector<int> > p(n);     for (int i = 0; i < n; i++) {       int sz;       scanf( %d , &sz);       p[i].resize(sz);       for (int j = 0; j < sz; j++) scanf( %d , &p[i][j]);     }     for (int i = 0; i < n; i++) {       bool can = true;       for (int j = 0; j < n; j++) {         if (i == j || p[j].size() > p[i].size()) continue;         int has[101] = {0};         bool ok = true;         for (int k = 0; k < p[j].size(); k++) has[p[j][k]]++;         for (int k = 0; k < p[i].size(); k++) has[p[i][k]]++;         for (int k = 0; k < p[j].size(); k++)           if (has[p[j][k]] != 2) ok = false;         can &= !(ok);       }       if (can)         puts( YES );       else         puts( NO );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       string s;       getline(cin >> ws, s);       string one =  1 , two =  1 ;       int prevOne = 1, prevTwo = 1;       for (int i = 1; i < n; i++) {         int num = s[i] -  0 ;         if (prevOne == prevTwo) {           if (num == 2) {             one +=  1 ;             two +=  1 ;             prevOne = 1;             prevTwo = 1;           } else if (num == 1) {             one +=  1 ;             two +=  0 ;             prevOne = 1;             prevTwo = 0;           } else {             one +=  0 ;             two +=  0 ;             prevOne =  0 ;             prevTwo =  0 ;           }         } else {           for (int j = i; j < n; j++) {             one +=  0 ;             two += s[j];           }           break;         }       }       cout << one <<   n  << two <<   n ;     }   }
#include<bits/stdc++.h>      #define y1 dmytxdy   #define pb push_back   #define fi first   #define se second   #define mp make_pair      using namespace std;      typedef long long ll;   typedef unsigned long long ull;   typedef pair<int,int> pii;   typedef pair<ll,ll> pll;   typedef long double ld;      template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}   template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}      int readint(){    int x=0,f=1; char ch=getchar();    while(ch< 0 ||ch> 9 ){if(ch== - )f=-1;ch=getchar();}    while(ch>= 0 &&ch<= 9 ){x=x*10+ch- 0 ;ch=getchar();}    return x*f;   }      const int cys=998244353,g=3,invg=(cys+1)/g;   int n,k,N,l;   ll fac[100005],inv[100005];   int A[300000],B[300000],r[300000];      ll mod(ll x){return x>=cys?x-cys:x;}      ll qpow(ll x,ll p){    ll ret=1;    for(;p;p>>=1,x=x*x%cys) if(p&1) ret=ret*x%cys;    return ret;   }      void init(int m){    l=0;    for(N=1;N<m;N<<=1) l++;    for(int i=1;i<N;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));   }      void ntt(int *A,int N,int f){    for(int i=1;i<N;i++) if(i<r[i]) swap(A[i],A[r[i]]);    for(int i=1;i<N;i<<=1){     int wn=qpow(f>0?g:invg,(cys-1)/(i<<1));     for(int j=0;j<N;j+=(i<<1)){      for(int k=j,w=1;k<j+i;k++,w=1ll*w*wn%cys){       int x=A[k],y=1ll*w*A[k+i]%cys;       A[k]=mod(x+y); A[k+i]=mod(x+cys-y);      }     }    }    if(f<0){     ll invn=qpow(N,cys-2);     for(int i=0;i<N;i++) A[i]=A[i]*invn%cys;    }   }      int main(){    n=readint(); k=readint();    fac[0]=inv[0]=1;    for(int i=1;i<=k;i++) fac[i]=fac[i-1]*i%cys;    inv[k]=qpow(fac[k],cys-2);    for(int i=k-1;i>=1;i--) inv[i]=inv[i+1]*(i+1)%cys;    for(int i=0;i<=k;i++) A[i]=i&1?cys-inv[i]:inv[i];    for(int i=0;i<=k;i++) B[i]=qpow(i,k)*inv[i]%cys;    init(k+k+1);    ntt(A,N,1); ntt(B,N,1);    for(int i=0;i<N;i++) A[i]=1ll*A[i]*B[i]%cys;    ntt(A,N,-1);    ll now=1,ans=0;    for(int i=1;i<=k;i++){     now=now*(n-i+1)%cys;     if(!now) break;     ans=(ans+A[i]*now%cys*qpow(n+1,n-i))%cys;    }    printf( %lld n ,ans);    return 0;   }
#include <bits/stdc++.h>   using namespace std;   char str1[100 + 10], str2[100 + 10];   int main() {     int m, s;     while (~scanf( %d%d , &m, &s)) {       for (int i = 0; i < m; i++) str1[i] = str2[i] =  0 ;       int ss = s;       if (m == 1 && s == 0) {         printf( 0 0 n );         continue;       }       if (s == 0 || s > m * 9) {         printf( -1 -1 n );         continue;       }       for (int i = 0; i < m; i++) {         if (ss > 9) {           str1[i] =  9 ;           ss -= 9;         } else {           str1[i] = ss +  0 ;           ss -= ss;         }       }       ss = s;       for (int i = m - 1; i >= 0; i--) {         if (ss > 9) {           str2[i] =  9 ;           ss -= 9;         } else {           if (i == 0) {             str2[i] =  0  + ss;             ss -= ss;           } else {             str2[i] =  0  + ss - 1;             ss -= ss - 1;             str2[0] =  1 ;             break;           }         }       }       str1[m] = str2[m] =   0 ;       printf( %s %s n , str2, str1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     int m;     cin >> n >> m;     vector<vector<bool>> arr(n, vector<bool>(m, 0));     long long int answ = 0;     vector<int> hor(n, 0);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         int temp;         cin >> temp;         if (!temp) {           hor[i]++;         }         arr[i][j] = (bool)temp;       }     }     vector<int> vert(m, 0);     for (int j = 0; j < m; j++) {       for (int i = 0; i < n; i++) {         if (!arr[i][j]) {           vert[j]++;         }       }     }     for (int i = 0; i < n; i++) {       int past = 0;       for (int j = 0; j < m; j++) {         if (arr[i][j]) {           answ += hor[i] - past;           break;         } else {           past++;         }       }       past = 0;       for (int j = m - 1; j >= 0; j--) {         if (arr[i][j]) {           answ += hor[i] - past;           break;         } else {           past++;         }       }     }     for (int j = 0; j < m; j++) {       int past = 0;       for (int i = 0; i < n; i++) {         if (arr[i][j]) {           answ += vert[j] - past;           break;         } else {           past++;         }       }       past = 0;       for (int i = n - 1; i >= 0; i--) {         if (arr[i][j]) {           answ += vert[j] - past;           break;         } else {           past++;         }       }     }     cout << answ << endl;     return 0;   }
#include <bits/stdc++.h>   char a[1005], b[1005];   int alen, blen, cnt1, cnt2;   int gcd(int a, int b) {     if (a % b == 0)       return b;     else       return gcd(b, a % b);   }   int lcm(int a, int b) { return a * b / gcd(a, b); }   void work(int t) {     int i;     for (i = 0; i < t; i++) switch (a[i % alen] - b[i % blen]) {         case 1:           cnt1++;           break;         case 2:           cnt1++;           break;         case 3:           cnt2++;           break;         case -1:           cnt2++;           break;         case -2:           cnt2++;           break;         case -3:           cnt1++;           break;       }   }   int main() {     int i, n, t, s;     while (~scanf( %d , &n)) {       cnt1 = 0, cnt2 = 0;       scanf( %s%s , a, b);       alen = strlen(a);       blen = strlen(b);       t = lcm(alen, blen);       work(t);       s = n / t;       cnt1 *= s;       cnt2 *= s;       work(n % t);       printf( %d %d n , cnt1, cnt2);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using int64 = long long;   int main() {     string s;     cin >> s;     int v[26] = {};     for (auto &c : s) v[c -  a ]++;     deque<int> odd;     for (int i = 0; i < 26; i++) {       if (v[i] % 2 == 1) odd.emplace_back(i);     }     while (odd.size() >= 2) {       int p = odd.front();       int q = odd.back();       odd.pop_front();       odd.pop_back();       v[p]++;       v[q]--;     }     string pre;     for (int i = 0; i < 26; i++) {       int t = v[i] / 2;       while (t--) pre += (char)(i +  a );     }     cout << pre;     if (odd.size()) cout << (char)( a  + odd[0]);     reverse(begin(pre), end(pre));     cout << pre << endl;   }
#include <bits/stdc++.h>   using namespace ::std;   const long double PI = acos(-1);   const long long MOD = 1000000000 + 7;   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   long long add(long long a, long long b, long long m = MOD) {     return (a % m + b % m + 2 * m) % m;   }   long long mul(long long a, long long b, long long m = MOD) {     return ((a % m + m) * (b % m + m)) % m;   }   long long pow_mod(long long a, long long b, long long m = MOD) {     long long res = 1LL;     a = a % m;     while (b) {       if (b & 1) res = mul(res, a, m);       b >>= 1;       a = mul(a, a, m);     }     return res;   }   long long fastexp(long long a, long long b) {     long long res = 1LL;     while (b) {       if (b & 1) res = res * a;       b >>= 1;       a *= a;     }     return res;   }   int gcdExtendido(int a, int b, int *x, int *y) {     if (a == 0) {       *x = 0;       *y = 1;       return b;     }     int x1, y1;     int gcd = gcdExtendido(b % a, a, &x1, &y1);     *x = y1 - (b / a) * x1;     *y = x1;     return gcd;   }   int modInverso(int a, int m) {     int x, y;     int g = gcdExtendido(a, m, &x, &y);     if (g != 1)       return -1;     else       return (x % m + m) % m;   }   const int MAX = 1000000 + 5;   const int N = 100 + 5;   int n, m;   int v[N];   long double memo[2][MAX];   int main() {     scanf( %d %d , &(n), &(m));     int S = 0;     for (int i = 1; i <= n; i++) {       scanf( %d , &(v[i]));       S += v[i];     }     long double ans = 0.0;     if (m > 1) {       memo[0][0] = m - 1;       for (int i = 0; i < n; i++) {         int next = (i + 1) & 1;         int act = i & 1;         for (int j = 1; j <= n * m; j++) {           memo[act][j] += memo[act][j - 1];         }         for (int j = 0; j <= n * m; j++) {           memo[next][j] = 0.0;         }         int next_chosen = v[i + 1];         for (int j = 0; j <= i * m; j++) {           memo[next][j + 1] += memo[act][j] / (m - 1);           memo[next][j + m + 1] -= memo[act][j] / (m - 1);           memo[next][j + next_chosen] -= memo[act][j] / (m - 1);           memo[next][j + next_chosen + 1] += memo[act][j] / (m - 1);         }       }       for (int j = 1; j <= n * m; j++) {         memo[n & 1][j] += memo[n & 1][j - 1];       }       for (int j = 0; j < S; j++) {         ans += memo[n & 1][j];       }     }     ans += 1.0;     printf( %.16Lf n , ans);     return 0;   }
#include <bits/stdc++.h>   int debugnum = 0;   using namespace std;   const long long MOD = 998244353;   inline long long add(long long a, long long b) { return (a + b) % MOD; }   int toint(bitset<10> bs) {     int ret = 0;     for (int i = 9; i >= 0; i--) {       ret = (ret << 1) | bs[i];     }     return ret;   }   long long chpow(long long a, long long b) {     long long ret = 1;     for (long long i = 1; i <= b; i <<= 1) {       if (i & b) ret = ret * a % MOD;       a = a * a % MOD;     }     return ret;   }   long long DP[20][10][1024];   long long sum[20][10][1024];   void init() {     memset(DP, 0, sizeof DP);     memset(sum, 0, sizeof sum);     for (int i = (0); i < (10); i++) DP[0][i][1 << i] = 1;     for (int i = (0); i < (10); i++) sum[0][i][1 << i] = i;     for (int i = (1); i < (19); i++) {       for (int j = (0); j < (10); j++) {         for (int S = (0); S < (1024); S++) {           long long &tmp = DP[i][j][S];           long long &tmp2 = sum[i][j][S];           bitset<10> bs = S, bs1;           if (bs[j] == 0) continue;           bs1 = bs;           bs1[j] = 0;           for (int j1 = (0); j1 < (10); j1++) {             tmp += DP[i - 1][j1][S] + DP[i - 1][j1][toint(bs1)];             tmp2 += sum[i - 1][j1][S] + sum[i - 1][j1][toint(bs1)];             tmp %= MOD;             tmp2 %= MOD;           }           tmp2 += tmp * (j * chpow(10, i) % MOD) % MOD;           tmp2 %= MOD;         }       }     }   }   long long solve(long long N, long long K, bitset<10> S0, long long extra = 0) {     long long ret = 0;     long long Ai = N, p = 1, i = 0;     while (Ai >= 10) Ai /= 10, p *= 10, i++;     if (i == 0) {       long long cnt = 0;       for (int i = (0); i < (Ai + 1); i++) {         if ((S0 | bitset<10>(1 << i)).count() <= K) cnt += i + extra;       }       cnt %= MOD;       return cnt;     }     if (S0.count() == 0) {       unsigned long long p = 1;       for (int i = (0); i < (19); i++) {         for (int j = (1); j < (10); j++) {           if ((1LL + j) * p > N) break;           for (int S1 = (0); S1 < (1024); S1++) {             bitset<10> S = S1;             if (S.count() <= K) {               ret += sum[i][j][S1];               ret %= MOD;             }           }         }         p *= 10;       }     } else {       for (int j = (0); j < (Ai); j++) {         for (int S1 = (0); S1 < (1024); S1++) {           bitset<10> S = bitset<10>(S1) | S0;           if (S.count() <= K) {             ret += DP[i][j][S1] * extra % MOD + sum[i][j][S1];             ret %= MOD;           }         }       }     }     S0[Ai] = 1;     if ((N - Ai * p) * 10 < p) S0[0] = 1;     if (N >= 10) ret += solve(N - Ai * p, K, S0, (extra + Ai * p % MOD) % MOD);     ret %= MOD;     return ret;   }   int main() {     init();     long long N, M, K;     while (cin >> N >> M >> K) {       N--;       long long output = (MOD + solve(M, K, 0) - solve(N, K, 0)) % MOD;       cout << output << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, ans1 = 0, ans2 = 0, x, y;   char s[1100], m[1100];   int main() {     scanf( %d , &n);     scanf( %s%s , s, m);     sort(s, s + n);     sort(m, m + n);     x = y = 0;     while (x < n && y < n) {       if (m[y] >= s[x]) {         x++;         y++;       } else         y++, ans1++;     }     x = y = 0;     while (x < n && y < n) {       if (m[y] > s[x]) {         x++;         y++;         ans2++;       } else         y++;     }     printf( %d n%d , ans1, ans2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void doRoutine() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);   }   void minus1(string &s) {     long long i = (long long)s.size() - 1;     while (i >= 0 && s[i] ==  0 ) {       s[i] =  9 ;       --i;     }     --s[i];     if (i == 0 && s[i] ==  0 ) {       s.erase(s.begin());     }   }   void solve_ez(string &s) {     long long n = s.size();     string t(n - 2,  9 );     cout << t << endl;   }   void solve(string &s) {     if (s.size() % 2 == 1) {       cout << string((long long)s.size() - 1,  9 ) << endl;       return;     }     long long n = s.size();     vector<long long> pref(n + 1);     for (long long i = 0; i < n; ++i) {       pref[i + 1] = pref[i] + (s[i] -  0 );     }     vector<long long> odd(10);     long long max_pref = 0;     for (long long i = 0; i < n; ++i) {       long long dig = s[i] -  0 ;       odd[dig] = (odd[dig] + 1) % 2;       vector<long long> odds;       for (long long c = 0; c < 10; ++c) {         if (odd[c]) {           odds.push_back(c);         }       }       bool ok = false;       long long cnt = odds.size();       if (n - i - 1 >= cnt) {         if (pref[n - cnt] - pref[i + 1] > 0) {           ok = true;         } else {           ok = true;           for (long long j = 0; j < cnt; ++j) {             long long s_dig = (s[n - cnt + j] -  0 );             long long cur_dig = odds[j];             if (cur_dig < s_dig) {               break;             } else if (cur_dig > s_dig) {               ok = false;             }           }         }       }       if (!ok) {         break;       } else {         max_pref = i + 1;       }     }     if (max_pref == n) {       cout << s << endl;       return;     }     for (long long c = (s[max_pref] -  0 ) - 1; c >= (max_pref == 0 ? 1 : 0);          --c) {       fill(odd.begin(), odd.end(), 0);       for (long long i = 0; i < max_pref; ++i) {         long long dig = s[i] -  0 ;         odd[dig] = (odd[dig] + 1) % 2;       }       odd[c] = (odd[c] + 1) % 2;       vector<long long> odds;       for (long long x = 9; x >= 0; --x) {         if (odd[x]) {           odds.push_back(x);         }       }       if ((long long)odds.size() <= n - max_pref - 1) {         string res;         for (long long i = 0; i < max_pref; ++i) {           res.push_back(s[i]);         }         res.push_back((char)(c +  0 ));         for (long long i = 0; i < n - max_pref - 1 - (long long)odds.size();              ++i) {           res.push_back( 9 );         }         for (auto el : odds) {           res.push_back((char)(el +  0 ));         }         cout << res << endl;         return;       }     }     solve_ez(s);   }   signed main() {     doRoutine();     long long n;     cin >> n;     while (n--) {       string s;       cin >> s;       minus1(s);       solve(s);     }     return 0;   }