malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   struct Data {     int sgn;     long long delta;     set<pair<long long, long long>> ranges;     void flip(int a) { sgn = -sgn, delta = a - delta; }     void trim(int l, int r) {       if (l > r) return;       long long xl = sgn * (l - delta), xr = sgn * (r - delta);       if (sgn < 1) swap(xl, xr);       while (!ranges.empty()) {         pair<long long, long long> cur = *ranges.begin();         if (cur.first >= xl) break;         ranges.erase(ranges.begin());         if (cur.second < xl) continue;         ranges.insert(make_pair(xl, cur.second));       }       while (!ranges.empty()) {         pair<long long, long long> cur = *ranges.rbegin();         if (cur.second <= xr) break;         ranges.erase(prev(ranges.end()));         if (cur.first > xr) continue;         ranges.insert(make_pair(cur.first, xr));       }     }     bool empty() { return ranges.empty(); }     void add(int l, int r) {       long long xl = sgn * (l - delta), xr = sgn * (r - delta);       if (sgn == -1) swap(xl, xr);       ranges.insert(make_pair(xl, xr));     }     void add(int y) {       long long x = sgn * (y - delta);       ranges.insert({x, x});     }     void clear() {       ranges.clear();       sgn = 1;       delta = 0;     }     bool contain(int y) {       long long x = sgn * (y - delta);       auto it = ranges.upper_bound({x, LLONG_MAX});       if (it == ranges.begin()) return 0;       return (prev(it)->second) >= x && (prev(it)->first) <= x;     }   };   int n, a[500005];   int solve() {     int cnt = 0;     Data Seg;     Seg.clear();     for (int i = 0; i < n; i++) {       Seg.trim(1, a[i] - 1);       if (Seg.empty())         Seg.add(1, a[i] - 1);       else         cnt++;       Seg.flip(a[i]);       if (a[i] % 2 == 0) {         int b = a[i] / 2;         if (Seg.contain(b)) {           cnt++;           Seg.clear();         }         Seg.add(b);       }     }     return 2 * n - cnt;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int T;     for (cin >> T; T--;) {       cin >> n;       for (int i = 0; i < n; i++) cin >> a[i];       cout << solve() << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   int n, k, m;   int a[1000000];   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> k;     int d = 0;     if (n % 2 == 1) {       d = (n / 2 + 1) * (n / 2 + 1);       d += (n / 2) * (n / 2);     } else {       d = (n / 2) * (n / 2);       d *= 2;     }     if (d < k)       cout <<  NO ;     else {       cout <<  YES  << endl;       int cnt = 0;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= n; j++) {           if (cnt < k) {             if (i % 2 == 1) {               if (j % 2 == 1)                 cout <<  L , cnt++;               else                 cout <<  S ;             } else {               if (j % 2 == 0)                 cout <<  L , cnt++;               else                 cout <<  S ;             }           } else             cout <<  S ;         }         cout << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using std::cin;   using std::cout;   long long MOD = 998244353;   int main() {     long long n, q;     cin >> n >> q;     for (int i = 0; i < q; i++) {       long long curr;       cin >> curr;       string s;       cin >> s;       for (int c = 0; c < s.size(); c++) {         long long bit = curr & -curr;         if (s[c] ==  U ) {           if (curr != (n + 1) / 2) {             if (((curr - bit) & -(curr - bit)) != bit * 2)               curr += bit;             else               curr -= bit;           }         } else if (s[c] ==  R ) {           if (bit == 1)             curr += 0;           else             curr += bit / 2;         } else if (s[c] ==  L ) {           if (bit == 1)             curr += 0;           else             curr -= bit / 2;         }       }       cout << curr <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int NN = 100 * 1000 + 5;   map<pair<pair<int, long long>, int>, long long> dp;   vector<int> adj[NN];   vector<long long> x;   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   const int mod = (int)1e9 + 7;   int rec(int node, int parent, long long g, int state) {     pair<pair<int, long long>, int> p = make_pair(make_pair(node, g), state);     if (dp.find(p) != dp.end()) return dp[p];     long long& res = dp[p];     res = gcd(g, x[node]);     res %= mod;     long long new_g = gcd(g, x[node]);     for (int child : adj[node]) {       if (child == parent) continue;       if (state == 0) {         res += rec(child, node, g, 0);         res %= mod;       }       res += rec(child, node, new_g, 1);       res %= mod;     }     return res;   }   int main() {     int n;     scanf( %d , &n);     x.resize(n);     for (int i = 0; i < n; i++) {       scanf( %lld , &x[i]);     }     for (int i = 0; i < n - 1; i++) {       int a, b;       scanf( %d%d , &a, &b);       a--;       b--;       adj[a].push_back(b);       adj[b].push_back(a);     }     long long ans = rec(0, -1, 0, 0);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long int> graph[100001];   bool vis[100001];   vector<long long int> ans;   void dfs(long long int root) {     vis[root] = true;     ans.push_back(root);     sort(graph[root].begin(), graph[root].end());     for (int i = 0; i < graph[root].size(); i++) {       if (!vis[graph[root][i]]) dfs(graph[root][i]);     }   }   void solve() {     long long int a, b, c, d, i, j, k, l;     cin >> a >> b;     for (i = 0; i < b; i++) {       cin >> c >> d;       graph[c].push_back(d);       graph[d].push_back(c);     }     memset(vis, false, sizeof(vis));     map<int, int> m;     m[1] = 0;     while (m.size()) {       k = m.begin()->first;       m.erase(k);       ans.push_back(k);       vis[k] = true;       for (i = 0; i < graph[k].size(); i++) {         if (!vis[graph[k][i]]) {           m[graph[k][i]] = 0;         }       }     }     for (i = 0; i < ans.size(); i++) cout << ans[i] <<    ;   }   int main() {     int t = 1;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int cost;     double amount;     cin >> cost;     string s[n];     for (int i = 0; i < n; i++) {       cin >> s[i];     }     int counter = 0;     double sum = 0.0;     for (int i = n - 1; i >= 0; i--) {       if (s[i] ==  halfplus ) {         counter++;         sum = (sum + 0.5) * 2;       } else if (s[i] ==  half ) {         sum = sum * 2;       }     }     double num;     num = sum - (0.5 * counter);     amount = cost * num;     cout << (long long int)amount << endl;   }
#include <bits/stdc++.h>   using namespace std;   int read() {     int x = 0, y = 1;     char ch =    ;     for (; (ch !=  -  && (ch >  9  || ch <  0 )); ch = getchar())       ;     if (ch ==  - ) y = -1, ch = getchar();     for (; ch >=  0  && ch <=  9 ; ch = getchar()) x = x * 10 + ch - 48;     return x * y;   }   const int N = 1e6 + 10;   struct node {     int to, nex;   } e[N << 1];   int bgn[N], d[N], mx[N], son[N], ans[N], dfn[N], id[N], c[N];   int n, cnt, tot;   void add(int x, int y) {     e[++cnt] = (node){y, bgn[x]};     bgn[x] = cnt;   }   void dfs(int x, int fa) {     mx[x] = d[x] = d[fa] + 1;     for (register int i = bgn[x]; i; i = e[i].nex) {       int y = e[i].to;       if (y == fa) continue;       dfs(y, x);       if (mx[y] > mx[son[x]]) {         son[x] = y;         mx[x] = mx[y];       }     }   }   void ins(int &p, int x, int k) {     c[x] += k;     if (c[x] > c[p] || c[x] == c[p] && p > x) p = x;   }   void solve(int x, int fa) {     dfn[++tot] = x;     id[x] = tot;     if (son[x]) solve(son[x], x);     int p = ans[son[x]];     for (register int i = bgn[x]; i; i = e[i].nex) {       int y = e[i].to;       if (y == fa || y == son[x]) continue;       solve(y, x);       for (register int j = 0; j <= mx[y] - d[y]; ++j)         ins(p, id[x] + j + 1, c[id[y] + j]);     }     ins(p, id[x], 1);     ans[x] = p;   }   int main() {     int x, y, z, k;     n = read();     for (register int i = 1; i < n; ++i) {       x = read();       y = read();       add(x, y);       add(y, x);     }     dfs(1, 0);     solve(1, 0);     for (register int i = 1; i <= n; ++i) printf( %d n , ans[i] - id[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool tep(pair<string, int> a, pair<string, int> b) {     return a.second > b.second;   }   bool f(string s) {     for (int i = 0; i < 10; i++) {       if ((i == 2 || i == 5) && s[i] !=  - ) return 0;       if ((i != 2 && i != 5) && s[i] ==  - ) return 0;     }     if (s.substr(6) !=  2013  && s.substr(6) !=  2014  && s.substr(6) !=  2015 )       return 0;     if ((s[3] !=  0  && s[4] !=  0  && s[4] !=  1  && s[4] !=  2 ) ||         s[3] >  1  || (s[3] ==  0  && s[4] ==  0 ))       return 0;     if (s.substr(0, 2) ==  00 ) return 0;     if (s.substr(3, 2) ==  02  && (s[0] >=  3  || (s[0] ==  2  && s[1] >  8 )))       return 0;     if ((s.substr(3, 2) ==  04  || s.substr(3, 2) ==  06  ||          s.substr(3, 2) ==  09  || s.substr(3, 2) ==  11 ) &&         (s[0] >  3  || (s[0] ==  3  && s[1] >  0 )))       return 0;     else if (s.substr(3, 2) !=  02  &&              (s[0] >  3  || (s[0] ==  3  && s[1] >  1 )))       return 0;     return 1;   }   int main() {     string str;     vector<pair<string, int> > x;     int xn = 0;     cin >> str;     for (int i = 0; i < str.length() - 9; i++) {       string ss = str.substr(i, 10);       if (f(ss)) {         int j;         for (j = 0; j < xn; j++)           if (ss == x[j].first) {             x[j].second++;             break;           }         if (j == xn) {           xn++;           x.push_back(make_pair(ss, 1));         }       }     }     pair<string, int> xx[xn];     for (int i = 0; i < xn; i++) {       xx[i].first = x[i].first;       xx[i].second = x[i].second;     }     sort(xx, xx + xn, tep);     cout << xx[0].first << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double pie = 3.14159265358979323846;   bool isPowerOfTwo(long long int n) {     if (n == 0) return false;     return (ceill(log2l(n)) == floorl(log2l(n)));   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int T, i, j, j1, k = 0, n, m, co = 0, check, mi, l, sum;     long long int ans = 0;     cin >> T;     for (i = 0; i < T; i++) {       string s, s1 =  twone , s2 =  two ;       cin >> s;       n = s.length();       set<long long int> second;       for (j = 0; j < n - 4; j++) {         co = 0;         for (k = 0; k < 5; k++) {           if (s[j + k] != s1[k]) {             co = 1;             break;           }         }         if (co == 0) second.insert(j + 2);       }       for (j = 0; j < n - 2; j++) {         co = 0;         for (k = 0; k < 3; k++) {           if (s[j + k] != s2[k]) {             co = 1;             break;           }         }         if (co == 0 && second.find(j + 2) == second.end()) second.insert(j + 1);       }       s2 =  one ;       for (j = 0; j < n - 2; j++) {         co = 0;         for (k = 0; k < 3; k++) {           if (s[j + k] != s2[k]) {             co = 1;             break;           }         }         if (co == 0 && second.find(j) == second.end()) second.insert(j + 1);       }       cout << second.size() << endl;       for (auto w : second) {         cout << w + 1 <<    ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     cin >> n;     string s;     cin >> s;     int ans = n;     for (int i = 0; i < n / 2; i++) {       string temp1 = s.substr(0, i + 1);       string temp2 = s.substr(i + 1, i + 1);       if (temp1 == temp2) ans = min(ans, n - i);     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   const int M = 2e3 + 50;   const int INF = 0x7fffffff;   const int mod = 1e9 + 7;   const int sz = 18;   const double eps = 1e-10;   const double pi = acos(-1);   long long n, m;   char str[N];   int f[N];   template <class T>   inline void read(T &x) {     char c;     x = 1;     while ((c = getchar()) <  0  || c >  9 )       if (c ==  - ) x = -1;     T res = c -  0 ;     while ((c = getchar()) >=  0  && c <=  9 ) res = res * 10 + c -  0 ;     x *= res;   }   int main() {     int t;     read(t);     while (t--) {       read(n);       read(m);       long long l, r;       for (int i = 1; i <= n; i++) {         long long tmp = 1ll * i * (i - 1) / 2;         if (tmp >= m) {           l = i;           break;         }       }       r = (l - 1) - ((l - 1) * l / 2 - m);       l = n - l + 1;       r = n - r + 1;       for (int i = 1; i <= n; i++) {         if (i == l || i == r)           cout <<  b ;         else           cout <<  a ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   int main(void) {     int n, m;     scanf( %d%d , &n, &m);     char c;     scanf( %c , &c);     int i, j;     char word[n + 2][m + 2];     for (i = 0; i < n + 2; i++)       for (j = 0; j < m + 2; j++) word[i][j] =  W ;     int v[n + 1], h[m + 1];     for (i = 0; i <= n; i++) v[i] = 0;     for (j = 0; j <= m; j++) h[j] = 0;     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         scanf( %c , &word[i][j]);         if (word[i][j] ==  B ) {           v[i] += 1;           h[j] += 1;         }       }       scanf( %c , &c);     }     int left = m + 1, right = 0;     for (j = 1; j <= m; j++) {       if ((h[j] > 0) && (j < left)) left = j;       if ((h[j] > 0) && (j > right)) right = j;     }     int up = 0, down = n + 1;     for (i = 1; i <= n; i++) {       if ((v[i] > 0) && (i > up)) up = i;       if ((v[i] > 0) && (i < down)) down = i;     }     int notTrue = 0;     for (i = down; i <= up; i++) {       if (v[i] == 0)         notTrue = 1;       else {         int black = 0;         for (j = left; j <= right; j++) {           if ((word[i][j] ==  B ) && (black == 0)) black = 1;           if ((word[i][j] ==  W ) && (black == 1)) black = 2;           if ((word[i][j] ==  B ) && (black == 2)) notTrue = 1;         }       }     }     for (j = left; j <= right; j++) {       if (h[j] == 0)         notTrue = 1;       else {         int black = 0;         for (i = down; i <= up; i++) {           if ((word[i][j] ==  B ) && (black == 0)) black = 1;           if ((word[i][j] ==  W ) && (black == 1)) black = 2;           if ((word[i][j] ==  B ) && (black == 2)) notTrue = 1;         }       }     }     while (up > down) {       int lv = right, pv = left, ln = right, pn = left;       for (j = left; j <= right; j++) {         if ((word[up][j] ==  B ) && (lv > j)) lv = j;         if ((word[up][j] ==  B ) && (pv < j)) pv = j;         if ((word[down][j] ==  B ) && (ln > j)) ln = j;         if ((word[down][j] ==  B ) && (pn < j)) pn = j;       }       if (lv > ln) lv = ln;       if (ln > lv) ln = lv;       if (pn < pv) pn = pv;       if (pv < pn) pv = pn;       if (((word[up][ln] ==  W ) && (word[up][pn] ==  B ) &&            (word[down][lv] ==  B ) && (word[down][pv] ==  W )) ||           ((word[down][lv] ==  W ) && (word[down][pv] ==  B ) &&            (word[up][ln] ==  B ) && (word[up][pn] ==  W )))         notTrue = 1;       --up;       ++down;     }     if (notTrue == 0) {       printf( YES );     } else {       printf( NO );     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(4)   using namespace std;   char _buf[100000], *_p1 = _buf, *_p2 = _buf;   inline int gi() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = (x << 3) + (x << 1) + (ch ^ 48);       ch = getchar();     }     return (f == 1) ? x : -x;   }   inline int max(int a, int b) { return a > b ? a : b; }   inline int min(int a, int b) { return a < b ? a : b; }   int T, n, m;   struct node {     int x[3], y[3];     node(int a1, int b1, int a2, int b2, int a3, int b3) {       x[0] = a1, x[1] = a2, x[2] = a3;       y[0] = b1, y[1] = b2, y[2] = b3;     }     inline void output() {       for (int i = 0; i <= 2; ++i) printf( %d %d  , x[i], y[i]);     }   };   const int maxn = 105;   vector<node> vec;   int a[maxn][maxn];   char s[maxn];   inline void init() {     memset(a, 0, sizeof(a));     vec.clear();   }   inline void input() {     n = gi(), m = gi();     for (int i = 1; i <= n; ++i) {       scanf( %s , s + 1);       for (int j = 1; j <= m; ++j) a[i][j] = s[j] -  0 ;     }   }   inline void change(int a1, int b1, int a2, int b2, int a3, int b3) {     vec.push_back(node(a1, b1, a2, b2, a3, b3));     a[a1][b1] ^= 1, a[a2][b2] ^= 1, a[a3][b3] ^= 1;   }   inline void solve() {     for (int i = 1; i <= n - 2; ++i) {       for (int j = 1; j <= m - 1; ++j) {         if (a[i][j] == 0 && a[i][j + 1] == 0)           continue;         else {           if (a[i][j] == 0) {             change(i, j + 1, i + 1, j, i + 1, j + 1);           } else if (a[i][j + 1] == 1) {             change(i, j, i, j + 1, i + 1, j);           } else {             change(i, j, i + 1, j, i + 1, j + 1);           }         }       }     }     for (int i = 1; i <= m - 1; ++i) {       if (a[n - 1][i] == 1 && a[n][i] == 1) {         change(n - 1, i, n, i, n - 1, i + 1);       } else if (a[n - 1][i] == 1) {         change(n - 1, i, n, i + 1, n - 1, i + 1);       } else if (a[n][i] == 1) {         change(n, i, n - 1, i + 1, n, i + 1);       }     }     if (a[n][m] == 1 && a[n - 1][m] == 1) {       change(n - 1, m - 1, n - 1, m, n, m - 1);       change(n - 1, m - 1, n, m - 1, n, m);     } else if (a[n - 1][m] == 1) {       change(n - 1, m, n - 1, m - 1, n, m - 1);       change(n - 1, m - 1, n, m, n - 1, m);       change(n, m - 1, n, m, n - 1, m);     } else if (a[n][m] == 1) {       change(n, m, n - 1, m - 1, n, m - 1);       change(n - 1, m - 1, n, m, n - 1, m);       change(n, m - 1, n, m, n - 1, m);     }     printf( %d n , (int)(vec.size()));     for (auto x : vec) {       x.output();       printf(  n );     }   }   int main() {     T = gi();     while (T--) {       init();       input();       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long l, r, k, p, num;     cin >> l >> r >> k;     num = 1;     int ans = 0;     while (num <= r) {       if (num >= l && num <= r) {         cout << num;         ans++;       }       num *= k;       if (ans != 0) cout << endl;       if (num % k != 0) break;     }     if (ans == 0) printf( -1 n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int ttt;     cin >> ttt;     for (int tttt = 0; tttt < ttt; tttt++) {       long long n, m, a, b, x, y, xw1, yw1, xw2, yw2, xb1, yb1, xb2, yb2,           sumw = 0, sumb = 0, tb, tw, x1, y1, x2, y2;       cin >> n >> m;       cin >> xw1 >> yw1 >> xw2 >> yw2;       cin >> xb1 >> yb1 >> xb2 >> yb2;       sumw = m * n / 2 + ((m * n) % 2);       sumb = m * n / 2;       x = xw2 - xw1 + 1;       y = yw2 - yw1 + 1;       if ((xw1 + yw1) % 2 == 0) {         tw = x * y / 2 + ((x * y) % 2);         tb = x * y / 2;       } else {         tb = x * y / 2 + ((x * y) % 2);         tw = x * y / 2;       }       sumw += tb;       sumb -= tb;       x = xb2 - xb1 + 1;       y = yb2 - yb1 + 1;       if ((xb1 + yb1) % 2 == 0) {         tw = x * y / 2 + ((x * y) % 2);         tb = x * y / 2;       } else {         tb = x * y / 2 + ((x * y) % 2);         tw = x * y / 2;       }       sumw -= tw;       sumb += tw;       x1 = max(xb1, xw1);       y1 = max(yb1, yw1);       x2 = min(xb2, xw2);       y2 = min(yb2, yw2);       x = x2 - x1 + 1;       y = y2 - y1 + 1;       if (x > 0 && y > 0) {         if ((x1 + y1) % 2 == 0) {           tw = x * y / 2 + ((x * y) % 2);           tb = x * y / 2;         } else {           tw = x * y / 2;           tb = x * y / 2 + ((x * y) % 2);         }         sumb += tb;         sumw -= tb;       }       cout << sumw <<     << sumb << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   string s, p;   int cnt[26], cnt1[26], ans;   bool check() {     for (int i = 0; i < 26; i++)       if (cnt[i] > cnt1[i]) return false;     return true;   }   int main() {     cin >> s >> p;     if (p.size() > s.size()) {       cout << 0;       return 0;     }     for (int i = 0; i < p.size(); i++) cnt1[p[i] -  a ]++;     for (int i = 0; i < p.size(); i++) {       if (s[i] !=  ? ) cnt[s[i] -  a ]++;     }     if (check() == true) ans++;     for (int i = 1; i < s.size() - p.size() + 1; i++) {       if (s[i - 1] !=  ? ) cnt[s[i - 1] -  a ]--;       if (s[i + p.size() - 1] !=  ? ) cnt[s[i + p.size() - 1] -  a ]++;       if (check()) ans++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   string name[1001];   int fen[1001];   vector<pair<string, int> > old;   vector<pair<int, string> > xin;   vector<int> ff;   int main(int argc, char *argv[]) {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> name[i] >> fen[i];       old.push_back(make_pair(name[i], fen[i]));     }     sort(old.begin(), old.end());     for (int i = 0; i < (int)old.size(); i++) {       if (i == (int)old.size() - 1 || old[i].first != old[i + 1].first) {         xin.push_back(make_pair(old[i].second, old[i].first));       }     }     sort(xin.begin(), xin.end());     for (int i = 0; i < (int)xin.size(); i++) {       ff.push_back(xin[i].first);     }     int sz = ff.size(), wz;     cout << sz << endl;     for (int i = 0; i < (int)xin.size(); i++) {       wz = sz - (upper_bound(ff.begin(), ff.end(), ff[i]) - ff.begin());       if (wz * 2 > sz) {         cout << xin[i].second <<   noob n ;       } else if (wz * 5 > sz) {         cout << xin[i].second <<   random n ;       } else if (wz * 10 > sz) {         cout << xin[i].second <<   average n ;       } else if (wz * 100 > sz) {         cout << xin[i].second <<   hardcore n ;       } else {         cout << xin[i].second <<   pro n ;       }     }     return EXIT_SUCCESS;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 300;   char s[MAXN];   int n;   void solve() {     int maxv = 0, x = 0, y = 0, sum = 0, f = 0;     s[n++] =  _ ;     s[n] = 0;     for (int i = 0; i < n; ++i) {       if (!f) {         if (s[i] ==  _ ) {           x = 0;         } else if (s[i] !=  ( ) {           x++;           maxv = max(maxv, x);         } else {           f = 1;           x = 0;         }       } else {         if (s[i] ==  _ ) {           if (y) sum++;           y = 0;         } else if (s[i] !=  ) ) {           y++;         } else {           if (y) sum++;           f = 0, y = 0;         }       }     }     printf( %d %d n , maxv, sum);   }   int main() {     while (~scanf( %d%s , &n, s)) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, num, maxs = INT_MIN, mins = INT_MAX, mins2 = INT_MAX;     cin >> n >> m;     vector<int> v1;     vector<int> v2;     for (int i = 0; i < n; i++) {       cin >> num;       v1.push_back(num);       maxs = max(maxs, num);       mins2 = min(mins2, num);     }     for (int i = 0; i < m; i++) {       cin >> num;       v2.push_back(num);       if (num <= maxs) {         cout <<  -1 ;         return 0;       }       mins = min(mins, num);     }     for (int i = 0; i < n; i++) {       if (2 * v1[i] <= maxs) {         cout << maxs;         return 0;       }     }     for (int i = 0; i < n; i++) {       if (2 * mins2 <= mins - 1) {         cout << 2 * mins2;         return 0;       }       if (2 * v1[i] <= mins - 1) {         cout << mins - 1;         return 0;       }     }     cout <<  -1 ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, r = 0, m = 0;     string s;     cin >> n;     while (!cin.eof()) {       cin >> s;       for (int i = 0; i < s.size(); i++) {         if (int(s[i]) > 64 && int(s[i]) < 91) {           r++;         }       }       if (r > m) {         m = r;       }       r = 0;     }     cout << m;     return 0;   }