Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
D = input()
 
if D == "25":
	print("Christmas")
elif D === "24":
	print("Christmas Eve")
elif D == "23":
	print("Christmas Eve Eve")
elif D == "22":
	print("Christmas Eve Eve Eve")


Fixed submission:
D = int(input())
 
if D == 25:
	print("Christmas")
elif D == 24:
	print("Christmas Eve")
elif D == 23:
	print("Christmas Eve Eve")
elif D == 22:
	print("Christmas Eve Eve Eve")

Buggy python submission (verdict: Runtime Error):
D = input()

if D == "25":
	print("Christmas")
elif D === "24":
	print("Christmas Eve")
elif D == "23":
	print("Christmas Eve Eve")
elif D == "22":
	print("Christmas Eve Eve Eve")

Fixed submission:
D = int(input())
 
if D == 25:
	print("Christmas")
elif D == 24:
	print("Christmas Eve")
elif D == 23:
	print("Christmas Eve Eve")
elif D == 22:
	print("Christmas Eve Eve Eve")

Buggy python submission (verdict: Runtime Error):
D = input()

if D == "25"
	print("Christmas")
elif D == "24"
	print("Christmas Eve")
elif D == "23"
	print("Christmas Eve Eve Eve")

Fixed submission:
D = int(input())
 
if D == 25:
	print("Christmas")
elif D == 24:
	print("Christmas Eve")
elif D == 23:
	print("Christmas Eve Eve")
elif D == 22:
	print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
N = int(input())
 
if N == 1:
	answer = "Hello World"
	print(answer)
elif N == 2:
	A = input(int())
    B = input(int())
	answer = A + B
	print(int(answer))

Fixed submission:
N = int(input())

if N == 1:
	answer = "Hello World"
	print(answer)
elif N == 2:
	A = int(input())
	B = int(input())
	answer = A + B
	print(answer)

Buggy python submission (verdict: Runtime Error):
N = int(input())

if N == 1:
	answer = "Hello World"
    print(answer)
elif N == 2:
	A = input(int())
    B = input(int())
	answer = A + B
	print(int(answer))

Fixed submission:
N = int(input())

if N == 1:
	answer = "Hello World"
	print(answer)
elif N == 2:
	A = int(input())
	B = int(input())
	answer = A + B
	print(answer)

Buggy python submission (verdict: Runtime Error):
N = int(input())

if N == 1:
	answer = "Hello World"
    print(answer)
elif N == 2:
	A,B = map(int,input().split())
	answer = A + B
	print(int(answer))

Fixed submission:
N = int(input())

if N == 1:
	answer = "Hello World"
	print(answer)
elif N == 2:
	A = int(input())
	B = int(input())
	answer = A + B
	print(answer)

Buggy python submission (verdict: Runtime Error):
N = int(input())

if N == 1:
	answer = "Hello World"
elif N == 2:
	A,B = map(int,input().split())
	answer = A + B

print(answer)

Fixed submission:
N = int(input())

if N == 1:
	answer = "Hello World"
	print(answer)
elif N == 2:
	A = int(input())
	B = int(input())
	answer = A + B
	print(answer)
Buggy python submission (verdict: Runtime Error):
k = int(input())

if k % 2 == 0:
	answer = (k/2) * (K/2)
