Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,Y=map(int,input().split())
A=[]
for i in range(Y//10000+1):
    for j in range((Y-i*10000)//5000+1):
        c1=(Y-10000*i-5000*j)/1000
        c2=N-i-j
        if c1==c2:
            A=[i,j,c1]
            break
        if c1!=c2:
            continue
if len(A)==0:
    print("-1 -1 -1")
else:
    A[2]=int(A[2])
    #intは整数、floatは少数
    print(str(A[0])+" "+str(A[1])+" "+str(A[2]))

Fixed submission:
N,Y=map(int,input().split())
A=[]
for i in range(Y//10000+1):
    for j in range((Y-i*10000)//5000+1):
        c1=(Y-10000*i-5000*j)/1000
        c2=N-i-j
        if c1==c2:
            A=[i,j,c1]
            break
        if c1!=c2:
            continue
if len(A)==0:
    print("-1 -1 -1")
else:
    A[2]=int(A[2])
    #intは整数、floatは少数
    print(str(A[0])+" "+str(A[1])+" "+str(A[2]))
Buggy python submission (verdict: Runtime Error):
import math
#N=int(input())
#考えるべき範囲
ans=11
#絶対ありえない数を定義しておく
for i in range(1,int(math.sqrt(N))+1):
    if N%i !=0:
        continue
    else:
        A=N//i
        A=str(A)
        i=str(i)
        F=max(len(A),len(i))
        if F<ans:
            ans=F

print(ans)
        

Fixed submission:
import math
N=int(input())
#考えるべき範囲
ans=11
#絶対ありえない数を定義しておく
for i in range(1,int(math.sqrt(N))+1):
    if N%i !=0:
        continue
    else:
        A=N//i
        A=str(A)
        i=str(i)
        F=max(len(A),len(i))
        if F<ans:
            ans=F

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

N = int(input())

xys = []
for _ in range(N):
    xys.append(tuple(map(int, input().split())))

sub = []
for x1, y1 in xys:
    for x2, y2 in xys:
        if x1 != x2 or y1 != y2:
            sub.append((x1 - x2, y1 - y2))

c = Counter(sub)
m = max(c.values())

print(N - m)


Fixed submission:
from collections import Counter

N = int(input())

xys = []
for _ in range(N):
    xys.append(tuple(map(int, input().split())))

sub = []
for x1, y1 in xys:
    for x2, y2 in xys:
        if x1 != x2 or y1 != y2:
            sub.append((x1 - x2, y1 - y2))

if not sub:
    print(1)
    exit(0)

c = Counter(sub)
m = max(c.values())

print(N - m)
Buggy python submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())


def f(num):
    n_max = math.ceil(math.log2(num+1))
    result = 0
    for n in range(n_max):
        if n == 0:
            r = num % 4
            if r == 1 or r == 2:
                result += 1
            continue
        r = (num+1) % 2**(n+1)
        if r <= 2**n:
            continue
        else:
            r -= 2**n

        if r % 2 == 1:
            result += 2**n

    return result


print(f(A-1) ^ f(B))


Fixed submission:
import math

A, B = map(int, input().split())


def f(num):
    n_max = math.ceil(math.log2(num+1))
    result = 0
    for n in range(n_max):
        if n == 0:
            r = num % 4
            if r == 1 or r == 2:
                result += 1
            continue
        r = (num+1) % 2**(n+1)
        if r <= 2**n:
            continue
        else:
            r -= 2**n

        if r % 2 == 1:
            result += 2**n

    return result


if A > 0:
    print(f(A-1) ^ f(B))
else:
    print(f(B))

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

ans = 0
for n in range(A, B+1):
    ans = ans ^ n

print(ans)


Fixed submission:
import math

A, B = map(int, input().split())


def f(num):
    n_max = math.ceil(math.log2(num+1))
    result = 0
    for n in range(n_max):
        if n == 0:
            r = num % 4
            if r == 1 or r == 2:
                result += 1
            continue
        r = (num+1) % 2**(n+1)
        if r <= 2**n:
            continue
        else:
            r -= 2**n

        if r % 2 == 1:
            result += 2**n

    return result


if A > 0:
    print(f(A-1) ^ f(B))
else:
    print(f(B))
Buggy python submission (verdict: Runtime Error):
import math
a,b = input().split()
n = b.find('.')
if n > 0:
  bi = int(b[:n])
  bf = int(b[n+1:])
else:
  bi,bf = int(b),0
  
ans = str(math.floor(int(a)*(bi*100+bf)))
N = ans.find('.')
if N > 0:
  ai = int(ans[:n-2])
else:
  ai = int(int(ans)/100)
print(ai)

Fixed submission:
import numpy as np
N = int(input())
list = list(map(int,input().split()))
ans = np.prod(list)
if ans > 10**18 or ans == 0:
  ans = -1
if 0 in list:
  ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a,b = input().split()
n = b.find('.')
if n > 0:
  bi = int(b[:n])
  bf = int(b[n+1:])
else:
  bi,bf = int(b),0
  
ans = str(math.floor(int(a)*(bi*100+bf)))
N = ans.find('.')
if N > 0:
  ai = int(ans[:n-2])
else:
  ai = int(ans/100)
print(ai)

Fixed submission:
import numpy as np
N = int(input())
list = list(map(int,input().split()))
ans = np.prod(list)
if ans > 10**18 or ans == 0:
  ans = -1
if 0 in list:
  ans = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = list(map(int,input().split()))
ans = 1
for i in list:
  ans *= i
if ans > 10**18:
  ans = -1
print(ans)

Fixed submission:
import numpy as np
N = int(input())
list = list(map(int,input().split()))
ans = np.prod(list)
if ans > 10**18 or ans == 0:
  ans = -1
if 0 in list:
  ans = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = list(map(int,input().split()))
ans = 1
for i in list:
  ans *= i
if ans > 10**18:
  ans = -1
print(ans)

Fixed submission:
import numpy as np
N = int(input())
list = list(map(int,input().split()))
ans = np.prod(list)
if ans > 10**18 or ans == 0:
  ans = -1
if 0 in list:
  ans = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = list(map(int,input().split()))
ans = 1
for i in list:
  ans *= i
  if ans == 0:
    break
if ans > 10**18:
  ans = -1
print(ans)

Fixed submission:
import numpy as np
N = int(input())
list = list(map(int,input().split()))
ans = np.prod(list)
if ans > 10**18 or ans == 0:
  ans = -1
if 0 in list:
  ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N,K = map(int,input().split())
k = 10**9+7
for i in range(1,K+1):
  A= 1
  for j in range(i-1):
    A *= K-1-j
  A = A//math.factorial(i-1)%k
  B = math.factorial(N-K+1)//math.factorial(N-K-i+1)//math.factorial(i)%k
  print(A*B%k)

Fixed submission:
import math
N,K = map(int,input().split())
k = 10**9+7
for i in range(1,K+1):
  A= 1
  for j in range(i-1):
    A *= K-1-j
  A = A//math.factorial(i-1)%k
  B = 1
  if N-K-i+1>=0:
    B = math.factorial(N-K+1)//math.factorial(N-K-i+1)//math.factorial(i)%k
    print(A*B%k)
  else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
dp = [0]*(N+1)
dp[0] = 1
for i in range(M):
  dp[a] = -1
k = 10**9+7
d = 1
if N == 1:
  print(1)
else:
  for i in range(1,N+1):
    if dp[i] == -1:
      continue
    elif i==1:
      dp[i] = 1
    elif i==2:
      dp1 = dp[i-1] if dp[i-1] != -1 else 0
      d += dp[1]
      dp[i] = d
    else:
      dp1 = dp[i-1] if dp[i-1] != -1 else 0
      dp3 = dp[i-3] if dp[i-3] != -1 else 0
      d = d-dp3+dp1
      dp[i] = d
  print(dp[N]%k)

Fixed submission:
N,M = map(int,input().split())
a = set([int(input()) for _ in range(M)])
k = 10**9+7
dp = [0]*(N+1)
dp[0] = 1
if N == 1:
  print(1)
else:
  for i in range(1,N+1):
    if i in a:
      continue
    elif i==1:
      dp[1] = 1
    elif i==2:
      dp[i] = 1+dp[1]
    else:
      dp[i] = dp[i-1]+dp[i-2]
  print(dp[N]%k)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
k = 10**9+7
dp = [0]*(N+1)
dp[0] = 1
d = 1
if N == 1:
  print(1)
else:
  for i in range(1,N+1):
    if i in a:
      continue
    elif i==1:
      dp[i] = d
    elif i==2:
      d += dp[1]
      dp[i] = d
    else:
      d = d-dp[i-3]+dp[i-1]
      dp[i] = dp[i-1]+dp[i-2]
  print(dp[N]%k)

Fixed submission:
N,M = map(int,input().split())
a = set([int(input()) for _ in range(M)])
k = 10**9+7
dp = [0]*(N+1)
dp[0] = 1
if N == 1:
  print(1)
else:
  for i in range(1,N+1):
    if i in a:
      continue
    elif i==1:
      dp[1] = 1
    elif i==2:
      dp[i] = 1+dp[1]
    else:
      dp[i] = dp[i-1]+dp[i-2]
  print(dp[N]%k)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ab = []
abn = [0]*N
abw = [[] for _ in range(N)]
for i in range(N-1):
  a,b = list(map(int,input().split()))
  ab.append([a,b])
  abw[a-1].append(b)
  abw[b-1].append(a)
  abn[a-1] += 1
  abn[b-1] += 1
c = sorted(list(map(int,input().split())))
cn = 0
d = [0]*N
s = [i for i in range(N)]
while cn <N:
  cut = []
  for i in s:
    if (abn[i] == 1 and cn<N) or len(s) == 1:
      d[i] = c[cn]
      cn += 1
      cut.append(i)
      abn[i] -=1
      s.remove(i)
  for j in cut:
    for k in abw[j]:
      abn[k-1] -= 1
print(sum(c)-max(c))
print(" ".join(map(str,d)))

Fixed submission:
N = int(input())
ab = []
abn = [0]*N
abw = [[] for _ in range(N)]
for i in range(N-1):
  a,b = list(map(int,input().split()))
  ab.append([a,b])
  abw[a-1].append(b)
  abw[b-1].append(a)
  abn[a-1] += 1
  abn[b-1] += 1
c = sorted(list(map(int,input().split())))
cn = 0
d = [0]*N
s = [i for i in range(N)]
while cn <N:
  cut = []
  for i in s:
    if (abn[i] == 1 and cn<N) or len(s) == 1:
      d[i] = c[cn]
      cn += 1
      cut.append(i)
      abn[i] -=1
      s.remove(i)
  for j in cut:
    for k in abw[j]:
      abn[k-1] -= 1
print(sum(c)-max(c))
print(" ".join(map(str,d)))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
Ap = []
for _ in range(M):
  B,C = map(int,input().split())
  Ap += [C]*B
Ap.sort()
np = len(Ap)
count = 0
i,j = 0,0
while i+j < N:
  a = A[N-i-1]
  b = Ap[np-j-1] if j<np else 0
  if a>=b and i<N:
    count += a
    i += 1
  elif a<b and j<np:
    count += b
    j += 1
print(count)

Fixed submission:
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
Ap = {}
for _ in range(M):
  B,C = map(int,input().split())
  if C in Ap.keys():
    Ap[C] = Ap[C]+B
  else:
    Ap[C] = B
Clist = sorted(Ap.keys())
nc = len(Clist)
i,j,k = 0,0,0
count = 0
a = A[N-1]
while i+j < N:
  if k<nc:
    c = Clist[nc-k-1]
    b = Ap[c]
  else:b,c = 0,0
  if a>=c:
    count += a
    i += 1
    a = A[N-i-1]
  elif c>a:
    count += b*c if i+j+b<N else c*(N-i-j)
    j += b
    k += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = list(map(int,input().split()))
for _ in range(M):
  B,C = map(int,input().split())
  A += [C]*B
print(sum(sorted(A)[len(A)-N:]))

Fixed submission:
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
Ap = {}
for _ in range(M):
  B,C = map(int,input().split())
  if C in Ap.keys():
    Ap[C] = Ap[C]+B
  else:
    Ap[C] = B
Clist = sorted(Ap.keys())
nc = len(Clist)
i,j,k = 0,0,0
count = 0
a = A[N-1]
while i+j < N:
  if k<nc:
    c = Clist[nc-k-1]
    b = Ap[c]
  else:b,c = 0,0
  if a>=c:
    count += a
    i += 1
    a = A[N-i-1]
  elif c>a:
    count += b*c if i+j+b<N else c*(N-i-j)
    j += b
    k += 1
print(count)
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
count = min(A,B)
k = 0
while count > 0:
  if A%count == 0 nad B%count == 0:
    k += 1
  if k == K:
    print(count)
    break
  else:
    count -= 1

Fixed submission:
A,B,K = map(int,input().split())
count = min(A,B)
k = 0
while count > 0:
  if A%count == 0 and B%count == 0:
    k += 1
  if k == K:
    print(count)
    break
  else:
    count -= 1
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,list(input()))
s = (sum([A,B,C,D])-7)//2
c = [1,1,1]
for a,n in enumerate([A,B,C,D]):
  if s == n:
    c[i] = -1
    s = 0
  else:
    for i in [1,-1]:
      for j in [1,-1]:
        for k in [1,-1]:
          if A+B*i+C*j+D*k == 7:
            c[0] = i
            c[1] = j
            c[2] = k
            s = 0
            break
print(str(A)+'{:+}{:+}{:+}'.format(B*c[0],C*c[1],D*c[2])+"=7")

Fixed submission:
Astr = input()
Aint = [0]*4
for i in range(4):
  Aint[i] = int(Astr[i])
q = [1,1,1]
ans = 7-Aint[0]

while sum(q) != -3:
  a = [0]*3
  for i in range(3):
    a[i] = Aint[i+1]*q[i]
  if sum(a) == ans:
    print(str(Aint[0])+"{:+}{:+}{:+}".format(a[0],a[1],a[2])+"=7")
    break
  elif q[2] == 1:
    q[2] = -1
  elif q[1] == 1:
    q[1] = -1
    q[2] = 1
  else:
    q[0] = -1
    q[1] = 1
    q[2] = 1
Buggy python submission (verdict: Runtime Error):
n = int(input())
sum1 = 0
while n!=0:
  sum1 += int(n%10)
  n = int(n/10)
if sum1 % 9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
if n % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
sum1 = 0
while n!=0:
  sum1 += int(n%10)
  n = int(n/10)
if sum1%9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
if n % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
sum1 = 0
while n>0:
  sum1 += n%10
  n = int(n/10)
if sum1%9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
if n % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
sum1 = 0
while n>0:
  sum1 += n%10
  n= int(n/10)
if sum1%9 == 0:
  print('YES')
else:
  print('NO')

Fixed submission:
n = int(input())
if n % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
sum1 = 0
while n>0:
  sum1 += n%10
  n/=10
if sum1%9 == 0:
  print('YES')
else:
  print('NO')

Fixed submission:
n = int(input())
if n % 9 == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if W >= V:
    print("NO")
else:
    C = abs(A - B)
    X = V - W
    if C // X > T:
        print("NO")
    else:
        print("YES")

Fixed submission:
S = input()
print(S[0]+S[1]+S[2])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = 1
for i in range(N):
    B = B * A[i]
    if B > 10 ** 18:
        print(-1)
        break
print(B)

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

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
import numpy as np
B = np.prod(A)
if B <= 10 ** 18:
    print(B)
else:
    print(-1)

Fixed submission:
A, B = map(int, input().split())
print(A * B)
Buggy python submission (verdict: Runtime Error):
A, B = input.split()
a = int(A)
b = round(float(B) * 100)
c = a * b // 100
print(c)


Fixed submission:
A, B = input().split()
a = int(A)
b = round(float(B) * 100)
c = a * b // 100
print(c)

Buggy python submission (verdict: Runtime Error):
A, B = input.split()
a = int(A)
b = float(B) * 100
c = a * b // 100
print(c)

Fixed submission:
A, B = input().split()
a = int(A)
b = round(float(B) * 100)
c = a * b // 100
print(c)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
if T = S + T[-1]:
    print("Yes")
else:
    print("No")

    

Fixed submission:
S = input()
T = input()
if T == S + T[-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))
s = b * n[1]
t = r * n[2]
u = 10**100
v = (s + t) * u
w = v.count("b", 0, n[0])
print(w)

Fixed submission:
N, A, B = map(int, input().split())
C = A + B
D = N // C
E = N % C
if N <= A:
    print(N)
elif N <= C:
    print(A)
else:
    if E <= A:
        print(A*D + E)
    else:
        print(A*D + A)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
        if X == 500 * a + 100 * b + 50 * c:
            count = count + 1
print(count)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if X == 500 * a + 100 * b + 50 * c:
                count = count + 1
print(count)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        fo c in range(C + 1):
        if X == 500 * a + 100 * b +50 * c:
            count = count + 1
print(count)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if X == 500 * a + 100 * b + 50 * c:
                count = count + 1
print(count)
Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())
total = 0
for x in range(N + 1):
    for y in range(N + 1 - x):
        for z in range(N + 1 - x - y):
            if Y == 10000 * x + 5000 * y + 1000 * z:
                total = total + 1
                ans = str(x) + " " + str(y) + " " + str(z)
                print(ans)
                break
        else:
            continue
        break
    else:
        continue
    break
