func_code_string: #include <bits/stdc++.h>   using namespace std;   const int Inf = 0x3f3f3f3f;   const long long INF = 0x3f3f3f3f3f3f3f3fll;   struct Shuffle {     vector<int> S;     Shuffle() {}     Shuffle(int len) {       S.resize(len);       iota((S).begin(), (S).end(), 0);     }     friend inline Shuffle operator*(const Shuffle &a, const Shuffle &b) {       static Shuffle res;       res = Shuffle(((int)(a.S).size()));       for (int i = 0; i < (((int)(a.S).size())); ++i) {         res.S[i] = b.S[a.S[i]];       }       return res;     }   };   int n, m;   char s[1 << 20], t[1 << 20];   int main() {     scanf( %s , s);     n = strlen(s);     scanf( %d , &m);     for (int i = 1; i <= (m); ++i) {       int k, d;       scanf( %d%d , &k, &d);       Shuffle a(n), b(n);       for (int j = 0; j < (n); ++j) a.S[j] = (j + n - 1) % n;       vector<vector<int> > ms(d);       for (int j = 0; j < (k); ++j) ms[j % d].push_back(j);       int cnt = 0;       for (int j = 0; j < (d); ++j)         for (int k = 0; k < (((int)(ms[j]).size())); ++k) {           b.S[ms[j][k]] = cnt++;         }       a = b * a;       b = Shuffle(n);       int tms = n - k + 1;       while (tms) {         if (tms & 1) b = b * a;         tms >>= 1;         a = a * a;       }       for (int j = 0; j < (n); ++j) t[b.S[j]] = s[j];       for (int j = 0; j < (n); ++j) s[j] = t[(j + k - 1) % n];       printf( %s n , s);     }     return 0;   }   