Buggy python submission (verdict: Runtime Error):
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if (n > 1 and r[0] <= 0) or (n == 1 and r[0] < 0):
        print(-1)
    else:
        print(r)
        r[r == -1] = 0
        print(r)
        r = r.astype(str)
        print(int(''.join(r)))

Fixed submission:
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))

Buggy python submission (verdict: Runtime Error):
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
s = np.full(m,-1)
c = np.full(m,10)
r = np.full(n,-1)
for i in range(m):
    a,b = getLine()
    if a in s:
        c[np.where(a == s)] = min(c[np.where(a == s)], b)
    else:
        s[i] = a
        c[i] = b
s = s[s != -1]
c = c[c != 10]
for a,b in zip(s,c):
    if a != -1:
        r[a-1] = b
if r[0] < 0 or (n > 1 and r[0] == 0):
    print('-1')
else:
    r[np.where(r == -1)] = 0
    r[np.where(r == 10)] = 0
    r = r.astype(str)
    print(int(''.join(r)))

Fixed submission:
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))

Buggy python submission (verdict: Runtime Error):
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
s = np.full(m,-1)
c = np.full(m,10)
r = np.full(n,-1)
for i in range(m):
    a,b = getLine()
    if a in s:
        c[np.where(a == s)] = min(c[np.where(a == s)], b)
    else:
        s[i] = a
        c[i] = b
for a,b in zip(s,c):
    r[a-1] = b
if r[0] < 0 or (n > 1 and r[0] == 0):
    print(-1)
else:
    r[np.where(r == -1)] = 0
    r[np.where(r == 10)] = 0
    r = r.astype(str)
    print(''.join(r))

Fixed submission:
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))

Buggy python submission (verdict: Runtime Error):
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
s = np.full(m,-1)
c = np.full(m,10)
r = np.full(n,-1)
for i in range(m):
    a,b = getLine()
    if a in s:
        c[np.where(a == s)] = min(c[np.where(a == s)], b)
    else:
        s[i] = a
        c[i] = b
for a,b in zip(s,c):
    r[a-1] = b
if r[0] < 0 or (n > 1 and r[0] == 0):
    print(-1)
    exit()
else:
    r[np.where(r == -1)] = 0
    r[np.where(r == 10)] = 0
    r = r.astype(str)
    print(''.join(r))

Fixed submission:
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
n,m = map(int, input().split())
s = list()
c = list()
for i in range(m):
    a,b = map(int, input().split())
    if not a in s:
        s.append(a)
        c.append(b)
    else:
        c[s.index(a)] == min(b,c[s.index(a)])
if c[np.argmin(s)] == 0 or not 1 in s:
    print('-1')
    sys.exit()
result = 0
for i,v in zip(s,c):
    result += (10**(n - i))*v
print(str(result))

Fixed submission:
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
n,m = map(int, input().split())
s = list()
c = list()
for i in range(m):
    a,b = map(int, input().split())
    if not a in s:
        s.append(a)
        c.append(b)
    elif a in s and c[s.index(a)] == b:
        continue
    elif c[s.index(a)] != b:
        print('-1')
        sys.exit()
if c[np.argmin(s)] == 0:
    print('-1')
    sys.exit()
result = 0
for i,v in zip(s,c):
    result += (10**(n - i))*v
print(str(result))

Fixed submission:
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
n,m = map(int, input().split())
s = list()
c = list()
for i in range(m):
    a,b = map(int, input().split())
    if not a in s:
        s.append(a)
        c.append(b)
    elif c[s.index(a)] != b:
        print('-1')
        sys.exit()
if c[np.argmin(s)] == 0:
    print('-1')
    sys.exit()
result = 0
for i,v in zip(s,c):
    result += (10**(n - i))*v
print(str(result))

Fixed submission:
import numpy as np
def getLine():
    return list(map(int, input().split()))
n,m = getLine()
r = np.full(n,-1,dtype=int)
for i in range(m):
    a,b = getLine()
    
    if r[a - 1] == -1:
        r[a - 1] = b
    elif r[a - 1] != b:
        print(-1)
        break
else:
    if n > 1 and r[0] == 0:
        print(-1)
    else:
        if r[0] == 0 and n == 1:
            print('0')
        else:
            if n > 1 and r[0] == -1:
                r[0] = 1
            r[r == -1] = 0
            r = r.astype(str)
            print(''.join(r))