func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:104857600 )   using namespace std;   const int c = 1000100;   int n, m;   int a[c];   int ans;   int d;   void go(int i, int b) {     if (a[i]) return;     a[i] = 1;     int k = (m - 1) << 1;     int nb = b;     int p = i;     while (k) {       if (b > 0)         d = min(k, n - p);       else         d = min(k, p - 1);       p += d * b;       if (d < k) b = -b;       k -= d;     }     go(p, b);     k = (m - 1) << 1;     p = i;     b = -nb;     while (k) {       if (b > 0)         d = min(k, n - p);       else         d = min(k, p - 1);       p += d * b;       if (d < k) b = -b;       k -= d;     }     go(p, b);   }   int main() {     scanf( %d%d , &n, &m);     ans = 0;     int i;     for (i = 1; i <= n; ++i)       if (!a[i]) {         ++ans;         go(i, 1);       }     printf( %d n , ans);     return 0;   }   