malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 5;   long long a[N];   struct tr {     int l, r, maxi;   } t[N * 4];   int sign(long long x) {     if (x > 0) return 1;     if (x < 0) return -1;     return 0;   }   inline void cal(int cur, int l, int r) {     int m = (l + r) / 2;     int dcur = cur + cur, u = dcur, v = u + 1;     t[cur].maxi = max(t[u].maxi, t[v].maxi);     t[cur].l = t[u].l;     t[cur].r = t[v].r;     if ((!a[m] || !a[m + 1] || sign(a[m]) < sign(a[m + 1]))) {     } else {       t[cur].maxi = max(t[cur].maxi, t[u].r + t[v].l);       if (t[u].maxi == m - l + 1) {         t[cur].l = t[u].l + t[v].l;       }       if (t[v].maxi == r - m) {         t[cur].r = t[v].r + t[u].r;       }     }   }   void build(int pos, int l, int r) {     if (l == r) {       int x = !!a[l];       t[pos].l = t[pos].r = t[pos].maxi = x;       return;     }     int mid = (l + r) >> 1;     build(pos * 2, l, mid);     build(pos * 2 + 1, mid + 1, r);     cal(pos, l, r);   }   void update(int pos, int l, int r, int k, int d) {     int mid = (l + r) >> 1;     if (l == r) {       a[l] += d;       int x = !!a[l];       t[pos].l = t[pos].r = t[pos].maxi = x;       return;     } else {       int mid = (l + r) >> 1;       if (k <= mid)         update(pos * 2, l, mid, k, d);       else         update(pos * 2 + 1, mid + 1, r, k, d);       cal(pos, l, r);     }   }   int main() {     int u, v, n, i, m, l, r, d;     cin >> n;     cin >> u;     for (i = 1; i < n; ++i) scanf( %d , &v), a[i - 1] = v - u, u = v;     if (n > 1) build(1, 0, n - 2);     cin >> m;     while (m--) {       scanf( %d%d%d , &l, &r, &u);       if (n == 1) {         printf( 1 n );       } else {         if (l > 1) update(1, 0, n - 2, l - 2, u);         if (r < n) update(1, 0, n - 2, r - 1, -u);         printf( %d n , t[1].maxi + 1);       }     }   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> v;   map<long long, int> mp, mpp;   long long ans[200005];   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) {       long long l, r;       cin >> l >> r;       if (!mpp[l]) {         v.push_back(l);         mpp[l] = 1;       }       if (!mpp[r + 1]) {         v.push_back(r + 1);         mpp[r + 1] = 1;       }       mp[l]++;       mp[r + 1]--;     }     sort(v.begin(), v.end());     long long prev = 0;     int active = 0;     for (int i = 0; i < v.size(); i++) {       ans[active] += v[i] - prev;       active += mp[v[i]];       prev = v[i];     }     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t, i, sum = 0, x, y;     cin >> n >> t;     int a[n];     for (i = 0; i < n; i++) cin >> a[i];     for (i = 0; i < n - 1; i++) {       if ((a[i] >= 0 && a[i + 1] >= 0) || (a[i] <= 0 && a[i + 1] <= 0)) {         x = abs(a[i] - a[i + 1]) / t;         y = abs(a[i] - a[i + 1]) % t;       } else if (a[i] < 0 && a[i + 1] > 0) {         x = ((a[i] * -1) + a[i + 1]) / t;         y = ((a[i] * -1) + a[i + 1]) % t;       }       if (x > 2) {         sum += 2;       } else if (x == 2 && y == 0)         sum += 1;       else if (x == 2 && y != 0)         sum += 2;     }     sum += 2;     cout << sum << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010;   int dp[550][550], A[550], B[550], path[550][550], n, m;   bool print(int x) {     if (!x) return false;     if (print(path[n][x]))       printf(  %d , B[x]);     else       printf( %d , B[x]);     return true;   }   int main() {     int i, j, tp, ans, pos;     while (~scanf( %d , &n)) {       for (i = 1; i <= n; i++) scanf( %d , &A[i]);       scanf( %d , &m);       for (i = 1; i <= m; i++) scanf( %d , &B[i]);       memset(dp, 0, sizeof dp);       for (i = 1; i <= n; i++) {         tp = pos = 0;         for (j = 1; j <= m; j++) {           dp[i][j] = dp[i - 1][j];           path[i][j] = path[i - 1][j];           if (A[i] == B[j] && tp + 1 > dp[i][j])             dp[i][j] = tp + 1, path[i][j] = pos;           if (B[j] < A[i] && dp[i - 1][j] > tp) tp = dp[i - 1][j], pos = j;         }       }       ans = 1;       for (i = 1; i <= m; i++)         if (dp[n][i] > dp[n][ans]) ans = i;       printf( %d n , dp[n][ans]);       if (dp[n][ans]) print(ans);       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct debugger {     template <typename T>     debugger& operator,(const T& v) {       cerr << v <<    ;       return *this;     }   } debug;   template <typename T1, typename T2>   inline ostream& operator<<(ostream& os, const pair<T1, T2>& p) {     return os <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <typename T>   inline ostream& operator<<(ostream& os, const vector<T>& v) {     bool first = true;     os <<  [ ;     for (typename vector<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {       if (!first) os <<  ,  ;       os << *ii;       first = false;     }     return os <<  ] ;   }   const int NN = (1 << 18);   int seg[NN], dp[NN];   int od[NN], ans[NN];   bool vowel(char ch) {     ch = tolower(ch);     if (ch ==  a  or ch ==  e  or ch ==  i  or ch ==  o  or ch ==  u )       return true;     return false;   }   bool cmp(int x, int y) {     if (dp[x] == dp[y]) return (x < y);     return (dp[x] < dp[y]);   }   void update(int i, int v) {     for (i += 5; i < NN; i += i & -i) seg[i] += v;   }   int findcum(int cum) {     int id = 0, bitmask = NN >> 1;     while (bitmask != 0) {       int tid = id + bitmask;       if (seg[tid] < cum) cum -= seg[tid], id = tid;       bitmask >>= 1;     }     return id + 1 - 5;   }   void solve() {     string msg;     cin >> msg;     int n = (int)msg.size();     dp[0] = od[0] = 0;     for (int i = 1; i <= n; ++i)       dp[i] = dp[i - 1] + ((vowel(msg[i - 1])) ? -1 : 2), od[i] = i;     sort(od, od + n + 1, cmp);     int res = numeric_limits<int>::min();     for (int i = 0; i <= n; ++i) {       update(od[i], 1);       int id = findcum(1);       if (id < od[i]) res = max(res, od[i] - id), ++ans[od[i] - id];     }     if (res <= 0)       puts( No solution );     else       cout << res <<     << ans[res] << endl;   }   int main() {     ios_base::sync_with_stdio(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   const int MOD = INF + 7;   int memo[3000 + 1][100 + 1][100];   int N;   vector<int> a, b;   int solve(int len, int w, int nouse) {     if (len == 0) return 1;     if (len < 0) return 0;     if (memo[len][w][nouse] != -1) return memo[len][w][nouse];     int res = 0;     for (int i = 0; i < N; i++)       if (i != nouse) {         if (a[i] == w)           res = (res + solve(len - b[i], b[i], i)) % MOD;         else if (b[i] == w)           res = (res + solve(len - a[i], a[i], i)) % MOD;       }     memo[len][w][nouse] = res;     return res;   }   int main() {     ios_base::sync_with_stdio(false);     memset(memo, -1, sizeof(memo));     int l;     cin >> N >> l;     a.resize(N);     b.resize(N);     for (int i = 0, _n = N; i < _n; i++) {       cin >> a[i] >> b[i];     }     int res = 0;     for (int i = 0, _n = 100; i < _n; i++)       res = (res + solve(l, i + 1, -1)) % MOD;     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   void solve() {     long long n;     cin >> n;     string s;     cin >> s;     vector<long long> v(n);     for (long long i = 0; i <= n - 1; i++) cin >> v[i];     long long ans = mod;     for (long long i = 0; i <= n - 2; i++) {       if (s[i] ==  R  && s[i + 1] ==  L ) ans = min(ans, abs(v[i] - v[i + 1]));     }     if (ans == mod)       cout << -1;     else       cout << ans / 2;   }   int main() {     long long tc = 1;     while (tc--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int A[100000];   int main() {     int n;     cin >> n;     int sh = 0;     for (int i = 0; i < n - 1; i++) {       int a;       cin >> a;       A[i] = A[i] + a;       int k = n - i - 1;       int l = 1;       while (l <= k) {         if (l * 2 > k) {           break;         } else {           l = l * 2;         }       }       A[i + l] = A[i + l] + A[i];       sh = sh + A[i];       cout << sh <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   const long long mod = 1e9 + 7;   const long long N = 1e5 + 10;   struct node {     int ind, type, row, color;     node(int a, int b, int c, int d) {       ind = a;       type = b;       row = c;       color = d;     }   };   bool comp(node x, node y) { return x.ind < y.ind; }   int main() {     ios::sync_with_stdio(false);     int n, m, k;     cin >> n >> m >> k;     vector<vector<int> > ans(n, vector<int>(m, 0));     vector<vector<pair<int, int> > > v(2, vector<pair<int, int> >(max(n, m)));     for (int i = 0; i < k; i++) {       int a, b, c;       cin >> a >> b >> c;       v[a - 1][b - 1] = make_pair(i, c);     }     vector<node> vec;     for (int i = 0; i < 2; i++)       for (int j = 0; j < max(n, m); j++)         if (v[i][j].second != 0)           vec.push_back(node(v[i][j].first, i, j, v[i][j].second));     sort(vec.begin(), vec.end(), comp);     for (int i = 0; i < vec.size(); i++) {       if (vec[i].type == 0) {         for (int j = 0; j < m; j++) ans[vec[i].row][j] = vec[i].color;       } else {         for (int j = 0; j < n; j++) ans[j][vec[i].row] = vec[i].color;       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) cout << ans[i][j] <<    ;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, p, num, mi = 1000000, ma = 0, ans = 1;     cin >> n >> p;     vector<long long> v, res;     for (long long i = 0; i < n; i++) {       cin >> num;       v.push_back(num);       mi = min(mi, num);       ma = max(ma, num);     }     sort(v.begin(), v.end());     for (long long i = mi; i <= ma; i++) {       ans = 1;       for (long long j = 0; j < n; j++) {         auto it = upper_bound(v.begin(), v.end(), i + j);         it--;         ans *= (distance(v.begin(), it) + 1 - j);         ans = ans % p;       }       if (ans) {         if (ans % p != 0) res.push_back(i);       }     }     cout << res.size() << endl;     for (long long i = 0; i < res.size(); i++) cout << res[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int t;     cin >> t;     while (t--) {       long long int a, b;       cin >> a >> b;       long long int r1 = 45;       long long int s1 = 10;       long long int r2 = 20;       long long int s2 = 5;       long long int r3 = 45;       long long int s3 = 10;       long long int r4 = 20;       long long int s4 = 5;       long long int r5 = 5;       long long int s5 = 2;       long long int r6 = 20;       long long int s6 = 5;       long long int r7 = 45;       long long int s7 = 10;       long long int r8 = 20;       long long int s8 = 5;       long long int r9 = 45;       long long int s9 = 10;       long long int digit = b % 10;       long long int sum = 0;       if (digit == 1) {         sum = (a / (b * s1)) * r1;         long long int loop = ((b * s1) * (a / (b * s1))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 2) {         sum = (a / (b * s2)) * r2;         long long int loop = ((b * s2) * (a / (b * s2))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 3) {         sum = (a / (b * s3)) * r3;         long long int loop = ((b * s3) * (a / (b * s3))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 4) {         sum = (a / (b * s4));         sum *= r4;         long long int loop = (a / (b * s4));         loop *= (b * s4);         loop += b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 5) {         sum = (a / (b * s5)) * r5;         long long int loop = ((b * s5) * (a / (b * s5))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 6) {         sum = (a / (b * s6)) * r6;         long long int loop = ((b * s6) * (a / (b * s6))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 7) {         sum = (a / (b * s7)) * r7;         long long int loop = ((b * s7) * (a / (b * s7))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 8) {         sum = (a / (b * s8)) * r8;         long long int loop = ((b * s8) * (a / (b * s8))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       if (digit == 9) {         sum = (a / (b * s9)) * r9;         long long int loop = ((b * s9) * (a / (b * s9))) + b;         for (long long int i = loop; i <= a; i = i + b) {           sum += i % 10;         }       }       cout << sum <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int getint() {     unsigned int c;     int x = 0;     while (((c = getchar()) -  0 ) >= 10) {       if (c ==  - ) return -getint();       if (!~c) exit(0);     }     do {       x = (x << 3) + (x << 1) + (c -  0 );     } while (((c = getchar()) -  0 ) < 10);     return x;   }   int getc_str(char str[]) {     unsigned int c, n = 0;     while ((c = getchar()) <=    )       ;     if (!~c) exit(0);     do {       str[n++] = c;     } while ((c = getchar()) >    );     str[n] =   0 ;     return n;   }   char in[100];   int main() {     int i, j, tcc, tc = 1 << 28;     for (tcc = 0; tcc < tc; tcc++) {       int n = getint();       getc_str(in);       bool ok = 1;       for (i = 0; i < n; i++) {         if (in[i] !=  4  and in[i] !=  7 ) ok = 0;       }       int firstSum = 0, secondSum = 0;       for (i = 0; i < n / 2; i++) firstSum += in[i];       for (i = 0; i < n / 2; i++) secondSum += in[i + n / 2];       if (firstSum != secondSum) ok = 0;       if (ok) {         puts( YES );       } else {         puts( NO );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const int dx4[] = {-1, 0, 1, 0};   const int dy4[] = {0, 1, 0, -1};   const int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1};   const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};   inline long long Int() {     long long num = 0;     char c = getchar_unlocked();     bool sign = true;     while (!((c >=  0  && c <=  9 ) || c ==  - )) c = getchar_unlocked();     if (c ==  - ) {       sign = false;       c = getchar_unlocked();     }     while (c >=  0  && c <=  9 ) {       num = (num << 1) + (num << 3) + c -  0 ;       c = getchar_unlocked();     }     return sign ? num : -num;   }   template <class S, class T>   ostream& operator<<(ostream& out, const pair<S, T>& P) {     out <<  {  << P.first <<  ,   << P.second <<  } ;     return out;   }   template <class T>   ostream& operator<<(ostream& out, const vector<T>& v) {     out <<  [ ;     for (int i = 0; i < (int)v.size(); ++i) {       out << v[i];       if (i + 1 < (int)v.size()) out <<  ,  ;     }     out <<  ] ;     return out;   }   template <class S, class T>   ostream& operator<<(ostream& out, const map<S, T>& mp) {     out <<  [ n ;     for (const auto& x : mp) {       out <<  {  << x.first <<  ,   << x.second <<  } n ;     }     out <<  ] n ;     return out;   }   template <class T>   ostream& operator<<(ostream& out, const set<T>& cs) {     out <<  { ;     for (auto it = cs.begin(); it != cs.end();) {       out << *it;       it++;       if (it != cs.end())         out <<  ,  ;       else         out <<  } ;     }     return out;   }   void solve();   int main() {     cout << fixed << setprecision(15);     cerr << fixed << setprecision(15);     solve();     return 0;   }   const double eps = 1e-10;   const int mod = (int)1e9 + 7;   const int N = (int)2e5 + 5;   int sm(string S) {     int r = 0;     for (char c : S) r += (c - 48);     return r;   }   int sm(long long x) {     int r = 0;     while (x) {       r += (x % 10);       x /= 10;     }     return r;   }   string sub(string a, string b) {     reverse((a).begin(), (a).end());     reverse((b).begin(), (b).end());     while (((int)(b).size()) < ((int)(a).size())) b +=  0 ;     string res =   ;     int carry = 0;     for (int i = 0; i < (((int)(a).size())); ++i) {       int x = a[i] - 48, y = b[i] - 48;       int add = -1;       if (x >= y + carry) {         add = x - (y + carry);         carry = 0;       } else {         add = (x + 10) - (y + carry);         carry = 1;       }       res += (char)(add + 48);     }     if (carry) {       cout <<  ERROR  <<   n ;       return   ;     }     reverse((res).begin(), (res).end());     return res;   }   void print(string b) {     int i = 0;     while (i < ((int)(b).size()) && b[i] ==  0 ) ++i;     while (i < ((int)(b).size())) putchar(b[i++]);   }   void solve() {     int n = Int(), m = Int();     string ab =   ;     for (int i = 0; i < (m); ++i) ab +=  1 ;     string a =   ;     for (int i = 0; i < (n); ++i) a +=  1 ;     while (((int)(ab).size()) < ((int)(a).size()) + 1) ab +=  0 ;     cout << a <<   n ;     string b = sub(ab, a);     print(b);     putchar(  n );   }
#include <bits/stdc++.h>   using namespace std;   const int N = 333;   long long n, ans[N], a[N][N], pos[N];   long long absv(long long val) {     if (val < 0) val *= -1;     return val;   }   int main() {     std::ios::sync_with_stdio(false);     cin >> n;     for (int i = 0; i <= n; i++) {       for (int j = 0; j < n; j++) cin >> a[i][j];     }     for (int i = 0; i < n; i++) pos[i] = N;     for (int i = 0; i < n; i++) {       long long num = i + 1, num2 = i + 1, jx = 0;       for (int j = 0; j < n; j++) {         if (a[n][j] <= num) {           num = a[n][j];           jx = j;           break;         }       }       for (int j = jx + 1; j < n; j++) {         if (a[n][j] <= num2) {           num2 = a[n][j];           break;         }       }       for (int j = 0; j < n; j++) {         long long tmp = num;         if (j + 1 == num)           if (num != num2)             num = num2;           else             continue;         for (int k = 0; k < n; k++) {           if (a[j][k] == num)             if (k < pos[j]) {               pos[j] = k;               ans[j] = i + 1;             }         }         num = tmp;       }     }     for (int i = 0; i < n; i++) cout << ans[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int a[3] = {0};     int n, t;     cin >> n;     while (n--) {       cin >> t;       a[t]++;     }     int res = min(a[1], a[2]);     a[1] -= a[2];     if (a[1] <= 0) a[1] = 0;     res += a[1] / 3;     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T abs(T x) {     return x > 0 ? x : -x;   }   const int LEN = 300;   const int MAX = (100000 + LEN - 1) / LEN;   int n;   int m;   int was[100000], x[100000], y[100000];   int l[MAX], r[MAX], w[MAX];   vector<pair<pair<int, int>, int> > v;   vector<int> res;   int get(int a, int b) {     int A = a / LEN;     int B = b / LEN;     if (abs(A - B) <= 1) {       for (int i = a; i <= b; i++)         if (!was[i]) return i;     } else {       for (int i = a; i <= r[A]; i++)         if (!was[i]) return i;       for (int i = A + 1; i < B; i++)         if (w[i] > 0) {           for (int j = l[i]; j <= r[i]; j++)             if (!was[j]) return j;         }       for (int i = l[B]; i <= b; i++)         if (!was[i]) return i;     }     return -1;   }   int add(int x) {     was[x] = 1;     int y = x / LEN;     w[y]--;     return 0;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d%d , &x[i], &y[i]);       x[i]--;       y[i]--;       v.push_back(make_pair(make_pair(x[i], y[i]), i));     }     int NUM = (n + LEN - 1) / LEN;     for (int i = 0; i < NUM; i++) {       l[i] = i * LEN;       r[i] = min((i + 1) * LEN, n) - 1;       w[i] = r[i] - l[i] + 1;     }     sort((v).begin(), (v).end());     for (int i = 0; i < m; i++) {       int j = v[i].second;       int a = n - y[j] - 1;       int b = x[j];       int c = get(a, b);       if (c != -1) {         res.push_back(j + 1);         add(c);       }     }     sort((res).begin(), (res).end());     printf( %d n , ((int)(res).size()));     for (int i = 0; i < ((int)(res).size()); i++) printf( %d  , res[i]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename item>   item abs(item i) {     if (i < 0) i = -i;     return i;   }   char *s;   int n;   int pos;   int main() {     cin >> n;     cin >> pos;     s = new char[n + 2];     cin >> s + 1;     int cnt = 0;     if (n == 1) {       cout << 0;       return 0;     }     if (n % 2 == 1 and pos == n / 2 + 1) pos++, cnt++;     if (pos > n / 2) pos = n - pos + 1;     int last = n / 2, fst = 1;     while (fst < n - fst + 1 and s[fst] == s[n - fst + 1]) fst++;     while (last > 0 and s[last] == s[n + 1 - last]) last--;     if (pos >= fst and pos <= last) {       int a = pos - fst, b = last - pos;       cnt += 2 * (min(a, b)) + max(a, b);     } else if (pos >= fst and pos >= last)       cnt += pos - min(fst, last);     else if (pos <= last and pos <= fst)       cnt += max(fst, last) - pos;     for (int i = 1; i <= n / 2; i++) {       int cmp = n - i + 1;       if (s[i] > s[cmp]) swap(s[i], s[cmp]);       int a = abs((int)(s[i] - s[cmp])), b =  z  - s[cmp] + s[i] -  a  + 1;       cnt += min(a, b);     }     cout << cnt;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = (1e9) + 7;   const long double EPS = 0.0000001;   int main(void) {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     string s;     cin >> s;     string t;     cin >> t;     int szs = s.size();     int szt = t.size();     int cur = 0;     int pref[szt + 1];     int suff[szt + 1];     for (int i = 0; i < szs; i++) {       if (s[i] == t[cur]) {         pref[cur] = i;         cur++;       }       if (cur == szt) break;     }     cur--;     for (int i = szs - 1; i >= 0; i--) {       if (s[i] == t[cur]) {         suff[cur] = i;         cur--;       }       if (cur == -1) break;     }     int ans = 0;     ans = max(ans, szs - 1 - suff[szt - 1]);     ans = max(ans, suff[0]);     ans = max(ans, pref[0]);     ans = max(ans, szs - 1 - pref[szt - 1]);     for (int i = 0; i < szt - 1; i++) {       ans = max(ans, suff[i + 1] - pref[i] - 1);     }     cout << ans << endl;     return 0;   }