break
if total ==0:
    print("-1 -1 -1")

Fixed submission:
N, Y = map(int, input().split())
for x in range(N + 1):
    for y in range(N - x + 1):
        z = N - x - y
        if Y == 10000 * x + 5000 * y + 1000 * z:
            print(x, y, z)
            exit()
print(-1, -1, -1)
Buggy python submission (verdict: Runtime Error):
s = int(input())
a = s.count(1)
print(a)

Fixed submission:
s = input()
a = s.count("1")
print(a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(N):
    cnt = 0
    while A[i] % 2 == 0:
        A[i] = A[i] / 2
        cnt = cnt + 1
    ans.append(cnt)
print(min(sns))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(N):
    cnt = 0
    while A[i] % 2 == 0:
        A[i] = A[i] / 2
        cnt = cnt + 1
    ans.append(cnt)
print(min(ans))
Buggy python submission (verdict: Runtime Error):
import itertools
a0,b0,c0 = map(int, input().split())
k = int(input())
p = itertools.product(range(3),repeat = k)
ans = 'No'
for i in p:
    a,b,c = a0,b0,c0
    if i[0] == 0:
        a = 2*a
    elif i[0] == 1:
        b = 2*b
    elif i[0] == 2:
        c = 2*c
    if b > a and c > b:
        ans = 'Yes'
        break
    if i[1] == 0:
        a = 2*a
    elif i[1] == 1:
        b = 2*b
    elif i[1] == 2:
        c = 2*c
    if b > a and c > b:
        ans = 'Yes'
        break
    if i[2] == 0:
        a = 2*a
    elif i[2] == 1:
        b = 2*b
    elif i[2] == 2:
        c = 2*c
    if b > a and c > b:
        ans = 'Yes'
        break
print(ans)

Fixed submission:
import itertools
a0,b0,c0 = map(int, input().split())
k = int(input())
p = itertools.product(range(3),repeat = k)
ans = 'No'
for i in p:
    a,b,c = a0,b0,c0
    for ii in i:
        if ii == 0:
            a = 2*a
        elif ii == 1:
            b = 2*b
        elif ii == 2:
            c = 2*c
        
        if b > a and c > b:
            ans = 'Yes'
            break
    if ans == 'Yes':
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for _ in range(n)]
print(len(set(s)))

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
print(len(set(s)))
Buggy python submission (verdict: Runtime Error):
n = input()
ans = 'No'
for s in n:
    if s == '7'
    ans = 'Yes'
    break
