Buggy python submission (verdict: Runtime Error):
n = []
j = True

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    if n[s-1] == "W":
        n[s-1] = c
    elif n[s-1] >= c:
        n[s-1] = c
    elif  n[s-1] <= c:
        pass
    else:
        print(-1)
        j = False
        
if j == True:
    for i in range(3):
        if n[i] =="W":
            n[i] = 0
    if n[0] == 0:
        print(-1)
    else:
        print(''.join(map(str,n)))

Fixed submission:
n = []

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    s -= 1
    if n[s] == "W":
        n[s] = c
    elif n[s] == c:
        pass
    else:
        print(-1)
        exit()
        
if N != 1:
    if n[0] == 0:
        print(-1)
        exit()
    
    if n[0] == "W":
        n[0] = 1
        
    for i in range(N):
        if n[i] =="W":
            n[i] = 0

else:
    if n[0] == "W":
        n[0] = 0
        
print(''.join(map(str,n)))

Buggy python submission (verdict: Runtime Error):
n = []
j = True

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    if n[s-1] == "W":
        n[s-1] = c
    elif n[s-1] == c:
        pass
    else:
        print(-1)
        j = False
        
if j == True:
    for i in range(3):
        if n[i] =="W":
            n[i] = 0
    if n[0] == 0:
        print(-1)
    else:
        print(''.join(map(str,n)))

Fixed submission:
n = []

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    s -= 1
    if n[s] == "W":
        n[s] = c
    elif n[s] == c:
        pass
    else:
        print(-1)
        exit()
        
if N != 1:
    if n[0] == 0:
        print(-1)
        exit()
    
    if n[0] == "W":
        n[0] = 1
        
    for i in range(N):
        if n[i] =="W":
            n[i] = 0

else:
    if n[0] == "W":
        n[0] = 0
        
print(''.join(map(str,n)))

Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
N = a[0]
M = a[1]

Array = [list(map(int, input().split())) for _ in range(M)]

i = 0
hya = 0
jyu = 0
ich = 0
while i < 3:
    if Array[i][0] == 1:
        hya = Array[i][1]
    elif Array[i][0] == 2:
        jyu = Array[i][1]
    elif Array[i][0] == 3:
        ich = Array[i][1]
    i += 1

for i in range(M):
    for j in range(i+1, M):
        if Array[i][0] == Array[j][0]:
            if Array[i][1] != Array[j][1]:
                print(-1)
            else:
                print(hya, jyu, ich, sep="")

Fixed submission:
n = []

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    s -= 1
    if n[s] == "W":
        n[s] = c
    elif n[s] == c:
        pass
    else:
        print(-1)
        exit()
        
if N != 1:
    if n[0] == 0:
        print(-1)
        exit()
    
    if n[0] == "W":
        n[0] = 1
        
    for i in range(N):
        if n[i] =="W":
            n[i] = 0

else:
    if n[0] == "W":
        n[0] = 0
        
print(''.join(map(str,n)))