Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
s = [list(map(int,input().split())) for i in range(M)]
ans = 0
ans_list = [ 0 for i in range(M)]

if M == 0:
    if N == 1:
        print('0')
    else:
        print(-1)
    sys.exit()
import sys
N,M = map(int,input().split())
s = [list(map(int,input().split())) for i in range(M)]
ans = 0
ans_list = [ 0 for i in range(M)]

if M == 0:
    if N == 1:
        print('0')
    else:
        print(-1)
    sys.exit()

for i in range(M):
    ans_list[s[i][0]-1] = s[i][1]

for i in range(M):
    ans = ans * 10 + ans_list[i]

if len(str(ans)) == N:
    print(ans)
else:
    print('-1')
for i in range(M):
    ans_list[s[i][0]-1] = s[i][1]

for i in range(M):
    ans = ans * 10 + ans_list[i]

if len(str(ans)) == N:
    print(ans)
else:
    print('-1')

Fixed submission:
import sys
N,M = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(M)]

ans = ['-1'] * N

for i in range(M):
    if ans[sc[i][0]-1] == sc[i][1]:
        continue
    elif ans[sc[i][0]-1] == '-1':
        ans[sc[i][0]-1] = sc[i][1]
    else:
        print('-1')
        sys.exit()

if N >= 2:
    if ans[0] == '-1':
        ans[0] = 1
    elif ans[0] == 0:
        print('-1')
        sys.exit()
else:
    if ans[0] == '-1':
        print(0)
        sys.exit()

for i in range(N):
    if ans[i] == '-1':
        ans[i] = 0

real = 0
for i in ans:
    real = real * 10 + i

print(real)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
s = [list(map(int,input().split())) for i in range(M)]
ans = 0
ans_list = [ 0 for i in range(M)]

if M == 0:
    print('0')

for i in range(M):
    ans_list[s[i][0]-1] = s[i][1]

for i in range(M):
    ans = ans * 10 + ans_list[i]

if len(str(ans)) == N:
    print(ans)
else:
    print('-1')

Fixed submission:
import sys
N,M = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(M)]

ans = ['-1'] * N

for i in range(M):
    if ans[sc[i][0]-1] == sc[i][1]:
        continue
    elif ans[sc[i][0]-1] == '-1':
        ans[sc[i][0]-1] = sc[i][1]
    else:
        print('-1')
        sys.exit()

if N >= 2:
    if ans[0] == '-1':
        ans[0] = 1
    elif ans[0] == 0:
        print('-1')
        sys.exit()
else:
    if ans[0] == '-1':
        print(0)
        sys.exit()

for i in range(N):
    if ans[i] == '-1':
        ans[i] = 0

real = 0
for i in ans:
    real = real * 10 + i

print(real)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
s = [list(map(int,input().split())) for i in range(M)]
ans = 0
ans_list = [ 0 for i in range(M)]

for i in range(M):
    ans_list[s[i][0]-1] = s[i][1]

for i in range(M):
    ans = ans * 10 + ans_list[i]

if len(str(ans)) == N:
    print(ans)
else:
    print('-1')

Fixed submission:
import sys
N,M = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(M)]

ans = ['-1'] * N

for i in range(M):
    if ans[sc[i][0]-1] == sc[i][1]:
        continue
    elif ans[sc[i][0]-1] == '-1':
        ans[sc[i][0]-1] = sc[i][1]
    else:
        print('-1')
        sys.exit()

if N >= 2:
    if ans[0] == '-1':
        ans[0] = 1
    elif ans[0] == 0:
        print('-1')
        sys.exit()
else:
    if ans[0] == '-1':
        print(0)
        sys.exit()

for i in range(N):
    if ans[i] == '-1':
        ans[i] = 0

real = 0
for i in ans:
    real = real * 10 + i

print(real)