Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
A = [0]
idx_list = []
for i in range(H):
    L = list(map(int, input().split()))
    M = []
    for j in range(W):
        M.append([i+1, j+1])
    if i%2 != 0:
        L.reverse()
        M.reverse()
    idx_list.extend(M)
    for j in range(W):
        A.append((A[-1]+L[j])%2)
A = A[1:-1]
a = A.index(1)
N = sum(A)
print(N)
iter = 0

while iter<N:
    if A[a] == 1:
        print(idx_list[a][0], idx_list[a][1], idx_list[a+1][0], idx_list[a+1][1])
        iter += 1
    a += 1


Fixed submission:
H, W = map(int, input().split())
A = [0]
idx_list = []
for i in range(H):
    L = list(map(int, input().split()))
    M = []
    for j in range(W):
        M.append([i+1, j+1])
    if i%2 != 0:
        L.reverse()
        M.reverse()
    idx_list.extend(M)
    for j in range(W):
        A.append((A[-1]+L[j])%2)
A = A[1:-1]
N = sum(A)
print(N)
if N != 0:
    a = A.index(1)
    iter = 0

    while iter<N:
        if A[a] == 1:
            print(idx_list[a][0], idx_list[a][1], idx_list[a+1][0], idx_list[a+1][1])
            iter += 1
        a += 1

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
A = [0]
idx_list = []
for i in range(H):
    L = list(map(int, input().split()))
    M = []
    for j in range(W):
        M.append([i+1, j+1])
    if i%2 != 0:
        L.reverse()
        M.reverse()
    idx_list.extend(M)
    for j in range(W):
        A.append((A[-1]+L[j])%2)
A = A[1:-2]
a = A.index(1)
N = sum(A)
print(N)
iter = 0

while iter<N:
    if A[a] == 1:
        print(idx_list[a][0], idx_list[a][1], idx_list[a+1][0], idx_list[a+1][1])
        iter += 1
    a += 1

Fixed submission:
H, W = map(int, input().split())
A = [0]
idx_list = []
for i in range(H):
    L = list(map(int, input().split()))
    M = []
    for j in range(W):
        M.append([i+1, j+1])
    if i%2 != 0:
        L.reverse()
        M.reverse()
    idx_list.extend(M)
    for j in range(W):
        A.append((A[-1]+L[j])%2)
A = A[1:-1]
N = sum(A)
print(N)
if N != 0:
    a = A.index(1)
    iter = 0

    while iter<N:
        if A[a] == 1:
            print(idx_list[a][0], idx_list[a][1], idx_list[a+1][0], idx_list[a+1][1])
            iter += 1
        a += 1

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
A = []
B = []
for i in range(H):
    L = list(map(int, input().split()))
    M = [j%2 for j in L]
    if i%2 != 0:
        M.reverse()
    A.extend(M)

indices = [i for i, x in enumerate(A) if x == 1]

def countiter(indices):
    if len(indices) == 0 or len(indices) == 1:
        return 0
    elif len(indices) == 2:
        return indices[1]-indices[0]
    else:
        return indices[1]-indices[0]+countiter(indices[2:])

N = countiter(indices)
print(N)
iter = 0
while iter<N:
    a = indices[0]
    b = indices[1]
    h = (a+1)//W + 1
    if h%2 != 0:
        w = a-(h-1)*W+1
        wchange = 1
    else:
        w = h*W-a
        wchange = -1
    while a < b:
        if w == 1 and wchange == -1:
            print(h, w, h+1, w)
            h += 1
            wchange *= -1
            iter += 1
            a += 1
        elif w == W and wchange == 1:
            print(h, w, h+1, w)
            h += 1
            wchange *= -1
            iter += 1
            a += 1
        else:
            print(h, w, h, w + wchange)
            w += wchange
            iter += 1
            a += 1
    indices[0:2] = []

Fixed submission:
H, W = map(int, input().split())
A = [0]
idx_list = []
for i in range(H):
    L = list(map(int, input().split()))
    M = []
    for j in range(W):
        M.append([i+1, j+1])
    if i%2 != 0:
        L.reverse()
        M.reverse()
    idx_list.extend(M)
    for j in range(W):
        A.append((A[-1]+L[j])%2)
A = A[1:-1]
N = sum(A)
print(N)
if N != 0:
    a = A.index(1)
    iter = 0

    while iter<N:
        if A[a] == 1:
            print(idx_list[a][0], idx_list[a][1], idx_list[a+1][0], idx_list[a+1][1])
            iter += 1
        a += 1