Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if M==0:
	ans=1*(10**(N-1))
	print(ans)
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if M==0:
	ans=1*(10**(N-1))
	if ans==1:
		ans=0
	print(ans)
	exit()
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if M==0:
	ans=1*(10**(N-1))
	if ans==1:
		ans=0
	print(ans)
	exit()
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if max(s)>N:
	print(ans)
	exit()
for j in range(1,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if M==0:
	ans=1*(10**(N-1))
	if ans==1:
		ans=0
	print(ans)
	exit()
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
for j in range(1,1000):
	value=str(j)
	if max(s)>N:
		break
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if M==0:
	ans=1*(10**(N-1))
	if ans==1:
		ans=0
	print(ans)
	exit()
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
for j in range(1,1000):
	value=str(j)
	if len(value)==N:
		if max(s)<=N:
			for S,C in zip(s,c):
				if int(value[S-1])==C:
					a+=1
			if a==M:
				ans=int(j)
				break
			else:
				a=0
		else:
			continue
	else:
		continue
print(ans)

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if M==0:
	ans=1*(10**(N-1))
	if ans==1:
		ans=0
	print(ans)
	exit()
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int, input().split())
s=[0]*M
c=[0]*M
x=[0]*M
h=0
y=0
z=1
for i in range(M):
	s[i],c[i]=map(int, input().split())
	y=s[i]-1
	x[y]=c[i]
if len(x)==N:
	x.reverse()
	for j in x:
		h=h+j*z
		z=10*z
	print(h)
else:
	print('-1')

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
a=0
for i in range(M):
	s[i],c[i]=map(int,input().split())
ans=-1
if M==0:
	ans=1*(10**(N-1))
	if ans==1:
		ans=0
	print(ans)
	exit()
if max(s)>N:
	print(ans)
	exit()
for j in range(0,1000):
	value=str(j)
	if len(value)==N:
		for S,C in zip(s,c):
			if int(value[S-1])==C:
				a+=1
		if a==M:
			ans=int(j)
			break
		else:
			a=0
	else:
		continue
print(ans)