func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, m;     cin >> n >> m;     long long int x[n][m], y[n][m], a[n][m], b[n], c[m], i, j, ans = 0, ans1 = 0,                                                                d[n], e[m];     for (i = 0; i < n; i++) {       long long int min = 99999999999;       for (j = 0; j < m; j++) {         cin >> x[i][j];         a[i][j] = x[i][j];         y[i][j] = x[i][j];       }     }     for (i = 0; i < n; i++) {       long long int min = 99999999999;       for (j = 0; j < m; j++) {         if (min > a[i][j]) min = a[i][j];       }       b[i] = min;       if (b[i] != 0) ans += b[i];     }     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         a[i][j] -= b[i];       }     }     for (i = 0; i < m; i++) {       long long int min = 99999999999;       for (j = 0; j < n; j++) {         if (min > a[j][i]) min = a[j][i];       }       c[i] = min;       if (c[i] != 0) ans += c[i];     }     for (i = 0; i < m; i++) {       for (j = 0; j < n; j++) {         a[j][i] -= c[i];       }     }     long long int count = 0;     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         if (a[i][j] == 0) count++;       }     }     for (i = 0; i < m; i++) {       long long int min = 99999999999;       for (j = 0; j < n; j++) {         if (min > y[j][i]) min = y[j][i];       }       e[i] = min;       if (e[i] != 0) ans1 += e[i];     }     for (i = 0; i < m; i++) {       for (j = 0; j < n; j++) {         y[j][i] -= e[i];       }     }     for (i = 0; i < n; i++) {       long long int min = 99999999999;       for (j = 0; j < m; j++) {         if (min > y[i][j]) min = y[i][j];       }       d[i] = min;       if (d[i] != 0) ans1 += d[i];     }     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         y[i][j] -= d[i];       }     }     long long int count1 = 0;     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         if (y[i][j] == 0) count1++;       }     }     if (ans < ans1) {       if (count == n * m) {         cout << ans << endl;         for (i = 0; i < n; i++) {           if (b[i] != 0) {             while (b[i]--) cout <<  row   << i + 1 << endl;           }         }         for (i = 0; i < m; i++) {           if (c[i] != 0) {             while (c[i]--) cout <<  col   << i + 1 << endl;           }         }       } else {         cout << -1 << endl;       }     } else {       if (count1 == n * m) {         cout << ans1 << endl;         for (i = 0; i < n; i++) {           if (d[i] != 0) {             while (d[i]--) cout <<  row   << i + 1 << endl;           }         }         for (i = 0; i < m; i++) {           if (e[i] != 0) {             while (e[i]--) cout <<  col   << i + 1 << endl;           }         }       } else {         cout << -1 << endl;       }     }     return 0;   }   