Buggy python submission (verdict: Runtime Error):
import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
check = 1
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))
    if ((N > 2) & (s[i] == 1) & (c[i] == 0)):
        check = 0

if check == 0:
    print('-1')
else:
    max = 10 ** N - 1
    #print(max)

    smax = np.max(s)
    if smax != 1:
        min = 10 ** (smax - 1)
    else:
        min = 0
    #print(min)

    answer = -1

    for i in range(max, min-1, -1):
        flag = 1
        for j in range(M):
            if s[j] <= N:
                if int(str(i)[s[j]-1]) != c[j]:
                    flag = 0
        if flag == 1:
            answer = i
    print(answer)

Fixed submission:
import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
check = 1
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))
    if ((N > 2) & (s[i] == 1) & (c[i] == 0)):
        check = 0

if check == 0:
    print('-1')
else:
    if N > 1:
        max = 10 ** N - 1
        min = 10 ** (N - 1)
    else:
        max = 9
        min = 0

    answer = -1

    for i in range(max, min-1, -1):
        flag = 1
        for j in range(M):
            if s[j] <= N:
                if int(str(i)[s[j]-1]) != c[j]:
                    flag = 0
        if flag == 1:
            answer = i
    print(answer)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))

max = 10 ** N - 1

smax = np.max(s)
if smax != 1:
    min = 10 ** (smax - 1)
else:
    min = 0

answer = -1
for i in range(max, min-1, -1):
    flag = 1
    for j in range(M):
        if int(str(i)[s[j]-1]) != c[j]:
            flag = 0
    if flag == 1:
        answer = i
print(answer)

Fixed submission:
import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
check = 1
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))
    if ((N > 2) & (s[i] == 1) & (c[i] == 0)):
        check = 0

if check == 0:
    print('-1')
else:
    if N > 1:
        max = 10 ** N - 1
        min = 10 ** (N - 1)
    else:
        max = 9
        min = 0

    answer = -1

    for i in range(max, min-1, -1):
        flag = 1
        for j in range(M):
            if s[j] <= N:
                if int(str(i)[s[j]-1]) != c[j]:
                    flag = 0
        if flag == 1:
            answer = i
    print(answer)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))

max = 10 ** N - 1

smax = np.max(s)
min = 10 ** (smax - 1)

answer = -1
for i in range(max, min-1, -1):
    flag = 1
    for j in range(M):
        if int(str(i)[s[j]-1]) != c[j]:
            flag = 0
    if flag == 1:
        answer = i
print(answer)

Fixed submission:
import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
check = 1
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))
    if ((N > 2) & (s[i] == 1) & (c[i] == 0)):
        check = 0

if check == 0:
    print('-1')
else:
    if N > 1:
        max = 10 ** N - 1
        min = 10 ** (N - 1)
    else:
        max = 9
        min = 0

    answer = -1

    for i in range(max, min-1, -1):
        flag = 1
        for j in range(M):
            if s[j] <= N:
                if int(str(i)[s[j]-1]) != c[j]:
                    flag = 0
        if flag == 1:
            answer = i
    print(answer)