else:
	answer = (k//2) * ((k//2) + 1) 
print(int(answer))

Fixed submission:
K = int(input())

if K % 2 == 0:
	answer = (K/2) * (K/2)
else:
	answer = (K//2) * ((K//2) + 1) 
print(int(answer))
Buggy python submission (verdict: Runtime Error):
N,i = map(int.input().split())

answer = N - i + 1

print(answer)

Fixed submission:
N,i = map(int,input().split())

answer = N - i + 1

print(answer)
Buggy python submission (verdict: Runtime Error):
A1,A2,A3 = map(int,input().split())

x = abs(A1 - A2)
y = abs(A2 - A3)
z = abs(A3 - A1)

if x + y <= y + z and x <= z + x:
	print(x + y )
elif y + z <= x + y and  y + Z <= z + x:
	print(y + z )
else:
	print(z + x)

Fixed submission:
A1,A2,A3 = map(int,input().split())
 
x = abs(A1 - A2)
y = abs(A2 - A3)
z = abs(A3 - A1)
 
if x + y <= y + z and x + y <= z + x:
	print(x + y )
elif y + z <= x + y and  y + z <= z + x:
	print(y + z )
else:
	print(z + x)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
 
return(max([A+B, A-B, A*B]))

Fixed submission:
A,B = map(int,input().split())

a1 = A + B
a2 = A - B
a3 = A * B

if a1 >= a2 and a1 >= a3:
	print(a1)
elif a2 >= a1 and a2>= a3:
	print(a2)
elif a3 >= a1 and a3 >= a2:
	print(a3)

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

a1 = A + B
a2 = A - B
a3 = A * B

if a1 >= a2 and a1 >= a3:
	print(a1)
elif a2 >= a1 and a>= a3:
	print(a2)
elif a3 >= a1 and a3 >=a2:
	print(a3)

Fixed submission:
A,B = map(int,input().split())

a1 = A + B
a2 = A - B
a3 = A * B

if a1 >= a2 and a1 >= a3:
	print(a1)
elif a2 >= a1 and a2>= a3:
	print(a2)
elif a3 >= a1 and a3 >= a2:
	print(a3)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input(),split())
 
if b >= a:
	print(a)
else:
	print(a - 1)

Fixed submission:
a,b = map(int,input().split())
 
if b >= a:
	print(a)
else:
	print(a - 1)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input(),split())

if b >= a:
	print(a)
else
	print(a - 1)


Fixed submission:
a,b = map(int,input().split())
 
if b >= a:
	print(a)
else:
	print(a - 1)
Buggy python submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)


Fixed submission:
C1= input()
C2= input()
C3= input()

print(C1[0] + C2[1] + C3[2])

Buggy python submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)

Fixed submission:
C1= input()
C2= input()
C3= input()

print(C1[0] + C2[1] + C3[2])

Buggy python submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()
 
print(C11 + C22 + C33)

Fixed submission:
C1= input()
C2= input()
C3= input()

print(C1[0] + C2[1] + C3[2])

Buggy python submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)

Fixed submission:
C1= input()
C2= input()
C3= input()

print(C1[0] + C2[1] + C3[2])

Buggy python submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)

Fixed submission:
C1= input()
C2= input()
C3= input()

print(C1[0] + C2[1] + C3[2])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Fixed submission:
a,b= map(int,input().split())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Fixed submission:
a,b= map(int,input().split())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
 
if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Fixed submission:
a,b= map(int,input().split())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a * b % 2 == 0:
	print("Even")
else:
	print("Odd")

Fixed submission:
a,b= map(int,input().split())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input()split())

if A == B:
	answer = C
elif B == C:
	answer = A
elif A ==C:
	answer = B

print(answer)

Fixed submission:
A,B,C = map(int,input().split())

if A == B:
	answer = C
elif B == C:
	answer = A
else:
	answer = B

print(answer)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if A + B % == 0 and A + B != 0:
	print("Possible")
else:
	print("Impossible")

Fixed submission:
A,B = map(int,input().split())

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 ==0:
	print("Possible")
else:
	print("Impossible")
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int.input().split())

if A <= C <= B:
	print("Yes")
else:
	print("No")

Fixed submission:
A,B,C = map(int,input().split())
 
if A <= C <= B:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
A,B = int(input().split())

if A > B and B != 1:
	print("Alice")
elif A == B:
	print("Draw")
elif B > A and A != 1:
	print("Bob")

Fixed submission:
A,B = map(int,input().split())

if A > B and B != 1:
	print("Alice")
elif A > B and B == 1:
	print("Bob")

if B > A and A != 1:
	print("Bob")
elif B > A and A == 1:
	print("Alice")

if A == B:
	print("Draw")
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
 
score = 1
if a != b:
	score = score + 1
elif b !=c:
	score = score + 1
elif c !=a:
else:
	score = score
print(score)

Fixed submission:
a,b,c = input().split()

if a == b and a == c:
	print(1)
elif a ==b and a != c:
	print(2)
elif b == c and b != a:
	print(2)
elif c ==a and c != b:
	print(2)
elif a != b and b != c and c != a:
	print(3)
Buggy python submission (verdict: Runtime Error):
a,b,h = map(int,input().split())

answer = (a + b) * h / 2

print(int(answer))

Fixed submission:
a =int(input())
b =int(input())
h = int(input())

