malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int inf = -1e9;   const int maxn = 400;   int dp[maxn][maxn][maxn];   int a[maxn][maxn];   int main() {     int n;     cin >> n;     for (int i = 0; i <= n + 1; i++)       for (int j = 0; j <= n + 1; j++) a[i][j] = inf;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) cin >> a[i][j];     for (int i = 0; i <= n + 1; i++)       for (int j = 0; j <= n + 1; j++)         for (int k = 0; k <= n + 1; k++) dp[i][j][k] = inf;     dp[1][1][1] = a[1][1];     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         for (int k = 1; k <= n; k++) {           int l = i + j - k;           if (dp[i][j][k] > inf) continue;           if (l <= 0 or l >= n + 1) {             dp[i][j][k] = inf;             continue;           }           int t1 = dp[i - 1][j][k - 1] + a[i][j] + a[k][l];           int t2 = dp[i - 1][j][k] + a[i][j] + a[k][l];           int t3 = dp[i][j - 1][k - 1] + a[i][j] + a[k][l];           int t4 = dp[i][j - 1][k] + a[i][j] + a[k][l];           dp[i][j][k] = max(max(t1, t2), max(t3, t4));           if (i == k and j == l) dp[i][j][k] -= a[i][j];           if (dp[i][j][k] < -1e7) dp[i][j][k] = 0;         }       }     }     cout << dp[n][n][n];     return 0;   }
#include<bits/stdc++.h>   using namespace std;   # define ll long long   # define read read1<ll>()   # define Type template<typename T>   Type T read1(){    T t=0;    char k;    bool vis=0;    do (k=getchar())== - &&(vis=1);while( 0 >k||k> 9 );    while( 0 <=k&&k<= 9 )t=(t<<3)+(t<<1)+(k^ 0 ),k=getchar();    return vis?-t:t;   }   # define fre(k) freopen(k .in , r ,stdin);freopen(k .out , w ,stdout)   struct A{    int l,r,v;    A(int _l=1,int _r=0,int _v=0){l=_l;r=_r;v=_v;}    A operator &(const A &b){return A(max(l,b.l),min(r,b.r),v&b.v);}   }sl[100005][20],sr[100005][20];   int s,k[100005],la[100005][2];   pair<int,int>a[100005],b[100005];   void pr(int n,bool p){    if(n==1)return;    pr(la[n][p],p^1);    for(int i=la[n][p];i<n;++i)     putchar(p^ 1 ),putchar(   );   }   int main(){    s=read;read;    for(int i=1;i<=s;++i){     k[i]=read;     a[i].first=read;     a[i].second=read;     b[i].first=read;     b[i].second=read;     sr[i][0]=A(a[i].first,a[i].second,b[i].first<=k[i]&&k[i]<=b[i].second);     sl[i][0]=A(b[i].first,b[i].second,a[i].first<=k[i]&&k[i]<=a[i].second);    }for(int i=s;i;--i)     for(int j=0;i+(1<<j+1)-1<=s;++j){      sl[i][j+1]=sl[i][j]&sl[i+(1<<j)][j];      sr[i][j+1]=sr[i][j]&sr[i+(1<<j)][j];     }    int xl=1,xr=1;    for(int i=1;i<=s;++i){     int tv=xr;     if(xl>=i&&a[i].first<=k[i]&&k[i]<=a[i].second&&b[i].first<=k[i-1]&&k[i-1]<=b[i].second){      int j=i;      for(int x=17;x--;)       if(sl[j][x].v&&sl[j][x].l<=k[i-1]&&k[i-1]<=sl[j][x].r)        j+=1<<x;      while(xr<j)la[++xr][1]=i;     }     if(tv>=i&&b[i].first<=k[i]&&k[i]<=b[i].second&&a[i].first<=k[i-1]&&k[i-1]<=a[i].second){      int j=i;      for(int x=17;x--;)       if(sr[j][x].v&&sr[j][x].l<=k[i-1]&&k[i-1]<=sr[j][x].r)        j+=1<<x;      while(xl<j)la[++xl][0]=i;     }    }    if(xl<=s&&xr<=s)return puts( No ),0;    puts( Yes );    if(xl>s)pr(s+1,0);    else pr(s+1,1);    return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, x1, y1, x2, y2;     cin >> n >> m >> x1 >> y1 >> x2 >> y2;     int dx = abs(x1 - x2) - 1;     int dy = abs(y1 - y2) - 1;     if (dx > 3 || dy > 3) {       cout <<  Second  << endl;     } else if (dx <= 2 && dy <= 2) {       cout <<  First  << endl;     } else if (dx <= 1 || dy <= 1) {       cout <<  First  << endl;     } else if (dx < 3 || dy < 3) {       cout <<  Second  << endl;     } else {       cout <<  Second  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<string, int> mp;   int t, x;   string s;   char ch;   string transform(string x) {     string s =   ;     for (char ch : x)       if ((ch -  0 ) % 2)         s +=  1 ;       else         s +=  0 ;     while (s.size() < 20) s =  0  + s;     return s;   }   int main() {     ios::sync_with_stdio(false);     cin >> t;     for (int i = 0; i < t; i++) {       cin >> ch >> s;       s = transform(s);       if (ch ==  ? ) {         cout << mp[s] << endl;       } else {         if (ch ==  + ) mp[s]++;         if (ch ==  - ) mp[s]--;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = 1e9 + 7;   long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) x = x * 10 + ch -  0 , ch = getchar();     return f * x;   }   long long n, m, _x, _y, f[300005][2], a[300005], b[300005];   int main() {     n = read();     m = read();     for (int i = 1; i <= n; i++) a[i] = read();     for (int i = 1; i <= n; i++) b[i] = read();     for (int i = 1; i <= n; i++) {       _x = a[i];       _y = b[i];       for (int j = 0; j <= 1; j++) {         long long x = _x, y = _y, t = 1, cnt, s;         cnt = min(x, y);         x -= cnt;         y -= cnt;         x -= m - f[i - 1][j];         x -= (cnt - 1) * (m - 1);         if (x > 0) {           if (x > m - 1)             s = inf;           else             s = 1 + x;         } else           s = 1;         y -= cnt * (m - 1);         if (y > 0) s = inf;         f[i][j] = s;         x = _x;         y = _y;         x--;         cnt = min(x, y);         x -= cnt;         y -= cnt;         y -= m - f[i - 1][j ^ 1];         x -= cnt * (m - 1);         if (x > 0) {           if (x > m - 1)             s = inf;           else             s = x + 1;         } else           s = 1;         y -= cnt * (m - 1);         if (y > 0) s = inf;         f[i][j] = min(f[i][j], s);         swap(_x, _y);       }     }     if (f[n][0] < inf || f[n][1] < inf)       puts( YES );     else       puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   char s[200002];   int cnt[200001][26];   void init() {     for (int i = 1; s[i]; ++i) {       for (int j = 0; j < 26; ++j) cnt[i][j] = cnt[i - 1][j];       cnt[i][s[i] -  a ]++;     }   }   int main() {     scanf( %s , s + 1);     init();     int q, l, r;     scanf( %d , &q);     while (q--) {       scanf( %d%d , &l, &r);       int diff = 0;       for (int i = 0; i < 26; ++i) diff += (cnt[l - 1][i] != cnt[r][i]);       if (l == r || s[l] != s[r] || diff > 2)         puts( Yes );       else         puts( No );     }   }
#include <bits/stdc++.h>   using namespace std;   queue<int> s1, s2;   int main() {     int n, k1, k2;     cin >> n;     cin >> k1;     int a, b;     for (int i = 0; i < k1; i++) {       cin >> a;       s1.push(a);     }     cin >> k2;     for (int i = 0; i < k2; i++) {       cin >> b;       s2.push(b);     }     int ans = 0;     while (!s1.empty() && !s2.empty() && ans < 2e5 + 10) {       int t1 = s1.front();       int t2 = s2.front();       s1.pop();       s2.pop();       if (t1 > t2) {         s1.push(t2);         s1.push(t1);       }       if (t1 < t2) {         s2.push(t1);         s2.push(t2);       }       ans++;     }     if (s1.empty()) {       cout << ans <<                <<  2  << endl;     }     if (s2.empty()) {       cout << ans <<                <<  1  << endl;     }     if (ans == 2e5 + 10) cout <<  -1  << endl;     return 0;   }
#include <bits/stdc++.h>   const int maxn = 100005;   int n, m, a[maxn], pos[maxn];   std::pair<int, int> b[maxn];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       b[i] = std::make_pair(a[i], i);     }     std::sort(b + 1, b + n + 1);     for (int i = 1; i <= n; ++i) pos[b[i].second] = i;     int ans = 0, r = 0;     for (int i = 1; i <= n; ++i) {       if (i > r) ans++;       r = std::max(r, pos[i]);     }     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 7;   const int N = 3e5 + 7;   long long arr[N];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     long long n, m, k;     cin >> n >> m >> k;     long long mn = INT_MAX;     for (int i = 0; i < n; i++) {       cin >> arr[i];       if (i % 2 == 0) mn = min(mn, arr[i]);     }     if (n % 2 == 0) {       cout << 0 <<   n ;     } else {       cout << min(mn, (m / (n / 2 + 1)) * k) <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x, y;     cin >> n >> x >> y;     if ((n / 2 == x || n / 2 + 1 == x) && (n / 2 == y || n / 2 + 1 == y)) {       cout <<  NO n ;       return 0;     }     cout <<  YES n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct ooxx {     int k, x, y;   } a[100];   int alla, allb, dp[250000][121], n;   int main() {     memset(dp, -1, sizeof(dp));     scanf( %d , &n);     int s = 1 << n;     for (int i = 0; i < s; ++i) dp[i][0] = 0;     for (int i = 0; i < n; ++i) {       char x = getchar();       while ((x !=  R ) && (x !=  B )) x = getchar();       scanf( %d%d , &a[i].x, &a[i].y), alla += a[i].x, allb += a[i].y;       if (x ==  R )         a[i].k = 1;       else         a[i].k = 0;     }     for (int i = 0; i < s; ++i) {       int nowa = 0, nowb = 0;       for (int j = 0; j < n; ++j) {         if (i & (1 << j)) {           if (a[j].k == 1)             nowa++;           else             nowb++;         }       }       for (int j = 0; j <= 120; ++j) {         for (int k = 0; k < n; ++k) {           if (i & (1 << k)) continue;           if (dp[i][j] == -1) continue;           dp[i | (1 << k)][j + min(nowa, a[k].x)] =               max(dp[i | (1 << k)][j + min(nowa, a[k].x)],                   dp[i][j] + min(nowb, a[k].y));         }       }     }     int ans = 1000000000;     for (int i = 0; i <= 120; ++i)       if (dp[s - 1][i] != -1) ans = min(ans, max(allb - dp[s - 1][i], alla - i));     return printf( %d , ans + n), 0;   }
#include <bits/stdc++.h>   using namespace std;   struct ned {     int x, y;     bool operator<(const ned &a) const { return x == a.x ? (y < a.y) : x < a.x; }   };   ned ned[4000010];   int n, m, cnt;   int a[2010], b[2010], c[2010], d[2010];   int sma[4000010];   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) scanf( %d%d , &a[i], &b[i]);     for (int i = 1; i <= m; ++i) scanf( %d%d , &c[i], &d[i]);     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         if (a[i] <= c[j] && b[i] <= d[j]) {           ned[++cnt] = {c[j] - a[i] + 1, d[j] - b[i] + 1};         }       }     }     sort(ned + 1, ned + cnt + 1);     for (int i = cnt; i >= 1; --i) sma[i] = max(sma[i + 1], ned[i].y);     int ans = 0x3f3f3f3f;     for (int i = 0; i <= cnt; ++i) ans = min(ans, ned[i].x + sma[i + 1]);     ans = ans * (cnt > 0);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[3];   int main() {     scanf( %I64d%I64d%I64d , &a[0], &a[1], &a[2]);     long long ans = a[0] + a[1] + a[2];     for (int i = 0; i <= 2; i++) {       long long A = a[i], B = a[(i + 1) % 3];       if (((A - B) < 0 ? -(A - B) : (A - B)) & 1) continue;       ans =           ((ans) < (((A) > (B) ? (A) : (B))) ? (ans) : (((A) > (B) ? (A) : (B))));     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 1000011;   bool hsh[MAX];   int fact[MAX];   void sieve(int n) {     int i, a;     for (i = 2; i <= n; i++) hsh[i] = true;     for (i = 2; i <= n; i++)       if (hsh[i]) {         a = 2;         fact[i] = i;         while (a * i <= n) hsh[a * i] = false, fact[a * i] = i, a++;       }   }   int factorize(int n) {     set<int> st;     int cnt = 0;     while (n > 1) {       cnt++;       st.insert(fact[n]);       n /= fact[n];     }     if (cnt == 1) return -1;     return *(--st.end());   }   int main() {     cin.sync_with_stdio(false);     int n, m;     sieve(1e6);     cin >> n;     m = factorize(n);     if (m == -1) {       cout << n;       return 0;     }     int pre = n;     int temp = n - m + 1;     int ans = INT_MAX;     while (n >= temp) {       m = factorize(n);       if (m == -1) {         n--;         continue;       }       ans = min(ans, n - m + 1);       n--;     }     if (ans == INT_MAX) ans = pre;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i1[5], i2[5], i3[5], i4[5], i5[5];     int o = 0, j = 0, o1, j1;     for (int i = 1; i < 6; i++) {       cin >> i1[i] >> i2[i] >> i3[i] >> i4[i] >> i5[i];       if (i1[i] == 1) {         o = i;         j = 1;       }       if (i2[i] == 1) {         o = i;         j = 2;       }       if (i3[i] == 1) {         o = i;         j = 3;       }       if (i4[i] == 1) {         o = i;         j = 4;       }       if (i5[i] == 1) {         o = i;         j = 5;       }     }     o1 = abs(3 - o);     j1 = abs(3 - j);     cout << o1 + j1;     return 0;   }
#include <bits/stdc++.h>   const int N = 1000001;   int gcd(int a, int b) {     int c;     while (a) {       c = a;       a = b % a;       b = c;     }     return b;   }   void cal(int a, int b, int &s1, int &s2) {     int c;     while (a > 1) {       s1 += b / a;       s2 += b / a - 1;       c = a;       a = b % a;       b = c;     }     s1 += b;     s2 += b - 2;   }   int s[N];   void output(int a, int b) {     int sign = 0, m = 0, c;     while (a > 1) {       for (int i = b / a; i >= 1; --i) s[m++] = sign;       c = a;       a = b % a;       b = c;       sign ^= 1;     }     if (sign)       for (int i = m - 1; i >= 0; --i) s[i] ^= 1;     for (int i = b - 1; i >= 1; --i) s[m++] = 0;     s[m++] = 1;     for (int i = m - 1; i >= 0; --i)       if (s[i])         printf( T );       else         printf( B );     printf(  n );   }   int main() {     int n, r, mis, d;     int s1, s2;     while (scanf( %d%d , &n, &r) != EOF) {       mis = n + 1;       d = -1;       for (int i = 1; i <= r; ++i) {         if (gcd(i, r) != 1) continue;         s1 = s2 = 0;         cal(i, r, s1, s2);         if (s2 < 0) s2 = 0;         if (s1 == n && s2 < mis) mis = s2, d = i;       }       if (mis > n)         printf( IMPOSSIBLE n );       else {         printf( %d n , mis);         output(d, r);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m;   bool judge(long long k) {     if (n == 1) return 1;     long long num = (long long)m * k, res = 1, C = 1;     for (int i = 1; i <= k; i++) {       if (num < i) return 0;       if ((long long)(k - i + 1) * C >= (long long)n * i)         C = n;       else         C = C * (k - i + 1) / i;       long long temp = min(num / i, C);       res += temp;       if (res >= n) return 1;       num -= temp * i;     }     return 0;   }   int main() {     long long T;     cin >> T;     while (T--) {       cin >> n >> m;       long long l = 0, r = n, mid, ans;       while (l <= r) {         mid = (l + r) / 2;         if (judge(mid)) {           ans = mid;           r = mid - 1;         } else           l = mid + 1;       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int k, n, maxb, t;   int b[100010], flag[100010];   int main() {     ios::sync_with_stdio(false);     cin >> k >> n >> maxb >> t;     t = min(t, min(n, maxb));     for (int ti = 1; ti <= k; ti++) {       for (int i = 1; i <= n; i++) cin >> b[i];       for (int i = 0; i <= maxb; i++) flag[i] = 0;       for (int i = 1; i <= t; i++)         for (int j = 1; j <= n; j++)           for (int k = b[j]; k <= maxb && flag[k] == flag[b[j] - 1]; k++)             flag[k]++;       cout << flag[maxb] << endl;     }     return 0;   }
#include <bits/stdc++.h>   const long long MOD1 = 998244353, MOD2 = 1000000007;   long long POWER_MOD1[300001], POWER_MOD2[300001];   struct node {     long long hash1_MOD1, hash1_MOD2, hash2_MOD1, hash2_MOD2;     int len;   } T[1048576], single[2] = {(node){0, 0, 0, 0, 1}, (node){1, 1, 1, 1, 1}};   inline node operator+(const node &a, const node &b) {     return (node){(a.hash1_MOD1 + POWER_MOD1[a.len] * b.hash1_MOD1) % MOD1,                   (a.hash1_MOD2 + POWER_MOD2[a.len] * b.hash1_MOD2) % MOD2,                   (b.hash2_MOD1 + POWER_MOD1[b.len] * a.hash2_MOD1) % MOD1,                   (b.hash2_MOD2 + POWER_MOD2[b.len] * a.hash2_MOD2) % MOD2,                   a.len + b.len};   }   int N, a[300001];   node G(int p, int l, int r, int L, int R) {     if (L <= l && r <= R) return T[p];     int m = l + r >> 1;     if (R <= m) return G(p << 1, l, m, L, R);     if (L > m) return G(p << 1 | 1, m + 1, r, L, R);     return G(p << 1, l, m, L, R) + G(p << 1 | 1, m + 1, r, L, R);   }   void P(int x, int w) {     int p = 1, l = 1, r = N;     while (l < r) {       int m = l + r >> 1;       if (x <= m)         p <<= 1, r = m;       else         p = p << 1 | 1, l = m + 1;     }     T[p] = single[w];     while (p >>= 1) T[p] = T[p << 1] + T[p << 1 | 1];   }   void build(int p, int l, int r) {     if (l == r) {       T[p] = single[0];       return;     }     int m = l + r >> 1;     build(p << 1, l, m);     build(p << 1 | 1, m + 1, r);     T[p] = T[p << 1] + T[p << 1 | 1];   }   int main() {     scanf( %d , &N);     POWER_MOD1[0] = POWER_MOD2[0] = 1;     for (int i = 1; i <= N; i++) {       scanf( %d , a + i);       POWER_MOD1[i] = POWER_MOD1[i - 1] * 2 % MOD1;       POWER_MOD2[i] = POWER_MOD2[i - 1] * 2 % MOD2;     }     build(1, 1, N);     for (int i = 1; i <= N; i++) {       int len = std::min(a[i] - 1, N - a[i]);       node H = G(1, 1, N, a[i] - len, a[i] + len);       if (H.hash1_MOD1 != H.hash2_MOD1 || H.hash1_MOD2 != H.hash2_MOD2) {         puts( YES );         return 0;       }       P(a[i], 1);     }     puts( NO );     return 0;   }
#include <bits/stdc++.h>   int main(void) {     long n;     long sum = 0;     int i;     int call = 0;     scanf( %li , &n);     while (n != 1) {       call = 0;       for (i = 2; i <= (long)sqrt((double)n); i++)         if (!(n % i)) {           call = 1;           break;         }       if (call) {         sum += n;         n /= i;       } else {         sum += n;         n = 1;       }     }     printf( %li , sum + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 2e5 + 5;   int n, first[MAX], nextt[MAX * 2], u[MAX * 2], v[MAX * 2], cnt, white, black;   int ans[MAX], father[MAX], tem[MAX];   bool col[MAX];   void add(int a, int b) {     u[cnt] = a, v[cnt] = b;     nextt[cnt] = first[u[cnt]];     first[u[cnt]] = cnt;     ++cnt;   }   void dfs1(int dot, int fa) {     father[dot] = fa;     col[dot] ? ++tem[dot] : --tem[dot];     for (int num = first[dot]; num != -1; num = nextt[num]) {       if (v[num] == fa) continue;       dfs1(v[num], dot);       if (tem[v[num]] > 0) tem[dot] += tem[v[num]];     }   }   void dfs2(int dot, int fa) {     for (int num = first[dot]; num != -1; num = nextt[num]) {       if (v[num] == fa) continue;       int nn = ans[dot];       if (tem[v[num]] > 0) nn -= tem[v[num]];       if (nn > 0) ans[v[num]] += nn;       dfs2(v[num], dot);     }   }   void solve() {     memset(first, -1, sizeof(first));     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &col[i]), col[i] ? ++white : black;     for (int i = 1; i < n; ++i) {       int a, b;       scanf( %d%d , &a, &b);       add(a, b), add(b, a);     }     dfs1(1, 0);     for (int i = 1; i <= n; ++i) ans[i] = tem[i];     dfs2(1, 0);     for (int i = 1; i <= n; ++i) printf( %d  , ans[i]);   }   int main(void) {     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 300005;   long long sum[3][maxn];   int pre[3][maxn];   map<pair<int, int>, int> vis, dp;   int ans[maxn];   map<long long, int> pos;   int dfs(int x, int y) {     if (vis[make_pair((x), (y))])       return dp[make_pair((x), (y))];     else {       vis[make_pair((x), (y))] = 1;       dp[make_pair((x), (y))] =           max(ans[min(x, y)], pre[0][x] > pre[1][y] ? dfs(pre[0][x], y) + 1                                                     : dfs(x, pre[1][y]) + 1);       return dp[make_pair((x), (y))];     }   }   int main() {     int n, a;     cin >> n;     n++;     for (int i = 2; i <= n; i++) {       cin >> a;       sum[0][i] = sum[0][i - 1] + a;     }     for (int i = 2; i <= n; i++) {       cin >> a;       sum[1][i] = sum[1][i - 1] + a;       sum[2][i] = sum[0][i] + sum[1][i];     }     for (int k = 0; k < 3; k++) {       pos.clear();       for (int i = 1; i <= n; i++) {         pre[k][i] = max(pre[k][i - 1], pos[sum[k][i]]);         pos[sum[k][i]] = i;       }     }     ans[0] = pre[0][0] = pre[1][0] = -1;     vis[make_pair((0), (0))] = 1;     dp[make_pair((0), (0))] = -2;     for (int i = 2; i <= n; i++) {       ans[i] = max(ans[pre[2][i]] + 1, dfs(i, i));       dp[make_pair((i), (i))] = ans[i];     }     cout << ans[n] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, cnt = 0, pz = 0, mx = 0;     string s;     cin >> a >> b;     for (int i = 0; i < a; i++) {       for (int j = 0; j < b; j++) {         s += j + 97;       }     }     for (int i = 0; i < a; i++) cout << s[i];   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int n, m;     cin >> n >> m;     char t[n][m];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> t[i][j];       }     }     bool check = true;     int count = 0, r, l;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (t[i][j] ==  B ) {           count++;           if (check) {             l = j;             check = false;           }         }       }       if (count) {         r = i + 1 + count / 2;         l = l + 1 + count / 2;         cout << r <<     << l;         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   std::mt19937 rnd(       (int)std::chrono::steady_clock::now().time_since_epoch().count());   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   const int MAXH = 200000;   const int MAXW = 200000;   const int MAXQ = 200000;   int h, w, nq;   int qx[MAXQ], qy[MAXQ];   bool qans[MAXQ];   int a[MAXW], b[MAXW];   bool can(int cnt) {     for (int y = (0); y < (w); ++y) a[y] = b[y] = 0;     for (int i = (0); i < (cnt); ++i) {       int x = qx[i], y = qy[i];       if (x % 2 == 1 && y % 2 == 1) {         x /= 2, y /= 2;         a[y] = max(a[y], x + 1);       } else {         assert(x % 2 == 0 && y % 2 == 0);         x /= 2, y /= 2;         b[y] = max(b[y], h - x);       }     }     for (int y = w - 2; y >= 0; --y) a[y] = max(a[y], a[y + 1]);     for (int y = 2; y < w; ++y) b[y] = max(b[y], b[y - 1]);     for (int y = (0); y < (w); ++y)       if (a[y] + b[y] > h) return false;     return true;   }   void solve() {     int lo = 0, hi = nq + 1;     while (lo + 1 < hi) {       int mi = lo + (hi - lo) / 2;       if (can(mi))         lo = mi;       else         hi = mi;     }     int res = lo;     for (int i = (0); i < (nq); ++i)       if (i + 1 <= res)         qans[i] = true;       else         qans[i] = false;   }   void run() {     scanf( %d%d%d , &h, &w, &nq);     for (int i = (0); i < (nq); ++i)       scanf( %d%d , &qx[i], &qy[i]), --qx[i], --qy[i];     solve();     for (int i = (0); i < (nq); ++i) printf( %s n , qans[i] ?  YES  :  NO );   }   int main() {     run();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long INF = (1e15);   int a[110];   int main() {     int n, x, y;     scanf( %d%d%d , &n, &x, &y);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     if (x > y) {       printf( %d n , n);     } else {       int ans = 0;       for (int i = 1; i <= n; i++) {         if (a[i] <= x) {           ans++;         }       }       ans++;       ans /= 2;       printf( %d n , ans);     }     return 0;   }