func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( -O2 )   using namespace std;   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<   =   << a << endl;     err(++it, args...);   }   const int LIM = 1e5 + 5, MOD = 1e9 + 7;   int t, n, m, k, x, y;   vector<int> par, rk;   int getpar(int i) { return (par[i] == i) ? i : (par[i] = getpar(par[i])); }   bool join(int i, int j) {     i = getpar(i), j = getpar(j);     if (i == j) return 0;     if (rk[i] > rk[j])       par[j] = i;     else {       par[i] = j;       if (rk[i] == rk[j]) rk[j]++;     }     return 1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     par.resize(2 * n + 2 * m - 2);     for (int i = 0; i < par.size(); i++) par[i] = i;     x = t + m + n + m - 2;     rk.assign(2 * n + 2 * m - 2, 0);     for (int i = 0; i < n; i++) {       join(i + x, i);       join(i + x + 1 - m, i + m - 1);     }     for (int i = 0; i < m; i++) {       join(x - i, i);       join(x - i + n - 1, i + n - 1);     }     set<int> st;     for (int i = 0; i < par.size(); i++) {       st.insert(getpar(i));     }     cout << st.size() <<   n ;     return 0;   }   