print(ans)

Fixed submission:
n = input()
ans = 'No'
for s in n:
    if s == '7':
        ans = 'Yes'
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
    
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans += gcd(gcd(a,b),c)
print(ans)


Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
    
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans += gcd(gcd(a,b),c)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
if n > 1:
    ns = list('1' + '0'*(n-1))
else:
    ns = list('0')

ss, cc = -1, -1
for i in range(m):
    s, c = map(int, input().split())
    if s == ss and c != cc:
        x = False
        break
    ns[s-1] = str(c)
    ss, cc = s, c
    
if (len(ns) > 1 and ns[0] == '0') or x == False:
    ans = -1
else:
    ans = ''.join(ns)
print(ans)

Fixed submission:
n,m = map(int,input().split())
if n > 1:
    ns = list('1' + '0'*(n-1))
else:
    ns = list('0')

ss, cc = -1, -1
for i in range(m):
    s, c = map(int, input().split())
    if s == ss and c != cc:
        ns[0] = '-1'
        break
    ns[s-1] = str(c)
    ss, cc = s, c
    
if (len(ns) > 1 and ns[0] == '0') or ns[0] == '-1':
    ans = -1
else:
    ans = ''.join(ns)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
l = [i for i,v in c.items() if v == max(c.values())]
l.sort()
for j in l:
    print(j)

