malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 3e3 + 5, mod = 1e9 + 7;   struct p {     int x, y;   } c[N];   int n, D, num;   int h[N], w[N];   int f[N][N];   int read() {     int x(0);     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       ;     for (; isdigit(ch); x = x * 10 + ch - 48, ch = getchar())       ;     return x;   }   void add(int x, int y) { c[++num] = (p){h[x], y}, h[x] = num; }   void dfs(int x = 1) {     for (int i = 1; i <= n; ++i) f[x][i] = 1;     for (int i = h[x]; i; i = c[i].x) {       dfs(c[i].y);       for (int j = 1; j <= n; ++j) f[x][j] = 1ll * f[x][j] * f[c[i].y][j] % mod;     }     for (int i = 1; i <= n; ++i) {       f[x][i] += f[x][i - 1];       if (f[x][i] >= mod) f[x][i] -= mod;     }   }   int Pow(int a, int b) {     int ans = 1;     for (; b; b >>= 1, a = 1ll * a * a % mod)       if (b & 1) ans = 1ll * ans * a % mod;     return ans;   }   int L(int x) {     int ans = 1;     for (int i = 0; i <= n; ++i)       if (x != i)         ans = (1ll * ans * (D - i) % mod * (x - i < 0 ? -1 : 1) *                    w[x - i < 0 ? i - x : x - i] % mod +                mod) %               mod;     return ans;   }   void Solve() {     if (n >= D) return void(printf( %d , f[1][D]));     int ans = 0;     for (int i = 1; i <= n; ++i) w[i] = Pow(i, mod - 2);     for (int i = 0; i <= n; ++i) {       ans += 1ll * f[1][i] * L(i) % mod;       if (ans >= mod) ans -= mod;     }     printf( %d , ans);   }   int main() {     n = read(), D = read();     for (int i = 2; i <= n; ++i) add(read(), i);     return dfs(), Solve(), 0;   }
#include <bits/stdc++.h>   using namespace std;   string to_string(char c) { return string(1, c); }   string to_string(string s) { return s; }   template <class A, class B>   string to_string(pair<A, B> p) {     return  (  + to_string(p.first) +  ,   + to_string(p.second) +  ) ;   }   template <class T>   string to_string(T v) {     bool f = true;     string res =  { ;     for (auto &x : v) {       if (!f) {         res +=  ,  ;       }       f = false;       res += to_string(x);     }     res +=  } ;     return res;   }   void DBG() { cerr <<  ]  << endl; }   template <class H, class... T>   void DBG(H h, T... t) {     cerr << to_string(h);     if (sizeof...(t)) cerr <<  ,  ;     DBG(t...);   }   string getCode(char c) {     string res;     if (c ==  > ) {       res =  1000 ;     } else if (c ==  < ) {       res =  1001 ;     } else if (c ==  + ) {       res =  1010 ;     } else if (c ==  - ) {       res =  1011 ;     } else if (c ==  . ) {       res =  1100 ;     } else if (c ==  , ) {       res =  1101 ;     } else if (c ==  [ ) {       res =  1110 ;     } else if (c ==  ] ) {       res =  1111 ;     } else {       assert(false);     }     return res;   }   const long long mod = 1e6 + 3;   long long powmod(long long a, long long b) {     long long res = 1;     a %= mod;     assert(b >= 0);     for (; b; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     string s;     cin >> s;     string ss;     for (char c : s) {       ss += getCode(c);     }     long long ans = 0;     int n = (int)(ss).size();     for (int i = 0; i < n; i++) {       if (ss[i] ==  1 ) {         ans = (ans + powmod(2, n - i - 1)) % mod;       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c, x, y, z;     cin >> a >> b >> c >> x >> y >> z;     int rest = 0, my = 0;     a -= x;     b -= y;     c -= z;     if (a > 0)       my += (a / 2);     else       rest += -a;     if (b > 0)       my += (b / 2);     else       rest += -b;     if (c > 0)       my += (c / 2);     else       rest += -c;     if (my >= rest)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int i, j, k, l, x, y, z, m, n, ans, dir, s, f, current, p, q;   pair<int, int> a;   pair<int, pair<int, int> > spies[300000];   int main() {     scanf( %d %d %d %d , &n, &m, &s, &f);     for (i = 0; i < m; i++) {       scanf( %d %d %d , &x, &y, &z);       a = make_pair(y, z);       spies[i] = make_pair(x, a);     }     if (s > f)       dir = -1;     else       dir = 1;     current = s;     i = 0;     j = 1;     while (current != f) {       a = spies[i].second;       x = spies[i].first;       if (x == j) {         i++;         y = a.first;         z = a.second;         p = current;         q = current + dir;         if ((p >= y && p <= z) || (q >= y && q <= z)) {           printf( X );         } else {           current = current + dir;           if (dir == 1)             printf( R );           else             printf( L );         }       } else {         current = current + dir;         if (dir == 1)           printf( R );         else           printf( L );       }       j++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > E[200005];   int U[200005], V[200005], D[200005];   int n, m;   int vs[200005];   queue<int> q;   int dfs(int u, int in) {     q.push(u);     for (int len = 0;; len++) {       int sz = q.size();       if (sz == 0) break;       in = len % 2;       for (int i = 0; i < sz; i++) {         u = q.front();         q.pop();         if (vs[u] != -1) {           if (vs[u] != in)             return false;           else             continue;         }         vs[u] = in;         for (auto e : E[u]) {           if (vs[e.first] == -1)             q.push(e.first);           else if (vs[e.first] != in ^ 1)             return false;         }       }     }     for (int i = 0; i < m; i++) {       if (vs[U[i]] == 0 && vs[V[i]] == 1) {         D[i] = 1;       } else if (vs[U[i]] == 1 && vs[V[i]] == 0) {         D[i] = 0;       } else         assert(1 == 2);     }     return true;   }   int main() {     memset(vs, -1, sizeof(vs));     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d%d , &U[i], &V[i]);       D[i] = -1;       E[U[i]].push_back(make_pair(V[i], i));       E[V[i]].push_back(make_pair(U[i], i));     }     if (dfs(1, 0)) {       printf( YES n );       for (int i = 0; i < m; i++) printf( %d , D[i]);       printf(  n );     } else {       printf( NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b);   long long nCr(long long n, long long r);   long long pow(long long b, long long n);   void read(long long a[], long long n);   void solve() {     long long n;     cin >> n;     vector<long long> v;     for (long long i = 2; i * i <= n; i++) {       if (n % i == 0) {         v.push_back(i);         n /= i;         if (v.size() == 2) {           v.push_back(n);           break;         }       }     }     if (v.size() != 3) {       cout <<  NO  << endl;       return;     }     if (v[0] != v[1] && v[0] != v[1] && v[1] != v[2]) {       cout <<  YES  << endl;       cout << v[0] <<     << v[1] <<     << v[2] << endl;     } else {       cout <<  NO  << endl;     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     cin >> t;     while (t--) {       solve();     }   }   long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }   long long nCr(long long n, long long r) {     if (r > n) return 0;     if (r * 2 > n) r = n - r;     if (r == 0) return 1;     long long ans = n;     for (long long i = 2; i <= r; i++) {       ans *= (n - i + 1);       ans /= i;     }     return ans;   }   long long pow(long long b, long long n) {     long long p = b, ans = 1;     while (n) {       if (n & 1) {         ans *= p;       }       p *= p;       n = n >> 1;     }     return ans;   }   void read(long long a[], long long n) {     for (long long i = 0; i < n; i++) {       cin >> a[i];     }   }
#include <bits/stdc++.h>   int main() {     long long int k, b, n, t, i;     scanf( %I64d %I64d %I64d %I64d , &k, &b, &n, &t);     double x = 1;     for (i = 0; i < n && x <= t; i++) {       x = k * x + b;     }     if (x > t) {       printf( %I64d , n - i + 1);     } else {       printf( %I64d , n - i);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string nonz;     int ans = 0;     string s =   ;     bool zr = false;     for (int i = 0; i < n; i++) {       string a;       cin >> a;       if (a ==  0 ) zr = true;       string x = a;       bool beauty = true;       int zero = 0, one = 0;       for (auto j : a) {         if (j ==  1 )           one++;         else if (j ==  0 )           zero++;         else {           beauty = false;           nonz = x;         }       }       if (one > 1) {         beauty = false;         nonz = x;       } else if (beauty) {         ans += zero;       }     }     if (!zr) {       if (nonz.size())         cout << nonz;       else         cout << 1;       for (int i = 0; i < ans; i++) {         cout << 0;       }       cout << endl;     } else {       cout << 0 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   bool debug = false;   int n, m, k;   long long ln, lk, lm;   int b[5105], a[5105];   void update(int x) {     for (int i = x; i <= n; i += i & -i) {       b[i]++;     }   }   int query(int x) {     int ret = 0;     for (; x > 0; ret += b[x], x -= x & -x)       ;     return ret;   }   int main() {     scanf( %d , &n);     for (int(i) = 1; (i) <= (int)(n); (i)++) {       scanf( %d , a + i);       a[i]++;     }     int tt = -((1 << 30)), cnt = 0;     pair<int, int> pp;     for (int i = n; i; i--) {       memset(b, 0, sizeof b);       for (int j = i - 1; j; j--) {         if (a[j] > a[i]) {           update(a[j]);           int x = query(a[j]) - 1;           if (x > tt) {             cnt = 1;             tt = x;             pp = {i, j};           } else if (x == tt)             cnt++;         }       }     }     swap(a[pp.first], a[pp.second]);     memset(b, 0, sizeof b);     int num = 0;     for (int(i) = 1; (i) <= (int)(n); (i)++) {       update(a[i]);       num += i - query(a[i]);     }     printf( %d %d n , num, cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> adj1[1000050], adj2[1000050];   bool vis1[1000050], vis2[1000050];   vector<int> ans;   int main() {     int n, m;     scanf( %d %d , &n, &m);     for (int i = 0; i < m; i++) {       int u, v;       scanf( %d %d , &u, &v);       adj1[u].push_back(v);       adj2[v].push_back(u);     }     for (int i = n; i >= 0; i--) {       if (!vis1[i]) {         vis1[i] = true;         vis2[i] = true;         for (auto c : adj1[i]) vis1[c] = true;       }     }     for (int i = 1; i <= n; i++) {       if (vis2[i]) {         for (auto c : adj2[i]) {           if (vis2[c]) vis2[i] = false;         }         if (vis2[i]) ans.push_back(i);       }     }     printf( %d n , ans.size());     for (auto c : ans) printf( %d  , c);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a, b, c;   vector<int> ans;   int sum(int curr) {     int sum = 0;     while (curr > 0) {       sum += curr % 10;       curr = curr / 10;     }     return sum;   }   long long go(long long x, int n) {     long long ans = 1;     for (int i = 0; i < n; i++) {       ans = ans * x;     }     return ans;   }   int main() {     scanf( %d %d %d , &a, &b, &c);     for (int i = 0; i <= 81; i++) {       long long curr = go(i, a) * b + c;       if (curr > 1000000000LL || curr <= 0) continue;       if (sum(curr) == i) ans.push_back(curr);     }     printf( %d n , ans.size());     for (int i = 0; i < ans.size(); i++) {       printf( %d  , ans[i]);     }     return 0;   }
#include <bits/stdc++.h>   int a, b, c, prad[1000001];   using namespace std;   int main() {     long long pro = 0;     for (int i = 1; i < 1000001; ++i) {       for (int j = 1; j * i < 1000001; ++j) {         ++prad[j * i];       }     }     cin >> a >> b >> c;     for (int j = 1; j < a + 1; ++j)       for (int ja = 1; ja < b + 1; ++ja)         for (int ha = 1; ha < c + 1; ++ha) {           pro += prad[ha * ja * j];           long long ta = pro >> 30;           ta << 30;           pro = pro - ta;         }     cout << pro;   }
#include <bits/stdc++.h>   using namespace std;   int vis[110000];   int st[110000], top;   int main() {     int n, m, i, j, k, x;     scanf( %d , &n);     if (n & 1) {       puts( -1 );       return 0;     }     st[++top] = 0;     x = n / 2;     while (x) {       st[++top] = x;       vis[x] = 1;       if (x + n >> 1 < n && !vis[x + n >> 1])         x = x + n >> 1;       else         x = x >> 1;     }     st[++top] = 0;     while (top) printf( %d  , st[top--]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, i, j, x, xx, yy, p = 1e9 + 7, pr[1000010], nt[1000010],                                 jc[1000010], pos[1000010], mu[1000010],                                 a[1000010], num[1000010], ans;   vector<long long> v[1000010];   int main() {     scanf( %lld , &n);     jc[0] = 1;     for (i = 1; i <= n; i++) jc[i] = jc[i - 1] * i % p;     for (i = 1; i <= n; i++) mu[i] = 1;     for (i = 2; i <= n; i++)       if (!v[i].size()) {         num[n / i]++;         pos[i] = n / i;         for (j = i; j <= n; j += i) v[j].push_back(i), mu[j] *= i;       }     for (i = 1; i <= n; i++) a[mu[i]]++;     num[1]++;     pos[1] = 1;     v[1].push_back(1);     for (i = 1; i <= n; i++) {       scanf( %lld , &x);       if (!x) continue;       a[mu[x]]--;       if (v[x].size() != v[i].size()) return puts( 0 ), 0;       for (j = 0; j < v[i].size() - 1; j++)         if (v[x][j] != v[i][j]) return puts( 0 ), 0;       xx = v[x].back();       yy = v[i].back();       if (pos[xx] != pos[yy]) return puts( 0 ), 0;       if (pr[xx] && pr[xx] != yy) return puts( 0 ), 0;       if (nt[yy] && nt[yy] != xx) return puts( 0 ), 0;       if (!pr[xx] && !nt[yy]) num[pos[xx]]--;       pr[xx] = yy;       nt[yy] = xx;     }     ans = 1;     for (i = 1; i <= n; i++) ans = ans * jc[a[i]] % p;     for (i = 1; i <= n; i++) ans = ans * jc[num[i]] % p;     printf( %lld , ans);   }
#include<bits/stdc++.h>   using namespace std;      #define f first   #define s second      using ll = long long;      const int mxN = 200000;   const int lgN = 18;   const int mod = 1e9 + 7;   const ll inf = 1e15;      void solve() {           int n; cin >> n;           int a[n + 1];           int check = true;           for (int i = 1; i <= n; i++) {                   cin >> a[i];                   if (i > 1 && a[i] < a[i - 1]) check = false;           }                      if (check) cout <<  0 ;           else if (a[1] == 1 || a[n] == n) cout <<  1 ;           else if (a[1] != n || a[n] != 1) cout <<  2 ;           else cout <<  3 ;   }      int main() {           /*if (fopen( input.txt ,  r )) {                   freopen( input.txt ,  r , stdin);                   freopen( output.txt ,  w , stdout);           }*/              ios_base::sync_with_stdio(0); cin.tie(0);              int n_test = 1; cin >> n_test;           for (int test = 1; test <= n_test; test++) {                   //cout <<  Case #  << test <<  :  ;                   solve(); cout <<   n ;           }              return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100050, inf = 1e9 + 7;   struct tree {     int l, r, mid, rx, id;   } t[N << 3];   struct node {     int l, r, t, id;     bool operator<(const node &p) const {       if (l == p.l) return id < p.id;       return l < p.l;     }   } g[N << 1];   int n, m, ans[N];   vector<int> v;   int get(int x) { return lower_bound(v.begin(), v.end(), x) - v.begin() + 1; }   void pushup(int rt) { t[rt].rx = max(t[rt << 1].rx, t[rt << 1 | 1].rx); }   void build(int l, int r, int rt) {     int m = (l + r) >> 1;     t[rt].l = l;     t[rt].r = r;     t[rt].mid = m;     if (l == r) {       t[rt].rx = -inf;       return;     }     build(l, m, rt << 1);     build(m + 1, r, rt << 1 | 1);     pushup(rt);   }   void update(int pos, int id, int x, int rt) {     if (t[rt].l == t[rt].r) {       t[rt].rx = x;       t[rt].id = id;       return;     }     if (pos <= t[rt].mid) {       update(pos, id, x, rt << 1);     }     if (pos > t[rt].mid) {       update(pos, id, x, rt << 1 | 1);     }     pushup(rt);   }   int query(int pos, int x, int rt) {     if (t[rt].rx < x) return -1;     if (t[rt].l == t[rt].r) return t[rt].id;     int ans = -1;     if (pos <= t[rt].mid) {       ans = query(pos, x, rt << 1);       if (ans > 0) return ans;     }     return query(pos, x, rt << 1 | 1);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n + m; i++) {       scanf( %d%d%d , &g[i].l, &g[i].r, &g[i].t);       g[i].id = i;       v.push_back(g[i].t);     }     sort(v.begin(), v.end());     v.erase(unique(v.begin(), v.end()), v.end());     build(1, v.size(), 1);     sort(g + 1, g + n + m + 1);     for (int i = 1; i <= n + m; i++) {       int pos = get(g[i].t);       if (g[i].id <= n) {         update(pos, g[i].id, g[i].r, 1);       } else {         ans[g[i].id - n] = query(pos, g[i].r, 1);       }     }     for (int i = 1; i <= m; i++) {       printf( %d  , ans[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t, n, a[5], ans[5], f1[19491001], cxk, f2[19491001];   int mod1 = 19260817, mod2 = 233317;   string s;   inline int Read() {     int x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = (x << 3) + (x << 1) + ch -  0 ;       ch = getchar();     }     return x * f;   }   void Write(int x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x > 9) Write(x / 10);     putchar(x % 10 +  0 );   }   inline int HAsh1() {     long long last = 0;     for (int i = 1; i <= 4; ++i) {       last = last * 13331 + a[i];       last %= mod1;     }     return last;   }   inline int HAsh2() {     long long last = 0;     for (int i = 1; i <= 4; ++i) {       last = last * 13331 + a[i];       last %= mod2;     }     return last;   }   void dfs(int k, int now) {     if (f1[HAsh1()] && f2[HAsh2()]) return;     f1[HAsh1()] = f2[HAsh2()] = 1;     if (cxk) return;     if (k == n + 1) {       int minn = 2147482647;       for (register int i = 1; i <= 4; ++i) {         if (minn > a[i]) minn = a[i];       }       for (register int i = 1; i <= 4; ++i) {         if (a[i] == minn) {           ans[i] = 1;         }       }       int flag = 1;       for (register int i = 1; i <= 4; ++i)         if (!ans[i]) flag = 0;       if (flag) cxk = 1;       return;     }     if (s[k - 1] ==  G ) {       a[1]++;       dfs(k + 1, 1);     } else if (s[k - 1] ==  H ) {       a[2]++;       dfs(k + 1, 2);     } else if (s[k - 1] ==  R ) {       a[3]++;       dfs(k + 1, 3);     } else if (s[k - 1] ==  S ) {       a[4]++;       dfs(k + 1, 4);     } else {       int minn = 2147482647;       for (register int i = 1; i <= 4; ++i) {         if (minn > a[i]) minn = a[i];       }       for (register int i = 1; i <= 4; ++i) {         if (a[i] == minn) {           int a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4];           a[i]++;           dfs(k + 1, i);           a[1] = a1, a[2] = a2, a[3] = a3, a[4] = a4;         }       }     }   }   int main() {     n = Read();     cin >> s;     memset(a, 0, sizeof(a));     memset(ans, 0, sizeof(ans));     memset(f1, 0, sizeof(f1));     memset(f2, 0, sizeof(f2));     cxk = 0;     dfs(1, 0);     if (ans[1]) puts( Gryffindor );     if (ans[2]) puts( Hufflepuff );     if (ans[3]) puts( Ravenclaw );     if (ans[4]) puts( Slytherin );     putchar(  n );   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, m;     cin >> n >> m;     vector<pair<int, int> > v;     v.resize(n * m);     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         v[m * (i - 1) + j - 1] = {i, j};       }     }     bool low = true;     int l = 0, r = m * n - 1;     while (r >= l) {       pair<int, int> u;       if (low) {         u = v[l];         l++;         low = false;       } else {         u = v[r];         r--;         low = true;       }       cout << u.first <<     << u.second <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     for (int i = 0; i < t; ++i) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   long long res = 1;   long long countn = 1;   void solve(long long a[], long long n) {     if (n == 0) {       res = max(countn, res);       cout << res;     } else if (a[n] >= a[n - 1]) {       countn++;       solve(a, n - 1);     } else {       res = max(countn, res);       countn = 1;       solve(a, n - 1);     }   }   int main() {     long long n;     cin >> n;     long long a[n];     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     solve(a, n - 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     pair<int, int> a, b, c;     int s = 0;     cin >> a.first >> a.second >> b.first >> b.second >> c.first >> c.second;     s = a.first * a.second + b.first * b.second + c.first * c.second;     if ((int)sqrt(s + 0.0) * (int)sqrt(s + 0.0) != s) {       cout << -1;       return 0;     }     s = sqrt(s + 0.0);     if (a.first < a.second) swap(a.first, a.second);     if (b.first < b.second) swap(b.first, b.second);     if (c.first < c.second) swap(c.first, c.second);     char mp[] = { A ,  B ,  C };     if (a.first < b.first) {       swap(a, b);       swap(mp[0], mp[1]);     }     if (b.first < c.first) {       swap(mp[1], mp[2]);       swap(b, c);     }     if (a.first < b.first) {       swap(mp[0], mp[1]);       swap(a, b);     }     if (a.first == s) {       if (b.first == c.first && a.first == b.first) {         if (a.second + b.second + c.second == s) {           cout << s << endl;           for (int i = 0; i < a.second; ++i, cout << endl)             for (int j = 0; j < a.first; ++j) cout << mp[0];           for (int i = 0; i < b.second; ++i, cout << endl)             for (int j = 0; j < b.first; ++j) cout << mp[1];           for (int i = 0; i < c.second; ++i, cout << endl)             for (int j = 0; j < c.first; ++j) cout << mp[2];         }       } else if (b.second + c.second == a.first && a.second + b.first == s &&                  b.first == c.first) {         cout << s << endl;         for (int i = 0; i < a.second; ++i, cout << endl)           for (int j = 0; j < a.first; ++j) cout << mp[0];         for (int i = 0; i < b.first; ++i, cout << endl)           for (int j = 0; j < s; ++j)             if (j < b.second)               cout << mp[1];             else               cout << mp[2];       } else if (b.first + c.first == a.first && a.second + b.second == s &&                  b.second == c.second) {         cout << s << endl;         for (int i = 0; i < a.second; ++i, cout << endl)           for (int j = 0; j < a.first; ++j) cout << mp[0];         for (int i = 0; i < s - a.second; ++i, cout << endl)           for (int j = 0; j < s; ++j)             if (j < b.first)               cout << mp[1];             else               cout << mp[2];       } else if (b.first + c.second == a.first && a.second + b.second == s &&                  b.second == c.first) {         cout << s << endl;         for (int i = 0; i < a.second; ++i, cout << endl)           for (int j = 0; j < a.first; ++j) cout << mp[0];         for (int i = 0; i < s - a.second; ++i, cout << endl)           for (int j = 0; j < s; ++j)             if (j < b.first)               cout << mp[1];             else               cout << mp[2];       } else         cout << -1;     } else       cout << -1;   }