Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
if M>=1:
    s=[0]*M
    c=[0]*M
    for i  in range(M):
      s[i],c[i]=map(int,input().split())

    a=0
    for i in range(M-1):
       for j in range(i+1,M):
        if s[i]==s[j] and c[i]!=c[j]:
          a+=1
    if a==0:
      u_=[0,0,0]
      for i in range(M):
        u_[s[i]-1]=c[i]
      if max(s)!=3 and N==2:
        if min(s)!=1 and u_[0]==0:
          print(10+u_[1])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(u_[0]*10+u_[1])
      elif N==3:
        if min(s)!=1 and u_[0]==0:
          print(100+u_[1]*10+u_[2])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(100*u_[0]+10*u_[1]+u_[2])
      elif N==1 and max(s)==1 and min(s)==1:
        print(c[0])
      else:
        print(-1)
    else:
      print(-1)
else:
  if N==1:
    print(0)
  else:
    N>=2:
      print(10**(N-1))
      


Fixed submission:
N,M=map(int,input().split())
if M>=1:
    s=[0]*M
    c=[0]*M
    for i  in range(M):
      s[i],c[i]=map(int,input().split())

    a=0
    for i in range(M-1):
       for j in range(i+1,M):
        if s[i]==s[j] and c[i]!=c[j]:
          a+=1
    if a==0:
      u_=[0,0,0]
      for i in range(M):
        u_[s[i]-1]=c[i]
      if max(s)!=3 and N==2:
        if min(s)!=1 and u_[0]==0:
          print(10+u_[1])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(u_[0]*10+u_[1])
      elif N==3:
        if min(s)!=1 and u_[0]==0:
          print(100+u_[1]*10+u_[2])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(100*u_[0]+10*u_[1]+u_[2])
      elif N==1 and max(s)==1 and min(s)==1:
        print(c[0])
      else:
        print(-1)
    else:
      print(-1)
else:
  if N==1:
    print(0)
  else:
      print(10**(N-1))

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i  in range(M):
  s[i],c[i]=map(int,input().split())

a=0
for i in range(M-1):
  for j in range(i+1,M):
    if s[i]==s[j] and c[i]!=c[j]:
      a+=1
if a==0:
  u_=[0,0,0]
  for i in range(M):
    u_[s[i]-1]=c[i]
  if max(s)!=3 and N==2:
    if min(s)!=1 and u_[0]==0:
      print(10+u_[1])
    elif min(s)==1 and u_[0]==0:
      print(-1)
    else:
      print(u_[0]*10+u_[1])
  elif N==3:
    if min(s)!=1 and u_[0]==0:
      print(100+u_[1]*10+u_[2])
    elif min(s)==1 and u_[0]==0:
      print(-1)
    else:
      print(100*u_[0]+10*u_[1]+u_[2])
  elif N==1 and max(s)==1 and min(s)==1:
    print(c[0])
  else:
    print(-1)
else:
  print(-1)
    

Fixed submission:
N,M=map(int,input().split())
if M>=1:
    s=[0]*M
    c=[0]*M
    for i  in range(M):
      s[i],c[i]=map(int,input().split())

    a=0
    for i in range(M-1):
       for j in range(i+1,M):
        if s[i]==s[j] and c[i]!=c[j]:
          a+=1
    if a==0:
      u_=[0,0,0]
      for i in range(M):
        u_[s[i]-1]=c[i]
      if max(s)!=3 and N==2:
        if min(s)!=1 and u_[0]==0:
          print(10+u_[1])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(u_[0]*10+u_[1])
      elif N==3:
        if min(s)!=1 and u_[0]==0:
          print(100+u_[1]*10+u_[2])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(100*u_[0]+10*u_[1]+u_[2])
      elif N==1 and max(s)==1 and min(s)==1:
        print(c[0])
      else:
        print(-1)
    else:
      print(-1)
else:
  if N==1:
    print(0)
  else:
      print(10**(N-1))