Problem p02761 (python)

Fixed submission:
#! env/bin/local python3
# -*- coding: utf-8 -*-

n, m = map(int, input().split())
conditions = []
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

for i in range(0, 10**n):
    if len(str(i)) != n:
        continue
    flag = True
    for c in conditions:
        if str(i)[c[0]-1] != str(c[1]):
            flag = False

    if flag:
        print(i)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3
# -*- coding: utf-8 -*-

conditions = []

n, m = map(int, input().split())
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

number: list = [0] * n

is_ok = True
for c in conditions:
    if number[c[0]-1] == 0 or number[c[0]-1] == c[1]:
        number[c[0]-1] = c[1]
    else:
        is_ok = False

if number[0] == 0:
    is_ok = False

if is_ok:
    number = [str(i) for i in number]
    number = ''.join(number)
    number = int(number)
    print(number)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3
# -*- coding: utf-8 -*-

conditions = []

n, m = map(int, input().split())
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

number: list = [0] * n

is_ok = True
for c in conditions:
    if number[c[0]-1] == 0 or number[c[0]-1] == c[1]:
        number[c[0]-1] = c[1]
    else:
        is_ok = False

if number[0] == 0:
    is_ok = False

if is_ok:
    print(*number, sep='')
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3
# -*- coding: utf-8 -*-

conditions = []

n, m = map(int, input().split())
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

number: list = [0] * n

is_ok = True
for c in conditions:
    if number[c[0]-1] == 0 or number[c[0]-1] == c[1]:
        number[c[0]-1] = c[1]
    else:
        is_ok = False

if number[0] == 0:
    is_ok = False

if is_ok:
    print(*number)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3
# -*- coding: utf-8 -*-

conditions = []

n, m = map(int, input().split())
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

number: list = [0] * n

is_ok = True
for c in conditions:
    if number[c[0]-1] == 0 or number[c[0]-1] == c[1]:
        number[c[0]-1] = c[1]
    else:
        is_ok = False

if number[0] == 0:
    is_ok = False

print(*number if is_ok else -1, sep='')

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3
# -*- coding: utf-8 -*-

conditions = []

n, m = map(int, input().split())
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

number: list = [0] * n

is_ok = True
for c in conditions:
    if number[c[0]-1] == 0 or number[c[0]-1] == c[1]:
        number[c[0]-1] = c[1]
    else:
        is_ok = False

if number[0] == 0:
    is_ok = False

print(*number if is_ok else -1, sep='')

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3
# -*- coding: utf-8 -*-

import numpy as np

a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
a_3 = list(map(int, input().split()))
_ = input()
pickup_number = []
while True:
    try:
        pickup_number.append(int(input()))
    except EOFError:
        break

a = np.array([a_1, a_2, a_3])
print(pickup_number)
print(a)

for pn in pickup_number:
    a[a == pn] = -1

print(a)

flag = False
if np.sum(a, axis=0)[0] == -3 or np.sum(a, axis=1)[0] == -3:
    flag = True
if np.sum(a.diagonal()) == -3 or a[0][2] + a[1][1] + a[2][0] == -3:
    flag = True

print('Yes' if flag else 'No')