Buggy python submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip()
 
h,w=map(int,input().split())
a=[]
for _ in range(h):
    a.append(list(map(int,input().split())))
ans = []
flag = 1
for i in range(h):
    if flag:
        for j in range(w):
            if j == w - 1 and i != h:
                flag ^= 1
                if a[i][j] % 2 == 1: 
                    ans.append([i + 1, j + 1, i + 2, j + 1])
                    a[i + 1][j] += 1
            elif a[i][j] % 2 == 1:
                ans.append([i + 1, j + 1, i + 1, j + 2])
                a[i][j + 1] += 1
    else:
        for j in range(w - 1, -1, -1):
            if j == 0 and i != h:
                flag ^= 1
                if a[i][j] % 2 == 1:
                    ans.append([i + 1, j + 1, i + 2, j + 1])
                    a[i + 1][j] += 1
            elif a[i][j] % 2 == 1:
                ans.append([i + 1, j + 1, i + 1, j])
                a[i][j - 1] += 1
print(len(ans))
for i in ans:
    print(*i)


Fixed submission:
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append([int(x) for x in input().split()])

place = [0, 0]
ans = []
flag = 1

for i in range(H * W - 1):
    x, y = place
    if flag:
        new_x, new_y = x, y + 1
        if new_y >= W:
            new_x, new_y = x + 1, y
            flag = 0
    else:
        new_x, new_y = x, y - 1
        if new_y < 0:
            new_x, new_y = x + 1, y
            flag = 1
    if a[x][y] % 2 == 1:
        ans.append([x + 1, y + 1, new_x + 1, new_y + 1])
        a[new_x][new_y] += 1
    place = [new_x, new_y]

print(len(ans))
for j in ans:
    print(*j)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append([int(x) for x in input().split()])

place = [0, 0]
ans = []
flag = 1

for i in range(H * W - 1):
    x, y = place
    if flag:
        new_x, new_y = x, y + 1
        if new_y >= W:
            new_x, new_y = x + 1, y
            flag = 0
    else:
        new_x, new_y = x, y - 1
        if new_x < 0:
            new_x, new_y = x + 1, y
            flag = 1
    if a[x][y] % 2 == 1:
        ans.append([x + 1, y + 1, new_x + 1, new_y + 1])
        a[new_x][new_y] += 1
    place = [new_x, new_y]

print(len(ans))
for j in ans:
    print(*j)

Fixed submission:
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append([int(x) for x in input().split()])

place = [0, 0]
ans = []
flag = 1

for i in range(H * W - 1):
    x, y = place
    if flag:
        new_x, new_y = x, y + 1
        if new_y >= W:
            new_x, new_y = x + 1, y
            flag = 0
    else:
        new_x, new_y = x, y - 1
        if new_y < 0:
            new_x, new_y = x + 1, y
            flag = 1
    if a[x][y] % 2 == 1:
        ans.append([x + 1, y + 1, new_x + 1, new_y + 1])
        a[new_x][new_y] += 1
    place = [new_x, new_y]

print(len(ans))
for j in ans:
    print(*j)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append([int(x) for x in input().split()])

place = [0, 0]
ans = []
flag = 1

for i in range(H * W - 1):
    x, y = place
    if flag:
        new_x, new_y = x, y + 1
        if new_y >= W:
            new_x, new_y = x + 1, y
            flag = 0
    else:
        new_x, new_y = x, y - 1
        if new_x < 0:
            new_x, new_y = x + 1, y
            flag = 1
    if a[x][y] % 2 == 1:
        ans.append([x + 1, y + 1, new_x + 1, new_y + 1])
        a[new_x][new_y] += 1
    place = [new_x, new_y]

for j in ans:
    print(*j)

Fixed submission:
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append([int(x) for x in input().split()])

place = [0, 0]
ans = []
flag = 1

for i in range(H * W - 1):
    x, y = place
    if flag:
        new_x, new_y = x, y + 1
        if new_y >= W:
            new_x, new_y = x + 1, y
            flag = 0
    else:
        new_x, new_y = x, y - 1
        if new_y < 0:
            new_x, new_y = x + 1, y
            flag = 1
    if a[x][y] % 2 == 1:
        ans.append([x + 1, y + 1, new_x + 1, new_y + 1])
        a[new_x][new_y] += 1
    place = [new_x, new_y]

print(len(ans))
for j in ans:
    print(*j)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append([int(x) for x in input().split()])

place = [0, 0]
ans = []
flag = 1

for i in range(H * W):
    x, y = place
    if flag:
        new_x, new_y = x, y + 1
        if new_y >= W:
            new_x, new_y = x + 1, y
            flag = 0
    else:
        new_x, new_y = x, y - 1
        if new_x < 0:
            new_x, new_y = x + 1, y
            flag = 1
    if a[x][y] % 2 == 1:
        ans.append([x + 1, y + 1, new_x + 1, new_y + 1])
    place = [new_x, new_y]

for j in ans:
    print(*j)

Fixed submission:
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
a = []
for _ in range(H):
    a.append([int(x) for x in input().split()])

place = [0, 0]
ans = []
flag = 1

for i in range(H * W - 1):
    x, y = place
    if flag:
        new_x, new_y = x, y + 1
        if new_y >= W:
            new_x, new_y = x + 1, y
            flag = 0
    else:
        new_x, new_y = x, y - 1
        if new_y < 0:
            new_x, new_y = x + 1, y
            flag = 1
    if a[x][y] % 2 == 1:
        ans.append([x + 1, y + 1, new_x + 1, new_y + 1])
        a[new_x][new_y] += 1
    place = [new_x, new_y]

print(len(ans))
for j in ans:
    print(*j)