malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void OUT_TST(string s, istream_iterator<string> it) { cerr << s; }   template <typename T, typename... Args>   void OUT_TST(string s, istream_iterator<string> it, T a, Args... args) {     cerr << *it <<  =  << a <<    ;     OUT_TST(s, ++it, args...);   }   template <class T>   void rd(T& ret) {     ret = 0;     bool ok = 0, u = 0;     for (;;) {       int c = getchar();       if (c >=  0  && c <=  9 )         ret = (ret << 3) + (ret << 1) + c -  0 , ok = 1;       else if (c ==  - )         u = 1;       else if (ok) {         if (u) ret *= -1;         return;       }     }   }   long long powmod(long long p, long long n, long long mod) {     long long ret = 1;     for (; n; n >>= 1) {       if (n & 1) ret = ret * p % mod;       p = p * p % mod;     }     return ret;   }   template <class T>   bool chmin(T& a, const T& b) {     return b < a ? a = b, 1 : 0;   }   template <class T>   bool chmax(T& a, const T& b) {     return b > a ? a = b, 1 : 0;   }   int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }   const int INF = (int)1e8;   void input(vector<vector<int>>& son, vector<int>& an, vector<int>& sz, int n) {     int m;     cin >> m;     son.resize(m);     an.resize(m, -1);     sz.resize(m, 0);     for (int i = 0; i < m - 1; ++i) {       int t;       cin >> t;       --t;       son[t].push_back(i + 1);     }     for (int i = 0; i < n; ++i) {       int t;       cin >> t;       --t;       an[t] = i;     }   }   pair<int, int> dfs(int first, const vector<vector<int>>& son,                      const vector<int>& idx, vector<vector<pair<int, int>>>& cost,                      vector<int>& sz) {     sz[first] = 1;     if (idx[first] != -1) {       cost[idx[first]].emplace_back(idx[first], 1);       return {idx[first], idx[first]};     }     int mi = INF, mx = -INF;     pair<int, int> tmp;     for (int second : son[first]) {       tmp = dfs(second, son, idx, cost, sz);       sz[first] += sz[second];       chmin(mi, tmp.first);       chmax(mx, tmp.second);     }     int c = sz[first];     if (first == 0) --c;     cost[mi].emplace_back(mx, c);     return {mi, mx};   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(nullptr);     int n;     cin >> n;     vector<int> an, bn, sza, szb;     vector<vector<int>> sa, sb;     input(sa, an, sza, n);     input(sb, bn, szb, n);     vector<vector<pair<int, int>>> cost(n);     auto tmp = dfs(0, sa, an, cost, sza);     assert(tmp.first == 0 && tmp.second == n - 1);     tmp = dfs(0, sb, bn, cost, szb);     assert(tmp.first == 0 && tmp.second == n - 1);     vector<int> dp(n + 1, 0);     for (auto& i : cost[0]) {       chmax(dp[i.first], i.second);     }     for (int i = 0; i < n - 1; ++i) {       chmax(dp[i + 1], dp[i]);       for (auto& j : cost[i + 1]) {         chmax(dp[j.first], dp[i] + j.second);       }     }     cout << dp[n - 1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<char, long long int>> vp(4000005);   void ans(vector<long long int> dp, vector<long long int> star, long long int x,            vector<pair<char, long long int>> &vp, long long int n,            long long int &flag) {     if (x <= 1) {       return;     }     long long int starpos = upper_bound((dp).begin(), (dp).end(), x) - dp.begin();     x -= dp[starpos - 1];     if (x == 0) {       for (long long int i = star[starpos - 1]; i < n; i++) {         if (vp[i].first ==  * ) {           vp[i].first =  b ;         }       }     } else {       for (long long int i = star[starpos]; i < n; i++) {         while (i < n && vp[i].first ==  * ) {           vp[i].first =  b ;           i++;         }         break;       }       ans(dp, star, x, vp, n, flag);     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int T = 1;     cin >> T;     while (T--) {       long long int n, k, x;       cin >> n >> k >> x;       string s;       cin >> s;       string b =   ;       for (long long int i = 0; i < k; i++) {         b +=  b ;       }       long long int cnt = 0;       for (long long int i = 0; i < n; i++) {         if (s[i] ==  * ) {           long long int t = cnt;           for (long long int j = cnt; j < t + k; j++) {             vp[cnt] = { * , cnt};             cnt++;           }         } else {           vp[cnt] = { a , cnt};           cnt++;         }       }       s.clear();       s =   ;       for (long long int i = 0; i < cnt; i++) {         s += vp[i].first;       }       vector<long long int> dp;       vector<long long int> star;       star.push_back(-1);       dp.push_back(1);       long long int prev = 1;       long long int curr = 1;       long long int flag1 = 1;       for (long long int i = cnt - 1; i >= 0 && flag1; i--) {         long long int flag = 0;         while (i >= 0 && vp[i].first ==  * ) {           if (x < (curr + 1) * 1ll * prev) {             dp.push_back((curr + 1) * 1ll * prev);             star.push_back(i);             flag1 = 0;             break;           }           dp.push_back((curr + 1) * 1ll * prev);           star.push_back(i);           i--;           curr++;           flag = 1;         }         if (flag) {           prev = curr * prev;           curr = 1;         }       }       long long int flag = 1;       ans(dp, star, x, vp, cnt, flag);       for (long long int i = 0; i < cnt; i++) {         if (vp[i].first ==  * ) continue;         cout << vp[i].first;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   int main() {     int t;     cin >> t;     for (int tc = 0; tc < t; tc++) {       long long a, b, c, d;       cin >> a >> b >> c >> d;       int temp = 1;       if (a % 2) {         temp *= -1;       }       if (b % 2) {         temp *= -1;       }       if (temp == 1) {         cout <<  Tidak Tidak  ;         if (b > 0 || c > 0) {           cout <<  Ya  ;         } else {           cout <<  Tidak  ;         }         if (a > 0 || d > 0) {           cout <<  Ya  << endl;         } else {           cout <<  Tidak  << endl;         }       } else {         if (a > 0 || d > 0) {           cout <<  Ya  ;         } else {           cout <<  Tidak  ;         }         if (b > 0 || c > 0) {           cout <<  Ya  ;         } else {           cout <<  Tidak  ;         }         cout <<  Tidak Tidak  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 5 * (1e5 + 5);   vector<int> e[MAX];   vector<int> ice[MAX];   int n, m;   int ans[MAX];   bool vis[MAX];   int cnt;   void dfs(int now, int pre) {     int len = ice[now].size();     for (int i = 0; i <= len; i++) vis[i] = 0;     for (int i = 0; i < len; i++)       if (ans[ice[now][i]]) vis[ans[ice[now][i]]] = 1;     int f = 1;     for (int i = 0; i < len; i++)       if (!ans[ice[now][i]]) {         int t = ice[now][i];         while (vis[f]) f++;         ans[t] = f++;       }     for (int i = 0; i < e[now].size(); i++)       if (e[now][i] != pre) dfs(e[now][i], now);   }   int main() {     cin >> n >> m;     int mx = 0;     for (int i = 1; i <= n; i++) {       int u, g;       scanf( %d , &u);       mx = max(mx, u);       for (int j = 1; j <= u; j++) {         scanf( %d , &g);         ice[i].push_back(g);       }     }     for (int i = 1; i <= n - 1; i++) {       int x, y;       scanf( %d%d , &x, &y);       e[x].push_back(y);       e[y].push_back(x);     }     dfs(1, -1);     if (mx)       printf( %d n , mx);     else       printf( 1 n );     if (ans[1])       printf( %d , ans[1]);     else       printf( 1 );     for (int i = 2; i <= m; i++) {       if (ans[i])         printf(  %d , ans[i]);       else         printf(  1 );     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   int n, nxt[100005], fa[100005];   int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }   int main(void) {     scanf( %d , &n);     if (n % 2) {       puts( -1 );       return 0;     }     for (int i = 0; i <= n; i++) fa[i] = i;     for (int i = 0; i < (n / 2); i++) {       int j = i + (n / 2);       nxt[i] = i * 2, nxt[j] = i * 2 + 1;       fa[find(i)] = find((i * 2) % n);       fa[find(j)] = find((i * 2 + 1) % n);     }     for (int i = 0; i < (n / 2); i++) {       int j = i + (n / 2);       if (find(i) != find(j)) {         nxt[i] ^= nxt[j] ^= nxt[i] ^= nxt[j];         fa[find(i)] = find(j);       }     }     int x = 0;     for (int i = 0; i <= n; i++) printf( %d  , x), x = nxt[x];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a;     cin >> n >> a;     vector<int> m(n);     for (int i = 0; i < n; i++) cin >> m[i];     n--;     a--;     int calc = 0;     if (m[a]) calc++;     for (int j = 1; j <= max(n - a, a); j++) {       if (a - j < 0) {         if (m[a + j]) calc++;         continue;       }       if (a + j > n) {         if (m[a - j]) calc++;         continue;       }       if (m[a + j] && m[a - j]) calc += 2;     }     cout << calc;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int arities[100001];   int legs[100001];   bool markers[100001];   list<int> graph[100001];   void parse() {     int a, b;     cin >> n;     for (int it = 0; it < (100001); it++) {       (arities)[it] = (0);     };     for (int it = 0; it < (100001); it++) {       (markers)[it] = (false);     };     for (int it = 0; it < (100001); it++) {       (legs)[it] = (0);     };     for (int i = 1; i < n; i++) {       cin >> a >> b;       graph[a].push_back(b);       graph[b].push_back(a);       arities[a]++;       arities[b]++;     }   }   void traverse(int i) {     if (markers[i]) return;     if (arities[i] >= 3) {       legs[i]++;       return;     }     markers[i] = true;     for (list<int>::iterator it = graph[i].begin(); it != graph[i].end(); ++it) {       traverse(*it);     }   }   void solve() {     for (int i = 1; i <= n; i++) {       if (arities[i] == 1) traverse(i);     }     for (int i = 1; i <= n; i++) {       if (!markers[i]) {         int r = 0;         for (list<int>::iterator it = graph[i].begin(); it != graph[i].end();              ++it) {           if (!markers[*it] && arities[*it] - min(legs[*it], 2) > 1) r++;         }         if (r > 2) {           cout <<  No ;           return;         }       }     }     cout <<  Yes ;   }   int main() {     ios::sync_with_stdio(false);     std::cout.precision(11);     parse();     solve();     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char stra[110];   char strb[110];   int mark[110];   int g[11000];   int main() {     int b, d;     scanf( %d%d , &b, &d);     scanf( %s , stra);     scanf( %s , strb);     int lena = strlen(stra);     int lenb = strlen(strb);     memset(mark, -1, sizeof(mark));     mark[0] = 0;     int pos = 0;     int key = 0;     int cnt = 0;     int num = 0;     for (int ii = 1; ii <= 1000; ii++) {       int sum = 0;       for (int i = 0; i < lena; i++) {         if (stra[i] == strb[pos]) {           pos++;           if (pos == lenb) {             sum++;             pos = 0;           }         }       }       g[ii] = sum;       if (mark[pos] == -1)         mark[pos] = ii;       else {         key = mark[pos];         cnt = ii - key;         for (int ti = key + 1; ti <= ii; ti++) num += g[ti];         break;       }     }     int ans = 0;     if (b <= key) {       for (int i = 1; i <= b; i++) ans += g[i];     } else {       int tb = (b - key) / cnt;       int tt = (b - key) - tb * cnt;       for (int i = 1; i <= key; i++) ans += g[i];       ans += tb * num;       for (int i = key + 1; i <= key + tt; i++) ans += g[i];     }     printf( %d n , ans / d);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   unordered_map<long long, string> Map;   unordered_map<long long, string>::iterator it;   string Get(long long x) {     string ans =   ;     int s[13], cnt = 0;     while (x) {       s[++cnt] = x % 10;       x /= 10;     }     for (int i = cnt; i >= 1; i--) ans += char(s[i] +  0 );     return ans;   }   int main() {     long long n;     scanf( %lld , &n);     long long len = sqrt(n);     for (long long i = 2; i <= len; i++) {       for (long long j = i * i, k = 2; j <= n; j *= i, k++) {         string gg = Get(i) +  ^  + Get(k);         if (gg.size() >= Get(j).size()) continue;         if (Map[j].size() == 0) {           Map[j] = gg;         } else if (Map[j].size() > gg.size())           Map[j] = gg;       }     }     string ans = Get(n);     for (it = Map.begin(); it != Map.end(); it++) {       long long k = (*it).first;       string gg = (*it).second;       if (n / k >= 2) {         gg +=  * ;         gg += (Map.count(n / k)) ? Map[n / k] : Get(n / k);       }       if (n % k) {         gg +=  + ;         gg += (Map.count(n % k)) ? Map[n % k] : Get(n % k);       }       if (ans.size() > gg.size()) ans = gg;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e3 + 13;   const int INF = 1e6 + 7;   int t[MAXN][MAXN];   int tab[MAXN * MAXN];   bool odw[MAXN * MAXN];   int wyn[MAXN * MAXN];   bool prze[MAXN * MAXN];   int xx[4] = {0, 0, -1, 1};   int yy[4] = {-1, 1, 0, 0};   vector<int> v[MAXN * MAXN];   int check(int x) {     int spr = 0;     odw[x] = true;     prze[x] = true;     for (auto it : v[x]) {       if (odw[it] && prze[it])         spr = 1;       else if (!odw[it])         spr = max(spr, check(it));     }     prze[x] = false;     return spr;   }   int DFS(int x, int gl) {     odw[x] = true;     for (auto it : v[x]) {       if (odw[it])         wyn[x] = max(wyn[x], wyn[it]);       else         wyn[x] = max(wyn[x], DFS(it, gl + 1));     }     wyn[x]++;     return wyn[x];   }   int main() {     int n, m;     int mx = 0;     char c;     scanf( %d %d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf(   );       for (int j = 1; j <= m; j++) {         scanf( %c , &c);         if (c ==  I ) t[i][j] = 1;         if (c ==  M ) t[i][j] = 2;         if (c ==  A ) t[i][j] = 3;         tab[(i - 1) * m + j] = t[i][j];       }       t[i][0] = t[i][m + 1] = 5;     }     for (int i = 1; i <= m; i++) t[0][i] = t[n + 1][i] = 5;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         for (int l = 0; l < 4; l++) {           if (t[i + xx[l]][j + yy[l]] == (t[i][j] + 1) % 4)             v[(i - 1) * m + j].push_back((i + xx[l] - 1) * m + j + yy[l]);         }       }     }     for (int i = 1; i <= n * m; i++) {       if (!odw[i] && tab[i] == 0) {         if (check(i) == 1) {           printf( Poor Inna! );           return 0;         }       }     }     for (int i = 1; i <= n * m; i++) odw[i] = false;     for (int i = 1; i <= n * m; i++) {       if (!odw[i] && tab[i] == 0) mx = max(mx, DFS(i, 1) / 4);     }     if (mx == 0)       printf( Poor Dima! );     else       printf( %d , mx);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   pair<int, int> a[100003];   int l = 0;   bool lios(string s) {     if (s.size() < 4) return false;     if (s.substr(s.size() - 4, 4) ==  lios ) return true;     return false;   }   bool liala(string s) {     if (s.size() < 5) return false;     if (s.substr(s.size() - 5, 5) ==  liala ) return true;     return false;   }   bool etr(string s) {     if (s.size() < 3) return false;     if (s.substr(s.size() - 3, 3) ==  etr ) return true;     return false;   }   bool etra(string s) {     if (s.size() < 4) return false;     if (s.substr(s.size() - 4, 4) ==  etra ) return true;     return false;   }   bool initis(string s) {     if (s.size() < 6) return false;     if (s.substr(s.size() - 6, 6) ==  initis ) return true;     return false;   }   bool inites(string s) {     if (s.size() < 6) return false;     if (s.substr(s.size() - 6, 6) ==  inites ) return true;     return false;   }   bool adj, n, v;   int main() {     while (cin >> s) {       a[l].first = -1, a[l].second = -1;       if (lios(s)) {         a[l++] = pair<int, int>{0, 0};         continue;       }       if (liala(s)) {         a[l++] = pair<int, int>{0, 1};         continue;       }       if (etr(s)) {         a[l++] = pair<int, int>{1, 0};         continue;       }       if (etra(s)) {         a[l++] = pair<int, int>{1, 1};         continue;       }       if (initis(s)) {         a[l++] = pair<int, int>{2, 0};         continue;       }       if (inites(s)) {         a[l++] = pair<int, int>{2, 1};         continue;       }       l++;     }     if (l == 1 && a[0].first != -1) {       cout <<  YES ;       return 0;     }     for (int i = 0; i < l; i++) {       if (a[i].first == -1) {         cout <<  NO ;         return 0;       }       if (i == 0)         ;       else {         if (a[i].second != a[i - 1].second) {           cout <<  NO ;           return 0;         }       }       if (a[i].first == 0) {         if (n || v) {           cout <<  NO ;           return 0;         }         adj = 1;         continue;       }       if (a[i].first == 1) {         if (n || v) {           cout <<  NO ;           return 0;         }         n = 1;         continue;       }       if (a[i].first == 2) {         if (!n) {           cout <<  NO ;           return 0;         }         v = 1;         continue;       }     }     if (!n)       cout <<  NO ;     else       cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e15;   long long binpow(long long a, long long b) {     long long res = 1;     while (b > 0) {       if (b & 1) {         res = res * a;       }       a = a * a;       b >>= 1;     }     return res;   }   long long dp[205][205][205];   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long T;     T = 1;     while (T--) {       long long n, k;       string s, t;       cin >> n >> k;       cin >> s >> t;       memset(dp, -1, sizeof(dp));       dp[0][0][0] = 0;       long long i, j;       for (i = 0; i < n; i++) {         for (j = 0; j <= k; j++) {           for (long long f0 = 0; f0 <= n; f0++) {             if (dp[i][j][f0] == -1) {               continue;             }             long long e0 = s[i] == t[0];             long long e1 = s[i] == t[1];             long long e01 = t[0] == t[1];             dp[i + 1][j][f0 + e0] =                 max(dp[i + 1][j][f0 + e0], dp[i][j][f0] + (e1 ? f0 : 0));             if (j + 1 <= k)               dp[i + 1][j + 1][f0 + 1] =                   max(dp[i + 1][j + 1][f0 + 1], dp[i][j][f0] + (e01 ? f0 : 0));             if (j + 1 <= k)               dp[i + 1][j + 1][f0 + e01] =                   max(dp[i + 1][j + 1][f0 + e01], dp[i][j][f0] + f0);           }         }       }       long long ans = 0;       for (j = 0; j <= k; j++) {         for (long long f0 = 0; f0 <= n; f0++) {           ans = max(ans, dp[n][j][f0]);         }       }       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int max_n = 1011, inf = 1000111222;   int n, a[max_n][max_n], x[max_n];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         scanf( %d , &a[i][j]);       }     }     long long val = 1LL * a[0][1] * a[0][2] / a[1][2];     x[0] = sqrtl(val);     while (1LL * x[0] * x[0] < val) {       ++x[0];     }     printf( %d  , x[0]);     for (int i = 1; i < n; ++i) {       printf( %d  , a[0][i] / x[0]);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int di[] = {-1, 0, 1, 0};   const int dj[] = {0, 1, 0, -1};   const long long MOD = 1e9 + 7;   const long long INF = 1e9;   const double EPS = 1e-11;   int main() {     ios::sync_with_stdio(false), cin.tie(0);     int n, q, c;     cin >> n >> q >> c;     vector<pair<int, int> > pos(n);     vector<int> s(n);     vector<vector<vector<int> > > cnt(         101, vector<vector<int> >(101, vector<int>(c + 1)));     for (int i = 0; i < n; ++i) {       cin >> pos[i].first >> pos[i].second >> s[i];       cnt[pos[i].first][pos[i].second][s[i]]++;     }     for (int i = 0; i < 101; ++i) {       for (int j = 0; j < 101; ++j) {         for (int k = 0; k < c + 1; ++k) {           if (i > 0) cnt[i][j][k] += cnt[i - 1][j][k];           if (j > 0) cnt[i][j][k] += cnt[i][j - 1][k];           if (i > 0 && j > 0) cnt[i][j][k] -= cnt[i - 1][j - 1][k];         }       }     }     while (q--) {       int t, x1, y1, x2, y2;       cin >> t >> x1 >> y1 >> x2 >> y2;       vector<vector<int> > cum(4, vector<int>(11));       cum[0] = cnt[x2][y2];       cum[1] = cnt[x2][y1 - 1];       cum[2] = cnt[x1 - 1][y1 - 1];       cum[3] = cnt[x1 - 1][y2];       vector<int> cur(11), cur2(11);       for (int i = 0; i < c + 1; ++i)         cur[i] = cum[0][i] - cum[1][i] - cum[3][i] + cum[2][i];       for (int i = 0; i < c + 1; ++i) cur2[(i + t) % (c + 1)] = cur[i];       int r = 0;       for (int i = 0; i < c + 1; ++i) r += i * cur2[i];       cout << r << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int t[200005], revt[200005];   int main() {     ios::sync_with_stdio(0);     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> t[i];       revt[t[i]]++;     }     int ans = 1;     for (int i = 0; i <= n; i++) ans += max(0, revt[i] - 1);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   int l[maxn];   int r[maxn];   int mx[maxn];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     long long ans = n;     for (int i = 1; i <= n; i++) {       cin >> l[i] >> r[i];     }     sort(l + 1, l + 1 + n);     sort(r + 1, r + 1 + n);     for (int i = 1; i <= n; i++) ans += max(r[i], l[i]);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   bool vowel(char a) {     a = toupper(a);     if ((a ==  A ) || (a ==  E ) || (a ==  I ) || (a ==  O ) || (a ==  U ))       return 1;     return 0;   }   long long int n, m, q, a, b, c, sum = 0, cnt = 0;   long long int arr[2000005];   map<long long int, bool> mp;   string s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> arr[i];       arr[i]--;     }     cin >> s;     long long int mn = 20000051, mx = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  0 ) {         if (arr[i] != i) {           cout <<  NO  << endl;           return 0;         }       } else if (s[i] ==  1 ) {         mn = 20000051, mx = 0;         int st = i;         mn = min(arr[i], mn);         mx = max(arr[i], mx);         while (i < n && s[i] ==  1 ) {           mn = min(arr[i + 1], mn);           mx = max(arr[i + 1], mx);           i++;         }         if (mn != st || mx != i) {           cout <<  NO  << endl;           return 0;         }         arr[i] = mx;       }     }     cout <<  YES  << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string a[6], b[6], c[6];     a[0] =  purple ;     b[0] =  Power ;     a[1] =  green ;     b[1] =  Time ;     a[2] =  blue ;     b[2] =  Space ;     a[3] =  orange ;     b[3] =  Soul ;     a[4] =  red ;     b[4] =  Reality ;     a[5] =  yellow ;     b[5] =  Mind ;     int n, i, j, k = 0, flag = 0;     int arr[6];     cin >> n;     for (i = 0; i < n; i++) cin >> c[i];     for (i = 0; i < n; i++) {       for (j = 0; j < 6; j++) {         if (c[i] == a[j]) {           arr[k] = j;           k++;         }       }     }     cout << 6 - n << endl;     for (i = 0; i < 6; i++) {       flag = 0;       for (k = 0; k < n; k++)         if (i == arr[k]) flag = 1;       if (flag == 0) cout << b[i] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     long long int cur = 1;     long long num = 1;     while (cur != n + 1) {       if (cur != 1)         cout << cur * 1ll * cur * 1ll * cur + 2 * cur * cur + 1;       else         cout << 2;       cout << endl;       cur++;     }     return 0;   }