Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    keta = 1 
    nx = x/10
    d = []
    while nx: 
        keta += 1
        d.append(nx%10)
        nx /= 10
    if keta != n:
        continue
    ok = True
    d = d[::-1]
    for i in range(m):
        if d[s[i]-1] != c[i]:
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)


Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    x = str(x)
    if len(x) != n:
        continue
    ok = True
#    print('x =', x)
    for i in range(m):
#        print('s[i] =', s[i])
#        print('x[s[i]-1] =', x[s[i]-1])
#        print('c[i] =', c[i])
        if x[s[i]-1] != str(c[i]):
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# input
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

# calc
# 重複があり、かつ、値が異なれば🙅
d = {}
for index, key in enumerate(s):
    if key not in d.keys():
        d[key] = c[index]
    else:
        if d[key] != c[index]:
            print(-1)
            exit(0)

# 0始まりは🙅
mi = min(list(d.keys()))
if d[mi] == 0:
    print(-1)
    exit(0)

# output
ans = ''
#import pdb; pdb.set_trace()
ma = max(list(d.keys()))
for i in range(1, n+1):
    if i in d.keys():
        ans += str(d[i])
    else:
        ans += '0' 
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    x = str(x)
    if len(x) != n:
        continue
    ok = True
#    print('x =', x)
    for i in range(m):
#        print('s[i] =', s[i])
#        print('x[s[i]-1] =', x[s[i]-1])
#        print('c[i] =', c[i])
        if x[s[i]-1] != str(c[i]):
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

# input
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

# calc

# 重複があり、かつ、値が異なれば🙅
d = {}
for index, key in enumerate(s):
    if key not in d.keys():
        d[key] = c[index]
    else:
        if d[key] != c[index]:
            print(-1)
            exit(0)

# 0始まりは🙅
mi = min(list(d.keys()))
if d[mi] == 0:
    print(-1)
    exit(0)

# output
ans = ''
#import pdb; pdb.set_trace()
ma = max(list(d.keys()))
for i in range(1, ma+1):
    if i in d.keys():
        ans += str(d[i])
    else:
        ans += '0'
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    x = str(x)
    if len(x) != n:
        continue
    ok = True
#    print('x =', x)
    for i in range(m):
#        print('s[i] =', s[i])
#        print('x[s[i]-1] =', x[s[i]-1])
#        print('c[i] =', c[i])
        if x[s[i]-1] != str(c[i]):
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)