Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
l = list(map(lambda x: '0' if x in None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) >1:
    print(-1)
else:
    print(msg.join(l))


Fixed submission:
n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
if l[0] is None and len(l) != 1:
    l[0]='1'
l = list(map(lambda x: '0' if x is None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) != 1:
    print(-1)
else:
    print(msg.join(l))

Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
l = ['0']*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] == '0':
	l[index] = c
    else:
        if l[index] == c:
            continue
	else:
            msg=-1
            break
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) >1:
    print(-1)
else:
    print(msg.join(l))



Fixed submission:
n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
if l[0] is None and len(l) != 1:
    l[0]='1'
l = list(map(lambda x: '0' if x is None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) != 1:
    print(-1)
else:
    print(msg.join(l))

Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
d = {}
flag = True
for _ in range(m):
    s, c = input().split()
    if d.get(s):
        if d.get(s) == c:
            continue
        else:
            flag = False
            break
    else:
        d[s] = c
if flag:
    if max(map(int, d.keys())) == n:
        l = ['0']*n
        for i in range(1,n+1):
            if d.get(str(i)):
                l[i-1] = d.get(str(i))
        if l[0] == '0':
            print(-1)
        else:
            print(''.join(l))
    else:
        print(-1)
else:
    print(-1)


Fixed submission:
n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
if l[0] is None and len(l) != 1:
    l[0]='1'
l = list(map(lambda x: '0' if x is None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) != 1:
    print(-1)
else:
    print(msg.join(l))

Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
d = {}
flag = True
for _ in range(m):
    s, c = input().split()
    if d.get(s):
        if d.get(s) == c:
            continue
        else:
            flag = False
            break
    else:
        d[s] = c
if flag:
    if max(map(int, d.keys())) == n:
        l = ['0']*n
        for i in range(1,n+1):
            if d.get(str(i)):
                l[i-1] = d.get(str(i))
        print(''.join(l))
    else:
        print(-1)
else:
    print(-1)

Fixed submission:
n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
if l[0] is None and len(l) != 1:
    l[0]='1'
l = list(map(lambda x: '0' if x is None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) != 1:
    print(-1)
else:
    print(msg.join(l))