Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
digit = {}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
      
    if ((tmp_d == 1) and (tmp == 0)):
        print(-1)
        exit()
    elif (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
 
 
    
ans = 0
for key in digit.keys():
    ans += digit[key]*(10**(n-key))
if (ans // (10*(n-1)) == 0) and n >= 2:
  ans += 1*(10**(n-1))

print(ans)

Fixed submission:
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
ans = 0

digit ={}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
       	
    if (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
      
      
if not (1 in digit.keys()) and n>=2:
	digit[1] = 1
    
ans = 0
for key in digit.keys():
  ans += digit[key]*(10**(n-key))

if len(str(ans)) == n: 
  print(ans)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
digit = {}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
      
    if ((tmp_d == 1) and (tmp == 0)):
        print(-1)
        exit()
    elif (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
 
 
    
ans = 0
for key in digit.keys():
    ans += digit[key]*(10**(n-key))
 
if (ans // n == 0) and n >= 2:
  ans += 1*(10**(n-1))
print(ans)
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
digit = {}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
      
    if ((tmp_d == 1) and (tmp == 0)):
        print(-1)
        exit()
    elif (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
 
 
    
ans = 0
for key in digit.keys():
    ans += digit[key]*(10**(n-key))
 
if (ans // (10*(n-1)) == 0) and n >= 2:
  ans += 1*(10**(n-1))
print(ans)

Fixed submission:
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
ans = 0

digit ={}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
       	
    if (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
      
      
if not (1 in digit.keys()) and n>=2:
	digit[1] = 1
    
ans = 0
for key in digit.keys():
  ans += digit[key]*(10**(n-key))

if len(str(ans)) == n: 
  print(ans)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
digit = {}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
      
    if ((tmp_d == 1) and (tmp == 0)):
        print(-1)
        exit()
    elif (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
 
 
    
ans = 0
for key in digit.keys():
    ans += digit[key]*(10**(n-key))
 
if (ans // n == 0) and n >= 2:
  ans += 1*(10**(n-1))
print(ans)
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
digit = {}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
      
    if ((tmp_d == 1) and (tmp == 0)):
        print(-1)
        exit()
    elif (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
 

    
ans = 0
for key in digit.keys():
    ans += digit[key]*(10**(n-key))

if (ans // (10*(n-1)) == 0) and n >= 2:
  ans += 1*(10**(n-1))
print(ans)
提出情報

Fixed submission:
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
ans = 0

digit ={}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
       	
    if (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
      
      
if not (1 in digit.keys()) and n>=2:
	digit[1] = 1
    
ans = 0
for key in digit.keys():
  ans += digit[key]*(10**(n-key))

if len(str(ans)) == n: 
  print(ans)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
ans = 0
f_one = False
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
    if tmp_d == 1:
      f_one = True
      
    if ((tmp_d == 1) and (tmp == 0)):
        ans = -1
        break
    elif (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        ans = -1
        break
    else:
        ans += tmp*(10**(n-tmp_d))
      
if not f_one:
	ans += 1*(10**(n-1))
  
print(ans)

Fixed submission:
# -*- coding:utf-8 -*-
n, m = map(int, input().strip().split())
ans = 0

digit ={}
for i in range(m):
    tmp_d, tmp = map(int, input().strip().split())
       	
    if (tmp_d in digit.keys()) and (digit[tmp_d] != tmp):
        print(-1)
        exit()
    else:
        digit[tmp_d] = tmp
      
      
if not (1 in digit.keys()) and n>=2:
	digit[1] = 1
    
ans = 0
for key in digit.keys():
  ans += digit[key]*(10**(n-key))

if len(str(ans)) == n: 
  print(ans)
else:
  print(-1)