Buggy python submission (verdict: Runtime Error):
def main():
    H, W = map(int, input().split())
    a = [[0] * W]
    for _ in range(H):
        ai = list(map(int, input().split()))
        ai.insert(0, 0)
        a.append(ai)
    N = 0
    yx = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if a[i][j] % 2 == 0:
                continue
            if W >= j + 1:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i, j, i, j + 1])
            elif H >= i + 1:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i, j, i + 1, j])
        if H > i + 1 and a[i][j + 1] % 2 != 0:
            a[i][j + 1] -= 1
            a[i + 1][j + 1] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j + 1])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()


Fixed submission:
def main():
    H, W = map(int, input().split())
    a = [[0] * W]
    for _ in range(H):
        ai = list(map(int, input().split()))
        ai.insert(0, 0)
        a.append(ai)
    N = 0
    yx = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if a[i][j] % 2 == 0:
                continue
            if W >= j + 1:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i, j, i, j + 1])
            elif H >= i + 1:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i, j, i + 1, j])
        if H > i + 1 and a[i][j] % 2 != 0:
            a[i][j] -= 1
            a[i + 1][j] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()

Buggy python submission (verdict: Runtime Error):
def main():
    H, W = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(H)]
    N = 0
    yx = []
    for i in range(H):
        for j in range(W - 1):
            if a[i][j] % 2 == 0:
                continue
            a[i][j] -= 1
            a[i][j + 1] += 1
            N += 1
            yx.append([i + 1, j + 1, i + 1, j + 2])
        if H > i + 1 and a[i][j + 1] % 2 != 0:
            a[i][j + 1] -= 1
            a[i + 1][j + 1] += 1
            N += 1
            yx.append([i + 1, j + 2, i + 2, j + 2])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()


Fixed submission:
def main():
    H, W = map(int, input().split())
    a = [[0] * W]
    for _ in range(H):
        ai = list(map(int, input().split()))
        ai.insert(0, 0)
        a.append(ai)
    N = 0
    yx = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if a[i][j] % 2 == 0:
                continue
            if W >= j + 1:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i, j, i, j + 1])
            elif H >= i + 1:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i, j, i + 1, j])
        if H > i + 1 and a[i][j] % 2 != 0:
            a[i][j] -= 1
            a[i + 1][j] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()

Buggy python submission (verdict: Runtime Error):
def main():
    H, W = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(H)]
    N = 0
    yx = []
    for i in range(H):
        for j in range(W - 1):
            if a[i][j] % 2 == 0:
                continue
            if 9 > a[i][j + 1]:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i + 1, j + 1, i + 1, j + 2])
            elif H > i + 1 and 9 > a[i + 1][j]:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i + 1, j + 1, i + 2, j + 1])
        if H > i + 1 and a[i][j + 1] % 2 != 0 and 9 > a[i + 1][j + 1]:
            a[i][j + 1] -= 1
            a[i + 1][j + 1] += 1
            N += 1
            yx.append([i + 1, j + 2, i + 2, j + 2])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()


Fixed submission:
def main():
    H, W = map(int, input().split())
    a = [[0] * W]
    for _ in range(H):
        ai = list(map(int, input().split()))
        ai.insert(0, 0)
        a.append(ai)
    N = 0
    yx = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if a[i][j] % 2 == 0:
                continue
            if W >= j + 1:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i, j, i, j + 1])
            elif H >= i + 1:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i, j, i + 1, j])
        if H > i + 1 and a[i][j] % 2 != 0:
            a[i][j] -= 1
            a[i + 1][j] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()

Buggy python submission (verdict: Runtime Error):
def main():
    H, W = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(H)]
    N = 0
    yx = []
    for i in range(H):
        for j in range(W - 1):
            if a[i][j] % 2 == 0:
                continue
            if 9 > a[i][j + 1]:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i + 1, j + 1, i + 1, j + 2])
            elif 9 > a[i + 1][j]:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i + 1, j + 1, i + 2, j + 1])
        if H > i + 1 and a[i][j + 1] % 2 != 0 and 9 > a[i + 1][j + 1]:
            a[i][j + 1] -= 1
            a[i + 1][j + 1] += 1
            N += 1
            yx.append([i + 1, j + 2, i + 2, j + 2])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()


Fixed submission:
def main():
    H, W = map(int, input().split())
    a = [[0] * W]
    for _ in range(H):
        ai = list(map(int, input().split()))
        ai.insert(0, 0)
        a.append(ai)
    N = 0
    yx = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if a[i][j] % 2 == 0:
                continue
            if W >= j + 1:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i, j, i, j + 1])
            elif H >= i + 1:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i, j, i + 1, j])
        if H > i + 1 and a[i][j] % 2 != 0:
            a[i][j] -= 1
            a[i + 1][j] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()

Buggy python submission (verdict: Runtime Error):
def main():
    H, W = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(H)]
    N = 0
    yx = []
    for i in range(H):
        for j in range(W - 1):
            if a[i][j] % 2 == 0:
                continue
            a[i][j] -= 1
            a[i][j + 1] += 1
            N += 1
            yx.append([i + 1, j + 1, i + 1, j + 2])
        if H > i + 1 and a[i][j + 1] % 2 != 0 and 9 > a[i + 1][j + 1]:
            a[i][j + 1] -= 1
            a[i + 1][j + 1] += 1
            N += 1
            yx.append([i + 1, j + 2, i + 2, j + 2])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()


Fixed submission:
def main():
    H, W = map(int, input().split())
    a = [[0] * W]
    for _ in range(H):
        ai = list(map(int, input().split()))
        ai.insert(0, 0)
        a.append(ai)
    N = 0
    yx = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if a[i][j] % 2 == 0:
                continue
            if W >= j + 1:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i, j, i, j + 1])
            elif H >= i + 1:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i, j, i + 1, j])
        if H > i + 1 and a[i][j] % 2 != 0:
            a[i][j] -= 1
            a[i + 1][j] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()

Buggy python submission (verdict: Runtime Error):
def main():
    H, W = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(H)]
    N = 0
    yx = []
    for i in range(H):
        for j in range(W - 1):
            if a[i][j] % 2 == 0:
                continue
            a[i][j] -= 1
            a[i][j + 1] += 1
            N += 1
            yx.append([i, j, i, j + 1])
        if H > i + 1 and a[i][j + 1] % 2 != 0 and 9 > a[i + 1][j + 1]:
            a[i][j + 1] -= 1
            a[i + 1][j + 1] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j + 1])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()


Fixed submission:
def main():
    H, W = map(int, input().split())
    a = [[0] * W]
    for _ in range(H):
        ai = list(map(int, input().split()))
        ai.insert(0, 0)
        a.append(ai)
    N = 0
    yx = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if a[i][j] % 2 == 0:
                continue
            if W >= j + 1:
                a[i][j] -= 1
                a[i][j + 1] += 1
                N += 1
                yx.append([i, j, i, j + 1])
            elif H >= i + 1:
                a[i][j] -= 1
                a[i + 1][j] += 1
                N += 1
                yx.append([i, j, i + 1, j])
        if H > i + 1 and a[i][j] % 2 != 0:
            a[i][j] -= 1
            a[i + 1][j] += 1
            N += 1
            yx.append([i, j + 1, i + 1, j])
    print(N)
    for row in yx:
        print(' '.join(list(map(str, row))))


main()