Buggy python submission (verdict: Runtime Error):
# ABC109D - Make Them Even
import sys
input = sys.stdin.readline


def main():
    H, W = tuple(map(int, input().rstrip().split()))
    A = list(
        list(map(lambda x: int(x) % 2, input().rstrip().split())) for _ in range(H)
    )
    ans = []
    # move left to right
    for i in range(H):
        for j in range(W - 1):
            if A[i][j]:
                A[i][j] ^= 1
                A[i][j + 1] ^= 1
                ans += [(i + 1, j + 1, i + 1, j + 2)]
    for i in range(H - 1):
        if A[i][W]:
            A[i][W] ^= 1
            A[i + 1][W] ^= 1
            ans += [(i + 1, W + 1, i + 2, W + 1)]
    print(len(ans))
    for i in ans:
        print(*i)


if __name__ == "__main__":
    main()

Fixed submission:
# ABC109D - Make Them Even
import sys
input = sys.stdin.readline


def main():
    H, W = tuple(map(int, input().rstrip().split()))
    A = list(
        list(map(lambda x: int(x) % 2, input().rstrip().split())) for _ in range(H)
    )
    ans = []
    # move left to right
    for i in range(H):
        for j in range(W - 1):
            if A[i][j]:
                A[i][j] ^= 1
                A[i][j + 1] ^= 1
                ans += [(i + 1, j + 1, i + 1, j + 2)]
    # move up to down
    for i in range(H - 1):
        if A[i][W - 1]:
            A[i][W - 1] ^= 1
            A[i + 1][W - 1] ^= 1
            ans += [(i + 1, W, i + 2, W)]
    print(len(ans))
    for i in ans:
        print(*i)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# ABC109D - Make Them Even (WA)
def main():
    H, W = tuple(map(int, input().split()))
    A = list(list(map(int, input().split())) for _ in range(H))
    ans = []
    # assume a single stroke
    for i in range(H):
        if i % 2 == 0:
            for j in range(W):
                if (i, j) == (H - 1, W - 1):
                    continue
                if A[i][j] % 2:
                    A[i][j] -= 1
                    if j + 1 != W:
                        A[i][j + 1] += 1
                        ans += [(i, j, i, j + 1)]
                    else:
                        A[i + 1][j] += 1
                        ans += [(i, j, i + 1, j)]
        else:
            for j in range(W, -1, -1):
                if (i, j) == (H - 1, W - 1):
                    continue
                if A[i][j] % 2:
                    A[i][j] -= 1
                    if j != 0:
                        A[i][j - 1] += 1
                        ans += [(i, j, i, j - 1)]
                    else:
                        A[i + 1][j] += 1
                        ans += [(i, j, i + 1, j)]
    print(len(ans))
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

Fixed submission:
# ABC109D - Make Them Even
import sys
input = sys.stdin.readline


def main():
    H, W = tuple(map(int, input().rstrip().split()))
    A = list(
        list(map(lambda x: int(x) % 2, input().rstrip().split())) for _ in range(H)
    )
    ans = []
    # move left to right
    for i in range(H):
        for j in range(W - 1):
            if A[i][j]:
                A[i][j] ^= 1
                A[i][j + 1] ^= 1
                ans += [(i + 1, j + 1, i + 1, j + 2)]
    # move up to down
    for i in range(H - 1):
        if A[i][W - 1]:
            A[i][W - 1] ^= 1
            A[i + 1][W - 1] ^= 1
            ans += [(i + 1, W, i + 2, W)]
    print(len(ans))
    for i in ans:
        print(*i)


if __name__ == "__main__":
    main()