Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    ans[si - 1] = ci
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
for i in range(len(e)):
    if (e[i][0] == 1 and e[i][1] == 0 ans not (len(ans) == 1)):
        print(-1)
        exit()
ans = map(str, ans)
print("".join(ans))

Fixed submission:
n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    if si == 1 and ci == 0 and n != 1:
        print(-1)
        exit()
    ans[si - 1] = ci
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
ans = map(str, ans)
print("".join(ans))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    ans[si - 1] = ci
for i in range(n):
    if e[i][0] == 1 and e[i][1] == 0:
        print(-1)
        exit()
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
ans = map(str, ans)
print("".join(ans))

Fixed submission:
n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    if si == 1 and ci == 0 and n != 1:
        print(-1)
        exit()
    ans[si - 1] = ci
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
ans = map(str, ans)
print("".join(ans))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    ans[si - 1] = ci
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
for i in range(n):
    if e[i][0] == 1 and e[i][1] == 0:
        print(-1)
        exit()
ans = map(str, ans)
print("".join(ans))

Fixed submission:
n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    if si == 1 and ci == 0 and n != 1:
        print(-1)
        exit()
    ans[si - 1] = ci
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
ans = map(str, ans)
print("".join(ans))