Buggy python submission (verdict: Runtime Error):
h,w = list(map(int,input().split()))

mat = []
for i in range(h):
    array = list(map(int,input().split()))
    mat.append(array)

count=0
s=""

for i in range(0,(h)//2+1,2):
    for j in range(w):
        if mat[i][j]%2 !=0:
#            print("a"+str(i)+str(j))
            mat[i][j]-=1
            count+=1
            if (j+1)==w:
                mat[i+1][j]+=1
                s+=' '.join(map(str,[i+1,j+1,i+2,j+1]))
                s+='\n'
            else:
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
    
    for j in range(w-1,-1,-1):
        if j==0:
            break
        if mat[i+1][j]%2!=0:
 #           print("b"+str(i+1)+str(j+1))
            mat[i+1][j]-=1
            count+=1
            if (j-1)==0:
                mat[i][j]+=1
                s+=' '.join(map(str,[i+2,j+1,i+1,j+1]))
                s+='\n'
            else:
                mat[i+1][j-1]+=1
                s+=' '.join(map(str,[i+2,j+1,i+2,j]))
                s+='\n'

if h%2!=0:
    i=h-1
    for j in range(w):
        if mat[i][j]%2 !=0:
            if(j+1!=w):
                mat[i][j]-=1
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
                count+=1                

print(count)
print(s)


Fixed submission:
H,W = map(int,input().split())
src =[list(map(int,input().split())) for i in range(H)]

order=[]
for i in range(H):
    if i%2==0:
        for j in range(W):
            order.append((i,j))
    else:
        for j in reversed(range(W)):
            order.append((i,j))

ans=[]

for(y1,x1),(y2,x2) in zip(order,order[1:]):
    if src[y1][x1]%2:
        ans.append((y1+1,x1+1,y2+1,x2+1))
        src[y2][x2]+=1
print(len(ans))
for row in ans:
    print(*row)

Buggy python submission (verdict: Runtime Error):
h,w = list(map(int,input().split()))

mat = []
for i in range(h):
    array = list(map(int,input().split()))
    mat.append(array)

count=0
s=""

for i in range(0,h//2+1,2):
    for j in range(w):
        if mat[i][j]%2 !=0:
            mat[i][j]-=1
            count+=1
            if (j+1)==w:
                mat[i+1][j]+=1
                s+=' '.join(map(str,[i+1,j+1,i+2,j+1]))
                s+='\n'
            else:
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
    
    i+=1
    for j in range(w-1,0,-1):
        if mat[i][j]%2!=0:
            mat[i][j]-=1
            count+=1
            if (j-1)==0:
                mat[i-1][j]+=1
                s+=' '.join(map(str,[i+1,j+1,i,j+1]))
                s+='\n'
            else:
                mat[i][j-1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j]))
                s+='\n'

if h%2!=0:
    i=h-1
    for j in range(w):
        if mat[i][j]%2 !=0:
            if(j+1!=w):
                mat[i][j]-=1
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
                count+=1                

print(count)
print(s)


Fixed submission:
H,W = map(int,input().split())
src =[list(map(int,input().split())) for i in range(H)]

order=[]
for i in range(H):
    if i%2==0:
        for j in range(W):
            order.append((i,j))
    else:
        for j in reversed(range(W)):
            order.append((i,j))

ans=[]

for(y1,x1),(y2,x2) in zip(order,order[1:]):
    if src[y1][x1]%2:
        ans.append((y1+1,x1+1,y2+1,x2+1))
        src[y2][x2]+=1
print(len(ans))
for row in ans:
    print(*row)

Buggy python submission (verdict: Runtime Error):
h,w = list(map(int,input().split()))

mat = []
for i in range(h):
    array = list(map(int,input().split()))
    mat.append(array)

count=0
s=""

for i in range(0,h,1):
    for j in range(w):
        if mat[i][j]%2 !=0:
            mat[i][j]-=1
            count+=1
            if (j+1)==w:
                mat[i+1][j]+=1
                s+=' '.join(map(str,[i+1,j+1,i+2,j+1]))
                s+='\n'
            else:
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
    
    i+=1
    for j in range(w-1,0,-1):
        if mat[i][j]%2!=0:
            mat[i][j]-=1
            count+=1
            if (j-1)==0:
                mat[i-1][j]+=1
                s+=' '.join(map(str,[i+1,j+1,i,j+1]))
                s+='\n'
            else:
                mat[i][j-1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j]))
                s+='\n'

if h%2!=0:
    i=h-1
    for j in range(w):
        if mat[i][j]%2 !=0:
            if(j+1!=w):
                mat[i][j]-=1
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
                count+=1                

print(count)
print(s)


Fixed submission:
H,W = map(int,input().split())
src =[list(map(int,input().split())) for i in range(H)]

order=[]
for i in range(H):
    if i%2==0:
        for j in range(W):
            order.append((i,j))
    else:
        for j in reversed(range(W)):
            order.append((i,j))

ans=[]

for(y1,x1),(y2,x2) in zip(order,order[1:]):
    if src[y1][x1]%2:
        ans.append((y1+1,x1+1,y2+1,x2+1))
        src[y2][x2]+=1
print(len(ans))
for row in ans:
    print(*row)

Buggy python submission (verdict: Runtime Error):
h,w = list(map(int,input().split()))

mat = []
for i in range(h):
    array = list(map(int,input().split()))
    mat.append(array)

count=0
s=""

for i in range(0,(h+1)//2,2):
    for j in range(w):
        if mat[i][j]%2 !=0:
            mat[i][j]-=1
            count+=1
            if (j+1)==w:
                mat[i+1][j]+=1
                s+=' '.join(map(str,[i+1,j+1,i+2,j+1]))
                s+='\n'
            else:
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
    
    i+=1
    for j in range(w-1,0,-1):
        if mat[i][j]%2!=0:
            mat[i][j]-=1
            count+=1
            if (j-1)==0:
                mat[i-1][j]+=1
                s+=' '.join(map(str,[i+1,j+1,i,j+1]))
                s+='\n'
            else:
                mat[i][j-1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j]))
                s+='\n'

if h%2!=0:
    i=h-1
    for j in range(w):
        if mat[i][j]%2 !=0:
            if(j+1!=w):
                mat[i][j]-=1
                mat[i][j+1]+=1
                s+=' '.join(map(str,[i+1,j+1,i+1,j+2]))
                s+='\n'
                count+=1                

print(count)
print(s)


Fixed submission:
H,W = map(int,input().split())
src =[list(map(int,input().split())) for i in range(H)]

order=[]
for i in range(H):
    if i%2==0:
        for j in range(W):
            order.append((i,j))
    else:
        for j in reversed(range(W)):
            order.append((i,j))

ans=[]

for(y1,x1),(y2,x2) in zip(order,order[1:]):
    if src[y1][x1]%2:
        ans.append((y1+1,x1+1,y2+1,x2+1))
        src[y2][x2]+=1
print(len(ans))
for row in ans:
    print(*row)