Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    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())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] == c[i]:
            continue
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    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())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] == c[i]:
            continue
        elif ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n == 3:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    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())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0:
            ans[s[i]-1] = c[i]
        if ans[s[i]-1] == c[i]:
            continue
        if ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n == 3:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    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())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0:
            ans[s[i]-1] = c[i]
        if ans[s[i]-1] == c[i]:
            continue
        else:
            print(-1)
            exit()
    if n == 3:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    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())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = [None, None, None]
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == None:
            ans[s[i]-1] = c[i]
        if ans[s[i]-1] == c[i]:
            continue
        else:
            print(-1)
            exit()
    if ans[0] == None:
        ans[0] = 1
    if ans[1] == None:
        ans[1] = 0
    if ans[2] == None:
        ans[2] = 0
    print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    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())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()