malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double EPS = 1e-7;   const long long BIG_PRIME7 = 1000000007;   const long long BIG_PRIME9 = 1000000009;   int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }   char ch =  a ;   int j, n, m, L, i;   int N, C;   int x, y, z, k;   string f, s;   int a[101], b[101];   int main() {     cin >> x;     for (i = 0; i < x; i++) {       cin >> k;       if (k & 1) z++;     }     if (!(z & 1))       cout << (x - z);     else       cout << z;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 111111;   int last[3 * N], pre[3 * N], v[3 * N], cnt[3 * N], cur = 0;   inline void add(int a, int b) {     pre[cur] = last[a];     v[cur] = b;     last[a] = cur;     cur++;   }   set<int>* who[N];   inline set<int>* merge(set<int>*& a, set<int>*& b) {     if (a->size() < b->size()) {       return merge(b, a);     } else {       for (set<int>::iterator it = b->begin(); it != b->end(); it++) {         if (a->find(-*it) != a->end()) {           a->erase(-*it);         } else {           a->insert(*it);         }       }       b->clear();       return a;     }   }   int used[N];   void dfs(int u) {     used[u] = true;     for (int i = last[u]; i >= 0; i = pre[i])       if (!used[v[i]]) {         dfs(v[i]);         cnt[i ^ 1] = cnt[i] = who[v[i]]->size();         who[u] = merge(who[u], who[v[i]]);       }   }   set<int>* mem[N];   int main() {     memset(last, -1, sizeof(last));     int n;     scanf( %d , &n);     for (int i = (0); i <= ((n - 1) - 1); i++) {       int u, v;       scanf( %d%d , &u, &v);       u--;       v--;       add(u, v);       add(v, u);     }     for (int i = (0); i <= ((n)-1); i++) mem[i] = who[i] = new set<int>();     int k;     scanf( %d , &k);     for (int i = (1); i <= ((k)); i++) {       int u, v;       scanf( %d%d , &u, &v);       u--;       v--;       if (u != v) {         who[u]->insert(i);         who[v]->insert(-i);       }     }     dfs(0);     for (int i = 0; i < cur; i += 2) {       if (i) printf(   );       printf( %d , cnt[i]);     }     puts(  );     for (int i = (0); i <= ((n)-1); i++) delete (mem[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int INF = 1e9 + 7;   const int base = 1e9;   const int MAX = 1e5;   const double EPS = 1e-9;   const double PI = acos(-1.);   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, *a, *res, j = 0;     cin >> n;     a = new int[n];     res = new int[n];     set<int> cnt;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int i = n - 1; i >= 0; i--) {       if (!cnt.count(a[i])) {         cnt.insert(a[i]);         res[j] = a[i];         j++;       }     }     cout << j << endl;     for (int i = j - 1; i >= 0; i--) {       cout << res[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   int n, m;   int f[150][150][250][2];   int main() {     cin >> s;     n = s.size();     scanf( %d , &m);     f[0][m][n][1] = true;     for (int i = 0; i < n; i++)       for (int j = 0; j <= m; j++)         for (int k = 0; k <= n * 2; k++)           for (int l = 0; l < 2; l++)             if (f[i][j][k][l])               if (s[i] ==  T ) {                 f[i + 1][j][k][1 - l] = true;                 if (j != 0 && k - 1 + 2 * l >= 0)                   f[i + 1][j - 1][k - 1 + 2 * l][l] = true;               } else {                 if (k - 1 + 2 * l >= 0) f[i + 1][j][k - 1 + 2 * l][l] = true;                 if (j != 0) f[i + 1][j - 1][k][1 - l] = true;               }     int i = 0;     for (int j = 0; j <= m; j++)       if (j % 2 == 0)         for (int k = 0; k <= n * 2; k++)           for (int l = 0; l < 2; l++)             if (f[n][j][k][l]) {               if (k - n < 0 && n - k > i) i = n - k;               if (k - n > 0 && k - n > i) i = k - n;             }     printf( %d n , i);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   int main() {     ios::sync_with_stdio(false);     int t;     cin >> t;     while (t--) {       string s, t;       cin >> s >> t;       vector<int> each[26];       int n, m;       n = s.length();       m = t.length();       for (int i = 0; i < n; ++i) {         each[s[i] -  a ].push_back(i);       }       int las = INF, res = 0;       for (int i = 0; i < m; ++i) {         if (upper_bound(each[t[i] -  a ].begin(), each[t[i] -  a ].end(), las) !=             each[t[i] -  a ].end()) {           las =               *upper_bound(each[t[i] -  a ].begin(), each[t[i] -  a ].end(), las);         } else {           if (each[t[i] -  a ].empty()) {             res = -1;             break;           } else {             res++;             las = each[t[i] -  a ][0];           }         }       }       cout << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, h, a, road_width = 0;     cin >> n >> h;     for (int i = 0; i < n; i++) {       cin >> a;       if (a > h)         road_width += 2;       else         road_width++;     }     cout << road_width <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int abs(int a, int b) {     if (a > b)       return a - b;     else       return b - a;   }   int main() {     int n, c, i, b, count = 0, index1 = 1, index2 = 1, flag = 0;     cin >> n >> c;     char *s;     s = new char[n + 2];     for (i = 1; i <= n; i++) {       cin >> s[i];     }     int *d = new int[n + 1];     for (i = 1; i <= n / 2; i++) {       b = abs((int)s[i], (int)s[n - i + 1]);       if (b < 13)         d[i] = d[n - i + 1] = b;       else         d[i] = d[n - i + 1] = 26 - b;     }     if (c > n / 2) c = 1 + n - c;     for (i = 1; i <= n / 2; i++) {       if (d[i] > 0) {         index1 = i;         break;       }     }     for (i = n / 2; i >= 1; i--) {       if (d[i] > 0) {         index2 = i;         flag = 1;         break;       }     }     if (c <= index1) {       count = index2 - c;     } else if (c <= index2) {       if (c - index1 > index2 - c)         count = 2 * (index2 - c) + c - index1;       else         count = 2 * (c - index1) + index2 - c;     } else       count = c - index1;     for (i = index1; i <= index2; i++) {       count += d[i];     }     if (flag == 1)       cout << count;     else       cout << 0;     return 0;   }
#include <bits/stdc++.h>   int any_table[11][11];   struct DammedPascalNUmber {     int tb[13][13];     DammedPascalNUmber() {       int i, j;       for (i = 0; i <= 12; i++)         for (j = 0; j <= i; j++) {           int &r = tb[i][j];           if (j == 0 || i == 0)             r = 1;           else             r = tb[i - 1][j - 1] + tb[i - 1][j];         }     }     int count(int n, int m) { return tb[n][m]; }   } pas;   int any(int dig, int amo) {     if (dig < amo) return 0;     if (amo < 0) return 0;     if (dig == 0) return 1;     int &r = any_table[dig][amo];     int i;     if (r >= 0) return r;     r = 1;     for (i = 0; i < amo; i++) r *= 2;     for (; i < dig; i++) r *= 8;     r *= pas.count(dig, amo);     return r;   }   int check(int m, int n) {     int i, j, t, r = 0;     for (i = 1; i <= m; i++) {       char str[15];       t = 0;       sprintf(str,  %d , i);       for (j = 0; str[j]; j++)         if (str[j] ==  4  || str[j] ==  7 ) t++;       if (t == n) r++;     }     return r;   }   int a[13];   int dfs(int party, int quta) {     int r = 0, i;     if (party == 6) {       return 1;     }     for (i = quta; i >= 0; i--)       if (a[i] > 0) {         int t = a[i];         a[i]--;         r = (1LL * r + 1LL * t * 1LL * dfs(party + 1, quta - i) +              1LL * 1000000007) %             1000000007;         a[i]++;       }     return r;   }   void test(int n, int m) { printf( any(%d,%d)=%d n , n, m, any(n, m)); }   void test2(int m, int n) {     printf( (%d,%d)=%d a[%d]=%d n , m, n, check(m, n), n, a[n]);   }   int main() {     memset(any_table, -1, sizeof(any_table));     int m, s, i, j, k, sn, lucked;     while (~scanf( %d , &m)) {       memset(a, 0, sizeof(a));       char str[15];       sprintf(str,  %d , m);       for (sn = 0; str[sn]; sn++)         ;       for (j = sn; j > 0; j--) {         a[j] = 0;         lucked = 0;         for (i = 0; i < sn; i++) {           int p = 0, q = 0;           k = str[i] -  0  - 1;           for (; k >= 0; k--)             if (k == 4 || k == 7)               q++;             else               p++;           if (p) a[j] += p * any(sn - i - 1, j - lucked);           if (q) a[j] += q * any(sn - i - 1, j - lucked - 1);           if (str[i] ==  4  || str[i] ==  7 ) {             lucked++;           }           if (i == sn - 1 && lucked == j) a[j]++;         }       }       a[0] = m;       for (i = 1; i <= sn; i++) a[0] -= a[i];       int ans = 0;       for (i = 1; i <= sn; i++)         if (a[i]) {           ans = (1LL * ans + 1LL * a[i] * dfs(0, i - 1) + 1LL * 1000000007) %                 1000000007;         }       printf( %d n , ans);     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   const double pi = acos(-1);   const int inf = 1 << 30;   const int mod = 1e9 + 9;   struct point {     int x, flag;     bool operator<(const point &a) const { return flag > a.flag; }   } s, q;   bool check(long long a[], int n, long long h, int x) {     priority_queue<int, vector<int>, less<int> > qwe;     for (int i = 1; i <= min(n, x); i++) qwe.push(a[i]);     int f = 1, pos;     while (!qwe.empty()) {       pos = qwe.top();       qwe.pop();       if (f) h -= pos;       f ^= 1;     }     if (h >= 0ll)       return true;     else       return false;   }   int main() {     int n;     long long h, a[maxn];     scanf( %d %lld , &n, &h);     for (int i = 1; i <= n; i++) scanf( %lld , &a[i]);     int l = 0, r = n, ans = 0;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(a, n, h, mid))         l = mid + 1, ans = mid;       else         r = mid - 1;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int n, m, x, y, f[N], fa[N], ch[N][2];   char op[5];   long long a[N], siz[N], ssiz[N], ans[N], sans[N], sqsiz[N], all[N];   bool isroot(int u) { return ch[fa[u]][0] != u && ch[fa[u]][1] != u; }   int which(int u) { return u == ch[fa[u]][1]; }   void pushup(int o) {     int lc = ch[o][0], rc = ch[o][1];     siz[o] = siz[lc] + siz[rc] + ssiz[o];     all[o] = all[lc] + all[rc] + a[o] * ssiz[o];     ans[o] = ans[lc] + ans[rc] + sans[o];     ans[o] += (ssiz[o] * ssiz[o] - sqsiz[o]) * a[o];     ans[o] += 2 * siz[rc] * ssiz[o] * a[o];     ans[o] += 2 * all[lc] * (siz[o] - siz[lc]);   }   void rotate(int x) {     int y = fa[x], z = fa[y], md = which(x);     if (!isroot(y)) {       ch[z][which(y)] = x;     }     fa[x] = z;     ch[y][md] = ch[x][!md];     fa[ch[y][md]] = y;     ch[x][!md] = y;     fa[y] = x;     pushup(y);     pushup(x);   }   void splay(int u) {     while (!isroot(u)) {       if (!isroot(fa[u])) {         rotate(which(u) == which(fa[u]) ? fa[u] : u);       }       rotate(u);     }   }   void access(int u) {     for (int v = 0; u; v = u, u = fa[u]) {       splay(u);       int rc = ch[u][1];       ssiz[u] += siz[rc];       sans[u] += ans[rc];       sqsiz[u] += siz[rc] * siz[rc];       ch[u][1] = v;       ssiz[u] -= siz[v];       sans[u] -= ans[v];       sqsiz[u] -= siz[v] * siz[v];       pushup(u);     }   }   void link(int u, int v) {     access(v);     splay(v);     access(u);     splay(u);     fa[u] = v;     ssiz[v] += siz[u];     sans[v] += ans[u];     sqsiz[v] += siz[u] * siz[u];     pushup(v);   }   void cut(int u, int v) {     access(u);     access(v);     splay(v);     splay(u);     fa[u] = 0;     ssiz[v] -= siz[u];     sans[v] -= ans[u];     sqsiz[v] -= siz[u] * siz[u];     pushup(v);   }   bool check(int u, int v) {     access(v);     splay(v);     splay(u);     if (isroot(v)) {       return false;     }     return true;   }   int main() {     scanf( %d , &n);     for (int i = 2; i <= n; i++) {       scanf( %d , &f[i]);     }     for (int i = 1; i <= n; i++) {       scanf( %lld , &a[i]);       ans[i] = all[i] = a[i];     }     for (int i = 1; i <= n; i++) {       siz[i] = 1;       ssiz[i] = 1;     }     for (int i = 2; i <= n; i++) {       link(i, f[i]);     }     access(1);     splay(1);     printf( %.10lf n , 1.0 * ans[1] / n / n);     scanf( %d , &m);     while (m--) {       scanf( %s%d%d , op, &x, &y);       if (op[0] ==  P ) {         if (check(x, y)) {           swap(x, y);         }         cut(x, f[x]);         f[x] = y;         link(x, f[x]);         access(1);         splay(1);         printf( %.10lf n , 1.0 * ans[1] / n / n);       } else {         access(x);         splay(x);         a[x] = y;         pushup(x);         printf( %.10lf n , 1.0 * ans[x] / n / n);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long x, y, n, m, t, q, a, b, count = 0;     cin >> n >> m;     long long arr[n];     for (x = 0; x < n; x++) cin >> arr[x];     a = 0;     for (x = 0; x < n; x++) {       a = a + arr[x];       cout << a / m <<    ;       a = a % m;     }   }
#include <bits/stdc++.h>   using namespace std;   int qread() {     char c;     int s = 0, f = 1;     while ((c = getchar()) <  0  || c >  9 ) (c ==  - ) && (f = -1);     do s = s * 10 + c -  0 ;     while ((c = getchar()) >=  0  && c <=  9 );     return s * f;   }   int n, m;   const int mod = 1e9 + 7;   int a[100011], pos[100011], bin[100011], inv[100011], sum[100011],       lp = 0, val[100011], vv[100011], svv[100011];   struct Ques {     int l, r, id;     bool operator<(const Ques &b) const { return r < b.r; }   } q[100011];   int ans[100011];   int WWW(long long v) { return v > 2000000001 ? 2000000001 : v; }   int main() {     n = qread();     m = qread();     bin[0] = inv[0] = 1;     for (int i = 1; i <= n; i++)       a[i] = qread(), bin[i] = (bin[i - 1] << 1) % mod,       inv[i] = 1ll * inv[i - 1] * ((mod + 1) >> 1) % mod,       sum[i] = ((sum[i - 1] + 1ll * a[i] * bin[i]) % mod + mod) % mod;     for (int i = 1; i <= m; i++) {       q[i].l = qread();       q[q[i].id = i].r = qread();     }     sort(q + 1, q + 1 + m);     pos[lp = 1] = 1;     int j = 1;     val[1] = a[1] * 2;     vv[1] = svv[1] = ((a[1] * 2) % mod + mod) % mod;     while (j <= m && q[j].r == 1) ans[q[j].id] = (a[1] + mod) % mod, j++;     for (int i = 2; i <= n; i++) {       if (a[i] <= 0)         pos[++lp] = i, val[lp] = 2 * a[i],         vv[lp] = (a[i] * 2ll % mod + mod) % mod,         svv[lp] = (svv[lp - 1] + vv[lp]) % mod;       else {         int cur =             WWW(0ll + val[lp] + bin[pos[lp] - pos[lp - 1] + 1] * 1ll * a[i]);         int cvv = (vv[lp] + bin[pos[lp] - pos[lp - 1] + 1] * 1ll * a[i]) % mod;         lp--;         while (lp && cur > 0) {           cur = WWW(0ll + val[lp] +                     (pos[lp] - pos[lp - 1] > 31 ? 2000000001                                                 : bin[pos[lp] - pos[lp - 1]]) *                         1ll * cur);           cvv = (vv[lp] + bin[pos[lp] - pos[lp - 1]] * 1ll * cvv) % mod;           lp--;         }         val[++lp] = cur;         pos[lp] = i;         vv[lp] = cvv;         svv[lp] = (svv[lp - 1] + vv[lp]) % mod;       }       while (j <= m && q[j].r == i) {         if (q[j].l == q[j].r) {           ans[q[j].id] = (a[i] + mod) % mod;           j++;           continue;         }         int l = q[j].l + 1, Ans = (a[q[j].l] + mod) % mod;         int L = 1, R = lp;         while (L < R) {           int mid = (L + R) >> 1;           if (pos[mid] >= l)             R = mid;           else             L = mid + 1;         }         Ans = (Ans + svv[lp] - svv[L]) % mod;         Ans = (Ans + mod) % mod;         Ans = (Ans + (sum[pos[L]] - sum[l - 1] + mod) * 1ll * inv[l - 1]) % mod;         ans[q[j].id] = Ans;         j++;       }     }     for (int i = 1; i <= m; i++) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const long long inf = 1000000000000000000;   int main() {     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       vector<pair<long long, long long> > p(n);       for (auto& x : p) cin >> x.first >> x.second;       sort(p.begin(), p.end());       pair<long long, long long> now = {0, 0};       bool f = 1;       string ans =   ;       for (int i = 0; i < n; i++) {         if (p[i].first >= now.first && p[i].second >= now.second) {           long long r = p[i].first - now.first, u = p[i].second - now.second;           while (r--) ans +=  R ;           while (u--) ans +=  U ;           now = p[i];         } else {           f = 0;           break;         }       }       if (f)         cout <<  YES n  << ans << endl;       else         cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     scanf( %d %d , &n, &m);     for (int i = 0; i < n; i++) {       if (i % 2 == 0) {         for (int j = 1; j <= m; j++) {           printf( # );         }       } else if (i % 4 == 1) {         for (int j = 1; j < m; j++) {           printf( . );         }         printf( # );       } else if (i % 4 == 3) {         printf( # );         for (int j = 1; j < m; j++) {           printf( . );         }       }       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 65, mod = 1e9 + 7;   vector<int> g[N];   int w[N];   int col[N], pr[N];   int sz[N][2];   long long ans = 0;   void dfs(int v, int par = -1, int c = 0) {     pr[v] = par;     ++sz[v][c];     col[v] = c;     for (int u : g[v])       if (u != par) {         dfs(u, v, c ^ 1);         sz[v][0] += sz[u][0];         sz[v][1] += sz[u][1];       }   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %d , w + i);     for (int i = 1; i < n; ++i) {       int u, v;       scanf( %d %d , &u, &v);       --u, --v;       g[u].push_back(v);       g[v].push_back(u);     }     ans = 0;     dfs(0);     for (int v = 0; v < n; ++v) {       vector<pair<int, int> > vs;       for (int u : g[v])         if (u != pr[v]) vs.emplace_back(sz[u][0], sz[u][1]);       if (pr[v] != -1) vs.emplace_back(sz[0][0] - sz[v][0], sz[0][1] - sz[v][1]);       long long cnt = n;       if (col[v]) {         for (pair<int, int> e : vs) {           cnt = (cnt + 1LL * e.second * (n - e.first - e.second)) % mod;           cnt = (cnt - 1LL * e.first * (n - e.first - e.second)) % mod;         }       } else {         for (pair<int, int> e : vs) {           cnt = (cnt - 1LL * e.second * (n - e.first - e.second)) % mod;           cnt = (cnt + 1LL * e.first * (n - e.first - e.second)) % mod;         }       }       cnt %= mod;       if (cnt < 0) cnt += mod;       ans = (ans + cnt * w[v]) % mod;     }     ans %= mod;     if (ans < 0) ans += mod;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1 << 28;   const double INF = 1e12, EPS = 1e-9;   int n, m, k;   bool star[600][600];   int sum[600][600];   char in[600][600];   void run() {     cin >> n >> m >> k;     for (int i = 0; i < n; i++) cin >> in[i];     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         if (in[i][j] ==  1  && in[i + 1][j] ==  1  && in[i + 2][j] ==  1  && j &&             in[i + 1][j - 1] ==  1  && in[i + 1][j + 1] ==  1 )           star[i][j] = 1;       }     long long ans = 0;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++)         sum[i + 1][j + 1] =             star[i][j] + sum[i][j + 1] + sum[i + 1][j] - sum[i][j];     for (int a = 0; a < n; a++)       for (int b = a + 3; b <= n; b++) {         int l = 0, r = 2, cnt = 0;         for (; l < m; l++) {           while (r <= m && cnt < k) {             r++;             cnt += sum[b - 2][r - 1] - sum[a][r - 1] -                    (sum[b - 2][r - 2] - sum[a][r - 2]);           }           if (cnt < k || r > m) break;           ans += m - r + 1;           cnt -= sum[b - 2][l + 2] - sum[a][l + 2] -                  (sum[b - 2][l + 1] - sum[a][l + 1]);         }       }     cout << ans << endl;   }   int main() { run(); }
#include <bits/stdc++.h>   using namespace std;   const long long mxn = 1003, inf = 1e18 + 18;   int n, m, lcp[mxn][mxn], rk[mxn][mxn], ri[mxn], tot;   long long k, f[mxn];   string s;   struct S {     int l, r;   } a[mxn * mxn];   inline bool cmp(S a, S b) {     int p = a.l + lcp[a.l][b.l], q = b.l + lcp[a.l][b.l];     if (p > a.r or q > b.r) return a.r - a.l < b.r - b.l;     return s[p] < s[q];   }   inline long long add(long long a, long long b) {     return a + b > inf ? inf : a + b;   }   inline long long calc(int md) {     for (int i = 1; i <= n; ++i) {       ri[i] = i;       for (; ri[i] <= n and rk[i][ri[i]] < md;) ++ri[i];     }     memset(f, 0, sizeof(f)), f[n + 1] = 1;     for (int i = 1; i <= m; ++i) {       for (int j = n; j; --j) f[j] = add(f[j], f[j + 1]);       for (int j = 1; j <= n; ++j) f[j] = ri[j] <= n ? f[ri[j] + 1] : 0;       f[n + 1] = 0;     }     return f[1];   }   int main() {     cin >> n >> m >> k >> s, s =     + s;     for (int i = n; i; --i)       for (int j = n; j; --j)         if (s[i] == s[j]) lcp[i][j] = lcp[i + 1][j + 1] + 1;     for (int i = 1; i <= n; ++i)       for (int j = i; j <= n; ++j) a[++tot] = (S){i, j};     sort(a + 1, a + tot + 1, cmp);     for (int i = 1; i <= tot; ++i) rk[a[i].l][a[i].r] = i;     int l = 1, r = tot, md;     for (; l <= r;) {       md = l + r >> 1;       if (calc(md) >= k)         l = md + 1;       else         r = md - 1;     }     for (int i = a[r].l; i <= a[r].r; ++i) putchar(s[i]);   }
#include <algorithm>   #include <cmath>   #include <cstdio>   #include <cstring>   #include <iostream>   #include <map>   #include <set>   #include <unordered_map>      using namespace std;   typedef long long LL;   const int N = 3e5 + 10, mod = 998244353;   string g[N];   int dp[N];      int fastPow(int a, int k) {       int res = 1;       while (k) {           if (k & 1) res = (LL)res * a % mod;           k >>= 1;           a = (LL)a * a % mod;       }       return res;   }      int main() {       ios::sync_with_stdio(false);       int n, m, sum = 0, res = 0;       n = 300000;       for (int i = 2; i <= n; i++) {           if (i & 1) sum = (sum + 1) % mod;           dp[i] = ((LL)dp[i - 1] * 2 % mod + sum + !(i & 1)) % mod;           sum = (sum << 1) % mod;       }       sum = 0;       cin >> n >> m;       for (int i = 0; i < n; i++) {           cin >> g[i];           for (auto c : g[i])               if (c ==  o ) sum++;       }       for (int i = 0; i < n; i++) {           int cnt = 0, len = 0;           while (cnt <= m) {               if (cnt == m || g[i][cnt] ==  * ) {                   if (len) {                       res = (res + (LL)dp[len] *                                        fastPow(2, sum - len) % mod) %                             mod;                       len = 0;                   }               } else {                   len++;               }               cnt++;           }       }       for (int i = 0; i < m; i++) {           int cnt = 0, len = 0;           while (cnt <= n) {               if (cnt == n || g[cnt][i] ==  * ) {                   if (len) {                       res = (res + (LL)dp[len] *                                        fastPow(2, sum - len) % mod) %                             mod;                       len = 0;                   }               } else {                   len++;               }               cnt++;           }       }       cout << res << endl;       return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100 + 10;   char s[maxn];   int f(char ch) {     if (ch ==  A ) return 1;     if (ch ==  B ) return 2;     if (ch ==  C ) return 4;     return 0;   }   int main() {     scanf( %s , s + 1);     int l = strlen(s + 1);     for (int i = 1; i <= l - 2; ++i) {       int t = f(s[i]) | f(s[i + 1]) | f(s[i + 2]);       if (t == 7) {         cout <<  Yes  << endl;         return 0;       }     }     cout <<  No ;     return 0;   }