Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
ans = []
for i in range(h):
    for j in range(w):
        if a[i][j] % 2 == 0:
            continue
        elif j+1 < w:
            a[i][j+1] += 1
            ans.append(i, j, i, j+1)
        elif i+1 < h:
            a[i+1][j] += 1
            ans.append(i, j, i+1, j)
        # elif j + 1 < w and a[i][j+1] % 2 == 1:
        #     a[i][j] -= 1
        #     a[i][j+1] += 1
        #     continue
        #     ans.append([i, j, i, j+1])
        # elif i + 1 < h and a[i+1][j] % 2 == 1:
        #     a[i][j] -= 1
        #     a[i+1][j] += 1
        #     ans.append([i, j, i+1, j])
        #     continue
        # elif j - 1 >= 0 and a[i][j-1] % 2 == 1:
        #     a[i][j] -= 1
        #     a[i][j-1] += 1
        #     ans.append([i, j, i, j-1])
        #     continue
        # elif i - 1 >= 0 and a[i-1][j] % 2 == 1:
        #     a[i][j] -= 1
        #     a[i-1][j] += 1
        #     ans.append([i, j, i-1, j])
        #     continue
print(len(ans))
for x in ans:
    print(x[0], x[1], x[2], x[3])


Fixed submission:
H, W = map(int, input().split())
A = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    A[h] = list(map(int, input().split()))
    
ans = []
for h in range(H-1):
    for w in range(W):
        if A[h][w] % 2 == 1:
            A[h][w] -= 1
            A[h+1][w] += 1
            ans.append([h+1, w+1, h+2, w+1])
            
for w in range(W-1):
    if A[H-1][w] % 2 == 1:
        A[H-1][w] -= 1
        A[H-1][w+1] += 1
        ans.append([H, w+1, H, w+2])
    
print(len(ans))
for a in ans:
    print(a[0], a[1], a[2], a[3])

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
ans = []
for i in range(h):
    for j in range(w):
        if a[i][j] % 2 == 0:
            continue
        elif j+1 < w and :
            a[i][j+1] += 1
            ans.append(i, j, i, j+1)
        elif i+1 < h:
            a[i+1][j] += 1
            ans.append(i, j, i+1, j)
print(len(ans))
for x in ans:
    print(x[0], x[1], x[2], x[3])


Fixed submission:
H, W = map(int, input().split())
A = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    A[h] = list(map(int, input().split()))
    
ans = []
for h in range(H-1):
    for w in range(W):
        if A[h][w] % 2 == 1:
            A[h][w] -= 1
            A[h+1][w] += 1
            ans.append([h+1, w+1, h+2, w+1])
            
for w in range(W-1):
    if A[H-1][w] % 2 == 1:
        A[H-1][w] -= 1
        A[H-1][w+1] += 1
        ans.append([H, w+1, H, w+2])
    
print(len(ans))
for a in ans:
    print(a[0], a[1], a[2], a[3])

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
ans = []
for i in range(h):
    for j in range(w):
        if a[i,j] % 2 == 0:
            continue
        elif j + 1 < w and a[i, j+1] % 2 == 1:
            a[i, j] -= 1
            a[i, j+1] += 1
            continue
            ans.append([i, j, i, j+1])
        elif i + 1 < h and a[i+1, j] % 2 == 1:
            a[i, j] -= 1
            a[i+1, j] += 1
            ans.append([i, j, i+1, j])
            continue
        elif j - 1 >= 0 and a[i, j-1] % 2 == 1:
            a[i, j] -= 1
            a[i, j-1] += 1
            ans.append([i, j, i, j-1])
            continue
        elif i - 1 >= 0 and a[i-1, j] % 2 == 1:
            a[i, j] -= 1
            a[i-1, j] += 1
            ans.append([i, j, i-1, j])
            continue
print(len(ans))
for x in ans:
    print(x[0], x[1], x[2], x[3])


Fixed submission:
H, W = map(int, input().split())
A = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    A[h] = list(map(int, input().split()))
    
ans = []
for h in range(H-1):
    for w in range(W):
        if A[h][w] % 2 == 1:
            A[h][w] -= 1
            A[h+1][w] += 1
            ans.append([h+1, w+1, h+2, w+1])
            
for w in range(W-1):
    if A[H-1][w] % 2 == 1:
        A[H-1][w] -= 1
        A[H-1][w+1] += 1
        ans.append([H, w+1, H, w+2])
    
print(len(ans))
for a in ans:
    print(a[0], a[1], a[2], a[3])