Buggy python submission (verdict: Runtime Error):
import numpy as np
K = input().split()
N = int(K[0])
M = int(K[1])

hairetu = np.ones((N+2, M+2))

for i in range(M+2):
    hairetu[0][i] = 0
    hairetu[N+1][i] = 0
for i in range(N+2):
    hairetu[i][0] = 0
    hairetu[i][M+1] = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        for k in range(-1, 2):
            for l in range(-1, 2):
                hairetu[i+k][j+l] = (-1) * hairetu[i+k][j+l]


count = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        if hairetu[i][j] == -1:
            count += 1


print(count)

Fixed submission:
K = input().split()
N = int(K[0])
M = int(K[1])

if N >= 2 and M >= 2:
    print((N-2)*(M-2))
elif N == 1 and M >= 2:
    print(M-2)
elif N >= 2 and M == 1:
    print(N-2)
elif N == 1 and M == 1:
    print(1)

Buggy python submission (verdict: Runtime Error):
import numpy as np
K = input()
N = int(K[0])
M = int(K[1])

hairetu = np.ones((N+2, M+2))

for i in range(M+2):
    hairetu[0][i] = 0
    hairetu[N+1][i] = 0
for i in range(N+2):
    hairetu[i][0] = 0
    hairetu[i][M+1] = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        for k in range(-1, 2):
            for l in range(-1, 2):
                hairetu[i+k][j+l] = (-1) * hairetu[i+k][j+l]


count = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        if hairetu[i][j] == -1:
            count += 1


print(count)

Fixed submission:
K = input().split()
N = int(K[0])
M = int(K[1])

if N >= 2 and M >= 2:
    print((N-2)*(M-2))
elif N == 1 and M >= 2:
    print(M-2)
elif N >= 2 and M == 1:
    print(N-2)
elif N == 1 and M == 1:
    print(1)

Buggy python submission (verdict: Runtime Error):
import numpy as np
K = input()
print(K)
N = int(K[0])
M = int(K[1])

hairetu = np.ones((N+2, M+2))

for i in range(M+2):
    hairetu[0][i] = 0
    hairetu[N+1][i] = 0
for i in range(N+2):
    hairetu[i][0] = 0
    hairetu[i][M+1] = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        for k in range(-1, 2):
            for l in range(-1, 2):
                hairetu[i+k][j+l] = (-1) * hairetu[i+k][j+l]


print(hairetu)
count = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        if hairetu[i][j] == -1:
            count += 1


print(count)

Fixed submission:
K = input().split()
N = int(K[0])
M = int(K[1])

if N >= 2 and M >= 2:
    print((N-2)*(M-2))
elif N == 1 and M >= 2:
    print(M-2)
elif N >= 2 and M == 1:
    print(N-2)
elif N == 1 and M == 1:
    print(1)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
M = int(input())

hairetu = np.ones((N+2, M+2))

for i in range(M+2):
    hairetu[0][i] = 0
    hairetu[N+1][i] = 0
for i in range(N+2):
    hairetu[i][0] = 0
    hairetu[i][M+1] = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        for k in range(-1, 2):
            for l in range(-1, 2):
                hairetu[i+k][j+l] = (-1) * hairetu[i+k][j+l]


print(hairetu)
count = 0

for i in range(1, N+1):
    for j in range(1, M+1):
        if hairetu[i][j] == -1:
            count += 1


print(count)

Fixed submission:
K = input().split()
N = int(K[0])
M = int(K[1])

if N >= 2 and M >= 2:
    print((N-2)*(M-2))
elif N == 1 and M >= 2:
    print(M-2)
elif N >= 2 and M == 1:
    print(N-2)
elif N == 1 and M == 1:
    print(1)