func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int N, M;     cin >> N >> M;     if (N == 1) {       if (M == 2) {         cout << 0 << endl;         cout <<  1 1  << endl <<  1 2  << endl <<  1 1  << endl;         return 0;       }       cout << 1 << endl;       cout << 1 <<     << M <<     << 1 <<     << 1 << endl;       for (int i = 0; i < M; i++) cout << 1 <<     << i + 1 << endl;       cout << 1 <<     << 1 << endl;     } else if (M == 1) {       if (N == 2) {         cout << 0 << endl;         cout <<  1 1  << endl <<  2 1  << endl <<  1 1  << endl;         return 0;       }       cout << 1 << endl;       cout << N <<     << 1 <<     << 1 <<     << 1 << endl;       for (int i = 0; i < N; i++) cout << i + 1 <<     << 1 << endl;       cout << 1 <<     << 1 << endl;     } else if (N % 2 == 0) {       cout << 0 << endl;       int k = 1;       cout << 1 <<     << 1 << endl;       while (k <= N) {         for (int i = 2; i <= M; i++) cout << k <<     << i << endl;         k++;         for (int i = M; i >= 2; i--) cout << k <<     << i << endl;         k++;       }       for (int i = N; i >= 1; i--) cout << i <<     << 1 << endl;     } else if (M % 2 == 0) {       cout << 0 << endl;       int k = 1;       cout << 1 <<     << 1 << endl;       while (k <= M) {         for (int i = 2; i <= N; i++) cout << i <<     << k << endl;         k++;         for (int i = N; i >= 2; i--) cout << i <<     << k << endl;         k++;       }       for (int i = M; i >= 1; i--) cout << 1 <<     << i << endl;     } else {       cout << 1 << endl;       cout << N <<     << M <<     << 1 <<     << 1 << endl;       int i = 1;       while (i <= N) {         for (int j = 1; j <= M; j++) cout << i <<     << j << endl;         i++;         if (i > N) break;         for (int j = M; j >= 1; j--) cout << i <<     << j << endl;         i++;       }       cout << 1 <<     << 1 << endl;     }     return 0;   }   