[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]:
make static int mod = 1e9 + 7
define the main function
    make int n, m, array row of size 105, array col of size 105, multidimensional array table of size 105x105, minn, and flag
    while read n and m
        set flag to 0
        set row elements to 0
        set col elements to 0
        for i = 1 to n inclusive
            for j = 1 to m inclusive, read table[i][j]
        end of the block
        if m greater than or equal to n
            for i = 1 to n inclusive
                set minn to 0x3f3f3f3f
                for j = 1 to m inclusive
                    if table[i][j] less than minn, set minn to table[i][j]
                end of the block
                if minn
                    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] less than minn, set minn to table[i]j]
                end of the block
                if minn
                    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] less than minn, set minn to table[i][j]
                end of the block
                if minn
                    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
                    set row[i] to minn
                    for j = 1 to m inclusive, decrease table[i][j] by minn
                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
            end of the block
        if flag
            make int tmp = 0
            for i = 1 to n inclusive, increase tmp by row[i]
            for j = 1 to m inclusive, increase tmp by col[j]
            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 k = 1 to col[j] inclusive, print "col " j
            end of the block
        else
            print "-1\n"
    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) {
        flag = 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) {
                    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) {
                    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) {
                    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) {
                    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) {
            int tmp = 0;
            for (int i = 1; i <= n; i++) { tmp += row[i]; }
            for (int j = 1; j <= m; j++) { tmp += col[j]; }
            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;
}