malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n;   int main() {     cin >> n;     n -= 10;     if (n <= 0)       cout << 0 << endl;     else if (n <= 9)       cout << 4 << endl;     else if (n == 10)       cout << 15 << endl;     else if (n == 11)       cout << 4 << endl;     else       cout << 0 << endl;   }
#include <bits/stdc++.h>   using namespace std;   int p[100005], cnt, h[100005], cnth, l[100005], cntl, cntquery;   int query(int x, int y) {     printf( 0 %d %d n , x, y);     fflush(stdout);     int ret;     scanf( %d , &ret);     cntquery++;     if (cntquery > 300000)       while (1)         ;     return ret;   }   int main() {     int t = 0, q, X;     for (int x = -100000000; x <= 100000000;) {       q = query(x, x);       if (q == 0) {         p[++cnt] = x;         x++;       } else if (q < 100 && x + 100 * 2 <= 100000000 &&                  query(x + 100, x + 100) >= 100) {         X = x;         x += 100 * 2;       } else {         X = x;         x += q;       }     }     for (int i = 1; i <= cnt; i++) {       q = query(p[i], X);       if (q == 0) l[++cntl] = p[i];       q = query(X, p[i]);       if (q == 0) h[++cnth] = p[i];     }     printf( 1 %d %d n , cntl, cnth);     for (int i = 1; i <= cntl; i++) printf( %d  , l[i]);     puts(  );     for (int i = 1; i <= cnth; i++) printf( %d  , h[i]);     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int mod(int val) { return val > 0 ? val : -val; }   int main() {     int g[2], b[2];     cin >> g[0] >> g[1] >> b[0] >> b[1];     bool pass = false;     if (((g[1] + 1) * 2 >= b[0]) && (b[0] - g[1]) > -2) {       pass = true;     }     if ((g[0] + 1) * 2 >= b[1] && (b[1] - g[0]) > -2) {       pass = true;     }     if (pass) {       cout <<  YES  << endl;     } else {       cout <<  NO  << endl;     }   }
#include <bits/stdc++.h>   int main() {     int i, n, k;     scanf( %d %d , &n, &k);     int a[n];     int count = 0, j = 0;     for (i = 0; i < n; i++) {       scanf( %d , &a[i]);     }     for (i = 0; i < n; i++) {       if (a[i] <= k)         count++;       else {         j = 1;         break;       }     }     if (j != 0) {       for (i = n - 1; i >= 0; i--) {         if (a[i] <= k)           count++;         else           break;       }     }     printf( %d n , count);     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(3)   using namespace std;   int n, m, a[1005][1005];   vector<int> row[1005];   vector<int> col[1005];   int ans[1005][1005];   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         scanf( %d , &a[i][j]);         row[i].push_back(a[i][j]);         col[j].push_back(a[i][j]);       }     for (int i = 1; i <= n; i++) {       sort(row[i].begin(), row[i].end());       row[i].erase(unique(row[i].begin(), row[i].end()), row[i].end());     }     for (int i = 1; i <= m; i++) {       sort(col[i].begin(), col[i].end());       col[i].erase(unique(col[i].begin(), col[i].end()), col[i].end());     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         int l1 =             lower_bound(row[i].begin(), row[i].end(), a[i][j]) - row[i].begin();         int l2 =             lower_bound(col[j].begin(), col[j].end(), a[i][j]) - col[j].begin();         int r1 =             row[i].end() - upper_bound(row[i].begin(), row[i].end(), a[i][j]);         int r2 =             col[j].end() - upper_bound(col[j].begin(), col[j].end(), a[i][j]);         printf( %d  , max(l1, l2) + 1 + max(r1, r2));       }       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define INF 200000000000000000LL   typedef long long int ll;   typedef pair<ll,ll> ii;   typedef pair<ii,ll> iii;   typedef vector<ll> vi;   typedef vector<ii> vii;   #define getbit(n,i) (((n)&(1LL<<(i)))!=0)   #define setbit0(n,i) ((n)&(~(1LL<<(i))))   #define setbit1(n,i) ((n)|(1LL<<(i)))   #define lastone(n) ((n)&(-(n)))   #define read freopen( debug//in.txt , r ,stdin)   #define write freopen( debug//out.txt , w ,stdout)   #define DBG(a) cerr<<#a<<  ->->->->  <<a<<  n    #define fi first   #define se second   #define PI (acos(-1))   #define fastread ios::sync_with_stdio(false);cin.tie(NULL)   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   #define mod (1000000007)   #define asz 500005   template<class T,class V> ostream& operator<<(ostream &s,pair<T,V> a)   {       s<<a.fi<<   <<a.se;       return s;   }   const int N = 1e3+5;   int main()   {       fastread;   #ifdef FILE_IO       read;       write;   #endif          int T=1;       cin>>T;       for(int qq=1; qq<=T; qq++)       {           int n;           string s;           cin>>n>>s;           vi l(n+2),r(n+2);           r[n] = 1;           r[n-1] = 1 + (s.back() ==  R );           l[0] = 1;           l[1] = 1 + (s[0] ==  L );           for(int i=2;i<=n;i++){               if(s[i-1] ==  L ){                   if(s[i-2] ==  R )l[i] = 2+l[i-2];                   else l[i] = 2;               }               else l[i] = 1;                  if(s[n-i] ==  R ){                   if(s[n-i+1] ==  L )r[n-i] = 2+r[n-i+2];                   else r[n-i] = 2;               }               else r[n-i] = 1;           }              for(int i=0;i<=n;i++)cout<<l[i]+r[i]-1<<   ;           cout<<endl;       }   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1000000007;   long long qpow(long long x, long long tms) {     long long tmp = 1;     while (tms) {       if (tms & 1) tmp = tmp * x % mod;       tms >>= 1;       x = x * x % mod;     }     return tmp;   }   int n, m, T;   bool chk(int k) {     if (n == 1) return 1;     long long sum = 1, t = (long long)k * m;     double C = 1;     long long s = 1;     for (int i = 1; i <= k; ++i) {       long long x = t / i, y = mod;       if (x == 0) return 0;       C = C * (k - i + 1) / i;       s = s * (k - i + 1) % mod * qpow(i, mod - 2) % mod;       if (C < mod) y = s;       x = min(x, y);       sum += x;       if (sum >= n) return 1;       t -= x * i;     }     return 0;   }   int main() {     scanf( %d , &T);     while (T--) {       scanf( %d%d , &n, &m);       int l = 0, r = n;       while (l < r) {         int mid = (l + r) >> 1;         if (chk(mid))           r = mid;         else           l = mid + 1;       }       printf( %d n , l);     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     scanf( %d , &t);     for (int i = 0; i < t; i++) {       int cont = 0;       int tamano;       scanf( %d , &tamano);       string x;       cin >> x;       for (int j = 0; j < tamano / 2; j++) {         if (x[j] == x[tamano - j - 1]) {           cont++;         } else if ((x[j] + 1 == x[tamano - j - 1] + 1) ||                    (x[j] + 1 == x[tamano - j - 1] - 1) ||                    (x[j] - 1 == x[tamano - j - 1] - 1) ||                    (x[j] - 1 == x[tamano - j - 1] + 1)) {           cont++;         } else {           printf( NO n );           break;         }       }       if (cont == tamano / 2) {         printf( YES n );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[109], d;   void nhap() {     scanf( %d n , &n);     for (int i = 1; i <= n; i++) scanf( %d  , &a[i]);   }   void qs(int l, int r) {     int x = a[(l + r) / 2];     int i = l;     int j = r;     while (i <= j) {       while (a[i] < x) i++;       while (a[j] > x) j--;       if (i <= j) {         int tmp = a[i];         a[i] = a[j];         a[j] = tmp;         i++;         j--;       }     }     if (i < r) qs(i, r);     if (j > l) qs(l, j);   }   void xuli() {     qs(1, n);     for (int i = 2; i <= n; i += 2) {       int s = a[i] - a[i - 1];       if (s != 0) d = d + s;     }     printf( %d , d);   }   int main() {     nhap();     xuli();   }
#include <bits/stdc++.h>   int max(int x, int y) { return (x > y ? x : y); }   int geGcd(int a, int b) {     if (a == 0 || b == 0) return 0;     for (int i = max(a, b); i >= 1; i--)       if (a % i == 0 && b % i == 0) return i;   }   using namespace std;   int main() {     int a, b, n;     cin >> a >> b >> n;     int cnt = 0;     while (n > 0) {       if (geGcd(a, n)) {         n -= geGcd(a, n);         cnt++;       }       if (geGcd(b, n)) {         n -= geGcd(b, n);         cnt++;       }     }     if (cnt % 2 == 0)       cout <<  1 ;     else       cout <<  0 ;   }
#include <bits/stdc++.h>   using namespace std;   long long lv[100001], lf[100001], par[100001], n;   vector<long long> con[100001], cld[100001];   long long get_leaf(long long id) {     if (cld[id].size() == 0) {       lf[1]++;       return 1;     }     long long x = 0, i;     for (i = 0; i <= cld[id].size() - 1; i++) {       x += get_leaf(cld[id][i]);     }     lf[x]++;     return x;   }   int main() {     ios_base::sync_with_stdio(0);     long long int i, j, x, y, m, cnt = 0, k, g, flg, t, l, r, md;     cin >> n;     for (i = 2; i <= n; i++) {       cin >> x;       con[x].push_back(i);       con[i].push_back(x);     }     queue<long long> q;     q.push(1);     while (!q.empty()) {       x = q.front();       q.pop();       if (con[x].size() == 0) continue;       for (i = 0; i <= con[x].size() - 1; i++) {         y = con[x][i];         if (par[y] || y == 1) continue;         par[y] = x;         cld[x].push_back(y);         q.push(y);       }     }     x = get_leaf(1);     for (i = 2; i <= n; i++) {       lf[i] += lf[i - 1];     }     for (i = 1; i <= n; i++) {       l = 0;       r = n;       while (r - l > 1) {         md = (l + r) / 2;         if (lf[md] < i)           l = md;         else           r = md;       }       cout << r <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s;     cin >> s;     int c = 0, f = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  x )         c++;       else if (s[i] !=  x  && c < 3)         c = 0;       if (c > 2) {         while (1) {           f++;           c--;           if (c < 3) break;         }       }     }     cout << f;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int k, d;     cin >> k >> d;     if (d == 9) {       cout << 9;       for (int i = 1; i < k; i++) cout << 0;     } else if (d == 0 && k > 1) {       cout <<  No solution ;     } else {       cout << d;       for (int i = 1; i < k; i++) cout << 9;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (!b) return a;     return gcd(b, a % b);   }   long long lcm(long long a, long long b) { return b / gcd(a, b) * a; }   int n, g[5001];   int s;   int l[5000][5001];   int best = 1 << 30, freq;   int SWAP(int a, int b) {     int B = g[b];     int A = g[a];     int res = s;     res -= (b - a - 2) - (l[B][b] - l[B][a]);     res += (l[B][b] - l[B][a]);     res -= (l[A][b] - l[A][a]);     res += (b - a - 2) - (l[A][b] - l[A][a]);     return res;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , g + i);       for (int j = i - 1; j; --j) s += g[i] < g[j];     }     for (int(i) = 0; i < int(n); ++i) {       l[i][1] = 0;       for (int j = 2; j <= n; ++j) l[i][j] = l[i][j - 1] + (i > g[j - 1]);     }     for (int i = 1; i <= n; ++i) {       for (int j = i + 1; j <= n; ++j) {         int cost = SWAP(i, j);         if (g[i] < g[j])           ++cost;         else           --cost;         if (cost == best)           ++freq;         else if (cost < best) {           best = cost;           freq = 1;         }       }     }     cout << best <<     << freq << endl;   }
#include <bits/stdc++.h>   using namespace std;   int ucln(int a, int b) {     int r;     while (b > 0) {       r = a % b;       a = b;       b = r;     }     return a;   }   int main() {     int x, y, a, b, bc;     cin >> x >> y >> a >> b;     bc = x * y / ucln(x, y);     int l = a, r = b;     while (l % bc != 0) l++;     while (r % bc != 0) r--;     cout << (r - l) / bc + 1;   }
#include <bits/stdc++.h>   using namespace std;   struct point {     long long x, y, index;     point(long long x, long long y, long long index) : x(x), y(y), index(index) {}     long long operator*(const point p) { return x * p.x + y * p.y; }     long long operator^(const point p) { return x * p.y - y * p.x; }     bool operator<(const point p) const {       return make_pair(x, y) < make_pair(p.x, p.y);     }     bool operator==(const point p) const { return x == p.x && y == p.y; }     bool operator!=(const point p) const { return !(*this == p); }     point operator*(long long scale) {       return point(scale * x, scale * y, index);     }     point operator+(const point p) { return point(x + p.x, y + p.y, index); }     point operator-(const point p) { return point(x - p.x, y - p.y, index); }     long long norm() { return (*this) * (*this); }   };   bool half(point p) {     assert(p.x != 0 || p.y != 0);     return p.x > 0 || (p.x == 0 && p.y > 0);   }   void polarSort(point o, vector<point> &v, int L, int R) {     sort(v.begin() + L, v.begin() + R, [&](point v, point w) {       return make_tuple(half(v - o), 0, (v - o).norm()) <              make_tuple(half(w - o), ((v - o) ^ (w - o)), (w - o).norm());     });   }   const int N = 1515;   int n;   int Ans[N];   int Sub[N];   vector<point> pts;   vector<int> Tree[N];   int DFS(int u, int p) {     Sub[u] = 1;     for (auto v : Tree[u])       if (v != p) Sub[u] += DFS(v, u);     return Sub[u];   }   void PaintTree(int u, int p, int L, int R) {     int idx = L;     for (int i = L; i <= R; i++)       if (pts[idx].y < pts[i].y) idx = i;     swap(pts[L], pts[idx]);     Ans[pts[L].index] = u;     polarSort(pts[L], pts, L + 1, R + 1);     int pre = 0;     for (auto v : Tree[u])       if (v != p) {         PaintTree(v, u, L + pre + 1, L + pre + Sub[v]);         pre += Sub[v];       }   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) {       int u, v;       scanf( %d%d , &u, &v);       Tree[u].push_back(v);       Tree[v].push_back(u);     }     for (int i = 0; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       pts.push_back(point(x, y, i + 1));     }     DFS(1, 0);     PaintTree(1, 0, 0, n - 1);     for (int i = 1; i <= n; i++) printf( %d  , Ans[i]);     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using u64 = unsigned long long;   const int mod = 1e9 + 7, N = 2e3 + 10;   char mp[N][N];   int f[N][N];   bool st[N][N];   unordered_map<char, pair<int, int>> mv = {       { L , {0, -1}}, { R , {0, 1}}, { U , {-1, 0}}, { D , {1, 0}}};   int main(void) {     int t;     cin >> t;     while (t--) {       int n, m, tx, ty;       cin >> n >> m;       for (int i = 1; i <= n; i++) scanf( %s , &mp[i][1]);       stack<pair<int, int>> q;       for (int i = 0; i <= n + 1; i++)         for (int j = 0; j <= m + 1; j++) f[i][j] = 1;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= m; j++) {           int x = i, y = j;           bool ring = false;           if (f[x][y] != 1) continue;           do {             q.push({x, y});             st[x][y] = true;             tx = x + mv[mp[x][y]].first, ty = y + mv[mp[x][y]].second;             x = tx, y = ty;             if (x < 1 || x > n || y < 1 || y > m) break;             if (st[x][y]) {               ring = true;               break;             }             if (f[x][y] != 1) {               q.push({x, y});               break;             }           } while (true);           pair<int, int> xy;           int step;           if (ring) {             stack<pair<int, int>> rq;             do {               xy = q.top();               q.pop();               st[xy.first][xy.second] = false;               rq.push(xy);               if (xy.first == x && xy.second == y) break;             } while (true);             step = rq.size();             while (rq.size()) {               xy = rq.top();               rq.pop();               f[xy.first][xy.second] = step;             }             step++;             while (q.size()) {               xy = q.top();               q.pop();               st[xy.first][xy.second] = false;               f[xy.first][xy.second] = step++;             }             continue;           }           step = f[q.top().first][q.top().second];           while (q.size()) {             xy = q.top();             q.pop();             st[xy.first][xy.second] = false;             f[xy.first][xy.second] = step++;           }         }       }       int res = -1, x, y;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= m; j++) {           if (res < f[i][j]) {             x = i, y = j;             res = f[i][j];           }         }       }       cout << x <<     << y <<     << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:36777216 )   using namespace std;   const int INF = ~(1 << 31);   const double EPS = 1;   const double PI = 3.141592653589793;   int main() {     int n, m;     cin >> n >> m;     if (m == 3 && n >= 5) {       cout <<  -1 n ;       return 0;     }     for (int i = 0; i < m; i++) cout << i <<     << i * i + 10000000 <<   n ;     for (int i = 0; i < n - m; i++) cout << i <<     << -i * i - 10000000 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int m, x, p[100005], h[100005], cnt;   long long n;   int ksm(int a, long long k) {     if (!k) return 1;     int p = ksm(a, k / 2);     if (k & 1) return (long long)p * p % 1000000007 * a % 1000000007;     return (long long)p * p % 1000000007;   }   int Getval(long long n, int x) {     int ret = 1;     while (n) {       n /= x;       ret = (long long)ret * ksm(x, n) % 1000000007;     }     return ret;   }   int main() {     scanf( %d%I64d , &x, &n);     int m = int(sqrt(x)) + 1, ans = 1;     for (int i = 2; i <= m; i++) {       if (x % i == 0) {         while (x % i == 0) x /= i;         ans = (long long)ans * Getval(n, i) % 1000000007;       }     }     if (x > 1) ans = (long long)ans * Getval(n, x) % 1000000007;     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int it = 0;   int find(int l, int r, int k) {     if (l == r) return l;     int ras = (r - l + 1) / 2;     int ll, rr;     if (k == 0) {       ll = l + ras - 1;       rr = l + ras;     } else {       ll = r - ras;       rr = ll + 1;     }     if (k == 0) {       assert(it != 60);       cout << 1 <<     << ll <<     << rr << endl;       ++it;     } else {       assert(it != 60);       cout << 1 <<     << rr <<     << ll << endl;       ++it;     }     string s;     cin >> s;     if (s[0] ==  T ) {       if (k == 0) {         return find(l, rr - 1, k);       } else {         return find(ll + 1, r, k);       }     } else {       if (k == 0) {         return find(ll + 1, r, k);       } else {         return find(l, rr - 1, k);       }     }   }   signed main() {     int n, k;     cin >> n >> k;     int cur = find(1, n, 0);     set<int> sss;     sss.insert(cur);     sss.insert(find(1, cur, 0));     sss.insert(find(cur, n, 1));     cout << 2 <<     << *sss.begin() <<     << *(++sss.begin()) << endl;     return 0;   }
#include <bits/stdc++.h>   unsigned long long int p[64][2][2], m, pi[64];   void mul_matrix(int size, unsigned long long int (*a)[2],                   unsigned long long int (*b)[2],                   unsigned long long int (*dest)[2]) {     int i, j, k;     for (i = 0; i < size; i++)       for (j = 0; j < 2; j++) {         dest[i][j] = 0;         for (k = 0; k < 2; k++)           dest[i][j] = (dest[i][j] + (a[i][k] * b[k][j]) % m) % m;       }   }   void init_mat() {     int i;     p[0][0][0] = p[0][0][1] = p[0][1][0] = 1;     p[0][1][1] = 0;     pi[0] = 2;     for (i = 1; i < 64; i++) {       mul_matrix(2, p[i - 1], p[i - 1], p[i]);       pi[i] = (pi[i - 1] * pi[i - 1]) % m;     }   }   int main() {     unsigned long long int n, k, t, zero = 0, one = 1, ans = 1, l, i;     unsigned long long int base1[1][2] = {0, 1}, base2[1][2] = {1, 0}, dest[1][2];     scanf( %lld %lld %lld %lld , &n, &k, &l, &m);     init_mat();     for (i = 0, t = n - 1; t; t >>= 1, i++) {       if (t & 1) {         mul_matrix(1, base1, p[i], dest);         memcpy(base1, dest, sizeof(dest));         mul_matrix(1, base2, p[i], dest);         memcpy(base2, dest, sizeof(dest));       }     }     for (i = 0, t = n; t; t >>= 1, i++)       if (t & 1) one = (one * pi[i]) % m;     zero =         ((base1[0][0] + base1[0][1]) % m + (base2[0][0] + base2[0][1]) % m) % m;     one = ((one + m) - zero) % m;     for (t = k, i = 0; i < l; t >>= 1, i++) {       if (t & 1)         ans = (ans * one) % m;       else         ans = (ans * zero) % m;     }     if (t) {       printf( 0 );       return 0;     }     printf( %u , ans % m);     return 0;   }
#include <bits/stdc++.h>   int inp() {     char c = getchar();     while (c <  0  || c >  9 ) c = getchar();     int sum = 0;     while (c >=  0  && c <=  9 ) {       sum = sum * 10 + c -  0 ;       c = getchar();     }     return sum;   }   char s[1000010], l[1000010], r[1000010];   long long f[1000010], sum[1000010];   int n, sl, sr, pl[1000010], pr[1000010], hshs[1000010], hshl[1000010],       hshr[1000010], fpow[1000010];   bool ok1(int x) {     if (x + sl - 1 > n) return false;     if (sl == pl[x]) return true;     return l[pl[x] + 1] < s[x + pl[x]];   }   bool ok2(int x) {     if (x + sr - 1 > n) return false;     if (pr[x] == sr) return true;     return r[pr[x] + 1] > s[x + pr[x]];   }   int get_hsh(int *hsh, int l, int r) {     return (hsh[r] -             ((long long)(hsh[l - 1]) * (long long)(fpow[r - l + 1]) % 998244353) +             998244353) %            998244353;   }   void solve(int *s, int *hsh, int len) {     for (int i = 1; i <= n - len + 1; i++) {       int l = 0;       int r = len;       while (l < r) {         int mid = (l + r + 1) >> 1;         if (get_hsh(hshs, i, i + mid - 1) == get_hsh(hsh, 1, mid))           l = mid;         else           r = mid - 1;       }       s[i] = l;     }   }   void gethash(char *str, int *hsh, int len) {     for (int i = 1; i <= len; i++)       hsh[i] = ((long long)(hsh[i - 1]) * (long long)(11) + str[i] -  0  + 1) %                998244353;   }   int main() {     fpow[0] = 1;     for (int i = 1; i <= 1000000; i++)       fpow[i] = ((long long)(fpow[i - 1]) * (long long)(11) % 998244353);     scanf( %s , s + 1);     scanf( %s , l + 1);     scanf( %s , r + 1);     n = strlen(s + 1);     sl = strlen(l + 1);     sr = strlen(r + 1);     gethash(l, hshl, sl);     gethash(r, hshr, sr);     gethash(s, hshs, n);     f[0] = 1;     solve(pl, hshl, sl);     solve(pr, hshr, sr);     for (int i = 0; i <= n; i++) {       if (i) {         sum[i] += sum[i - 1];         f[i] += sum[i];         f[i] %= 998244353;       }       if (s[i + 1] ==  0 ) {         if (sl == 1 && l[1] ==  0 ) {           f[i + 1] += f[i];           f[i + 1] %= 998244353;         }         continue;       }       if (sl < sr) {         sum[sl + i + 1] += f[i];         sum[sl + i + 1] %= 998244353;         sum[sr + i] += 998244353 - f[i];         sum[sr + i] %= 998244353;       }       if (sl == sr) {         if (ok1(i + 1) && ok2(i + 1)) {           f[i + sl] += f[i];           f[i + sl] %= 998244353;         }       } else {         if (ok1(i + 1)) {           f[i + sl] += f[i];           f[i + sl] %= 998244353;         }         if (ok2(i + 1)) {           f[i + sr] += f[i];           f[i + sr] %= 998244353;         }       }     }     std::cout << f[n] << std::endl;   }