answer = (a + b) * h / 2

print(int(answer))

Buggy python submission (verdict: Runtime Error):
a,b,h = map(int,input().split())

answer = (a + b) * h / 2

print(answer)

Fixed submission:
a =int(input())
b =int(input())
h = int(input())

answer = (a + b) * h / 2

print(int(answer))
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
 
if  K > N:
	answer = (K * X) + (N - K) * Y:
else:
	answer = N * X
print(answer)   

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
 
if N <= K :
	answer = X * N
elif N >= K + 1:
	answer = (X * K) + (Y * (N - K) )
print(answer)

Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if K <= N:
	answer = N * X
elif K > N:
	answer = (K * X) + (N - K) * Y:
print(answer)    

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
 
if N <= K :
	answer = X * N
elif N >= K + 1:
	answer = (X * K) + (Y * (N - K) )
print(answer)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(input().split())

if A == 5 and B == 5 and C == 7:
	print("Yes")
elif B == 5 and C == 5 and A == 7:
	print("Yes")
elif C == 5 and A == 5 and B == 7:
	print("Yes")
else:
	print("No")

Fixed submission:
A,B,C = map(int,input().split())

if A == 5 and B == 5 and C == 7:
	print("YES")
elif B == 5 and C == 5 and A == 7:
	print("YES")
elif C == 5 and A == 5 and B == 7:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [1]
for i in range(n):
    b.append(a[i]*b[-1])
for i in range(n-k):
    if b[i+k+1]/b[i+1] > b[i+k]/b[i]:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-k):
    if a[i] < a[i+k]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [1]
for i in range(n):
    b.append(a[i]*b[-1])
c = [b[i+k]/b[i] for i in range(n-k+1)]
for i in range(len(c) - 1):
    if c[i+1] > c[i]:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-k):
    if a[i] < a[i+k]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import *
from bisect import bisect_right
n,m,time = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

A = [0]+list(accumulate(a))
B = [0]+list(accumulate(b))

ans = 0
for i in range(bisect_right(A, time)-1,-1,-1):
    for j in range(bisect_right(B, time)-1,-1,-1):
        if A[i] + B[j] <= time:
            ans = max(ans,i+j)
print(ans)


Fixed submission:

from itertools import *
from bisect import bisect_right
n,m,time = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

A = [0]+list(accumulate(a))
B = [0]+list(accumulate(b))

