malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<int> z;   vector<int> pr;   vector<vector<int>> ans;   int s, f;   long long pow(long long n, long long s) {     if (s == 0)       return 1;     else {       if (s % 2 == 1) {         return (n * (pow(n, s - 1))) % 1000000007;       }       if (s % 2 == 0) {         long long k = (pow(n, s / 2)) % 1000000007;         return (k * k) % 1000000007;       }     }   }   void prfix(string s) {     for (int i = 1; i < s.size(); i++) {       pr[i] = pr[i - 1];       while (pr[i] > 0 && s[i] != s[pr[i]]) {         pr[i] = pr[pr[i] - 1];       }       if (s[i] == s[pr[i]]) pr[i]++;     }   }   void zet(string s) {     int l = 0, r = 0;     for (int i = 1; i < s.size(); i++) {       if (i <= r) {         z[i] = min(z[i - l], r - i + 1);       }       for (; z[i] + i < s.size() && s[z[i] + i] == s[z[i]]; z[i]++)         ;       if (i + z[i] - 1 >= r) {         l = i;         r = i + z[i] - 1;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long double R, x1, y1, x2, y2;     cin >> R >> x1 >> y1 >> x2 >> y2;     if (sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) >= R) {       cout << x1 <<     << y1 <<     << R;       return 0;     }     if (x1 == x2 && y1 == y2) {       long double y3 = y1 + R / 2;       cout << x1 <<     << y3 <<     << R / 2;       return 0;     }     long double c = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));     long double x4 = (x1 - x2) * (R + c) / 2 / c + x2;     long double y4 = (y1 - y2) * (R + c) / 2 / c + y2;     cout.precision(10);     cout << fixed << x4 <<     << y4 <<     << (R + c) / 2;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i = 0, n;     bool ok(false);     cin >> n;     while (i * (i + 1) / 2 <= n && ok == false) {       if (i * (i + 1) / 2 == n) {         ok = true;       }       i++;     }     (ok == true) ? cout <<  YES  : cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)1e9 + 7;   template <class X, class Y>   void minimize(X &x, const Y &y) {     if (x > y) x = y;   }   template <class X, class Y>   void maximize(X &x, const Y &y) {     if (x < y) x = y;   }   vector<int> adj[5050];   int nLeaf[5050];   int f[5050][5050][2];   int tmp[5050][2];   int n;   void loadTree(void) {     scanf( %d , &n);     for (int love = 0, _n = (n - 1); love < _n; love = love + 1) {       int u, v;       scanf( %d%d , &u, &v);       adj[u].push_back(v);       adj[v].push_back(u);     }     if (n == 2) {       printf( 1 n );       exit(0);     }     memset(f, 0x3f, sizeof f);   }   void dfs(int u, int p) {     bool leaf = true;     for (__typeof((adj[u]).begin()) it = (adj[u]).begin(); it != (adj[u]).end();          it++)       if (*it != p) {         int v = *it;         dfs(v, u);         leaf = false;       }     if (leaf) {       nLeaf[u] = 1;       for (int i = 0, _n = (2); i < _n; i = i + 1) f[u][i][i] = 0;       return;     }     for (int i = 0, _n = (2); i < _n; i = i + 1) f[u][0][i] = 0;     for (__typeof((adj[u]).begin()) it = (adj[u]).begin(); it != (adj[u]).end();          it++)       if (*it != p) {         int v = *it;         for (int i = 0, _n = (nLeaf[u] + 1); i < _n; i = i + 1)           for (int j = 0, _n = (2); j < _n; j = j + 1) {             tmp[i][j] = f[u][i][j];             f[u][i][j] = INF;           }         for (int i = 0, _n = (nLeaf[u] + 1); i < _n; i = i + 1)           for (int j = 0, _n = (2); j < _n; j = j + 1)             for (int k = 0, _n = (nLeaf[v] + 1); k < _n; k = k + 1)               for (int l = 0, _n = (2); l < _n; l = l + 1)                 minimize(f[u][i + k][j], tmp[i][j] + f[v][k][l] + (j != l));         nLeaf[u] += nLeaf[v];       }   }   void process(void) {     for (int i = (1), _b = (n); i <= _b; i = i + 1)       if (adj[i].size() > 1) {         dfs(i, -1);         printf( %d n , min(f[i][nLeaf[i] / 2][0], f[i][nLeaf[i] / 2][1]));         return;       }     assert(false);   }   int main(void) {     loadTree();     process();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline bool chkmin(T &x, T y) {     return y < x ? x = y, 1 : 0;   }   template <typename T>   inline bool chkmax(T &x, T y) {     return x < y ? x = y, 1 : 0;   }   const int INF = 0x3f3f3f3f;   const int N = 1e2 + 10, Node = 2e3 + 10, Edge = Node * Node / 2;   int Dis[N][N], p[Node], a[Node], f[Node];   int to[Edge], nex[Edge], beg[Node], flow[Edge], dis[Node], cur[Node];   int S, T, e = 1;   inline int read() {     int x = 0, flag = 1;     char ch = getchar();     while (!isdigit(ch) && ch !=  - ) ch = getchar();     if (ch ==  - ) flag = -1, ch = getchar();     while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch -  0 ), ch = getchar();     return x * flag;   }   inline void add(int x, int y, int z) {     to[++e] = y, nex[e] = beg[x], beg[x] = e, flow[e] = z;     to[++e] = x, nex[e] = beg[y], beg[y] = e, flow[e] = 0;   }   inline bool bfs() {     queue<int> q;     memset(dis, 0, sizeof(dis));     dis[S] = 1;     q.push(S);     while (!q.empty()) {       int x = q.front();       q.pop();       for (int i = beg[x]; i; i = nex[i])         if (flow[i] && !dis[to[i]]) dis[to[i]] = dis[x] + 1, q.push(to[i]);     }     return dis[T];   }   inline int dfs(int x, int f) {     if (x == T) return f;     int res = f;     for (int &i = cur[x]; i; i = nex[i])       if (flow[i] && dis[to[i]] == dis[x] + 1) {         int v = dfs(to[i], min(f, flow[i]));         flow[i] -= v, flow[i ^ 1] += v, f -= v;         if (!f) return res;       }     return res - f;   }   int main() {     int n = read(), m = read();     memset(dis, 63, sizeof(dis));     for (int i = (1), iend = (m); i <= iend; i++) {       int u = read(), v = read();       Dis[u][v] = Dis[v][u] = 1;     }     for (int i = (1), iend = (n); i <= iend; i++) Dis[i][i] = 0;     for (int k = (1), kend = (n); k <= kend; k++)       for (int i = (1), iend = (n); i <= iend; i++)         for (int j = (1), jend = (n); j <= jend; j++)           chkmin(Dis[i][j], Dis[i][k] + Dis[k][j]);     int A = read(), B = read(), k = read(), h = read();     S = A + B + 1, T = A + B + 2;     for (int i = (1), iend = (A); i <= iend; i++)       p[i] = read(), a[i] = read(), f[i] = read(), add(S, i, 1);     for (int i = (1), iend = (B); i <= iend; i++) {       add(i + A, T, 1);       int x = read(), d = read();       for (int j = (1), jend = (A); j <= jend; j++)         if (Dis[p[j]][x] <= f[j] && a[j] >= d) add(j, i + A, 1);     }     int ans = 0;     while (bfs()) {       memcpy(cur, beg, sizeof(cur));       ans += dfs(S, 1e9);     }     long long Ans = 1e18;     for (int i = (0), iend = (A); i <= iend; i++)       chkmin(Ans, 1ll * k * min(A - i, ans) + 1ll * i * h);     printf( %lld n , Ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char sign[1000][1000], cpy[1000][1000];   int n, m;   void tryFill(int i, int j) {     for (int ii = i - 1; ii <= i + 1; ii++) {       for (int jj = j - 1; jj <= j + 1; jj++) {         if (i == ii && j == jj) {           continue;         }         if (sign[ii][jj] ==  . ) {           return;         }       }     }     for (int ii = i - 1; ii <= i + 1; ii++) {       for (int jj = j - 1; jj <= j + 1; jj++) {         if (i == ii && j == jj) {           continue;         }         cpy[ii][jj] =  # ;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> sign[i][j];         cpy[i][j] =  . ;       }     }     for (int i = 1; i < n - 1; i++) {       for (int j = 1; j < m - 1; j++) {         tryFill(i, j);       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (sign[i][j] != cpy[i][j]) {           cout <<  NO ;           return 0;         }       }     }     cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T, class T2>   inline int chkmax(T &x, const T2 &y) {     return x < y ? x = y, 1 : 0;   }   template <class T, class T2>   inline int chkmin(T &x, const T2 &y) {     return x > y ? x = y, 1 : 0;   }   const int MAXN = (1 << 20);   int n;   void read() { cin >> n; }   vector<pair<int, int> > change_list = {       {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 3}, {0, 3}, {1, 2}, {2, 0},       {3, 1}, {2, 1}, {1, 1}, {2, 2}, {3, 0}, {3, 3}, {2, 3}, {3, 2},   };   void solve() {     if (n % 4 >= 2) {       cout <<  NO  <<   n ;       return;     }     cout <<  YES  <<   n ;     bool odd_flag = n % 2;     for (int i = 0; i < (n / 4); i++) {       int a = i * 4 + 1, b = i * 4 + 2, c = i * 4 + 3, d = i * 4 + 4;       if (odd_flag) cout << a <<     << n <<   n ;       cout << a <<     << c <<   n ;       if (odd_flag) cout << c <<     << n <<   n ;       if (odd_flag) cout << b <<     << n <<   n ;       cout << b <<     << d <<   n ;       if (odd_flag) cout << d <<     << n <<   n ;       cout << a <<     << b <<   n ;       cout << c <<     << d <<   n ;       cout << a <<     << d <<   n ;       cout << b <<     << c <<   n ;     }     for (int i = 0; i < (n / 4); i++)       for (int j = i + 1; j < (n / 4); j++)         for (auto it : change_list)           cout << 4 * i + 1 + it.first <<     << 4 * j + 1 + it.second <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     read();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T1, typename T2>   pair<T1, T2> operator+(pair<T1, T2> a, pair<T1, T2> b) {     return make_pair(a.first + b.first, a.second + b.second);   }   template <typename T1, typename T2>   pair<T1, T2> operator-(pair<T1, T2> a, pair<T1, T2> b) {     return make_pair(a.first - b.first, a.second - b.second);   }   template <typename T1, typename T2>   ostream& operator<<(ostream& out, pair<T1, T2> p) {     out << p.first <<     << p.second;     return out;   }   template <typename T1, typename T2>   istream& operator>>(istream& in, pair<T1, T2>& p) {     in >> p.first >> p.second;     return in;   }   template <typename T>   ostream& operator<<(ostream& out, vector<T> v) {     for (auto a : v) out << a <<    ;     return out;   }   template <typename T>   istream& operator>>(istream& in, vector<T>& v) {     for (auto& a : v) in >> a;     return in;   }   template <typename T>   ostream& operator<<(ostream& out, multiset<T> S) {     for (auto a : S) out << a <<    ;     return out;   }   template <typename T>   ostream& operator<<(ostream& out, set<T> S) {     for (auto a : S) out << a <<    ;     return out;   }   template <typename T>   set<T> operator+(set<T> A, set<T> B) {     for (auto b : B) A.insert(b);     return A;   }   int main() {     string s, t;     cin >> s >> t;     int i = 0;     for (int j = 0; j < t.size(); j++) {       if (s[i] == t[j]) i++;     }     cout << i + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, l, k;     cin >> n >> l >> k;     vector<int> cnt(26, 0);     for (int i = 0; i < n * l; ++i) {       char c;       cin >> c;       cnt[c -  a ]++;     }     int last = 0;     int cur = 0;     vector<string> ans(n, string(l,  # ));     for (int i = 0; i < l; ++i) {       while (!cnt[cur]) cur++;       while (cnt[cur] < k - last && k - last > 0) {         for (int j = 0; j < cnt[cur]; ++j) {           ans[last + j][i] = char( a  + cur);         }         last += cnt[cur];         cur++;       }       for (int j = 0; j < k - last; ++j) {         ans[j + last][i] = char( a  + cur);       }       cnt[cur] -= k - last;     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < l; ++j) {         if (ans[i][j] ==  # ) {           cnt[cur]--;           cout << char( a  + cur);         } else           cout << ans[i][j];         while (!cnt[cur]) cur++;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     long long int n, i, m, j, f, k;     cin >> n;     m = n * n;     vector<long long int> v[n];     for (i = m; i >= n; i -= n) {       if (f == 0) {         k = 0;         for (j = i; j > (i - n); j--, k++) {           v[k].push_back(j);         }       } else {         k = n - 1;         for (j = i; j > (i - n); j--, k--) {           v[k].push_back(j);         }       }       (f == 0) ? f = 1 : f = 0;     }     for (i = 0; i < n; i++) {       for (j = 0; j < n; j++) cout << v[i][j] <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 15e4 + 4;   const int MAXQ = MAXN;   const int MAXK = 6 + 2;   int n, k, q;   int t[MAXN];   set<int, greater<int> > st;   int main() {     scanf( %d%d%d , &n, &k, &q);     for (int i = 0; i < n; ++i) scanf( %d , t + i);     while (q--) {       int op, id;       scanf( %d%d , &op, &id);       --id;       if (op == 1) {         st.insert(t[id]);       } else {         if (!st.count(t[id])) {           puts( NO );           continue;         }         int cnt = k;         bool ok = false;         for (auto it : st) {           if (it == t[id]) {             puts( YES );             ok = true;             break;           }           --cnt;           if (ok) break;           if (cnt == 0) break;         }         if (!ok) puts( NO );       }     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC target( avx,avx2,fma )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   using pl = pair<long long, long long>;   using vll = vector<long long>;   using mll = map<long long, long long>;   using vpl = vector<pl>;   long long mod = 1000000007;   long long modu(long long a, long long b) {     long long c = a % b;     return (c < 0) ? c + b : c;   }   long long ipow(long long a, long long b) {     long long ans = 1;     while (b--) {       ans = ans * a;     }     return ans;   }   long long getmx(long long i, long long j, long long i1, long long j1,                   long long i2, long long j2) {     long long ans = 0;     ans += abs(i - i1) + abs(j - j1);     ans += abs(i1 - i2) + abs(j1 - j2);     ans += abs(i - i2) + abs(j - j2);     return ans;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   bool isleap(long long n) {     if (n % 400 == 0) return true;     if (n % 4 == 0 && n % 100 != 0) return true;     return false;   }   void solve() {     long long n, dif = 0;     cin >> n;     for (long long i = n + 1;; i++) {       if (isleap(i)) {         dif += 2;       } else {         dif++;       }       if (dif % 7 == 0 && (isleap(i) == isleap(n))) {         cout << i <<   n ;         return;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, a, b, i, x, t, rem;     cin >> n >> a >> b;     for (i = 0; i < n; i++) {       cin >> x;       t = (x * a) % b;       if (t / a >= 1)         rem = t / a;       else         rem = 0;       cout << rem <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void scanint(long long int &x);   map<long long int, long long int> vv;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     multiset<long long int> ms;     long long int n;     scanint(n);     long long int a[n];     long long int curr = 1;     long long int i = 0;     for (i = 0; i < n; i++) {       scanint(a[i]);       if (!vv[a[i]] && a[i] >= 1 && a[i] <= n)         vv[a[i]]++;       else         ms.insert(a[i]);     }     long long int ans = 0;     multiset<long long int>::iterator itr;     for (itr = ms.begin(); itr != ms.end(); itr++) {       while (vv[curr]) curr++;       ans += abs(*itr - curr);       vv[curr]++;     }     cout << ans << endl;     return 0;   }   void scanint(long long int &x) {     register int c = getchar();     x = 0;     int neg = 0;     for (; ((c < 48 || c > 57) && c !=  - ); c = getchar())       ;     if (c ==  - ) {       neg = 1;       c = getchar();     }     for (; c > 47 && c < 58; c = getchar()) {       x = (x << 1) + (x << 3) + c - 48;     }     if (neg) x = -x;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, mid, ans = 0;     int all[100001];     all[0] = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a;       all[i] = all[i - 1] + a;     }     if (all[n] % 2 == 1) {       cout << 0;       return 0;     }     mid = all[n] / 2;     for (int i = 1; i < n; i++) {       if (all[i] == all[n] - all[i]) ans++;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, i;     cin >> t;     for (int i = 0; i < t; i++) {       long long int n;       cin >> n;       if (n < 4)         cout << 4 - n << endl;       else {         cout << n % 2 << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   inline int add(int x, int y) {     x += y;     if (x >= mod) x -= mod;     return x;   }   inline int mul(int x, int y) { return ((long long)x) * y % mod; }   const int N = 1e6 + 5;   int fac[N + 5], ifac[N + 5], p[N + 5];   int Pow(int a, int b) {     int x = 1;     for (; b > 0; b >>= 1) {       if (b & 1) x = mul(x, a);       a = mul(a, a);     }     return x;   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0);     int n, m;     cin >> n >> m;     fac[0] = ifac[0] = p[0] = 1;     for (int i = 1; i < N; ++i) {       fac[i] = mul(fac[i - 1], i);       ifac[i] = Pow(fac[i], mod - 2);       p[i] = mul(p[i - 1], m);     }     auto comb = [&](int x, int y) {       return mul(mul(fac[x], ifac[x - y]), ifac[y]);     };     auto f = [&](int x, int y) {       if (x == y) return 1;       return mul(y, Pow(x, x - y - 1));     };     int ans = 0;     for (int k = 1; k < n; ++k)       if (m >= k) {         int g = mul(mul(comb(m - 1, m - k), comb(n - 2, k - 1)),                     mul(mul(fac[k - 1], p[n - k - 1]), f(n, k + 1)));         ans = add(ans, g);       }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[27];   int main() {     long long n;     string s;     cin >> n;     cin >> s;     long long c = 0, i, d;     for (i = 0; i < (2 * n) - 2; i++) {       if (s[i] >=  a  && s[i] <=  z ) {         d = s[i] -  a ;         a[d]++;       } else {         d = s[i] -  A ;         if (a[d] > 0) {           a[d]--;         } else {           c++;         }       }     }     cout << c << endl;   }
// Problem: A. Dense Array   // Contest: Codeforces - Codeforces Round #702 (Div. 3)   // URL: https://codeforces.com/contest/1490/problem/A   // Memory Limit: 256 MB   // Time Limit: 2000 ms   // Powered by CP Editor (https://github.com/cpeditor/cpeditor)      #include <bits/stdc++.h>   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   #define ll          long long   #define pb          push_back   #define eb    emplace_back   #define mp    make_pair   #define pii         pair<ll,ll>   #define vi          vector<int>   #define vii         vector<pii>   #define mi          map<ll,ll>   #define mii         map<pii,ll>   #define all(a)      (a).begin(),(a).end()   #define fi          first   #define si          second   #define sz(x)       (ll)x.size()   #define endl          n    #define checkbit(n, b) ((n >> b) & 1)   #define mod        1000000007   #define inf        1000000000000000000   #define puts(n)  cout<<n;   #define um           unordered_map<ll,ll>   #define rep(i,a,b)  for(int i=a;i<b;i++)   #define setbits(x) __builtin_popcount(x)   #define mset(m,v) memset(m,v,sizeof(m))   #define int ll    #define deb(x) cout << #x <<  =  << x << endl   #define deb2(x, y) cout << #x <<  =  << x <<  ,  << #y <<  =  << y << endl   using namespace std;   int power(int base, int exp);        //=======================        // USED UNORDERED_MAP????????    // INT_MAX and LONG_MAX range???    //gcd(x,y)=gcd(x-y,y)    //gcd(x,y,z...)=gcd(x,y-x,z-x,...)   void solve() {    int n;    cin>>n;    vi arr(n,0);    rep(i,0,n)    {     cin>>arr[i];    }    int cnt=0;    rep(i,0,n-1)    {     int x=max(arr[i],arr[i+1]);     int y=min(arr[i],arr[i+1]);     while(y*2<x)     {      x=(x+1)/2;      cnt++;     }    }    cout<<cnt<<endl;   }       int32_t main() {       ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);       srand(chrono::high_resolution_clock::now().time_since_epoch().count());          int t = 1;       cin >> t;       while(t--) {         solve();       }           return 0;   }       int power(int base, int exp) {     base %= mod;     int result = 1;     while (exp > 0) {       if (exp & 1) result = ((ll)result * base) % mod;       base = ((ll)base * base) % mod;       exp >>= 1;     }     return result;   }
#include <bits/stdc++.h>   using namespace std;   string s;   struct SUM {     int n;     bool pp;   } b;   vector<SUM> a;   bool cmp(SUM u, SUM v) { return u.n < v.n; }   int main() {     std::ios::sync_with_stdio(false);     int i, j, k, m;     cin >> m >> s;     s = s[0] ==  -  ? s :  +  + s;     for (i = 0; i < s.size();) {       j = i + 1;       if (s[i + 1] <  0  || s[i + 1] >  9 )         k = 1;       else {         for (k = 0; s[j] >=  0  && s[j] <=  9 ; ++j) k = k * 10 + s[j] -  0 ;         ++j;       }       if (s[i] ==  - ) k = -k;       b.n = k;       b.pp = s[j] !=  a ;       a.push_back(b);       i = j + 3;     }     sort(a.begin(), a.end(), cmp);     for (k = 0, i = 0; i < a.size(); ++i) {       if (a[i].pp)         k += a[i].n * ++m;       else         k += a[i].n * m++;     }     cout << k << endl;     return 0;   }
#include <iostream>   #include <bits/stdc++.h>   using namespace std;      int main()   {       int t; cin >> t;       while (t--){           //int n; cin >> n;           string s; cin >> s;           string res =   ;           for (int i=0;i<s.size();i++){               if (i%2==0){                   if (s[i]== a ){                       res +=  b ;                   } else {                       res +=  a ;                   }               } else {                   if (s[i]== z ){                       res +=  y ;                   } else {                       res +=  z ;                   }               }                 }           cout << res << endl;                   }   }