malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5;   struct edge {     int x, y, w, p;     edge() {}     void input() { scanf( %d%d%d%d , &x, &y, &w, &p); }   } E[N], EE[N];   int n;   vector<int> G[N];   long long W[N], WW[N];   void dfs(int x, int y, int id, int mi) {     if (id) {       int tmp = EE[id].p - E[id].p;       tmp = min(mi, tmp);       E[id].p += tmp;       E[id].w += tmp;       mi = min(mi - tmp, E[id].p - (int)W[y]);       WW[id] = tmp;     }     for (int i = 0; i < G[y].size(); i++) {       int ID = G[y][i];       if (id == 0) mi = 2e9;       dfs(E[ID].x, E[ID].y, ID, mi);       mi -= WW[ID];       WW[id] += WW[ID];     }   }   void dfs(int x, int y, int id) {     for (int i = 0; i < G[y].size(); i++) {       int ID = G[y][i];       dfs(E[ID].x, E[ID].y, ID);     }     if (id == 0) return;     if (E[id].p < W[y]) {       puts( -1 );       exit(0);     }     long long tmp = min(E[id].p - W[y], (long long)E[id].w - 1);     E[id].p -= tmp;     E[id].w -= tmp;     W[x] += W[y];     W[x] += E[id].w;   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) {       E[i].input();       EE[i] = E[i];       G[E[i].x].push_back(i);     }     dfs(0, 1, 0);     dfs(0, 1, 0, 2e9);     cout << n << endl;     for (int i = 1; i < n; i++) {       printf( %d %d %d %d n , E[i].x, E[i].y, E[i].w, E[i].p);     }   }
#include <bits/stdc++.h>   using namespace std;   long long unsigned int n;   long long unsigned int val(long long unsigned int x, long long unsigned int k) {     if (x >= 1e10) return n + 1;     long long unsigned int ans = x * (x - 1);     ans /= 2;     long long unsigned int kt = k;     if (ans > n) return n + 1;     while (k--) {       x *= 2;       if (x > 1e19) return n + 1;     }     for (int i = 1; i <= kt; i++) {       ans = ans + x / 2;       if (ans > n) return n + 1;       x /= 2;     }     if (ans > n) return n + 1;     return ans;   }   long long unsigned int calc(long long unsigned int k) {     long long unsigned int lo = 0;     long long unsigned int hi = 1e10;     long long unsigned int mid;     while (hi - lo > 1) {       mid = (hi + lo) / 2;       if (val(2 * mid - 1, k) >= n)         hi = mid;       else         lo = mid;     }     if (val(2 * hi - 1, k) == n) {       return (2 * hi - 1) * (1LL << k);     }     return 0;   }   int main() {     cin >> n;     long long unsigned int g;     vector<long long unsigned int> ans;     for (int i = 0; i <= 60; i++) {       g = calc(i);       if (g != 0) ans.push_back(g);     }     sort(ans.begin(), ans.end());     for (auto x : ans) {       cout << x <<    ;     }     if (ans.size() == 0) cout << -1;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, t;     int n;     int a[100005];     int b[100005];     cin >> n;     for (i = 0; i < n; i++) {       cin >> a[i];       b[i] = a[i];     }     sort(a, a + n);     int cnt = 0;     for (i = 0; i < n; i++) {       if (a[i] != b[i]) cnt++;     }     if (cnt == 0 || cnt == 2)       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int st[200005];   int main() {     int tam1, tam2, i;     string s, t;     cin >> s >> t;     long long r = 0;     tam1 = s.size();     tam2 = t.size();     st[0] = 0;     for (i = 0; i < tam2; i++) {       st[i + 1] = st[i] + (t[i] -  0 );     }     for (i = 0; i < tam1; i++) {       if (s[i] ==  0 ) {         r += (st[tam2 - tam1 + i + 1] - st[i]);       } else {         r += (tam2 - tam1 + 1 - (st[tam2 - tam1 + i + 1] - st[i]));       }     }     cout << r << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[10];   char c[100007];   int main() {     scanf( %d , &n);     scanf( %s , &c);     for (int i = 0; i < n; i++) {       if (c[i] ==  L ) {         for (int j = 0; j < 10; j++) {           if (a[j] == 0) {             a[j] = 1;             break;           }         }       } else if (c[i] ==  R ) {         for (int j = 9; j >= 0; j--) {           if (a[j] == 0) {             a[j] = 1;             break;           }         }       } else {         a[c[i] -  0 ] = 0;       }     }     for (int i = 0; i <= 9; i++) {       printf( %d , a[i]);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int T;     cin >> T;     for (int t = 0; t < T; ++t) {       long long int n;       long long int a, b;       cin >> n >> a >> b;       string s;       cin >> s;       long long int bc = n * (a + b) + b;       bool ftram = true;       bool ztram = true;       long long int fzero = -1;       long long int nc = 0;       for (int i = 0; i < n; ++i) {         if (s[i] ==  0 ) {           if (!ztram) {             fzero = i;             ztram = true;           }         } else {           if (ztram) {             if (ftram) {               nc += a;               ftram = false;             } else {               nc += min(2 * a, (i - fzero - 1) * b);             }             ztram = false;             nc += b;           }           nc += b;         }       }       if (!ftram) nc += a;       cout << bc + nc << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   bool sortbysec(const pair<long long int, long long int> &a,                  const pair<long long int, long long int> &b) {     return (a.second < b.second);   }   int main() {     vector<pair<long long int, long long int>> v;     long long int n, m, k;     cin >> n >> m >> k;     long long int a[n];     for (long long int i = 0; i < n; i++) {       cin >> a[i];       v.push_back(make_pair(a[i], i));     }     sort(v.begin(), v.end());     reverse(v.begin(), v.end());     long long int beauty = 0;     for (long long int i = 0; i < m * k; i++) {       beauty += v[i].first;     }     cout << beauty <<   n ;     long long int j = 0, q = 0;     int pos[999999];     for (int i = 0; i < n; i++) {       pos[v[i].second] = i;     }     for (int i = 0; i < n; i++) {       if (pos[i] < m * k) {         j++;         if (j == m) {           q++;           if (q < k) {             cout << i + 1 <<    ;             j = 0;           }         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     long long c;     while (a != 0) {       c = a;       a = b % a;       b = c;     }     return b;   }   long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }   long long triple(long long x) {     long long ans = x * max(1LL, x - 1LL) * max(1LL, x - 2LL);     if (x % 2 == 0) {       return x * max(1LL, x - 1LL) * max(1LL, x - 3LL);     }     if (x >= 4 && x % 2 == 0) {       ans /= 2;     }     return ans;   }   int main() {     std::ios::sync_with_stdio(false);     int N;     cin >> N;     long long ans;     switch (N) {       case 1: {         ans = 1;         break;       }       case 2: {         ans = 2;         break;       }       default: {         if (N % 2 != 0) {           ans = N * (N - 1LL) * (N - 2LL);         } else {           ans = (N - 1LL) * (N - 2LL) * (N - 3LL);           long long tmp = N * (N - 1LL);           for (int i = N - 2; i >= 1; i--) {             long long val = lcm(tmp, i);             if (val > ans) {               ans = val;               break;             }           }         }         break;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool comp(int a, int b) { return a > b; }   int gcd(int a, int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   bool isPrime(int n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (int i = 5; i * i <= n; i = i + 6) {       if (n % i == 0 || n % (i + 2) == 0) {         return false;       }     }     return true;   }   void primeFactors(int n) {     while (n % 2 == 0) {       cout << 2 <<    ;       n = n / 2;     }     for (int i = 3; i <= sqrt(n); i = i + 2) {       while (n % i == 0) {         cout << i <<    ;         n = n / i;       }     }     if (n > 2) {       cout << n <<    ;     }   }   int dayofweek(int d, int m, int y) {     static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};     y -= m < 3;     return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7;   }   void BellmanFord(int graph[][3], int V, int E, int src) {     int dis[V];     for (int i = 0; i < V; i++) dis[i] = INT_MAX;     dis[src] = 0;     for (int i = 0; i < V - 1; i++) {       for (int j = 0; j < E; j++) {         if (dis[graph[j][0]] + graph[j][2] < dis[graph[j][1]])           dis[graph[j][1]] = dis[graph[j][0]] + graph[j][2];       }     }     bool flag = true;     for (int i = 0; i < E; i++) {       int x = graph[i][0], y = graph[i][1], weight = graph[i][2];       if (dis[x] != INT_MAX && dis[x] + weight < dis[y]) {         flag = false;         break;       }     }   }   void topoSort(int n, int m, vector<vector<bool>> &e, vector<bool> &visited,                 int x) {     visited[x] = true;     for (int i = n - 1; i >= 0; i--) {       if (e[x][i] and !visited[i]) {         topoSort(n, m, e, visited, i);       }     }     return;   }   void convertGraphToTree(int x, vector<vector<int>> &v, vector<bool> &visited,                           vector<vector<int>> &newedges) {     visited[x] = true;     for (int i = 0; i < v[x].size(); i++) {       if (!visited[v[x][i]]) {         newedges[x].push_back(v[x][i]);         convertGraphToTree(v[x][i], v, visited, newedges);       }     }     return;   }   int subtreeCount(int x, vector<vector<int>> &v, vector<bool> &visited,                    vector<int> &count) {     visited[x] = true;     int ans = 1;     for (int i = 0; i < v[x].size(); i++) {       if (!visited[v[x][i]]) {         ans += subtreeCount(v[x][i], v, visited, count);       }     }     count[x] = ans;     return ans;   }   void helper(int n) {     double ans = 0.0;     for (int i = n; i >= 1; i--) {       double temp = 1.0 / double(i);       ans += temp;     }     cout << ans << endl;     return;   }   int main() {     int n;     cin >> n;     helper(n);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int ALF_SIZE = 26;   int val[200], sizeB = 1;   struct bor {     char q;     int a[ALF_SIZE];     int val, par;     int go[ALF_SIZE];     int link;     bool updated;     void init(int q) {       this->q = q;       val = par = 0;       link = -1;       updated = 0;       for (int w = 0; w < ALF_SIZE; w++) {         a[w] = -1;         go[w] = -1;       }     }   };   bor a[201];   int go(int c, char v);   int get_link(int c) {     if (a[c].link < 0) {       if ((c == 0) || (a[c].par == 0)) {         a[c].link = 0;       } else {         a[c].link = go(get_link(a[c].par), a[c].q);       }     }     return a[c].link;   }   int go(int c, char v) {     if (a[c].go[v] < 0) {       if (a[c].a[v] >= 0) {         a[c].go[v] = a[c].a[v];       } else {         if (c == 0) {           a[c].go[v] = 0;         } else {           a[c].go[v] = go(get_link(c), v);         }       }     }     return a[c].go[v];   }   char h[201];   int calc_val(int c) {     if (a[c].updated == 0) {       a[c].updated = 1;       a[c].val += calc_val(get_link(c));     }     return a[c].val;   }   long long d[201][201];   void mult(long long **a, long long **s, long long **f) {     int w, e, r;     for (e = 0; e < sizeB; e++) {       for (r = 0; r < sizeB; r++) {         d[e][r] = -1;       }     }     for (w = 0; w < sizeB; w++) {       for (e = 0; e < sizeB; e++) {         for (r = 0; r < sizeB; r++) {           if ((a[w][e] >= 0) && (s[e][r] >= 0)) {             d[w][r] = max(d[w][r], a[w][e] + s[e][r]);           }         }       }     }     for (e = 0; e < sizeB; e++) {       for (r = 0; r < sizeB; r++) {         f[e][r] = d[e][r];       }     }   }   int main() {     int q, w, e, r, t, c, v;     long long len;     a[0].init(0);     cin >> q >> len;     for (w = 0; w < q; w++) {       scanf( %d , &val[w]);     }     for (w = 0; w < q; w++) {       scanf( %s , h);       c = 0;       for (e = 0; h[e]; e++) {         h[e] -=  a ;         if (a[c].a[h[e]] == -1) {           a[sizeB].init(h[e]);           a[sizeB].par = c;           a[c].a[h[e]] = sizeB;           sizeB++;         }         c = a[c].a[h[e]];       }       a[c].val += val[w];     }     for (w = 0; w < sizeB; w++) {       calc_val(w);     }     long long **s = new long long *[sizeB];     long long **d = new long long *[sizeB];     for (e = 0; e < sizeB; e++) {       s[e] = new long long[sizeB];       d[e] = new long long[sizeB];       for (r = 0; r < sizeB; r++) {         s[e][r] = -1;         d[e][r] = -1;       }     }     d[0][0] = 0;     for (e = 0; e < sizeB; e++) {       for (c = 0; c < 26; c++) {         if (a[e].a[c] >= 0) {           v = a[e].a[c];           s[e][v] = max(s[e][v], (long long)(a[v].val));         } else {           v = go(get_link(e), c);           s[e][v] = max(s[e][v], (long long)a[v].val);         }       }     }     for (; len; len /= 2) {       if (len % 2 == 1) {         mult(d, s, d);       }       mult(s, s, s);     }     long long ans = 0;     for (w = 0; w < sizeB; w++) {       ans = max(ans, d[0][w]);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double s = 10000000, a, b, m;   int n;   int main() {     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> a >> b;       s = min(s, a / b);     }     printf( %.8f , s * m);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios::sync_with_stdio(0);     cin.sync_with_stdio(0);     cin.tie(0);     long long t;     cin >> t;     while (t--) {       long long a, b;       cin >> a >> b;       if (a > b) swap(a, b);       long long ans = 0;       while (a * 8 <= b) {         a *= 8;         ans++;       }       while (a * 4 <= b) {         a *= 4;         ans++;       }       while (a * 2 <= b) {         a *= 2;         ans++;       }       if (a == b) {         cout << ans <<   n ;       } else {         cout << -1 <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   int getbit(T s, int i) {     return (s >> i) & 1;   }   template <class T>   T onbit(T s, int i) {     return s | (T(1) << i);   }   template <class T>   T offbit(T s, int i) {     return s & (~(T(1) << i));   }   template <class T>   int cntbit(T s) {     return __builtin_popcount(s);   }   template <class T>   T gcd(T a, T b) {     T r;     while (b != 0) {       r = a % b;       a = b;       b = r;     }     return a;   }   template <class T>   T lcm(T a, T b) {     return a / gcd(a, b) * b;   }   int n, m;   vector<int> V[200005];   int res[200005];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> m;     for (int i = (1); i <= (n); ++i) {       int x;       cin >> x;       V[x].push_back(i);     }     int RR = 1;     for (int i = (1); i <= (m); ++i) {       int x;       cin >> x;       if (V[x].size() > 1 && RR == 1) {         RR = 2;       } else if (V[x].size() == 0) {         RR = 0;       }       if (RR == 1) {         res[i] = V[x][0];       }     }     if (!RR) {       cout <<  Impossible  << endl;     } else if (RR == 1) {       cout <<  Possible  << endl;       for (int i = (1); i <= (m); ++i) cout << res[i] <<    ;     } else {       cout <<  Ambiguity  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, q, s, e, cc, sz, t, l, r;   long long tt[150000];   void inc(int i, long long w) {     for (; i <= n; i |= i + 1) tt[i] += w;   }   long long sum(int i) {     long long sum = 0;     for (; i >= 0; i = (i & (i + 1)) - 1) sum += tt[i];     return sum;   }   long long que(int l, int r) {     if (l > r) swap(l, r);     return sum(r) - sum(l - 1);   }   int conv(int i) {     if (!cc)       return i + s;     else       return e - i;   }   int main() {     cin >> n >> q;     e = n - 1;     for (int i = 0; i < n; i++) inc(i, 1);     while (q--) {       sz = e - s + 1;       cin >> t >> l;       if (t == 1) {         if (!(sz / 2 >= l)) {           l = sz - l;           cc ^= 1;         }         for (int i = 1; i <= l; i++)           inc(conv(2 * l - i), que(conv(i - 1), conv(i - 1)));         if (!cc)           s += l;         else           e -= l;       } else {         cin >> r;         cout << que(conv(l), conv(r - 1)) << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a, curr;   vector<long long int> v;   void start() {     cin >> n;     int times = 0;     bool flag = false;     for (int i = 0; i < n; i++) {       cin >> a;       if (i == 0) {         curr = a;         times++;         if (i == n - 1) v.push_back(times);         continue;       } else if (curr != a) {         v.push_back(times);         times = 1;         if (i == n - 1) v.push_back(times);         curr = a;       } else {         times++;         if (i == n - 1) v.push_back(times);       }     }     long long int sol = 0;     for (int i = 0; i < v.size(); i++) {       long long int t = v[i];       sol += (t * (t + 1)) / 2;     }     cout << sol <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     start();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T x, T y) {     if (x < y) swap(x, y);     while (y > 0) {       T f = x % y;       x = y;       y = f;     }     return x;   }   template <typename T>   pair<T, T> exgcd(T x, T y) {     int sw = 0;     if (x < y) sw = true, swap(x, y);     pair<T, T> r = make_pair(1, 0);     while (y > 0) {       T f = x % y;       r = make_pair(r.second, r.first - (x / y) * r.second);       x = y;       y = f;     };     if (sw) swap(r.first, r.second);     return r;   }   int rot[][12] = {       {           1,           2,           4,           3,           13,           14,           5,           6,           17,           18,           21,           22,       },       {           9,           10,           11,           12,           15,           16,           7,           8,           19,           20,           23,           24,       },       {13, 14, 16, 15, 1, 3, 5, 7, 9, 11, 24, 22},       {17, 18, 20, 19, 2, 4, 6, 8, 10, 12, 23, 21},       {5, 6, 8, 7, 3, 4, 17, 19, 10, 9, 16, 14},       {21, 22, 24, 23, 18, 20, 12, 11, 15, 13, 1, 2},   };   bool solved(int s[25]) {     for (int i = 1; i < 24; i += 4) {       if (s[i] != s[i + 1] || s[i] != s[i + 2] || s[i] != s[i + 3]) return false;     }     return true;   }   int main(int argc, char *argv[]) {     std::cin.sync_with_stdio(false);     std::cin.tie(nullptr);     int s[25];     cin >> s[1];     {       for (int i = 2; i <= 24; i++) cin >> s[i];       int t[25];       bool ok = false;       for (int i = 0; i < 6; i++) {         memcpy(t, s, sizeof(t));         for (int j = 0; j < 4; j++) t[rot[i][(j + 1) % 4]] = s[rot[i][j]];         for (int j = 0; j < 8; j++)           t[rot[i][4 + ((j + 2) % 8)]] = s[rot[i][4 + j]];         if (solved(t)) {           ok = true;           break;         }         memcpy(t, s, sizeof(t));         for (int j = 0; j < 4; j++) t[rot[i][(j + 3) % 4]] = s[rot[i][j]];         for (int j = 0; j < 8; j++)           t[rot[i][4 + ((j + 6) % 8)]] = s[rot[i][4 + j]];         if (solved(t)) {           ok = true;           break;         }       }       cout << (ok ?  YES  :  NO ) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, T;   const int mn = 5009;   double p[mn];   double p2[102][mn];   int pi[mn];   int t[mn];   double dp[2][mn];   int main() {     scanf( %d , &(n));     scanf( %d , &(T));     int pk;     for (int i = 0; i < n; i++) {       scanf( %d %d , &pi[i], &t[i]);       p[i] = pi[i] / 100.0;     }     for (int i = 0; i <= 100; i++) {       p2[i][0] = 1;       for (int j = 1; j <= T; j++) {         p2[i][j] = (i / 100.0) * p2[i][j - 1];       }     }     int la = 0;     double r1 = 0;     double r2 = 0;     int i2;     int i12;     for (int i = n - 1; i >= 0; i--) {       la = 0;       r1 = 0;       r2 = 0;       i2 = i % 2;       i12 = (i + 1) % 2;       for (int w = 1; w <= T; w++) {         r1 = (r1) * (1 - p[i]) + dp[i12][w - 1] + 1;         while (w - la >= t[i]) {           r1 = r1 - (1 + dp[i12][la]) * p2[100 - pi[i]][t[i] - 1];           la++;         }         r2 = r1 * p[i];         if (w - t[i] >= 0) {           r2 = r2 + (dp[i12][w - t[i]] + 1) * p2[100 - pi[i]][t[i] - 1];         }         dp[i2][w] = r2;       }     }     printf( %.10lf n , dp[0][T]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int minx, maxx, miny, maxy, sumofarea = 0;     int n;     cin >> n;     for (int i = 0; i < n; i++) {       int x1, y1, x2, y2;       cin >> x1 >> y1 >> x2 >> y2;       if (i == 0) {         minx = x1;         maxx = x2;         miny = y1;         maxy = y2;       } else {         minx = min(minx, x1);         maxx = max(maxx, x2);         miny = min(miny, y1);         maxy = max(maxy, y2);       }       sumofarea += ((x2 - x1) * (y2 - y1));     }     int final_square_area = (maxx - minx) * (maxy - miny);     int lengthofside1 = maxx - minx;     int lengthofside2 = maxy - miny;     if (sumofarea == final_square_area && (lengthofside1 == lengthofside2)) {       cout <<  YES ;     } else {       cout <<  NO ;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   template <typename T, typename TT>   inline ostream &operator<<(ostream &os, const pair<T, TT> &t) {     return os << t.first <<     << t.second;   }   template <typename T>   inline ostream &operator<<(ostream &os, const vector<T> &t) {     for (auto i : t) os << i <<    ;     return os;   }   template <typename T>   inline istream &operator>>(istream &is, vector<T> &v) {     for (T &t : v) is >> t;     return is;   }   template <typename T1, typename T2>   inline istream &operator>>(istream &is, pair<T1, T2> &t) {     is >> t.first >> t.second;     return is;   }   const long long mod = 1e9 + 7;   void solve() {     int a, b, c, d;     cin >> a >> b >> c >> d;     vector<string> s(50, string(50,  D ));     for (int i = 0; i < 36; i++) {       for (int j = 0; j < 50; j++) {         s[i][j] = char( A  + (i / 12));       }     }     a--, b--, c--, d--;     for (int i = 1; i < 11; i += 2) {       for (int j = 0; j < 50 and b; j += 2, b--) s[i][j] =  B ;     }     for (int i = 13; i < 23; i += 2) {       for (int j = 0; j < 50 and c; j += 2, c--) s[i][j] =  C ;     }     for (int i = 25; i < 35; i += 2) {       for (int j = 0; j < 50 and d; j += 2, d--) s[i][j] =  D ;     }     for (int i = 37; i < 50; i += 2) {       for (int j = 0; j < 50 and a; j += 2, a--) s[i][j] =  A ;     }     cout << 50 <<     << 50 <<   n ;     for (auto x : s) cout << x <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     ;     int T = 1;     while (T--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) {       int a;       int b;       cin >> a;       cin >> b;       if (a != b) {         cout <<  Happy Alex ;         return 0;       }     }     cout <<  Poor Alex ;     return 0;   }