Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
s, c = [], []
for i in range(M):
  tmp_s, tmp_c = map(int, input().split())
  s.append(tmp_s)
  c.append(tmp_c)

flag = 0
v_set = [999 for i in range(N)]
for i in range(M):
  if N == 1:	# 一桁のとき
    if v_set[0] == 999:
      v_set[0] = c[i]
      flag = 1
    elif v_set[0] != 999 and c[i] < v_set[0]:
      v_set[0] = c[i]
      flag = 1
  else:			# ２桁以上のとき
    if s[i] == 1 and c[i] == 0:
      flag = 0
      break
    elif v_set[s[i]-1] == 999:
      v_set[s[i]-1] = c[i]
      flag = 1
    elif v_set[s[i]-1] != 999 and c[i] < v_set[s[i]-1]:
      v_set[s[i]-1] = c[i]
      flag = 1
if flag == 0:
  print(-1)
else:
  for i in range(N):
    if v_set[i] == 999:
      v_set[i] = 0
  if N >= 2 and v_set[0] == 0:
    print(-1)
  else:
    print(str(int(v_set[0]))+str(int(v_set[1]))+str(int(v_set[2])))
  

Fixed submission:
import numpy as np
N, M = map(int, input().split())
s, c = [], []
for i in range(M):
  tmp_s, tmp_c = map(int, input().split())
  s.append(tmp_s)
  c.append(tmp_c)

v_set = [999 for i in range(N)]
if N == 1:
  if M == 0:
    print(0)
  else:
    for i in range(M):
      if v_set[0] == 999 or v_set[0] == c[i]:
        v_set[0] = c[i]
      else:
        v_set[0] = -1
        break
    print(v_set[0])
elif N >= 2:
  for i in range(M):
    if v_set[s[i]-1] == 999 or v_set[s[i]-1] == c[i]:
      v_set[s[i]-1] = c[i]
    else:
      v_set[0] = 0
      break
  if v_set[0] == 0:
    print(-1)
  else:
    if v_set[0] == 999:
      v_set[0] = 1
    for i in range(1,N):
      if v_set[i] == 999:
        v_set[i] = 0
    out = ''
    for i in range(N):
      out += str(int(v_set[i]))
    print(out)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
s, c = [], []
for i in range(M):
  tmp_s, tmp_c = map(int, input().split())
  s.append(tmp_s)
  c.append(tmp_c)

flag = 0
v_set = [999 for i in range(N)]
#print(v_set)
for i in range(M):
  if N == 1:	# 一桁のとき
    if v_set[0] == 999:
      v_set[0] = c[i]
      flag = 1
    elif v_set[0] != 999 and c[i] < v_set[0]:
      v_set[0] = c[i]
      flag = 1
  else:			# ２桁以上のとき
    if s[i] == 1 and c[i] == 0:
      flag = 0
      break
    elif v_set[s[i]-1] == 999:
      v_set[s[i]-1] = c[i]
      flag = 1
    elif v_set[s[i]-1] != 999 and c[i] < v_set[s[i]-1]:
      v_set[s[i]-1] = c[i]
      flag = 1
if flag == 0:
  print(-1)
else:
  for i in range(N):
    if v_set[i] == 999:
      v_set[i] = 0
  if v_set[i] == 0:
    print(-1)
  else:
    print(str(int(v_set[0]))+str(int(v_set[1]))+str(int(v_set[2])))
  

Fixed submission:
import numpy as np
N, M = map(int, input().split())
s, c = [], []
for i in range(M):
  tmp_s, tmp_c = map(int, input().split())
  s.append(tmp_s)
  c.append(tmp_c)

v_set = [999 for i in range(N)]
if N == 1:
  if M == 0:
    print(0)
  else:
    for i in range(M):
      if v_set[0] == 999 or v_set[0] == c[i]:
        v_set[0] = c[i]
      else:
        v_set[0] = -1
        break
    print(v_set[0])
elif N >= 2:
  for i in range(M):
    if v_set[s[i]-1] == 999 or v_set[s[i]-1] == c[i]:
      v_set[s[i]-1] = c[i]
    else:
      v_set[0] = 0
      break
  if v_set[0] == 0:
    print(-1)
  else:
    if v_set[0] == 999:
      v_set[0] = 1
    for i in range(1,N):
      if v_set[i] == 999:
        v_set[i] = 0
    out = ''
    for i in range(N):
      out += str(int(v_set[i]))
    print(out)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
s, c = [], []
for i in range(M):
  tmp_s, tmp_c = map(int, input().split())
  s.append(tmp_s)
  c.append(tmp_c)

flag = 0
v_set = np.zeros(N)
#print(v_set)
for i in range(M):
  if len(v_set) != 1 and s[i] == 1 and c[i] == 0:
    flag = 0
    break
  else:
    if v_set[s[i]-1] == 0 or v_set[s[i]-1] == c[i]:
      v_set[s[i]-1] = c[i]
      flag = 1
    else:
      flag = 0
      break
if flag == 0:
  print(-1)
else:
  print(v_set)
  print(str(int(v_set[0]))+str(int(v_set[1]))+str(int(v_set[2])))
  

Fixed submission:
import numpy as np
N, M = map(int, input().split())
s, c = [], []
for i in range(M):
  tmp_s, tmp_c = map(int, input().split())
  s.append(tmp_s)
  c.append(tmp_c)

v_set = [999 for i in range(N)]
if N == 1:
  if M == 0:
    print(0)
  else:
    for i in range(M):
      if v_set[0] == 999 or v_set[0] == c[i]:
        v_set[0] = c[i]
      else:
        v_set[0] = -1
        break
    print(v_set[0])
elif N >= 2:
  for i in range(M):
    if v_set[s[i]-1] == 999 or v_set[s[i]-1] == c[i]:
      v_set[s[i]-1] = c[i]
    else:
      v_set[0] = 0
      break
  if v_set[0] == 0:
    print(-1)
  else:
    if v_set[0] == 999:
      v_set[0] = 1
    for i in range(1,N):
      if v_set[i] == 999:
        v_set[i] = 0
    out = ''
    for i in range(N):
      out += str(int(v_set[i]))
    print(out)