func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxN = 1000 * 1000 + 5;   bool mark[4][maxN];   int n, m, comp;   inline void dfs(int x, int y) {     if (mark[x][y]) return;     mark[x][y] = true;     if (x == 0 && y == 1) mark[3][1] = true;     if (x == 0 && y == m) mark[1][1] = true;     if (x == 1 && y == 1) mark[0][m] = true;     if (x == 1 && y == n) mark[2][m] = true;     if (x == 2 && y == 1) mark[3][n] = true;     if (x == 2 && y == m) mark[1][n] = true;     if (x == 3 && y == m) mark[2][1] = true;     if (x == 3 && y == 1) mark[0][1] = true;     if (x == 0) {       int dr = m - y;       int dl = y - 1;       int dd = n - 1;       int xr = 1 + min(dr, dd), yr = y + min(dr, dd);       int xl = 1 + min(dl, dd), yl = y - min(dl, dd);       (xr == n) ? dfs(2, yr) : dfs(1, xr);       (xl == n) ? dfs(2, yl) : dfs(3, xl);     }     if (x == 2) {       int dr = m - y;       int dl = y - 1;       int du = n - 1;       int xr = n - min(dr, du), yr = y + min(dr, du);       int xl = n - min(dl, du), yl = y - min(dl, du);       (xr == 1) ? dfs(0, yr) : dfs(1, xr);       (xl == 1) ? dfs(0, yl) : dfs(3, xl);     }     if (x == 1) {       int dd = n - y;       int du = y - 1;       int dl = m - 1;       int xu = y - min(du, dl), yu = m - min(du, dl);       int xd = y + min(dd, dl), yd = m - min(dd, dl);       (yu == 1) ? dfs(3, xu) : dfs(0, yu);       (yd == 1) ? dfs(3, xd) : dfs(2, yd);     }     if (x == 3) {       int dd = n - y;       int du = y - 1;       int dr = m - 1;       int xu = y - min(du, dr), yu = 1 + min(du, dr);       int xd = y + min(dd, dr), yd = 1 + min(dd, dr);       (yu == m) ? dfs(1, xu) : dfs(0, yu);       (yd == m) ? dfs(1, xd) : dfs(2, yd);     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       if (!mark[0][i]) {         comp++;         dfs(0, i);       }       if (!mark[2][i]) {         comp++;         dfs(2, i);       }     }     for (int i = 1; i <= n; i++) {       if (!mark[1][i]) {         comp++;         dfs(1, i);       }       if (!mark[3][i]) {         comp++;         dfs(3, i);       }     }     printf( %d n , comp);     return 0;   }   