malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int getInt() {     int x;     scanf( %d , &x);     return x;   }   long long getLongLong() {     long long x;     scanf( %I64d , &x);     return x;   }   double getDouble() {     double x;     scanf( %lf , &x);     return x;   }   char getChar() {     char x;     scanf( %c , &x);     return x;   }   template <typename t>   t abs(t a) {     if (a >= 0) return a;     return -a;   }   struct dual {     int a, b;     bool const operator<(const dual &x) const {       if (a == x.a) return b > x.b;       return a < x.a;     }   };   struct triple {     int a, b, c;     bool const operator<(const triple &x) const {       if (c == x.c) {         if (a == x.a) return b > x.b;         return a < x.a;       }       return c < x.c;     }   };   void FastIO() {     ios::sync_with_stdio(0);     cin.tie(0);   }   int a[512345];   char s[512345];   long long ssb[512345] = {0}, psb[512345] = {0};   long long ssa[512345] = {0}, psa[512345] = {0};   int main() {     int n = getInt();     for (int i = 0; i < n; i++) a[i] = getInt();     scanf( %s , s);     if (s[0] ==  B )       psb[0] = a[0];     else       psa[0] = a[0];     for (int i = 1; i < n; i++) {       psa[i] = psa[i - 1];       psb[i] = psb[i - 1];       if (s[i] ==  A )         psa[i] += a[i];       else         psb[i] += a[i];     }     for (int i = n - 1; i >= 0; i--) {       ssa[i] = ssa[i + 1];       ssb[i] = ssb[i + 1];       if (s[i] ==  A )         ssa[i] += a[i];       else         ssb[i] += a[i];     }     long long ans = max(ssa[0], ssb[0]);     for (int i = 0; i < n; i++) {       ans = max(ans, max(psa[i] + ssb[i + 1], psb[i] + ssa[i + 1]));     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000;   const int dx[4] = {1, 1, -1, -1};   const int dy[4] = {1, -1, -1, 1};   int n, m;   int t[MAXN + 2][MAXN + 2];   int dp[4][MAXN + 2][MAXN + 2];   int sol;   int main() {     ios::sync_with_stdio(0);     cin >> n >> m;     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j) cin >> t[i][j];     for (int d = 0; d < 4; ++d)       for (int i = dy[d] == 1 ? 1 : n; i && i <= n; i += dy[d])         for (int j = dx[d] == 1 ? 1 : m; j && j <= m; j += dx[d])           dp[d][i][j] = max(dp[d][i - dy[d]][j], dp[d][i][j - dx[d]]) + t[i][j];     for (int i = 2; i < n; ++i)       for (int j = 2; j < m; ++j)         sol = max(sol, max(dp[0][i - 1][j] + dp[1][i][j - 1] + dp[2][i + 1][j] +                                dp[3][i][j + 1],                            dp[0][i][j - 1] + dp[1][i + 1][j] + dp[2][i][j + 1] +                                dp[3][i - 1][j]));     cout << sol << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int a[N];   int n;   int res[N];   int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }   int lcm(int a, int b) { return a * b / gcd(a, b); }   void solve() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     if (n % 2 == 0) {       for (int i = 0; i < n / 2; i++) {         int j = n - 1 - i;         int t = lcm(a[i], a[j]);         res[i] = t / a[i];         res[j] = t / a[j];         if (1) {           res[i] *= -1;         }       }       for (int i = 0; i < n; i++) cout << res[i] <<    ;       cout << endl;     } else {       for (int i = 0; i < n / 2 - 1; i++) {         int j = n - 1 - i;         int t = lcm(a[i], a[j]);         res[i] = t / a[i];         res[j] = t / a[j];         if (1) {           res[i] *= -1;         }       }       res[n / 2 - 1] = 1;       res[n / 2 + 1] = -1;       int t = 1 * a[n / 2 - 1] + -1 * a[n / 2 + 1];       if (t == 0) {         t += a[n / 2 - 1];         res[n / 2 - 1]++;       }       int t2 = lcm(t, a[n / 2]);       res[n / 2] = t2 / a[n / 2];       res[n / 2 - 1] *= t2 / t;       res[n / 2 + 1] *= t2 / t;       if (1) {         res[n / 2] *= -1;       }       for (int i = 0; i < n; i++) cout << res[i] <<    ;       cout << endl;     }   }   int main() {     int K;     scanf( %d , &K);     while (K--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5e5 + 9;   struct Node {     double st, ed, dir;   } p[N];   struct flag {     double num, id;   } q[N];   bool cmp(flag a, flag b) { return a.num < b.num; }   int main() {     int n, m, i, j, k;     while (~scanf( %d , &n)) {       for (i = 0; i < n; ++i) {         scanf( %lf%lf , &p[i].st, &p[i].dir);       }       double L = 0, R = 1e9 + 10, mid, ans = -1;       for (j = 0; j < 100; ++j) {         mid = (L + R) / 2;         bool ok = false;         double Max = -1e50;         for (i = 0; i < n; ++i) {           p[i].ed = p[i].st + p[i].dir * mid;           if (p[i].dir >= 0) {             Max = max(Max, p[i].ed);           } else {             if (p[i].ed <= Max) {               ok = true;               break;             }           }         }         if (ok) {           ans = mid;           R = mid;         } else {           L = mid;         }       }       printf( %.20f n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200020;   long long a;   int main() {     cin >> a;     long long l = 1, r = 1e18;     long long ans =         (((9 * (5 * (9 * (2 * (long long)1e17) % a) % a) % a) % a) + 1) % a;     cout << l + (a - ans) <<     << r + (a - ans) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int task;     scanf( %d , &task);     while (task--) {       int n, p;       scanf( %d%d , &n, &p);       int rest(2 * n + p);       for (int i = 1; (i <= n) && rest; i++)         for (int j = i + 1; (j <= n) && rest; j++)           printf( %d %d n , i, j), rest--;     }     return 0;   }
#include <bits/stdc++.h>   const long long max9 = 10 + 1e9, max6 = 10 + 1e6, max12 = 10 + 1e12,                   max15 = 10 + 1e15;   const long long min6 = -1 * max6, min9 = -1 * max9, min12 = -1 * max12,                   min15 = -1 * max15;   const long long R = 7 + 1e9, NN = 10 + 1e5;   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n;     long long k;     cin >> n >> k;     long long mn = n * (n + 1);     mn /= 2;     long long nn = n / 2 - 1, mx = 2 * (nn + 1) * n - nn * (nn + 1);     if (n % 2) mx += nn + 2;     if (k < mn) {       cout << -1;       return 0;     }     if (k >= mx) {       cout << mx << endl;       for (int i = (0); i < (n); ++i) cout << i + 1 <<    ;       cout << endl;       for (int i = (0); i < (n); ++i) cout << n - i <<    ;       return 0;     }     vector<int> a(n);     long long l = 0, last = n;     for (int i = (0); i < (n); ++i) a[i] = i + 1;     long long ben = k - mn;     for (int i = (0); i < (n / 2); ++i) {       if (ben == 0) break;       long long test = a[i] + ben;       if (test > last) {         a[i] = last;         a[last - 1] = i + 1;         ben -= last - i - 1;         last--;       } else {         a[i] = test;         a[test - 1] = i + 1;         break;       }     }     long long sum = 0;     for (int i = (0); i < (n); ++i) sum += max(i + 1, a[i]);     cout << sum << endl;     for (int i = (0); i < (n); ++i) cout << i + 1 <<    ;     cout << endl;     for (int i = (0); i < (n); ++i) cout << a[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:167772160 )   int comp(const void* a, const void* b) {     return (*(long long*)a) - (*(long long*)b);   }   int main() {     int n;     long long mas[300000], ans(0);     scanf( %d , &n);     for (int i(0); i < n; ++i) scanf( %I64d , &mas[i]);     qsort(mas, n, sizeof(long long), comp);     for (int i(0); i < n; ++i) ans += mas[i] * (2 + i);     ans -= mas[n - 1];     printf( %I64d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[105];   int main() {     int n, m, i, l, r;     char ch1, ch2;     cin >> n >> m;     cin >> (s + 1);     while (m--) {       cin >> l >> r >> ch1 >> ch2;       for (i = l; i <= r; i++)         if (s[i] == ch1) s[i] = ch2;     }     cout << (s + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string a[100], b[100];   map<string, int> m;   int n, s;   int main(void) {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       cin >> a[i];       m[a[i]]++;     }     for (int i = 0; i < n; i++) {       cin >> b[i];       m[b[i]]--;     }     s += abs(m[ S ]);     s += abs(m[ M ]);     s += abs(m[ L ]);     s += abs(m[ XS ]);     s += abs(m[ XXS ]);     s += abs(m[ XXXS ]);     s += abs(m[ XL ]);     s += abs(m[ XXL ]);     s += abs(m[ XXXL ]);     cout << s / 2;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.tie(0);     ios::sync_with_stdio(0);     cout << fixed;     cout << setprecision(12);     long long n1, n2;     cin >> n1 >> n2;     long long a[n1], b[n2], cnt1[10] = {0}, cnt2[10] = {0};     for (long long i = 0; i < n1; i++) {       cin >> a[i];       cnt1[a[i]]++;     }     for (long long i = 0; i < n2; i++) {       cin >> b[i];       cnt2[b[i]]++;     }     for (long long i = 0; i < 10; i++)       if (cnt1[i] != 0 && cnt2[i] != 0) {         cout << i;         return 0;       }     sort(a, a + n1);     sort(b, b + n2);     cout << min(a[0] * 10 + b[0], b[0] * 10 + a[0]);     return 0;   }   void setprime(bool isprime[], long long n) {     for (long long i = 0; i < n; i++) isprime[i] = true;     isprime[0] = false;     isprime[1] = false;     for (long long i = 2; i < n; i++) {       for (long long j = 2; i * j < n; j++) isprime[i * j] = false;     }   }   long long BinarySearch(long long arr[], long long first, long long last,                          long long search) {     long long middle = (first + last) / 2;     while (first <= last) {       if (arr[middle] < search) {         first = middle + 1;       } else if (arr[middle] == search) {         return middle;       } else {         last = middle - 1;       }       middle = (first + last) / 2;     }     if (first > last) {       return -1;     }   }   long long choose(long long n, long long k) {     if (k == 0) return 1;     return (n * choose(n - 1, k - 1)) / k;   }   void showArray(long long a[], long long n) {     for (long long i = 0; i < n; i++) {       cout << a[i] <<    ;     }     cout << endl;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }
#include <bits/stdc++.h>   using namespace std;   long long N;   long long x, y, x2, y2;   pair<int, int> v[100010];   bool Can(long long n) {     long long Rem = n % N;     long long Count = n / N;     long long X = v[Rem].first + (v[N].first * Count);     long long Y = v[Rem].second + (v[N].second * Count);     return ((abs(x2 - (X + x)) + abs(y2 - (Y + y))) <= n);   }   void Solve() {     cin >> x >> y;     cin >> x2 >> y2;     cin >> N;     string s;     cin >> s;     long long X = 0, Y = 0;     for (long long i = 0; i < N; ++i) {       if (s[i] ==  U ) {         Y++;       } else if (s[i] ==  D ) {         Y--;       } else if (s[i] ==  L ) {         X--;       } else if (s[i] ==  R ) {         X++;       }       v[i + 1] = make_pair(X, Y);     }     long long ans = -1;     long long low = 0, high = (1100000000000000000ll);     while (low <= high) {       long long mid = (low + high) / 2;       if (Can(mid)) {         high = mid - 1;         ans = mid;       } else {         low = mid + 1;       }     }     cout << ans << endl;   }   int main() {     ios::sync_with_stdio(NULL);     cin.tie(NULL);     cout.tie(NULL);     int t = 1;     while (t--) Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 500;   bool vis[3][MAXN];   char g[3][MAXN];   pair<int, int> que[MAXN * 3];   int n, k;   inline void init() {     memset(g, 0, sizeof(g));     memset(vis, false, sizeof(vis));     scanf( %d%d , &n, &k);     for (int i = 0; i < 3; i++) scanf( %s , g[i]);   }   inline bool BFS() {     int begin = 0, end = 0;     for (int i = 0; i < 3; i++)       if (g[i][0] ==  s ) que[end++] = pair<int, int>(i, 0);     while (begin != end) {       int ux = que[begin].first, uy = que[begin].second;       begin++;       if (uy >= n) return true;       if (!isupper(g[ux][uy + 1])) {         if (ux + 1 < 3 && !vis[ux + 1][uy + 3] && !isupper(g[ux + 1][uy + 1]) &&             !isupper(g[ux + 1][uy + 2]) && !isupper(g[ux + 1][uy + 3]))           que[end++] = pair<int, int>(ux + 1, uy + 3), vis[ux + 1][uy + 3] = true;         if (ux - 1 >= 0 && !vis[ux - 1][uy + 3] && !isupper(g[ux - 1][uy + 1]) &&             !isupper(g[ux - 1][uy + 2]) && !isupper(g[ux - 1][uy + 3]))           que[end++] = pair<int, int>(ux - 1, uy + 3), vis[ux - 1][uy + 3] = true;         if (!vis[ux][uy + 3] && !isupper(g[ux][uy + 2]) &&             !isupper(g[ux][uy + 3]))           que[end++] = pair<int, int>(ux, uy + 3), vis[ux][uy + 3] = true;       }     }     return false;   }   int main(void) {     int t;     scanf( %d , &t);     while (t--) {       init();       printf( %s n , BFS() ?  YES  :  NO );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int t = 1;     while (t--) {       long long int i, j, k = 0, n, m;       cin >> n >> m;       vector<long long int> a(n);       for (i = 0; i < n; i++) {         long long int x, y;         cin >> x >> y;         k += x * y;         a[i] = k;       }       while (m--) {         cin >> k;         cout << (lower_bound(a.begin(), a.end(), k) - a.begin() + 1) <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long f(long long x) {     long long res;     res = x * x;     return res;   }   void solve() {     long long a[3];     cin >> a[0] >> a[1] >> a[2];     sort(a, a + 3);     long long d;     d = (long long)(sqrt(f(a[2]) + f(a[1] - a[0])));     d = d + 1;     cout << d <<   n ;   }   int main() {     long long t;     cin >> t;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;      #define Int long long      const int mxN = 2e5 + 5;      int main()   {       ios_base::sync_with_stdio(false);       cin.tie(0);       int t = 1;       cin >> t;       while(t--){           Int n;           cin >> n;           while(n % 11 != 0 && n > 10)n -= 111;           if(n >= 0 && n % 11 == 0)cout <<  YES  << endl;           else cout <<  NO  << endl;          }   }
#include <bits/stdc++.h>   using namespace std;   long long exp(long long a, long long b, long long p) {     if (b == 0) return 1;     if (b % 2) return a * exp(a, b - 1, p) % p;     return exp(a * a % p, b / 2, p);   }   long long inv[1000009], E[1000009];   int main() {     long long a, b, p, x;     cin >> a >> b >> p >> x;     vector<long long> v;     for (int i = 1; i <= p; i++) {       if ((p - 1) % i == 0) v.push_back(i);     }     long long on;     for (int j = 0; j < v.size(); j++) {       if (exp(a, v[j], p) == 1) {         on = v[j];         break;       }     }     for (int i = 1; i <= p; i++) {       inv[i] = exp(i, p - 2, p);     }     long long ans = 0;     for (int i = 1; i <= on; i++) {       long long E = exp(a, i, p);       long long N = inv[E] * b % p;       long long y = (N - i + p) * inv[on] % p;       long long m = i + y * on;       long long M = p * on;       if (x % M >= m)         ans += x / M + 1;       else         ans += x / M;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1000000;   int f[35][35][55];   int gao(int x, int y, int z) {     if (f[x][y][z] > 0) return f[x][y][z];     if (z == 0) return f[x][y][z] = 0;     if (x * y < z) return f[x][y][z] = inf;     if (x * y == z) return f[x][y][z] = 0;     int now = inf;     for (int i = 1; i <= z; i++) {       int cnt = inf;       for (int j = 1; j < x; j++)         cnt = min(cnt, gao(j, y, i) + gao(x - j, y, z - i) + y * y);       for (int j = 1; j < y; j++)         cnt = min(cnt, gao(x, j, i) + gao(x, y - j, z - i) + x * x);       now = min(now, cnt);     }     return f[x][y][z] = now;   }   int main() {     int T;     scanf( %d , &T);     while (T--) {       int n, m, k;       scanf( %d%d%d , &n, &m, &k);       printf( %d n , gao(n, m, k));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     int m;     cin >> n >> m;     bool ans[m + 1];     for (int i = 0; i <= m; i++) {       ans[i] = false;     }     int a[n];     vector<pair<int, int> > v;     for (int i = 0; i < n; i++) {       int a;       int b;       cin >> a;       cin >> b;       v.push_back(make_pair(a, b));     }     for (int i = 0; i < n; i++) {       int start = v[i].first;       int end = v[i].second;       for (int j = start; j <= end; j++) {         if (ans[j] == false) ans[j] = true;       }     }     vector<int> final;     int result = 0;     for (int i = 1; i <= m; i++) {       if (ans[i] == false) {         final.push_back(i);         result++;       }     }     cout << result << endl;     for (int i = 0; i < final.size(); i++) {       cout << final[i] <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   const double pi = 3.1415926535897932384626433832795028841971;   long long fb[100100], fa[100100];   long long k[100100], a[100100], b[100100];   int main() {     ios::sync_with_stdio(0);     cin.tie();     cout.tie();     long long n, s, sum = 0, ans = 0, ka = 0, kb = 0;     cin >> n >> s;     for (int i = 0; i < (n); i++) {       cin >> k[i] >> a[i] >> b[i];       if (a[i] >= b[i]) {         fa[a[i] - b[i]] += k[i];         ka += k[i];       }       if (a[i] <= b[i]) {         fb[b[i] - a[i]] += k[i];         kb += k[i];       }       sum += k[i];       ans += k[i] * max(a[i], b[i]);     }     long long ks = (sum + s - 1) / s;     if (((ka + s - 1) / s) + ((kb + s - 1) / s) == ks) {       cout << ans;       return 0;     }     kb %= s;     ka %= s;     long long sum1 = 0, sum2 = 0;     for (long long i = 0; i < 100010; i++) {       if (ka > 0) {         sum1 += i * min(ka, fa[i]);         ka -= min(ka, fa[i]);       }       if (kb > 0) {         sum2 += i * min(kb, fb[i]);         kb -= min(kb, fb[i]);       }     }     cout << ans - min(sum1, sum2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char buf[2000];   int dx[4] = {0, 0, -1, 1};   int dy[4] = {-1, 1, 0, 0};   int n, m;   pair<int, int> tbl1[1 << 23];   pair<int, int> tbl2[1 << 23];   const int Prime1 = 262139, Prime2 = 40999999;   const int Prime3 = 100003, Prime4 = 40999799;   const pair<int, int> ZERO = make_pair(0, 0);   bool ex(int x, int y) {     int t1 = x * Prime1 + y * Prime2;     int t2 = x * Prime3 + y * Prime4;     t1 = abs(t1);     t1 %= ((1 << 23) - 1);     t2 = abs(t2);     t2 %= ((1 << 23) - 1);     while (tbl1[t1] != ZERO && tbl1[t1] != make_pair(x, y))       t1 = (t1 + 1) % (1 << 23);     if (tbl1[t1] == make_pair(x, y)) return false;     tbl2[t2] = tbl1[t1] = make_pair(x, y);     return true;   }   int main() {     cin >> n >> m;     vector<string> a;     for (int i = (0); i < (n); ++i) {       string s;       scanf( %s , buf);       s = buf;       a.push_back(s);     }     pair<int, int> start;     for (int i = (0); i < (n); ++i) {       for (int j = (0); j < (m); ++j)         if (a[i][j] ==  S ) start = make_pair(i, j);     }     queue<pair<int, int> > q;     q.push(start);     ex(start.first, start.second);     int k = 0;     while (!q.empty()) {       if (k > n * m) {         cout <<  Yes n ;         return 0;       }       pair<int, int> v = q.front();       q.pop();       for (int i = (0); i < (4); ++i) {         int x = v.first + dx[i];         int y = v.second + dy[i];         int _x = (x % n + n) % n;         int _y = (y % m + m) % m;         if (a[_x][_y] !=  #  && ex(x, y)) {           k++;           q.push(make_pair(x, y));         }       }     }     cout <<  No n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int a;     cin >> a;     while (1) {       long long int t = a;       long long int su = 0;       while (t > 0) {         su += t % 10;         t /= 10;       }       if (su % 4 == 0) {         cout << a;         return 0;       }       a++;     }   }
#include <bits/stdc++.h>   using namespace std;   struct MinTreeNode {     int min;     int count;   };   int n;   MinTreeNode tmin[200000];   int tgcd[200000];   int gcd(int a, int b) {     if (a == 0) {       return b;     }     if (b == 0) {       return a;     }     if (a == 1 || b == 1) {       return 1;     }     if (a % 2 == 0) {       if (b % 2 == 0) {         return 2 * gcd(a / 2, b / 2);       } else {         return gcd(a / 2, b);       }     } else {       if (b % 2 == 0) {         return gcd(a, b / 2);       } else {         return gcd(min(a, b), max(a, b) - min(a, b));       }     }   }   void buildGcdTree() {     for (int i = n - 1; i >= 1; --i) {       tgcd[i] = gcd(tgcd[i << 1], tgcd[i << 1 | 1]);     }   }   void buildMinTree() {     for (int i = n - 1; i >= 1; --i) {       if (tmin[i << 1].min < tmin[i << 1 | 1].min) {         tmin[i] = tmin[i << 1];       } else {         if (tmin[i << 1].min > tmin[i << 1 | 1].min) {           tmin[i] = tmin[i << 1 | 1];         } else {           tmin[i].min = tmin[i << 1].min;           tmin[i].count = tmin[i << 1].count + tmin[i << 1 | 1].count;         }       }     }   }   MinTreeNode minAndCount(int l, int r) {     MinTreeNode result;     result.min = 2000000000;     result.count = 0;     for (l += n, r += n; l < r; l >>= 1, r >>= 1) {       if (l & 1) {         if (result.min == tmin[l].min) {           result.count += tmin[l].count;         } else {           if (result.min > tmin[l].min) {             result = tmin[l];           }         }         ++l;       }       if (r & 1) {         --r;         if (result.min == tmin[r].min) {           result.count += tmin[r].count;         } else {           if (result.min > tmin[r].min) {             result = tmin[r];           }         }       }     }     return result;   }   int gcdOfInterval(int l, int r) {     int result = 0;     for (l += n, r += n; l < r; l >>= 1, r >>= 1) {       if (l & 1) {         result = gcd(result, tgcd[l++]);       }       if (r & 1) {         result = gcd(result, tgcd[--r]);       }     }     return result;   }   int elementsThatDivideIntervalCount(int l, int r) {     int g = gcdOfInterval(l, r);     MinTreeNode m = minAndCount(l, r);     if (m.min == g) {       return m.count;     } else {       return 0;     }   }   int main(int argc, char** argv) {     ios::sync_with_stdio(0);     cin >> n;     for (int i = n; i < 2 * n; ++i) {       int s;       cin >> s;       tgcd[i] = s;       tmin[i].min = s;       tmin[i].count = 1;     }     buildMinTree();     buildGcdTree();     int t;     cin >> t;     for (int i = 0; i < t; ++i) {       int l, r;       cin >> l >> r;       --l;       cout << r - l - elementsThatDivideIntervalCount(l, r) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long int> v;   vector<long long int> v1;   vector<long long int> v2;   const long long int inf = 100000000000005;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n;     cin >> n;     for (int i = 1; i < n; i++) cout << i + 1 <<    ;     cout << 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int p[] = {0, 5, 7, 5};   int main() {     for (int k = 1; k <= 3; k++) {       string s;       getline(cin, s);       int tot = 0;       for (int i = 0; i < s.size(); i++)         if (s[i] ==  a  || s[i] ==  e  || s[i] ==  i  || s[i] ==  o  ||             s[i] ==  u )           tot++;       if (tot != p[k]) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     return 0;   }