Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = -1
li = []

for i in range(M):
  s, c = map(int, input().split())
  if not [s, c] == [1, 0]:
    li.append([s, c])
  
if N==1 and li==[]:
  ans = 0
else:
  for i in range(10**(N-1), 10**N):
    j = 0
    while j < M:
      num = str(i)
      l = li[j]
      if num[l[0]-1] != str(l[1]):
        break;
      j += 1
    else:
      ans = i
      break;
    
print(ans)


Fixed submission:
def check(x):
  if len(str(x))!=N:
    return False
  for i in range(M):
    if str(x)[S[i]]!=str(C[i]):
      return False
  return True

N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  s-=1
  S.append(s)
  C.append(c)
#print(S,C)
for i in range(1000):
  if check(i):
    print(i)
    exit()   
print(-1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = -1
li = []

for i in range(M):
  s, c = map(int, input().split())
  if not [s, c] == [1, 0]:
    li.append([s, c])
  
if N==1 and li==[]:
  ans = 0
  
for i in range(10**(N-1), 10**N):
  j = 0
  while j < M:
    num = str(i)
    l = li[j]
    if num[l[0]-1] != str(l[1]):
      break;
    j += 1
  else:
    ans = i
    break;
    
print(ans)


Fixed submission:
def check(x):
  if len(str(x))!=N:
    return False
  for i in range(M):
    if str(x)[S[i]]!=str(C[i]):
      return False
  return True

N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  s-=1
  S.append(s)
  C.append(c)
#print(S,C)
for i in range(1000):
  if check(i):
    print(i)
    exit()   
print(-1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = -1
li = []

for i in range(M):
  s, c = map(int, input().split())
  if not [s, c] == [1, 0]:
    li.append([s, c])
  
if N==1 and li!=[]:
  ans = 0
  
for i in range(10**(N-1), 10**N):
  j = 0
  while j < M:
    num = str(i)
    l = li[j]
    if num[l[0]-1] != str(l[1]):
      break;
    j += 1
  else:
    ans = i
    break;
    
print(ans)


Fixed submission:
def check(x):
  if len(str(x))!=N:
    return False
  for i in range(M):
    if str(x)[S[i]]!=str(C[i]):
      return False
  return True

N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  s-=1
  S.append(s)
  C.append(c)
#print(S,C)
for i in range(1000):
  if check(i):
    print(i)
    exit()   
print(-1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = -1
li = []

for i in range(M):
  s, c = map(int, input().split())
  if not s, c = 1, 0:
    li.append([s, c])
  
if N==1 and li!=[]:
  ans = 0
  
for i in range(10**(N-1), 10**N):
  j = 0
  while j < M:
    num = str(i)
    l = li[j]
    if num[l[0]-1] != str(l[1]):
      break;
    j += 1
  else:
    ans = i
    break;
    
print(ans)

Fixed submission:
def check(x):
  if len(str(x))!=N:
    return False
  for i in range(M):
    if str(x)[S[i]]!=str(C[i]):
      return False
  return True

N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  s-=1
  S.append(s)
  C.append(c)
#print(S,C)
for i in range(1000):
  if check(i):
    print(i)
    exit()   
print(-1)