Buggy python submission (verdict: Runtime Error):
H, W = [int(i) for i in input().split()]
A = [[]] * H
for i in range(H):
    A[i] = [int(i) for i in input().split()]

ans = []
x = -1
for i in range(H):
    x = x * (-1)
    l, r, d = (0, W, 1) if i % 2 == 0 else (W-1, -1, -1)
    for j in range(l, r, d):
        #print("i,j=",i, j)
        if A[i][j] % 2 == 0:
            continue
        if x == 1 and i == H - 1 and j == W - 1:
            continue
        if x == -1 and i == 0 and j == 0:
            continue
        
        if not(j + x < 0 or j + x >= W):
            A[i][j] = A[i][j] - 1
            A[i][j + x] = A[i][j + x] + 1
            ans.append((i, j, i, j+x))
        else :
            A[i][j] = A[i][j] - 1;
            A[i+1][j] = A[i+1][j] + 1
            ans.append((i, j, i+1, j));


print (len(ans))
for y, x, b, a in ans:
    print (y+1, x+1, b+1, a+1)
        


Fixed submission:
H, W = [int(i) for i in input().split()]
A = [[]] * H
for i in range(H):
    A[i] = [int(i) for i in input().split()]

ans = []
x = -1
for i in range(H):
    x = x * (-1)
    l, r, d = (0, W, 1) if i % 2 == 0 else (W-1, -1, -1)
    for j in range(l, r, d):
        #print("i,j=",i, j)
        if A[i][j] % 2 == 0:
            continue
        if x == 1 and i == H - 1 and j == W - 1:
            continue
        if x == -1 and i == H - 1 and j == 0:
            continue
        
        if not(j + x < 0 or j + x >= W):
            A[i][j] = A[i][j] - 1
            A[i][j + x] = A[i][j + x] + 1
            ans.append((i, j, i, j+x))
        else :
            A[i][j] = A[i][j] - 1;
            A[i+1][j] = A[i+1][j] + 1
            ans.append((i, j, i+1, j));


print (len(ans))
for y, x, b, a in ans:
    print (y+1, x+1, b+1, a+1)

Buggy python submission (verdict: Runtime Error):
H, W = [int(i) for i in input().split()]
A = [[]] * H
for i in range(H):
    A[i] = [int(i) for i in input().split()]

ans = []
x = -1
for i in range(H):
    x = x * (-1)
    l, r, d = (0, W, 1) if i % 2 == 0 else (W-1, -1, -1)
    for j in range(l, r, d):
        #print("i,j=",i, j)
        if A[i][j] % 2 == 0:
            continue
        if x == 1 and i == H - 1 and j == W - 1:
            continue
        if x == -1 and i == 0 and j == 0:
            continue
        
        if not(j + x < 0 or j + x >= W):
            A[i][j] = A[i][j] - 1
            A[i][j + x] = A[i][j + x] + 1
            ans.append((i, j, i, j+x))
        else :
            A[i][j] = A[i][j] - 1;
            A[i+1][j] = A[i+1][j] + 1
            ans.append((i, j, i+1, j));


print (len(ans))
for y, x, b, a in ans:
    print (y, x, b, a)
        


Fixed submission:
H, W = [int(i) for i in input().split()]
A = [[]] * H
for i in range(H):
    A[i] = [int(i) for i in input().split()]

ans = []
x = -1
for i in range(H):
    x = x * (-1)
    l, r, d = (0, W, 1) if i % 2 == 0 else (W-1, -1, -1)
    for j in range(l, r, d):
        #print("i,j=",i, j)
        if A[i][j] % 2 == 0:
            continue
        if x == 1 and i == H - 1 and j == W - 1:
            continue
        if x == -1 and i == H - 1 and j == 0:
            continue
        
        if not(j + x < 0 or j + x >= W):
            A[i][j] = A[i][j] - 1
            A[i][j + x] = A[i][j + x] + 1
            ans.append((i, j, i, j+x))
        else :
            A[i][j] = A[i][j] - 1;
            A[i+1][j] = A[i+1][j] + 1
            ans.append((i, j, i+1, j));


print (len(ans))
for y, x, b, a in ans:
    print (y+1, x+1, b+1, a+1)