func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int t[4000005];   void update(long long int v, long long int tl, long long int tr,               long long int pos) {     if (tl == tr) {       t[v]++;       return;     }     long long int tm = (tl + tr) / 2;     if (pos <= tm)       update(2 * v, tl, tm, pos);     else       update(2 * v + 1, tm + 1, tr, pos);     t[v] = t[2 * v] + t[2 * v + 1];   }   long long int sum(long long int v, long long int tl, long long int tr,                     long long int l, long long int r) {     if (l > r) return 0;     if (l == tl && r == tr) return t[v];     long long int tm = (tl + tr) / 2;     return sum(2 * v, tl, tm, l, min(r, tm)) +            sum(2 * v + 1, tm + 1, tr, max(l, tm + 1), r);   }   void solve() {     long long int n, k;     cin >> n >> k;     if (k >= (n + 1) / 2) k = n - k;     long long int cnt = n, x = 1, cur = 1;     while (cnt) {       long long int y = x + k;       if (y > n) y -= n;       long long int s = x + 1, e = y - 1, val;       if (s == n + 1) s = 1;       if (e == 0) e = n;       if (s <= e)         val = sum(1, 1, n, s, e);       else         val = sum(1, 1, n, s, n) + sum(1, 1, n, 1, e);       cur += val + 1;       cout << cur <<    ;       update(1, 1, n, x);       update(1, 1, n, y);       x = y;       cnt--;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     clock_t z = clock();     long long int qc = 1;     for (long long int i = 1; i <= qc; i++) {       solve();     }     fprintf(stderr,  Total Time:%.4Lf n ,             (long double)(clock() - z) / CLOCKS_PER_SEC),         fflush(stderr);   }   