Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

if m == 0:
  if n == 1:
    print(0)
  elif n ==2:
    print(10)
  else:
    print(100)
else:
    sc = [list(map(int, input().split())) for i in range(m)]

    k = 0

    ans = [-5] * n

    for i in range(m):
        if ans[sc[i][0] - 1] == -5:
            ans[sc[i][0] - 1] = sc[i][1]
        elif ans[sc[i][0] - 1] != sc[i][1]:
            k = 1
        else:
            continue

    if k == 1:
        print(-1)
    elif ans[0] == 0:
        if n == 1:
            print(0)
        else:
            print(-1)
    else:
        for i in range(3):
            if ans[i] == -5:
                ans[i] = 0
        if ans[0] == 0:
            ans[0] = 1
        ans = [str(i) for i in ans]
        ans = "".join(ans)
        print(int(ans))



Fixed submission:
n, m = map(int, input().split())

if m == 0:
  if n == 1:
    print(0)
  elif n == 2:
    print(10)
  else:
    print(100)
else:
    sc = [list(map(int, input().split())) for i in range(m)]

    k = 0

    ans = [-5] * n

    for i in range(m):
        if ans[sc[i][0] - 1] == -5:
            ans[sc[i][0] - 1] = sc[i][1]
        elif ans[sc[i][0] - 1] != sc[i][1]:
            k = 1

    if k == 1:
        print(-1)
    elif ans[0] == 0:
        if n == 1:
            print(0)
        else:
            print(-1)
    else:
        for i in range(n):
            if ans[i] == -5:
                ans[i] = 0
        if ans[0] == 0:
            ans[0] = 1
        ans = [str(i) for i in ans]
        ans = "".join(ans)
        print(int(ans))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())


sc = [list(map(int, input().split())) for i in range(m)]

k = 0

ans = [-5]*n

for i in range(m):
    if ans[sc[i][0]-1] == -5:
        ans[sc[i][0]-1] = sc[i][1]
    elif ans[sc[i][0]-1] != sc[i][1]:
        k = 1
    else:
        continue

if k == 1:
    print(-1)
elif m == 0:
  if n == 1:
    print(0)
  elif n ==2:
    print(10)
  else:
    print(100)
elif ans[0] == 0:
    if n == 1:
        print(0)
    else:
        print(-1)
else:
    for i in range(3):
        if ans[i] == -5:
            ans[i] = 0
    if ans[0] == 0:
        ans[0] = 1
    ans = [str(i) for i in ans]
    ans = "".join(ans)
    print(int(ans))

Fixed submission:
n, m = map(int, input().split())

if m == 0:
  if n == 1:
    print(0)
  elif n == 2:
    print(10)
  else:
    print(100)
else:
    sc = [list(map(int, input().split())) for i in range(m)]

    k = 0

    ans = [-5] * n

    for i in range(m):
        if ans[sc[i][0] - 1] == -5:
            ans[sc[i][0] - 1] = sc[i][1]
        elif ans[sc[i][0] - 1] != sc[i][1]:
            k = 1

    if k == 1:
        print(-1)
    elif ans[0] == 0:
        if n == 1:
            print(0)
        else:
            print(-1)
    else:
        for i in range(n):
            if ans[i] == -5:
                ans[i] = 0
        if ans[0] == 0:
            ans[0] = 1
        ans = [str(i) for i in ans]
        ans = "".join(ans)
        print(int(ans))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

sc = [list(map(int, input().split())) for i in range(m)]

k = 0

ans = [-5]*n

for i in range(m):
    if ans[sc[i][0]-1] == -5:
        ans[sc[i][0]-1] = sc[i][1]
    elif ans[sc[i][0]-1] != sc[i][1]:
        k = 1
    else:
        continue

if k == 1:
    print(-1)
elif ans[0] == 0:
    if n == 1:
        print(0)
    else:
        print(-1)
else:
    for i in range(3):
        if ans[i] == -5:
            ans[i] = 0
    if ans[0] == 0:
        ans[0] = 1
    ans = [str(i) for i in ans]
    ans = "".join(ans)
    print(int(ans))

Fixed submission:
n, m = map(int, input().split())

if m == 0:
  if n == 1:
    print(0)
  elif n == 2:
    print(10)
  else:
    print(100)
else:
    sc = [list(map(int, input().split())) for i in range(m)]

    k = 0

    ans = [-5] * n

    for i in range(m):
        if ans[sc[i][0] - 1] == -5:
            ans[sc[i][0] - 1] = sc[i][1]
        elif ans[sc[i][0] - 1] != sc[i][1]:
            k = 1

    if k == 1:
        print(-1)
    elif ans[0] == 0:
        if n == 1:
            print(0)
        else:
            print(-1)
    else:
        for i in range(n):
            if ans[i] == -5:
                ans[i] = 0
        if ans[0] == 0:
            ans[0] = 1
        ans = [str(i) for i in ans]
        ans = "".join(ans)
        print(int(ans))