malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long int INF = LONG_LONG_MAX;   const long long int NINF = LONG_LONG_MIN;   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long int n, l, k;     cin >> n >> l >> k;     string s;     cin >> s;     sort((s).begin(), (s).end());     vector<string> list(n);     long long int p = 0;     long long int start = 0;     for (long long int i = 0; i < l; i++) {       for (long long int j = start; j < k; j++) {         list[j] += s[p++];         if (j != 0) {           if (list[j].back() != list[j - 1].back()) start = j;         }       }     }     for (long long int i = 0; i < n; i++) {       for (long long int j = (long long int)list[i].size(); j < l; j++) {         list[i] += s[p++];       }     }     for (string& ss : list) cout << ss << endl;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> dan, ans;   vector<pair<long long, long long> > check;   long long calc(long long st) {     multiset<long long> otr;     long long otv = 0;     for (long long i = 0; i < dan.size(); i++) {       st += dan[i];       if (dan[i] < 0) otr.insert(dan[i]);       if (st < 0) {         st -= *otr.begin();         otr.erase(otr.begin());         otv++;       }     }     return otv;   }   int main() {     long long n, m;     cin >> n >> m;     dan.resize(n);     ans.resize(m, -1);     check.resize(m, {0, 0});     for (long long i = 0; i < n; i++) {       cin >> dan[i];     }     for (long long i = 0; i < m; i++) {       cin >> check[i].first;       check[i].second = i + 1;     }     sort(check.begin(), check.end());     reverse(check.begin(), check.end());     long long l = 0;     while (l < m) {       long long l1 = l, r1 = m, mid, mida;       long long now;       if (ans[l1] != -1)         now = ans[l1];       else {         now = calc(check[l1].first);         ans[l1] = now;       }       while (l1 + 1 != r1) {         mid = (l1 + r1) / 2;         if (ans[mid] != -1)           mida = ans[mid];         else {           mida = calc(check[mid].first);           ans[mid] = mida;         }         if (mida > now) {           r1 = mid;         } else {           l1 = mid;         }       }       if (ans[l1] == -1) {         ans[l1] = calc(check[l1].first);       }       l = l1 + 1;     }     long long last = -1;     for (long long i = 0; i < m; i++) {       if (ans[i] != -1)         last = ans[i];       else         ans[i] = last;     }     for (long long i = 0; i < m; i++) {       swap(check[i].first, check[i].second);       check[i].second = ans[i];     }     sort(check.begin(), check.end());     for (long long i = 0; i < m; i++) {       cout << check[i].second <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 500;   int d[maxn * maxn];   map<int, int> id;   int idcnt;   map<pair<int, int>, int> id2;   int id2cnt;   pair<int, int> status[maxn * maxn];   int ans[maxn * maxn];   int first[maxn * maxn], nxt[1750000], des[1750000], tot;   int W[6];   int T, f;   queue<int> Q;   inline int get(int status, int x_) { return status % W[x_ + 1] / W[x_]; }   void dfs(int dep, int rest, int val) {     if (dep == 4) {       int temp = val + rest * W[4];       if (!id.count(temp)) {         id.insert(make_pair(temp, ++idcnt));       }       return;     }     for (int i = 0; i <= rest; i++) {       dfs(dep + 1, rest - i, val + W[dep] * i);     }   }   inline void AE(int id1, int id2) {     tot++;     des[tot] = id2;     nxt[tot] = first[id1];     first[id1] = tot;     d[id2]++;   }   void addEdge(int fi, int se, int idd) {     for (int i = 1; i <= 4; i++) {       for (int j = 1; j <= 4; j++) {         int f = get(fi, i);         int s = get(se, j);         if (f > 0 && s > 0) {           AE(id2[make_pair(se, fi - W[i] + W[(i + j) % 5])], idd);         }       }     }   }   void search() {     for (int i = 1; i <= id2cnt; i++) {       if (d[i] == 0) {         if (status[i].first == 8) {           ans[i] = 1;         } else {           ans[i] = -1;         }         Q.push(i);       }     }     while (!Q.empty()) {       int q = Q.front();       Q.pop();       if (ans[q] == 1) {         for (int t = first[q]; t; t = nxt[t]) {           int v = des[t];           d[v]--;           if (d[v] == 0 && ans[v] == 0) {             ans[v] = -1;             Q.push(v);           }         }       } else {         for (int t = first[q]; t; t = nxt[t]) {           int v = des[t];           d[v]--;           if (ans[v] == 0) {             ans[v] = 1;             Q.push(v);           }         }       }     }   }   void init() {     W[0] = 1;     for (int i = 1; i <= 5; i++) W[i] = W[i - 1] * 10;     dfs(0, 8, 0);     for (pair<int, int> fi : id) {       for (pair<int, int> se : id) {         id2.insert(make_pair(make_pair(fi.first, se.first), ++id2cnt));         status[id2cnt] = make_pair(fi.first, se.first);       }     }     memset(d, 0, sizeof d);     for (pair<pair<int, int>, int> e : id2) {       addEdge(e.first.first, e.first.second, e.second);     }     search();   }   void solve() {     scanf( %d , &f);     int ast = 0, bst = 0;     for (int i = 0; i < 8; i++) {       int t;       scanf( %d , &t);       ast += W[t];     }     for (int i = 0; i < 8; i++) {       int t;       scanf( %d , &t);       bst += W[t];     }     if (f) {       int res = ans[id2[make_pair(bst, ast)]];       if (res == 1) {         printf( Bob n );       } else if (res == -1) {         printf( Alice n );       } else {         printf( Deal n );       }     } else {       int res = ans[id2[make_pair(ast, bst)]];       if (res == 1) {         printf( Alice n );       } else if (res == -1) {         printf( Bob n );       } else {         printf( Deal n );       }     }   }   int main() {     init();     scanf( %d , &T);     while (T--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   int n, cnt[60], have, r = 1;   int main() {     ios_base::sync_with_stdio(0);     cin.tie();     cout.tie();     cin >> s;     n = s.size();     s =     + s;     for (int i = (1); i <= (n); ++i) {       while (r <= n && have < 26) {         if (s[r] ==  ? )           ++have;         else {           int temp = s[r] -  A ;           if (!cnt[temp]) ++have;           ++cnt[temp];         }         ++r;       }       if (have == 26 && r - i == 26) {         int q[50], top = 0;         for (int j = (0); j <= (25); ++j)           if (!cnt[j]) q[++top] = j;         for (int j = (1); j <= (i - 1); ++j)           if (s[j] ==  ? )             cout <<  A ;           else             cout << s[j];         for (int j = (i); j <= (min(r, n)); ++j)           if (s[j] ==  ? ) {             if (top)               cout << (char)( A  + q[top--]);             else               cout <<  A ;           } else             cout << s[j];         for (int j = (r + 1); j <= (n); ++j)           if (s[j] ==  ? )             cout <<  A ;           else             cout << s[j];         return 0;       }       if (s[i] ==  ? )         --have;       else {         int temp = s[i] -  A ;         --cnt[temp];         if (!cnt[temp]) --have;       }     }     cout << -1;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   const int MAX = 1e5 + 55;   const int inf = 1e9 + 77;   const int MOD = 1e9 + 7;   const double PI = acos(-1.0);   const double eps = 1e-7;   int main() {     int n, k;     scanf( %d , &n);     scanf( %d , &k);     if (n > (long long)k * (long long)(k - 1)) {       printf( NO );       return 0;     }     printf( YES n );     int need = n;     for (int i = 1; i <= k && need; ++i) {       for (int j = i + 1; j <= k && need; ++j) {         printf( %d %d n , i, j);         --need;         if (need) {           printf( %d %d n , j, i);           --need;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long spf[1000005];   vector<long long> primes, prev[1000005], next[1000005];   void sieve() {     for (long long i = 2; i < 1000005; ++i) {       if (spf[i] == 0) {         spf[i] = i;         for (long long j = 2 * i; j <= 1000005; j += i) {           if (spf[j] == 0) spf[j] = i;         }       }     }   }   bool cmp(const pair<long long, long long>& a,            const pair<long long, long long>& b) {     if (a.first == b.first)       return a.second < b.second;     else       return a.first > b.first;   }   string kmp(string s) {     long long n = s.size();     vector<long long> p(n);     long long i = 1, len = 0;     while (i < n) {       if (s[i] == s[len]) {         len++;         p[i] = len;         i++;       } else {         if (len != 0) {           len = p[len - 1];         } else {           p[i] = 0;           i++;         }       }     }     long long ans = p[n - 1];     string t = s.substr(0, ans);     return t;   }   string pal(string t) {     string r = t;     reverse(r.begin(), r.end());     string t1 = kmp(r +  #  + t);     string t2 = kmp(t +  #  + r);     return t1.size() > t2.size() ? t1 : t2;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     srand(static_cast<unsigned>(time(0)));     long long t = 1;     cin >> t;     while (t--) {       string s;       cin >> s;       long long n = s.size();       long long i = 0;       while (i <= n - i - 1 && s[i] == s[n - i - 1]) {         i++;       }       if (i > n - i - 1) {         cout << s <<   n ;         continue;       }       string t1 = s.substr(i, n - 2 * i);       string ans = pal(t1);       string temp = s.substr(0, i);       ans = temp + ans;       reverse(temp.begin(), temp.end());       ans = ans + temp;       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   vector<long long int> graph[100007];   long long int vis[100007];   long long int mxm;   void dfs(long long int u, long long int p, long long int d) {     vis[u] = 1;     mxm = max(mxm, d);     for (long long int v : graph[u]) {       dfs(v, u, d + 1);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long int tc = 1;     long long int cs = 0;     while (tc--) {       long long int n;       cin >> n;       mxm = 0;       for (long long int i = 1; i <= n; i++) {         long long int a;         cin >> a;         if (a != -1) graph[a].push_back(i);       }       long long int ans = 0;       for (long long int i = 1; i <= n; i++) {         if (!vis[i]) {           dfs(i, -1, 1);           ans = max(ans, mxm);           mxm = 0;         }       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int NMAX = 31400;   struct point {     int x, y;   };   int n;   pair<point, point> p[5];   bool used[5];   bool func() {     long long s = 0;     point MIN, MAX;     MIN.x = MIN.y = NMAX;     MAX.x = MAX.y = 0;     for (int i = 0; i < n; i++) {       s += (p[i].second.x - p[i].first.x) * (p[i].second.y - p[i].first.y);       MIN.x = min(MIN.x, p[i].first.x);       MIN.y = min(MIN.y, p[i].first.y);       MAX.x = max(MAX.x, p[i].second.x);       MAX.y = max(MAX.y, p[i].second.y);     }     if ((MAX.x - MIN.x) == (MAX.y - MIN.y) && s == pow(MAX.x - MIN.x, 2)) {       return true;     }     return false;   }   int main() {     cin >> n;     pair<int, int> a, b, MAX, MIN;     for (int i = 0; i < n; i++) {       cin >> p[i].first.x >> p[i].first.y >> p[i].second.x >> p[i].second.y;     }     if (func())       cout <<  YES ;     else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long int power(unsigned long long int n,                                unsigned long long int m) {     if (n == 0LL)       return 1LL % m;     else if (n & 1LL)       return ((power(n / 2, m) % m) * (power(n / 2, m) % m) * (3LL % m)) % m;     else       return ((power(n / 2, m) % m) * (power(n / 2, m) % m)) % m;   }   void solve() {     unsigned long long int n, m, ans;     cin >> n >> m;     ans = (power(n, m) + m - 1) % m;     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cout.tie(NULL);     cin.tie(NULL);     ;     unsigned long long int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 10;   const long long mod = 1000000007;   int A[N], rmq[N][25], getL[N];   void go(int n) {     for (int i = 0; i < n; i++) rmq[i][0] = i;     for (int i = 1; i < N; i++) getL[i] = log2(i);     for (int j = 1; (1 << j) <= n; j++) {       for (int i = 0; i + (1 << j) - 1 < n; i++) {         if (A[rmq[i][j - 1]] < A[rmq[i + (1 << (j - 1))][j - 1]]) {           rmq[i][j] = rmq[i][j - 1];         } else {           rmq[i][j] = rmq[i + (1 << (j - 1))][j - 1];         }       }     }   }   int getmin(int i, int j) {     int k = getL[j - i + 1];     if (A[rmq[i][k]] < A[rmq[j - (1 << k) + 1][k]]) {       return A[rmq[i][k]];     }     return A[rmq[j - (1 << k) + 1][k]];   }   vector<pair<int, int> > v;   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n, d, m;     cin >> d >> n >> m;     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       v.push_back(make_pair(x, y));     }     v.push_back(make_pair(d, 0));     sort(v.begin(), v.end());     int st = 0, fuel = n;     for (int i = 0; i < v.size(); i++) A[i] = v[i].second;     go(m + 1);     long long cst = 0;     for (int i = 0; i < v.size(); i++) {       if (v[i].first - st > n) {         cst = -1;         break;       }       fuel -= (v[i].first - st);       int l = i + 1, r = v.size() - 1, res = i;       while (l <= r) {         int mid = (l + r) >> 1;         if (v[mid].first - v[i].first <= fuel) {           l = mid + 1;           res = mid;         } else           r = mid - 1;       }       int nxtmin = i;       l = i + 1, r = v.size() - 1;       while (l <= r) {         int mid = (l + r) >> 1;         if (getmin(i + 1, mid) <= v[i].second) {           r = mid - 1;           nxtmin = mid;         } else           l = mid + 1;       }       st = v[i].first;       if (res >= nxtmin) {         continue;       }       cst += (min(n, v[nxtmin].first - v[i].first) - fuel) * 1LL * v[i].second;       fuel = min(n, v[nxtmin].first - v[i].first);     }     cout << cst;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1005;   struct edge {     int to, next;   } e[N * 2];   int head[N], tot, n;   int sz[N], mxv, mxrt;   void add(int x, int y) {     e[++tot] = (edge){y, head[x]};     head[x] = tot;   }   void dfs(int x, int fa, int n) {     int mx = 0;     sz[x] = 1;     for (int i = head[x]; i; i = e[i].next)       if (e[i].to != fa) {         dfs(e[i].to, x, n);         sz[x] += sz[e[i].to];         mx = max(mx, sz[e[i].to]);       }     mx = max(mx, n - sz[x]);     if (mx < mxv) mxv = mx, mxrt = x;   }   pair<int, int> q[N];   int f[N][N];   int top, be[N], mnv, mnid, dif;   void insert(int x, int y) {     q[++top] = pair<int, int>(x, y);     for (int i = (int)(0); i <= (int)(n); i++) f[top][i] = f[top - 1][i];     for (int i = (int)(y); i <= (int)(n); i++) f[top][i] |= f[top - 1][i - y];   }   int s1, s2, dep[N];   void getans(int x, int fa, int type) {     dep[x] = (type == 1 ? (s1 += 1) : (s2 += dif));     printf( %d %d %d n , x, fa, dep[x] - dep[fa]);     for (int i = head[x]; i; i = e[i].next)       if (e[i].to != fa) getans(e[i].to, x, type);   }   int main() {     scanf( %d , &n);     for (int i = (int)(1); i <= (int)(n - 1); i++) {       int x, y;       scanf( %d%d , &x, &y);       add(x, y);       add(y, x);     }     mxv = 1 << 30;     dfs(1, 0, n);     f[0][0] = 1;     for (int i = head[mxrt]; i; i = e[i].next)       insert(e[i].to, sz[e[i].to] > sz[mxrt] ? n - sz[mxrt] : sz[e[i].to]);     insert(mxrt, 1);     mnv = 1 << 30;     for (int i = (int)(0); i <= (int)(n); i++)       if (abs(n - 2 * i) < mnv && f[top][i]) mnv = n - 2 * i, mnid = i;     dif = mnid;     for (int i = (int)(top); i >= (int)(1); i--) {       if (mnid >= q[i].second && f[i - 1][mnid - q[i].second])         be[i] = 1, mnid -= q[i].second;       else         be[i] = 0;     }     for (int i = (int)(1); i <= (int)(top - 1); i++)       getans(q[i].first, mxrt, be[i]);   }
#include <bits/stdc++.h>   using namespace std;   struct Node {     vector<int> children;     int value, bit;     Node(int b) {       children.assign(2, -1);       value = 0;       bit = b;     }   };   vector<Node> tree;   void add(int id, int amt, int n) {     tree[n].value += amt;     if (tree[n].bit == 0) return;     int next = id / tree[n].bit;     if (tree[n].children[next] == -1) {       tree[n].children[next] = tree.size();       tree.emplace_back(tree[n].bit / 2);     }     add(id & (tree[n].bit - 1), amt, tree[n].children[next]);   }   int query(int id, int l, int n) {     if (tree[n].bit == 0) return 0;     int nextId = id & (tree[n].bit - 1);     int nextL = l & (tree[n].bit - 1);     int child = (id ^ l) / tree[n].bit;     int result = 0;     if (l & tree[n].bit) {       int rChild = tree[n].children[1 - child];       if (rChild != -1) result += tree[rChild].value;     }     if (tree[n].children[child] != -1)       result += query(nextId, nextL, tree[n].children[child]);     return result;   }   int main() {     tree.emplace_back(1 << 30);     int q;     cin >> q;     for (int qa = 0; qa < q; ++qa) {       int type;       cin >> type;       if (type < 3) {         int p;         cin >> p;         add(p, type == 1 ? 1 : -1, 0);       } else {         int p, l;         cin >> p >> l;         cout << query(p, l, 0) << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   double PI = 3.14159;   int dX[] = {1, -1, 0, 0};   int dY[] = {0, 0, 1, -1};   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     double h, m, angle_h = 0, angle_m = 0;     char c;     cin >> h >> c >> m;     h = fmod(h, 12);     angle_h = (h + m / 60) * 5;     angle_h *= 6.0;     angle_m = m * 6;     cout << fixed << setprecision(9) << angle_h <<     << angle_m <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, q;     cin >> n >> q;     while (q--) {       long long a, b;       cin >> a >> b;       if ((a + b) % 2 == 0) {         long long ans = 0;         ans += (a) / 2 * ((n + 1) / 2);         ans += ((a - 1) - (a / 2)) * (n / 2);         if (a % 2) {           ans += (b + 1) / 2;         } else {           ans += b / 2;         }         cout << ans <<   n ;       } else {         long long ans = (n * n + 1) / 2;         ans += (a) / 2 * (n / 2);         ans += ((a - 1) - (a / 2)) * ((n + 1) / 2);         if (a % 2) {           ans += (b) / 2;         } else {           ans += (b + 1) / 2;         }         cout << ans <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k, c, ans = 0;     string s;     cin >> s;     bool sol = 1;     for (int i = 0; i < s.length(); i++) {       if (s[i] ==  1  && s[i + 1] ==  4  && s[i + 2] ==  4 ) {         i += 2;         continue;       }       if (s[i] ==  1  || (s[i] ==  4  && s[i - 1] ==  1 ))         continue;       else         sol = 0;     }     if (sol)       cout <<  YES ;     else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int max_n = 100;   int a[max_n], tmp[max_n];   bool vis[max_n];   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   int main() {     int n;     cin >> n;     for (int i = 0; i < (n); i++) {       cin >> a[i];       a[i]--;       tmp[i] = a[i];     }     sort(tmp, tmp + n);     for (int i = 0; i < (n); i++)       if (i != tmp[i]) {         cout << -1 << endl;         return 0;       }     long long ans = 1;     memset(vis, false, sizeof vis);     for (int i = 0; i < (n); i++)       if (!vis[i]) {         int cnt = 0;         for (int k = i; !vis[k]; k = a[k]) {           vis[k] = true;           cnt++;         }         if (cnt % 2 == 0) cnt /= 2;         ans *= cnt / gcd(ans, cnt);       }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long p;   long long a[1000005];   long long fastpow(long long a, int x) {     if (x < 0) return 1;     if (x == 0) return 1;     if (x == 1) return a;     long long tmp = fastpow(a, x >> 1);     tmp = (tmp * tmp) % 1000000007ll;     if (x & 1) {       tmp = (tmp * a) % 1000000007ll;     }     return tmp;   }   void solve() {     scanf( %d%lld , &n, &p);     for (int i = 0; i < n; i++) {       scanf( %lld , a + i);     }     if (p == 1) {       printf( %d n , n % 2);       return;     }     sort(a, a + n);     long long ans = 0;     long long res = 0;     int last = 0;     for (int i = n - 1; i >= 0; i--) {       if (i != n - 1) {         ans *= fastpow(p, last - a[i]);         ans %= 1000000007ll;       }       if (i != n - 1 && res <= 1e6 + 100) {         for (int j = 0; j < 20 && j < last - a[i]; j++) {           res *= p;           if (res > 1e6 + 100) {             res = 1e18;             break;           }         }       }       if (res == 0) {         ans++;         res++;       } else {         ans += 1000000007ll - 1;         res--;       }       ans %= 1000000007ll;       last = a[i];     }     ans *= fastpow(p, last);     printf( %lld n , ans % 1000000007ll);   }   int main() {     ios_base::sync_with_stdio(false);     int T;     scanf( %d , &T);     while (T--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int mod = 1000000007;   const long long linf = 0x3f3f3f3f3f3f3f3f;   char c[200100];   int qnt[200100][26];   int main() {     int t;     scanf( %d , &t);     while (t--) {       int n, k;       scanf( %d%d , &n, &k);       scanf(  %s , c);       int m = n / k;       int res = 0;       if (k % 2) {         for (int i = 0; i <= k / 2; i++) {           for (int j = 0; j < m; j++) {             int a = i + j * k;             int b = k - 1 - i + j * k;             qnt[i][c[a] -  a ]++;             qnt[i][c[b] -  a ]++;           }         }         for (int i = 0; i < k / 2; i++) {           int maior = 0;           for (int j = 0; j < 26; j++) maior = max(maior, qnt[i][j]);           res += 2 * m - maior;         }         int maior = 0;         for (int j = 0; j < 26; j++) maior = max(maior, qnt[k / 2][j]);         res += (2 * m - maior) / 2;       } else {         for (int i = 0; i < k / 2; i++) {           for (int j = 0; j < m; j++) {             int a = i + j * k;             int b = k - 1 - i + j * k;             qnt[i][c[a] -  a ]++;             qnt[i][c[b] -  a ]++;           }         }         for (int i = 0; i < k / 2; i++) {           int maior = 0;           for (int j = 0; j < 26; j++) maior = max(maior, qnt[i][j]);           res += 2 * m - maior;         }       }       printf( %d n , res);       for (int i = 0; i <= n; i++) {         for (int j = 0; j < 26; j++) qnt[i][j] = 0;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     bool x = false;     string s;     cin >> s;     string b;     for (int i = 0; i < s.size(); i++) {       if (s[i] ==  d  && s[i + 1] ==  o  && s[i + 2] ==  t  && i != 0 &&           i + 2 < s.size() - 1) {         b +=  . ;         s[i + 1] =    ;         s[i + 2] =    ;       } else if (x == false && s[i] ==  a  && s[i + 1] ==  t  && i != 0 &&                  i + 1 < s.size() - 1) {         b +=  @ ;         s[i + 1] =    ;         x = true;       } else if (s[i] !=    ) {         b += s[i];       }     }     cout << b;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mx = 1e3 + 100, M = 1e9 + 7;   long long int n, m, d[mx][mx];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     d[0][0] = 1;     for (int i = 1; i < mx; i++) {       d[i][0] = 1;       for (int j = 1; j < i + 1; j++)         d[i][j] = (d[i - 1][j - 1] + d[i - 1][j]) % M;     }     cout << d[(m * 2) + (n - 1)][(n - 1)] << endl;     return 0;   }