ans = 0
for i in range(bisect_right(A, time)-1,-1,-1):
    ans = max(ans,i+bisect_right(B, time-A[i])-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
dist = [0]*max(a)
ans = sum(a)
for i in a:
    dist[i-1] += 1

q = int(input())
for i in range(q):
    b,c = map(int,input().split())
    if dist[b-1] != 0:
        dist[c-1] += dist[b-1]
        ans += dist[b-1] * (c-b)
        dist[b-1] = 0
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
dist = [0]*100000
ans = sum(a)
for i in a:
    dist[i-1] += 1

q = int(input())
for i in range(q):
    b,c = map(int,input().split())
    if dist[b-1] != 0:
        dist[c-1] += dist[b-1]
        ans += dist[b-1] * (c-b)
        dist[b-1] = 0
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
for i in range(q):
    b,c = map(int,input().split())
    a = [i if i != b else c for i in a]
    print(sum(a))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
dist = [0]*100000
ans = sum(a)
for i in a:
    dist[i-1] += 1

q = int(input())
for i in range(q):
    b,c = map(int,input().split())
    if dist[b-1] != 0:
        dist[c-1] += dist[b-1]
        ans += dist[b-1] * (c-b)
        dist[b-1] = 0
    print(ans)
Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = list(map(int,input().split()))
ans = float('inf')
for i in range(101):
    if i not in p:
        if abs(i-x) < abs(ans-x):
            ans = i
        elif abs(i-x) == abs(ans -x):
            ans = min(ans,i)
print(ans)

Fixed submission:
a = list(map(int,input().split()))
print(a.index(0)+1)
Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = list(map(int,input().split()))
ans = []
for i in range(max(p)+2):
    if i not in p:
        ans.append([abs(i-x),i])
ans.sort()
print(ans[0][1])

Fixed submission:
x,n = map(int,input().split())
p = list(map(int,input().split()))
i = 0
while True:
    if x - i not in p:
        print(x-i)
        exit()
    elif x + i not in p:
        print(x+i)
        exit()
    i += 1
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = [ [] for _ in range(n + 1) ]
for _ in range(m):
    s,e = map(int,input().split())
    B[s].append(e)
    B[e].append(s)
ans = 0
for i in range(1,n+1):
    if max(B[i]) < i:
        ans += 1
print(ans)

Fixed submission:
n,m = map(int,input().split())
A = [0] + list(map(int,input().split()))
B = [ [] for _ in range(n + 1) ]
for _ in range(m):
    s,e = map(int,input().split())
    B[s].append(A[e])
    B[e].append(A[s])
ans = 0
for i in range(1,n+1):
    if len(B[i]) == 0:
        ans += 1
    elif max(B[i]) < A[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor
a,b,n = map(int,input().split())
ans = 0
if n <= b:
    for i in range(n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(max(0,b-10),min(n,b+10)):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)

Fixed submission:
from math import floor
a,b,n = map(int,input().split())
ans = 0
if n <= b:
    for i in range(max(0,n-9),n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(max(0,b-10),min(n,b+10)):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import floor
a,b,n = map(int,input().split())
ans = 0
for i in range(max(0,int(n/max(a,b))-1),n+1):
    ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)

Fixed submission:
from math import floor
a,b,n = map(int,input().split())
ans = 0
if n <= b:
    for i in range(max(0,n-9),n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(max(0,b-10),min(n,b+10)):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import floor
a,b,n = map(int,input().split())
ans = 0
dd = 0
for i in range(n+1):
    y = (floor(a*i/b) - a*floor(i/b))
    if y >= ans:
        dd = 1
        ans = y
    else:
        print(ans)
        exit()
print(ans)

Fixed submission:
from math import floor
a,b,n = map(int,input().split())
ans = 0
if n <= b:
    for i in range(max(0,n-9),n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(max(0,b-10),min(n,b+10)):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in a:
    ans[a[i]-1] += 1
for i in ans:
    print(i)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter(list(map(int,input().split())))
for i in range(1,n+1):
    print(a[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n+1):
    print(a.count(i))

Fixed submission:
from collections import Counter
n = int(input())
a = Counter(list(map(int,input().split())))
for i in range(1,n+1):
    print(a[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n+1):
    print(a.count(i))

Fixed submission:
from collections import Counter
n = int(input())
a = Counter(list(map(int,input().split())))
for i in range(1,n+1):
    print(a[i])
Buggy python submission (verdict: Runtime Error):
X,Y,A,B,C = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort(
ans = 0

for i in range(X):
    if A[-1] >= C[-1]:
        ans += A[-1]
        A.pop()
    else:
        ans += C[-1]
        C.pop()

for i in range(Y):
    if B[-1] >= C[-1]:
        ans += B[-1]
        B.pop()
    else:
        ans += C[-1]
        C.pop()
        
print(ans)

Fixed submission:
X,Y,a,b,c = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()

ans = 0
if X < a:
    A = A[a-X:]
if Y < b:
    B = B[b-Y:]
ans = 0
for i in range(X+Y):
    if len(A) == 0:
        A.append(0)
    if len(B) == 0:
        B.append(0)
    if len(C) == 0:
        C.append(0)
    if max(A[-1],B[-1],C[-1]) == A[-1]:
        ans += A[-1]
        A.pop()
    elif max(A[-1],B[-1],C[-1]) == B[-1]:
        ans += B[-1]
        B.pop()
    else:
        ans += C[-1]
        C.pop()
print(ans)

Buggy python submission (verdict: Runtime Error):
X,Y,A,B,C = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ans = 0

for i in range(X):
    if A[0] >= C[0]:
        ans += A[0]
        A.pop(0)
    else:
        ans += C[0]
        C.pop(0)

for i in range(Y):
    if B[0] >= C[0]:
        ans += B[0]
        B.pop(0)
    else:
        ans += C[0]
        C.pop(0)
        
print(ans)

Fixed submission:
X,Y,a,b,c = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()

ans = 0
if X < a:
    A = A[a-X:]
if Y < b:
    B = B[b-Y:]
ans = 0
for i in range(X+Y):
    if len(A) == 0:
        A.append(0)
    if len(B) == 0:
        B.append(0)
    if len(C) == 0:
        C.append(0)
    if max(A[-1],B[-1],C[-1]) == A[-1]:
        ans += A[-1]
        A.pop()
    elif max(A[-1],B[-1],C[-1]) == B[-1]:
        ans += B[-1]
        B.pop()
    else:
        ans += C[-1]
        C.pop()
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
query = [list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    k = str(i)
    flag = True
    for s,c in query:
        if k[s-1] != str(c):
            flag = False
    if flag and len(k) == n:
        print(i)
        exit()
print(-1)

Fixed submission:
n,m = map(int,input().split())
if m == 0:
    if n == 1:
        print(0)
        exit()
    if n == 2:
        print(10)
        exit()
    if n == 3:
        print(100)
        exit()

a = [-1]*n
for _ in range(m):
    s,c = map(int,input().split())
    if s == 1 and c == 0 and n == 3:
        print(-1)
        exit()
    if s == 1 and c == 0 and n == 2:
        print(-1)
        exit()
    if a[s-1] == -1:
        a[s-1] = c
    else:
        if a[s-1] != c:
            print(-1)
            exit()

ans = ""
for i in range(n):
    if a[i] == -1:
        if i == 0:
            ans += "1"
        else:
            ans += "0"
    else:
        ans += str(a[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
query = [list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    k = str(i)
    flag = True
    for s,c in query:
        if k[s-1] != c:
            flag = False
    if flag and len(k) == n:
        print(i)
        exit()
print(-1)

Fixed submission:
n,m = map(int,input().split())
if m == 0:
    if n == 1:
        print(0)
        exit()
    if n == 2:
        print(10)
        exit()
    if n == 3:
        print(100)
        exit()

a = [-1]*n
for _ in range(m):
    s,c = map(int,input().split())
    if s == 1 and c == 0 and n == 3:
        print(-1)
        exit()
    if s == 1 and c == 0 and n == 2:
        print(-1)
        exit()
    if a[s-1] == -1:
        a[s-1] = c
    else:
        if a[s-1] != c:
            print(-1)
            exit()

ans = ""
for i in range(n):
    if a[i] == -1:
        if i == 0:
            ans += "1"
        else:
            ans += "0"
    else:
        ans += str(a[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(1000000)

def mod_combination(n, k, mod):
    # nCk (mod m)
    def mod_permutation(n, k, mod):
        if n<=k:
            return 1
        else:
            return (n * mod_permutation(n-1,k,mod))%mod

    def mod_inv_permutation(k, mod):
        k, mod = int(k), int(mod)
        if k<=1:
            return 1
        else:
            return (pow(k,mod-2,mod) * mod_inv_permutation(k-1, mod))%mod

    return (mod_permutation(n,n-k,mod) * mod_inv_permutation(k, mod))%mod

n,a,b = map(int,input().split())
ans = (2**n - 1) 
k = mod_combination(n, a,10**9+7)
l = mod_combination(n, b,10**9+7)
ans -= k
ans -= l
ans %= 10**9+7
print(ans)

Fixed submission:
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod) - 1 
mod_inv = [0, 1] + [0] * (b+3)
for i in range(2, b+5):
    mod_inv[i] = - mod_inv[mod % i] * (mod // i) % mod
def comod(n, r, mod):
    ans = 1
    for i in range(r):
        ans *= (n-i) % mod
        ans *= mod_inv[i+1]
        ans %= mod
    return ans
ans -= comod(n,a,mod) + comod(n,b,mod)
print(ans % mod)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
P = list(map(int,input().split()))
ans = 0
P = [float('inf')]+P
for i in range(1,n+1):
    if min(P[0:i]) >= P[i]:
        ans += 1
        #print(P[0:i])
print(ans)


Fixed submission:
n = int(input())
l = list(map(int,input().split()))
ans = 0
tmpmin = l[0]
for i in range(n):
    if l[i] <= tmpmin:
        ans += 1
    tmpmin = min(tmpmin,l[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
P = list(map(int,input().split()))
ans = 0
P = [float('inf')]+P
for i in range(1,n+1):
    if min(P[0:i]) >= P[i]:
        ans += 1
        #print(P[0:i])
print(ans)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
ans = 0
tmpmin = l[0]
for i in range(n):
    if l[i] <= tmpmin:
        ans += 1
    tmpmin = min(tmpmin,l[i])
print(ans)