Fixed submission:
import collections
n = int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
mv = c.most_common()[0][1]
l = [i for i,v in c.items() if v == mv]
l.sort()
for j in l:
    print(j)
Buggy python submission (verdict: Runtime Error):
import math 
h, a = map(int, input.split())
ans = math.ceil(h/a)
print(ans)

Fixed submission:
import math 
h, a = map(int, input().split())
ans = math.ceil(h/a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(_) for _ in input().split()]

ans = 1
for i in range(1,len(p)):
    p_min = min(p[0:i+1])
    if p_min == p[i]:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
p = [int(_) for _ in input().split()]

t = 200001
ans = 0
for i in range(n):
    if p[i] < t:
        ans += 1
        t = p[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(_) for _ in input().split()]

ans = 0
for i in range(len(p)):
    if i == 0:
        ans += 1
    else:
        p_min = min(p[0:i+1])
        if p_min == p[i]:
            ans += 1
print(ans)

Fixed submission:
n = int(input())
p = [int(_) for _ in input().split()]

t = 200001
ans = 0
for i in range(n):
    if p[i] < t:
        ans += 1
        t = p[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())

ac = [False]*n
c_ac = 0
c_wa = 0

for _ in range(m):
    pi,si = input().split()
    pi = int(pi)
    
    if ac[pi] == False:
        if si == 'WA':
            c_wa += 1
        elif si == 'AC':
            c_ac += 1
            ac[pi] = True

print(c_ac, c_wa)

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

ac = [False]*n
c_ac = 0
c_wa = 0
wa = [0]*n
for _ in range(m):
    pi,si = input().split()
    pi = int(pi) - 1
    
    if ac[pi] == False:
        if si == 'WA':
            wa[pi] += 1
        elif si == 'AC':
            c_ac += 1
            c_wa += wa[pi]
            ac[pi] = True

print(c_ac, c_wa)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 0
for i in range(n):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
        ans += 1
        
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(n-2):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
        ans += 1
        
print(ans)