Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m == 0:
  if n == 1:
    print(0)
    exit()
  else:
    print(pow(10,n-1))
    exit()
  
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp
  
if dic[1] == 0:
  if n != 1:
    print(-1)
    exit()
  else:
    print(0)
    exit()

num = 0
for i in range(1,n+1):
  if i in dic:
    num += dic[i] * pow(10, n-i)
print(num)

Fixed submission:
n, m = map(int, input().split())
if m == 0:
  if n == 1:
    print(0)
    exit()
  else:
    print(pow(10,n-1))
    exit()
num = 0
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp

if 1 in dic:
  if dic[1] == 0:
    if n != 1:
      print(-1)
      exit()
    else:
      print(0)
      exit()
else:
  num = pow(10,n-1)
for i in range(1,n+1):
  if i in dic:   
    num += dic[i] * pow(10, n-i)

      
print(num)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp
  
if dic[1] == 0:
  if n != 1:
    print(-1)
    exit()
  else:
    print(0)

num = 0
for i in range(1,n+1):
  if i in dic:
    num += dic[i] * pow(10, n-i)
print(num)

Fixed submission:
n, m = map(int, input().split())
if m == 0:
  if n == 1:
    print(0)
    exit()
  else:
    print(pow(10,n-1))
    exit()
num = 0
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp

if 1 in dic:
  if dic[1] == 0:
    if n != 1:
      print(-1)
      exit()
    else:
      print(0)
      exit()
else:
  num = pow(10,n-1)
for i in range(1,n+1):
  if i in dic:   
    num += dic[i] * pow(10, n-i)

      
print(num)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp
  
if dic[1] == 0:
  if n != 1:
    print(-1)
    exit()
  else:
    print(0)

num = 0
for i in range(1,n+1):
  if i in dic:
    num += dic[i] * pow(10, n-i)
print(num)

Fixed submission:
n, m = map(int, input().split())
if m == 0:
  if n == 1:
    print(0)
    exit()
  else:
    print(pow(10,n-1))
    exit()
num = 0
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp

if 1 in dic:
  if dic[1] == 0:
    if n != 1:
      print(-1)
      exit()
    else:
      print(0)
      exit()
else:
  num = pow(10,n-1)
for i in range(1,n+1):
  if i in dic:   
    num += dic[i] * pow(10, n-i)

      
print(num)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp
  
if dic[1] == 0:
  print(-1)
  exit()

num = 0
for i in range(1,n+1):
  if i in dic:
    num += dic[i] * pow(10, n-i)
print(num)

Fixed submission:
n, m = map(int, input().split())
if m == 0:
  if n == 1:
    print(0)
    exit()
  else:
    print(pow(10,n-1))
    exit()
num = 0
dic = {}
for i in range(m):
  s_tmp, c_tmp = list(map(int, input().split()))
  if s_tmp in dic:
    if dic[s_tmp] != c_tmp:
      print(-1)
      exit()
    else:
      continue
  dic[s_tmp] = c_tmp

if 1 in dic:
  if dic[1] == 0:
    if n != 1:
      print(-1)
      exit()
    else:
      print(0)
      exit()
else:
  num = pow(10,n-1)
for i in range(1,n+1):
  if i in dic:   
    num += dic[i] * pow(10, n-i)

      
print(num)