[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
mod = static integer = 1e9 + 7
define the main function
    n, m are integers, row, col are integer arrays both of size 105, table is an integer array of sizes 105 and 105, minn and flag are integers
    while read n, m
        tmp = integer = 0
        call memset with row, 0, call sizeof with row
        call memset with col, 0, call sizeof with col
        for i = 1 to n inclusive
            for j = 1 to m inclusive, read table[i][j]
        end of the block
        if m is at least n
            for i = 1 to n inclusive
                set min to 0x3f3f3f3f
                for j = 1 to m inclusive
                    if table[i][j] is less than minn, set minn to table[i][j]
                end of the block
                if minn
                    add minn to tmp
                    set row[i] to minn
                    for j = 1 to m inclusive, subtract minn from table[i][j]
                end of the block
            end of the block
            for j = 1 to m inclusive
                set minn to 0x3f3f3f3f
                for i = 1 to n inclusive
                    if table[i][j] is less than minn, set minn to table[i][j]
                end of the block
                if minn
                    add minn to tmp
                    set col[j] to minn
                    for i = 1 to n inclusive, subtract minn from table[i][j]
                end of the block
            end of the block
        else
            for j = 1 to m inclusive
                set minn to 0x3f3f3f3f
                for i = 1 to n inclusive
                    if table[i][j] is less than minn, set minn to table[i][j]
                end of the block
                if minn
                    add minn to tmp
                    set col[j] to minn
                    for i = 1 to n inclusive, subtract minn from table[i][j]
                end of the block
            end of the block
            for i = 1 to n inclusive
                set minn to 0x3f3f3f3f
                for j = 1 to m inclusive
                    if table[i][j] is less than minn, set minn to table[i][j]
                end of the block
                if minn
                    add minn to tmp
                    set row[i] to minn
                    iterate m times, subtract minn from table[i][j]
                end of the block
            end of the block
        end of the block
        set flag to 1
        for i = 1 to n inclusive
            for j = 1 to m inclusive
                if table[i][j]
                    set flag to 0
                    break
                end of the block
        if flag
            print tmp
            for i = 1 to n inclusive
                for k = 1 to row[i] inclusive, print "row ", i
            end of the block
            for j = 1 to m inclusive
                for j = 1 to col[j] inclusive, print "col ", j
            end of the block
        else
            print -1
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

static int mod = 1e9 + 7;
int main() {
    int n, m, row[105], col[105], table[105][105], minn, flag;
    while (cin >> n >> m) {
        int tmp = 0;
        memset(row, 0, sizeof(row));
        memset(col, 0, sizeof(col));
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) cin >> table[i][j];
        }
        if (m >= n) {
            for (int i = 1; i <= n; i++) {
                minn = 0x3f3f3f3f;
                for (int j = 1; j <= m; j++) {
                    if (table[i][j] < minn) minn = table[i][j];
                }
                if (minn) {
                    tmp += minn;
                    row[i] = minn;
                    for (int j = 1; j <= m; j++) table[i][j] -= minn;
                }
            }
            for (int j = 1; j <= m; j++) {
                minn = 0x3f3f3f3f;
                for (int i = 1; i <= n; i++) {
                    if (table[i][j] < minn) minn = table[i][j];
                }
                if (minn) {
                    tmp += minn;
                    col[j] = minn;
                    for (int i = 1; i <= n; i++) table[i][j] -= minn;
                }
            }
        } else {
            for (int j = 1; j <= m; j++) {
                minn = 0x3f3f3f3f;
                for (int i = 1; i <= n; i++) {
                    if (table[i][j] < minn) minn = table[i][j];
                }
                if (minn) {
                    tmp += minn;
                    col[j] = minn;
                    for (int i = 1; i <= n; i++) table[i][j] -= minn;
                }
            }
            for (int i = 1; i <= n; i++) {
                minn = 0x3f3f3f3f;
                for (int j = 1; j <= m; j++) {
                    if (table[i][j] < minn) minn = table[i][j];
                }
                if (minn) {
                    tmp += minn;
                    row[i] = minn;
                    for (int j = 1; j <= m; j++) table[i][j] -= minn;
                }
            }
        }
        flag = 1;
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= m; j++)
                if (table[i][j]) {
                    flag = 0;
                    break;
                }
        if (flag) {
            cout << tmp << '\n';
            for (int i = 1; i <= n; i++) {
                for (int k = 1; k <= row[i]; k++) cout << "row " << i << '\n';
            }
            for (int j = 1; j <= m; j++) {
                for (int k = 1; k <= col[j]; k++) cout << "col " << j << '\n';
            }
        } else
            cout << "-1\n";
    }
    return 0;
}