malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n;   double w[507][507], e[507][507], a[507][507];   void dfs(int sco, int l, int r, int p) {     if (l == r) {       w[p][l] = 1;       e[p][l] = sco;       return;     }     int mid = (l + r) >> 1;     dfs(sco / 2, l, mid, p << 1);     dfs(sco / 2, mid + 1, r, (p << 1) + 1);     for (int i = l; i <= mid; i++)       for (int j = mid + 1; j <= r; j++) {         w[p][i] += w[p << 1][i] * w[(p << 1) + 1][j] * a[i][j];         w[p][j] += w[p << 1][i] * w[(p << 1) + 1][j] * a[j][i];       }     for (int i = l; i <= mid; i++)       for (int j = mid + 1; j <= r; j++) {         e[p][i] = max(e[p][i], w[p][i] * sco + e[p << 1][i] + e[(p << 1) + 1][j]);         e[p][j] = max(e[p][j], w[p][j] * sco + e[p << 1][i] + e[(p << 1) + 1][j]);       }   }   int main() {     scanf( %d , &n);     n = 1 << n;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) scanf( %lf , &a[i][j]), a[i][j] *= 0.01;     dfs(n / 2, 1, n, 1);     double ans = -1;     for (int i = 1; i <= n; i++) ans = max(ans, e[1][i]);     printf( %.10f , ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     map<int, vector<int>> frec;     for (int i = 0; i < n; i++) {       int val;       cin >> val;       frec[val].push_back(i);     }     int x = 0;     vector<int> ans(n);     for (int i = 0; i < n; i++) {       while (frec[x].empty() && x >= 3) x -= 3;       if (frec[x].empty()) {         cout <<  Impossible n ;         return 0;       }       ans[i] = frec[x].back() + 1;       frec[x].pop_back();       x++;     }     cout <<  Possible n ;     for (int i = 0; i < n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MM = 2e5 + 5;   int n, k, a, b, q, pref[MM], suff[MM], cnt[MM];   void upd(int bit[], int x, int v) {     for (; x < MM; x += x & -x) {       bit[x] += v;     }   }   int get(int bit[], int x) {     int res = 0;     for (; x > 0; x -= x & -x) res += bit[x];     return res;   }   int get(int bit[], int l, int r) { return get(bit, r) - get(bit, l - 1); }   int main() {     cin.tie(0)->sync_with_stdio(0);     cin >> n >> k >> a >> b >> q;     while (q--) {       int t;       cin >> t;       if (t == 1) {         int x, v;         cin >> x >> v;         int val = min(b, v + cnt[x]);         int diff = val - get(pref, x, x);         upd(pref, x, diff);         val = min(a, v + cnt[x]);         diff = val - get(suff, x, x);         upd(suff, x, diff);         cnt[x] += v;       } else {         int p;         cin >> p;         int ans = get(pref, p - 1);         ans += get(suff, p + k, MM - 1);         cout << ans <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e+5 + 10;   long long b[MAXN], l[MAXN], r[MAXN], o[MAXN], dp[MAXN];   int main() {     int n;     cin >> n;     for (int i = 0; i < n - 1; i++) {       cin >> b[i];     }     for (int i = 1; i < n; i++) {       l[i] = b[i - 1] - (b[i - 1] % 2) + l[i - 1];       if (b[i - 1] == 1) l[i] = 0;     }     for (int i = n - 2; i > -1; i--) {       r[i] = b[i] - (b[i] % 2) + r[i + 1];       if (b[i] == 1) r[i] = 0;     }     for (int i = 1; i < n; i++) {       o[i] = o[i - 1] + b[i - 1] - (b[i - 1] % 2 == 0);     }     long long ans = 0, m = 0;     for (int i = 0; i < n; i++) {       m = max(m, l[i] - o[i]);       ans = max(ans, r[i] + o[i] + m);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve();   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int64_t t;     cin >> t;     while (t--) solve();     return 0;   }   vector<vector<int64_t>> to;   vector<bool> bobCan, parcouru;   vector<int64_t> pId;   int64_t nbPar;   int64_t da, db, goal;   void dfsBob(int64_t n, int64_t dist) {     if (bobCan[n]) return;     bobCan[n] = true;     goal++;     if (dist == 0) return;     for (int64_t &i : to[n]) dfsBob(i, dist - 1);   }   int64_t dfs2(int64_t n, int64_t dist, int64_t id) {     if (pId[n] == id) return 0;     pId[n] = id;     int64_t score = 0;     if (bobCan[n]) score = 1;     if (dist == 0) return score;     for (int64_t &i : to[n]) score += dfs2(i, dist - 1, id);     return score;   }   bool dfs1(int64_t n, int64_t dist) {     if (parcouru[n]) return false;     parcouru[n] = true;     if (dfs2(n, da, nbPar++) == goal) return true;     if (dist == 0) return false;     for (int64_t &i : to[n])       if (dfs1(i, dist - 1)) return true;     return false;   }   bool recherche(int64_t n, int64_t dist, int64_t m) {     if (parcouru[n]) return false;     parcouru[n] = true;     if (n == m) return true;     if (dist == 0) return false;     for (int64_t &i : to[n])       if (recherche(i, dist - 1, m)) return true;     return false;   }   void solve() {     int64_t n, a, b;     cin >> n >> a >> b >> da >> db;     to = vector<vector<int64_t>>(n + 1);     bobCan = parcouru = vector<bool>(n + 1);     for (int64_t i = 0; i < n - 1; i++) {       pair<int64_t, int64_t> input;       cin >> input.first >> input.second;       to[input.first].push_back(input.second);       to[input.second].push_back(input.first);     }     if (db <= 2 * da) {       cout <<  Alice n ;       return;     }     if (recherche(a, da, b)) {       cout <<  Alice n ;       return;     }     parcouru = vector<bool>(n + 1);     goal = 0;     dfsBob(b, db);     parcouru = vector<bool>(n + 1);     pId = vector<int64_t>(n + 1);     nbPar = 1;     if (dfs1(n, da)) {       cout <<  Alice n ;       return;     }     {       cout <<  Bob n ;       return;     }     return;   }
#include <bits/stdc++.h>   using namespace std;   long long int mod = 1e9 + 7;   long long int mul(long long int x, long long int y) {     return (x * 1ll * y) % mod;   }   long long int add(long long int x, long long int y) {     x += y;     while (x >= mod) x -= mod;     while (x < 0) x += mod;     return x;   }   long long int dp[200005][3];   long long int a, b, c;   long long int n, l, r;   long long int fun(int i, int j) {     if (i == n) {       if (j == 0)         return 1;       else         return 0;     }     if (dp[i][j] != -1) return dp[i][j];     dp[i][j] = add(         mul(a, fun(i + 1, (j) % 3)),         add(mul(b, fun(i + 1, (j + 1) % 3)), mul(c, fun(i + 1, (j + 2) % 3))));     return dp[i][j];   }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     cin >> n >> l >> r;     long long int x = (l - 1 + 2) / 3;     long long int y = (r - 1) / 3;     b = y - x + 1;     x = (l - 2 + 2) / 3;     y = (r - 2) / 3;     c = y - x + 1;     x = (l + 2) / 3;     y = (r) / 3;     a = y - x + 1;     if (l == 1 && r == 1) {       a = 0, b = 1, c = 0;     }     memset(dp, -1, sizeof(dp));     long long int ans = 0;     ans = add(ans, mul(a, fun(1, 0)));     ans = add(ans, mul(b, fun(1, 1)));     ans = add(ans, mul(c, fun(1, 2)));     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     char c =  a ;     for (int i = 0; i < s.size(); i++) {       if (s[i] ==  z  + 1)         continue;       else if (s[i] != c) {         cout <<  NO n ;         return 0;       } else {         for (int j = i; j < s.size(); j++) {           if (s[j] == c) s[j] =  z  + 1;         }         c++;       }     }     cout <<  YES n ;   }
#include <bits/stdc++.h>   using namespace std;   const long long max_n = 1e6 + 20;   long long n, m, k, ans, sum;   long long a[max_n];   long long mark[max_n];   vector<long long> v, adj[max_n], jda[max_n];   void dfs(long long v) {     mark[v] = 1;     if (adj[v].size() == 2) ans = -1;     for (auto i : adj[v]) {       if (!mark[i]) {         dfs(i);       }     }   }   int32_t main() {     cin >> n;     for (long long i = 1; i < n; i++) {       long long u, v;       cin >> u >> v;       u--, v--;       adj[v].push_back(u);       adj[u].push_back(v);     }     if (n == 2) {       cout <<  YES ;       return 0;     }     for (long long i = 0; i < n; i++) {       if (adj[i].size() == 1 && !mark[i]) dfs(i);     }     if (ans == -1) {       cout <<  NO ;     } else       cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[111111], ans[111111];   int n, kk;   int main() {     scanf( %d , &n);     for (int i = (1); i <= (n); ++i) scanf( %I64d , &a[i]);     sort(a + 1, a + n + 1);     reverse(a + 1, a + n + 1);     for (int i = (1); i <= (n); ++i) a[i] += a[i - 1];     scanf( %d , &kk);     for (int t = (0); t < (kk); ++t) {       int k;       scanf( %d , &k);       k = (k > n - 1) ? n - 1 : k;       if (!ans[k]) {         long long l, r, st, tmp;         l = r = tmp = 1;         st = 0;         while (l <= n) {           ans[k] += (a[r] - a[l - 1]) * st;           tmp *= k;           ++st;           l = r + 1;           r += tmp;           r = (r > n) ? n : r;         }       }       printf( %I64d  , ans[k]);     }     return 0;   }
#include <bits/stdc++.h>   int main() {     unsigned long long no_of_paths;     unsigned long long no_of_arrangements;     scanf( %I64u , &no_of_paths);     no_of_arrangements = (no_of_paths) * (no_of_paths - 1) / 2 *                          (no_of_paths - 2) / 3 * (no_of_paths - 3) / 4 *                          (no_of_paths - 4) / 5;     no_of_arrangements *= (no_of_paths) * (no_of_paths - 1) * (no_of_paths - 2) *                           (no_of_paths - 3) * (no_of_paths - 4);     printf( %I64u n , no_of_arrangements);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, mod = 1, cnt = 0, i, min;     cin >> n;     vector<int> v{1, 5, 10, 20, 100};     while (n) {       min = INT_MAX;       for (i = 0; i < 5; ++i) {         if (n / v[i] >= 1) {           if (min > n / v[i]) {             min = n / v[i];             mod = n % v[i];           }         }       }       cnt += min;       n = mod;     }     cout << cnt;   }
#include <bits/stdc++.h>   using namespace std;   long long T, m, n, q, w, mi, ma, cnt, s, t, fi, cc, e, r, z, x, an, anx, any,       cx, cy;   long long d[5][2];   int main() {     scanf( %I64d%I64d , &m, &n);     scanf( %I64d%I64d , &e, &r);     scanf( %I64d%I64d , &cx, &cy);     for (int i = 0; i < 4; i++) {       q = e;       w = r;       d[i][0] = e - m;       d[i][1] = r - n;       e = -w;       r = q;     }     fi = 0;     for (int i = 0; i < 4; i++) {       if (d[i][0] == 0 && d[i][1] == 0) {         fi = 1;         break;       }       if (cx == 0 && cy == 0) continue;       if ((d[i][1] * cx - d[i][0] * cy) % (cx * cx + cy * cy) == 0)         if ((d[i][0] * cx + d[i][1] * cy) % (cx * cx + cy * cy) == 0) {           fi = 1;           break;         }     }     if (fi == 1)       puts( YES );     else       puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long B = 360;   const long long N = 100005;   long long block(long long x) { return x / B; }   long long offset(long long x) { return x % B; }   deque<long long> a[B];   signed c[B][N];   long long n, q;   signed main() {     ios::sync_with_stdio(false);     cin >> n;     for (long long i = 0; i < n; i++) {       long long x;       cin >> x;       a[block(i)].push_back(x);       c[block(i)][x]++;     }     cin >> q;     long long lastans = 0;     for (long long i = 0; i < q; i++) {       long long op, l, r, k;       cin >> op >> l >> r;       l = (l + lastans - 1) % n;       r = (r + lastans - 1) % n;       if (l > r) swap(l, r);       if (op == 2) cin >> k;       k = (k + lastans - 1) % n + 1;       long long L = block(l);       long long R = block(r);       l = offset(l);       r = offset(r);       if (op == 1) {         if (L == R) {           long long x = a[R][r];           a[R].erase(a[R].begin() + r);           a[L].insert(a[L].begin() + l, x);         } else {           for (long long i = L; i < R; i++) {             long long x = a[i].back();             a[i].pop_back();             c[i][x]--;             c[i + 1][x]++;             a[i + 1].push_front(x);           }           long long x = a[R][r + 1];           a[R].erase(a[R].begin() + r + 1);           a[L].insert(a[L].begin() + l, x);           c[R][x]--;           c[L][x]++;         }       } else {         long long ans = 0;         if (L == R) {           for (long long i = l; i <= r; i++) ans += a[L][i] == k;         } else {           for (long long i = l; i < a[L].size(); i++) ans += a[L][i] == k;           for (long long i = 0; i <= r; i++) ans += a[R][i] == k;           for (long long i = L + 1; i <= R - 1; i++) ans += c[i][k];         }         cout << (lastans = ans) << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   struct Point {     int x;     int y;   };   int main() {     int n;     cin >> n;     Point P[n];     for (int i = 0; i < n; i++) {       cin >> P[i].x >> P[i].y;     }     int val;     if (n < 2)       val = -1;     else if (n == 2) {       if (P[0].x != P[1].x && P[0].y != P[1].y)         val = abs(P[0].x - P[1].x) * abs(P[0].y - P[1].y);       else         val = -1;     } else {       int alt, larg;       if ((P[0].x - P[1].x) != 0)         alt = P[0].x - P[1].x;       else {         alt = P[0].x - P[2].x;       }       if ((P[0].y - P[1].y) != 0)         larg = P[0].y - P[1].y;       else {         larg = P[0].y - P[2].y;       }       val = abs(alt * larg);     }     cout << val << endl;   }
#include <bits/stdc++.h>   using namespace std;   int q, n;   int par[1 << 20][32], dep[1 << 20];   int da[500000];   void add(int v) {     par[n][0] = par[n + 1][0] = v;     dep[n] = dep[n + 1] = dep[v] + 1;     for (int i = (int)(0); i < (int)(20); i++)       par[n][i + 1] = par[n + 1][i + 1] = par[par[n][i]][i];   }   int lca(int u, int v) {     if (dep[u] > dep[v]) swap(u, v);     int dif = dep[v] - dep[u];     for (int i = (int)(0); i < (int)(21); i++)       if (dif & (1 << i)) v = par[v][i];     if (u == v) return u;     for (int i = 20; i >= 0; i--)       if (par[u][i] != par[v][i]) {         u = par[u][i];         v = par[v][i];       }     return par[u][0];   }   int dist(int u, int v) { return dep[u] + dep[v] - 2 * dep[lca(u, v)]; }   void solve() {     int u = 2, v = 3, d = 2, x, i = 0, jos = q;     ;     dep[2] = dep[3] = dep[4] = 1;     par[2][0] = par[3][0] = par[4][0] = 1;     n = 5;     while (q--) {       scanf( %d , &x);       add(x);       int du = dist(n, u), dv = dist(n, v);       if (du > d)         v = n, d = du;       else if (dv > d)         u = n, d = dv;       n += 2;       da[i] = d;       i++;     }     int j;     for (j = 0; j < jos; j++) {       printf( %d n , da[j]);     }   }   int main() {     scanf( %d , &q);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int mat[1005][1005];   int main() {     int n;     scanf( %d , &n);     for (int i = (0); i < (n); i++) {       for (int j = (0); j < (n); j++) {         scanf( %d , &mat[i][j]);       }     }     int akt = 0;     for (int i = (0); i < (n); i++) akt = (akt + mat[i][i]) % 2;     int q;     scanf( %d , &q);     for (int i = (0); i < (q); i++) {       int nr;       scanf( %d , &nr);       if (nr == 1 || nr == 2) {         akt = 1 - akt;         int x;         scanf( %d , &x);       } else         printf( %d , akt);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = 3.14159265358979323846;   void rw() {}   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     vector<long long> s;     long long n, c, f, se;     cin >> n;     s.push_back(4);     s.push_back(7);     for (int i = 0; i < s.size(); i++) {       f = 0, se = 0;       c = s[i];       while (c) {         if (c % 10 == 4)           f++;         else           se++;         c /= 10;       }       if (s[i] >= n && f == se) {         cout << s[i] <<   n ;         break;       } else {         s.push_back(s[i] * 10 + 4);         s.push_back(s[i] * 10 + 7);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, b, k = 0;     long long x, y, z = 0;     long long hsl[1002];     cin >> a;     for (int i = 1; i <= a; i++) {       y = 0;       z = 0;       cin >> b >> k >> x;       if (x % 2 == 0) {         y = x / 2;         z = x / 2;       } else {         z = x / 2 + 1;         y = x / 2;       }       z = z * b;       y = y * k;       z = z - y;       hsl[i] = z;     }     for (int i = 1; i <= a; i++) {       cout << hsl[i] << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   pair<long long int, long long int> a[500001];   int main() {     ios::sync_with_stdio(false);     cout << fixed << setprecision(10);     long long int i, j, n, f;     double lo, mid, hi, ans = -1, last;     cin >> n;     for (i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;     lo = 0;     hi = 1e10;     for (i = 0; i < 100; i++) {       mid = (lo + hi) / 2.0;       f = 0;       last = -1e100;       for (j = 1; j <= n; j++) {         if (a[j].second > 0)           last = max(last, 1.0 * (a[j].first + 1.0 * a[j].second * mid));         else {           if (1.0 * (a[j].first + 1.0 * a[j].second * mid) < last) {             f = 1;             break;           }         }       }       if (f) {         hi = mid;         ans = mid;       } else         lo = mid;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct st {     int t, l, r, p;     bool operator<(const st& B) const { return t < B.t; }   } a[100005];   int N, M, K, s[100005];   vector<st> u[100005], v[100005];   long long b[100005], ans[100005];   int sum(int x) {     int d = 0;     for (int i = x; i; i -= i & -i) d += s[i];     return d;   }   void ins(int x, int d) {     for (int i = x; i <= M; i += i & -i) s[i] += d;   }   int find(int k) {     int p = 0;     for (int i = 20; i >= 0; i--)       if (p + (1 << i) <= M && s[p + (1 << i)] < k) k -= s[p += 1 << i];     return p + 1;   }   void init() {     scanf( %d%d , &N, &M);     for (int i = 1; i <= N; i++)       scanf( %d%d%d , &a[i].t, &a[i].l, &a[i].r), b[i] = a[i].t, a[i].p = i;     sort(a + 1, a + N + 1), sort(b + 1, b + N + 1),         K = unique(b + 1, b + N + 1) - b - 1;   }   void work(long long t, int p) {     for (auto i : u[p]) v[i.r].push_back(i), ins(i.r, 1);     for (auto i : v[p]) ans[i.p] = t;     ins(p, -u[p].size() - v[p].size());     u[p].clear(), v[p].clear();   }   void doit() {     b[++K] = 1e18;     long long t = 0;     for (int i = 1, j = 1, p = 1; i <= K; i++) {       for (; t < b[i];) {         int n = sum(M), d = sum(p), u = n - sum(p - 1), q;         if (!n) {           t = b[i];           continue;         }         if (u >= d) {           q = find(n - u + 1);           if (t + q - p <= b[i])             t += q - p, p = q, work(t, p);           else             p += b[i] - t, t = b[i];         } else {           q = find(d);           if (t + p - q <= b[i])             t += p - q, p = q, work(t, p);           else             p -= b[i] - t, t = b[i];         }       }       for (; j <= N && a[j].t == b[i]; j++)         ins(a[j].l, 1), u[a[j].l].push_back(a[j]);     }     for (int i = 1; i <= N; i++) printf( %I64d n , ans[i]);   }   int main() {     init();     doit();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, x, n, k, m = 0, f = 0, j = 1;     int a[26];     string s;     cin >> s;     n = s.length();     cin >> k;     k = k + n;     for (i = 0; i < 26; i++) {       cin >> a[i];       m = max(m, a[i]);     }     for (i = 0; i < n; i++) {       f = f + a[s[i] -  a ] * j;       j++;     }     f = f + ((k * (k + 1)) / 2 - (n * (n + 1)) / 2) * m;     cout << f << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long modInverse(long long a, long long m) {     long long m0 = m;     long long y = 0, x = 1;     if (m == 1) return 0;     while (a > 1) {       long long q = a / m;       long long t = m;       m = a % m, a = t;       t = y;       y = x - q * y;       x = t;     }     if (x < 0) x += m0;     return x;   }   long long nCmmod(long long n, long long m, long long mod) {     vector<long long> a(200001, 1);     for (__typeof(1) i = 1; i < 200001; i += 1) {       a[i] = (a[i - 1] * i) % mod;     }     long long p = 1;     p = (p * a[n]) % mod;     p = (p * modInverse(a[m], mod)) % mod;     p = (p * modInverse(a[n - m], mod)) % mod;     return p;   }   vector<long long> p(long long n) {     long long x = 0;     vector<long long> v;     for (long long i = 1; i <= sqrt(n); i++) {       if (n % i == 0) {         if (n / i == i) {           v.push_back(i);         } else {           v.push_back(i);           v.push_back(n / i);         }       }     }     sort(v.begin(), v.end());     return v;   }   long long bsearch(vector<long long> arr, long long l, long long r, int x) {     if (r >= l) {       long long mid = l + (r - l) / 2;       if (arr[mid] == x) return mid;       if (arr[mid] > x) return bsearch(arr, l, mid - 1, x);       return bsearch(arr, mid + 1, r, x);     }     return l + (r - l) / 2;   }   string decToBinary(long long n) {     string s =   ;     long long f = 0;     for (int i = 31; i >= 0; i--) {       int k = n >> i;       if (k & 1)         s +=  1 ;       else         s +=  0 ;     }     return s;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long int power(long long int x, long long int y) {     long long int temp;     if (y == 0) return 1;     temp = power(x, y / 2);     if (y % 2 == 0)       return (temp % 1000000007 * temp % 1000000007) % 1000000007;     else {       if (y > 0)         return (x % 1000000007 * temp % 1000000007 * temp % 1000000007) %                1000000007;       else         return (temp % 1000000007 * temp % 1000000007) % 1000000007 / x;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t = 1;     cin >> t;     while (t--) {       long long n, k;       cin >> n >> k;       string s;       cin >> s;       long long m = n / k;       long long cn = (k + 1) / 2;       long long r = 0;       for (__typeof(cn) i = 0; i < cn; i += 1) {         vector<long long> A(26, 0);         char c = s[i];         for (__typeof(m) j = 0; j < m; j += 1) {           A[s[j * k + i] -  a ] += 1;         }         for (__typeof(m) j = 0; j < m; j += 1) {           A[s[j * k + k - 1 - i] -  a ] += 1;         }         long long ma = -1;         for (__typeof(26) j = 0; j < 26; j += 1) {           if (A[j] > ma) {             ma = A[j];           }         }         if (k % 2 == 1 && i == cn - 1)           r += m - ma / 2;         else           r += 2 * m - ma;       }       cout << r << endl;     }   }