Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
DP = [1] * (2 * 10 ** 6)
DP[0] = A[0]
for i in range(1, K):
    DP[i] = DP[i - 1] * A[i]


for i in range(K, N):
    DP[i] = DP[i - 1] * A[i] // A[i - K]
    if DP[i] > DP[i - 1]:
        print("Yes")
    else:
        print("No")


Fixed submission:
import sys
#import numpy as np
N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
# DP = [1] * (2 * 10 ** 6)
# DP[K - 1] = np.prod(A[0:K])

for i in range(K, N):
    if A[i] / A[i - K] > 1:
        print("Yes")
    else:
        print("No")

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

tmp = 1
for a in range(K):
    tmp *= A[a]

for i in range(K, N):
    c = tmp
    c = c // A[i - K]
    c *= A[i]
    if c > tmp:
        print("Yes")
    else:
        print("No")
    tmp = c


Fixed submission:
import sys
#import numpy as np
N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
# DP = [1] * (2 * 10 ** 6)
# DP[K - 1] = np.prod(A[0:K])

for i in range(K, N):
    if A[i] / A[i - K] > 1:
        print("Yes")
    else:
        print("No")

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

tmp = 1
for a in range(K):
    tmp *= A[a]

for i in range(K, N):
    c = tmp
    c = c // A[i - K]
    c *= A[i]
    if c > tmp:
        print("Yes")
    else:
        print("No")
    tmp = c


Fixed submission:
import sys
#import numpy as np
N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
# DP = [1] * (2 * 10 ** 6)
# DP[K - 1] = np.prod(A[0:K])

for i in range(K, N):
    if A[i] / A[i - K] > 1:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
D = int(input())
c = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]
#T = [int(input()) for i in range(D)]
SUM = 0
last = [0] * 28
for d in range(1, D + 1):
    i = S[d].index(max(S[d]))
    print(i)

Fixed submission:
D = int(input())
c = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]
#T = [int(input()) for i in range(D)]
SUM = 0
last = [0] * 28
for d in range(1, D + 1):
    i = S[d - 1].index(max(S[d - 1]))
    print(i + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
Q = int(input())
BC = [list(map(int, sys.stdin.readline().split())) for i in range(Q)]
for i in range(Q):
    B, C = BC[i]
    A[A == B] = C
    print(sum(A))

Fixed submission:
import sys
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Co = Counter(A)
Q = int(input())
BC = [list(map(int, sys.stdin.readline().split())) for i in range(Q)]
ans = sum(A)
for i in range(Q):
    B, C = BC[i]
    ans += ((C - B) * Co[B])
    print(ans)
    Co[C] += Co[B]
    Co[B] = 0
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
LIM = 10 ** 18
ans = 1
for i in A:
    ans *= i
if ans > LIM:
    print(-1)
else:
    print(ans)


Fixed submission:
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
LIM = 10 ** 18
ans = 1
if A[-1] == 0:
    print(0)
    exit()
for i in A:
    ans *= i
    if ans > LIM:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
for i in range(1, N + 1):
    print(A.count(i))

Fixed submission:
import sys
import collections

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
c = collections.Counter(A)
for i in range(1, N + 1):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
import sys
N, M = map(int, sys.stdin.readline().split())
A = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)
S = sum(A)
if A[M] < S / (4 * M):
    print("No")
else:
    print("Yes")

Fixed submission:
import sys
N, M = map(int, sys.stdin.readline().split())
A = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)
S = sum(A)
if A[M - 1] < S / (4 * M):
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

def comb(n,k):
    nCk = 1
    MOD = 10**9+7

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= MOD

    for i in range(1,k+1):
        nCk *= pow(i,MOD-2,MOD)
        nCk %= MOD
    return nCk

N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
for i in A:
    ans = 0
    for j in C:
        if i == j:
            ans += comb((C[j] - 1), 2)
        else:
            ans += comb(C[j], 2)
    print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
x = 0
for i in C:
    x += C[i] * (C[i] - 1) // 2
for a in A:
    print(x - (C[a] - 1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = sorted(list(map(int, input().split())))
print(d[N / 2] - d[N / 2 - 1])

Fixed submission:
N = int(input())
d = sorted(list(map(int, input().split())))
print(d[int(N / 2)] - d[int(N / 2 - 1)])
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N, K = map(int, input().split())
MOD = 10 **9 + 7
ans = 0
for i in range(1, K + 1):
    ans = (cmb(N - K + 1, i) * cmb(K - 1, i - 1)) % MOD
    print(ans)

Fixed submission:
N, K = map(int, input().split())
MOD = 10 **9 + 7
C = [[0] * (N + 1) for i in range(N + 1)]
C[1][1] = 1
for i in range(2, N + 1):
    for j in range(1, i + 1):
        if j == 1:
            C[i][j] = C[i - 1][j] + 1
        elif j == i:
            C[i][j] = 1
        else:
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
print(N - K + 1)
for i in range(2, K + 1):
    ans = (C[N - K + 1][i] * C[K - 1][i - 1]) % MOD
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def comb(n,k):
    nCk = 1
    MOD = 10**9+7

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= MOD

    for i in range(1,k+1):
        nCk *= pow(i,MOD-2,MOD)
        nCk %= MOD
    return nCk

N, K = map(int, input().split())
MOD = 10 **9 + 7
ans = 0
for i in range(1, K + 1):
    ans = (comb(N - K + 1, i) * comb(K - 1, i - 1)) % MOD
    print(ans)

Fixed submission:
N, K = map(int, input().split())
MOD = 10 **9 + 7
C = [[0] * (N + 1) for i in range(N + 1)]
C[1][1] = 1
for i in range(2, N + 1):
    for j in range(1, i + 1):
        if j == 1:
            C[i][j] = C[i - 1][j] + 1
        elif j == i:
            C[i][j] = 1
        else:
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
print(N - K + 1)
for i in range(2, K + 1):
    ans = (C[N - K + 1][i] * C[K - 1][i - 1]) % MOD
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(int(input()) for i in range(M))
MOD = 10 ** 9 + 7
DP = [0] * (N + 10)
if 1 not in A:
    DP[1] = 1
if 2 not in A and 1 in A:
    DP[2] = 1
if 2 not in A and 1 not in A:
    DP[2] = 2
for i in range(3, N + 1):
    if i not in A:
        DP[i] = (DP[i - 1] + DP[i - 2]) % MOD
print(DP[N])

Fixed submission:
N, M = map(int, input().split())
A = set(int(input()) for i in range(M))
MOD = 10 ** 9 + 7
DP = [0] * (N + 10)
if 1 not in A:
    DP[1] = 1
if 2 not in A and 1 in A:
    DP[2] = 1
if 2 not in A and 1 not in A:
    DP[2] = 2
for i in range(3, N + 1):
    if i not in A:
        DP[i] = (DP[i - 1] + DP[i - 2]) % MOD
print(DP[N])

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(int(input()) for i in range(M))
MOD = 10 ** 9 + 7
DP = [0] * (N + 10)
if 1 not in A:
    DP[1] = 1
if 2 not in A and 1 in A:
    DP[2] = 1
if 2 not in A and 1 not in A:
    DP[2] = 2
for i in range(3, N + 1):
    if i not in A:
        DP[i] = (DP[i - 1] + DP[i - 2]) % MOD
print(DP[N])

Fixed submission:
N, M = map(int, input().split())
A = set(int(input()) for i in range(M))
MOD = 10 ** 9 + 7
DP = [0] * (N + 10)
if 1 not in A:
    DP[1] = 1
if 2 not in A and 1 in A:
    DP[2] = 1
if 2 not in A and 1 not in A:
    DP[2] = 2
for i in range(3, N + 1):
    if i not in A:
        DP[i] = (DP[i - 1] + DP[i - 2]) % MOD
print(DP[N])
Buggy python submission (verdict: Runtime Error):
import sys
r, D, x2000 = map(int, sys.stdin.readline().split())
x2001 = r * x2000 - D
x2002 = r * x2001 - D
x2003 = r * x2002 - D
x2004 = r * x2003 - D
x2005 = r * x2004 - D
x2006 = r * x2005 - D
x2007 = r * x2006 - D
x2008 = r * x2007 - D
x2009 = r * x2008 - D
x2010 = r * x2009 - D
print(x2001)
print(x2002)
print(x2003)
print(x2004)
print(x2005)
print(x2006)
print(x2007)
print(x2008)
print(x2009)
print(x20010)

Fixed submission:
import sys
r, D, x2000 = map(int, sys.stdin.readline().split())
x2001 = r * x2000 - D
x2002 = r * x2001 - D
x2003 = r * x2002 - D
x2004 = r * x2003 - D
x2005 = r * x2004 - D
x2006 = r * x2005 - D
x2007 = r * x2006 - D
x2008 = r * x2007 - D
x2009 = r * x2008 - D
x2010 = r * x2009 - D
print(x2001)
print(x2002)
print(x2003)
print(x2004)
print(x2005)
print(x2006)
print(x2007)
print(x2008)
print(x2009)
print(x2010)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N, M = map(int, sys.stdin.readline().split())
LR = [list(map(int,sys.stdin.readline().split())) for i in range(M)]
B = list(range(0, 10 ** 5 + 1))
for i in LR:
	A = list(range(i[0], i[1] + 1))
	B = set(A) & set(B)
print(len(B))

Fixed submission:
import sys
N, M = map(int, sys.stdin.readline().split())
LR = sorted([list(map(int,sys.stdin.readline().split())) for i in range(M)])
L = 1
R = 10 ** 5
for i in LR:
    L = max(L, i[0])
    R = min(R, i[1])
if R - L >= 0:
    print(R - L + 1)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import sys
N, M = map(int, sys.stdin.readline().split())
LR = [list(map(int,sys.stdin.readline().split())) for i in range(N)]
B = list(range(0, 10 ** 5 + 1))
for i in LR:
	A = list(range(i[0], i[1]))
	B = set(A) & set(B)
print(len(B))

Fixed submission:
import sys
N, M = map(int, sys.stdin.readline().split())
LR = sorted([list(map(int,sys.stdin.readline().split())) for i in range(M)])
L = 1
R = 10 ** 5
for i in LR:
    L = max(L, i[0])
    R = min(R, i[1])
if R - L >= 0:
    print(R - L + 1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
A, B, C, X, Y = map(int, sys.stdin.readline().split(" "))
ans = float("inf")
 
for i in range(X + 1):
    for j in range(Y + 1):
        k = max(X - i, Y - j) * 2
        ans = min(ans, A * i + B * j + C * k)
print(ans)

Fixed submission:
import sys
A, B, C, X, Y = map(int, sys.stdin.readline().split(" "))
ans = float("inf")
 
for i in range(max(X, Y) * 2 + 1):
    j = X - i // 2
    if j < 0:
        j = 0
    k = Y - i // 2
    if k < 0:
        k = 0
    ans = min(ans, C * i + A * j + B * k)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
C = [list(map(int, sys.stdin.readline().split(" "))) for i in range(3)]
for a0 in range(101):
    b1 = C[0][0] - a0
    b2 = C[0][1] - a0
    b3 = C[0][2] - a0
    if (C[1][0] - b0 == C[1][1] - b1 == C[1][2] - b2) and (C[2][0] - b0 == C[2][1] - b1 == C[2][2] - b2):
        print("Yes")
        exit()
print("No")

Fixed submission:
import sys
C = [list(map(int, sys.stdin.readline().split(" "))) for i in range(3)]
for a0 in range(101):
    b0 = C[0][0] - a0
    b1 = C[0][1] - a0
    b2 = C[0][2] - a0
    if (C[1][0] - b0 == C[1][1] - b1 == C[1][2] - b2) and (C[2][0] - b0 == C[2][1] - b1 == C[2][2] - b2):
        print("Yes")
        exit()
print("No")
Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split(" "))
 
A = -1
B = -1
C = -1
 
for a in range(N + 1):
  for b in range(N + 1 - a):
    c = N + 1 - a - b
    if (10000 * a + 5000 * b + 1000 * c == Y) and 
      A = a
      B = b
      C = c
      
print(A, B, C)

Fixed submission:
N, Y = map(int, input().split(" "))
 
A = -1
B = -1
C = -1
 
for a in range(N + 1):
  for b in range(N + 1 - a):
    c = N - a - b
    if 10000 * a + 5000 * b + 1000 * c == Y and 0 <= c:
      A = a
      B = b
      C = c
      
print(A, B, C)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
 
N = int(input())
a = list(map(int, input().split(" ")))
c = []
 
for i in a:
  count = 0
  while not(i % 2):
    a = int(i / 2)
    count += 1
    c.append(count)
print(min(c))

Fixed submission:
# -*- coding: utf-8 -*-
 
N = int(input())
a = list(map(int, input().split(" ")))
c = []
 
for i in a:
  count = 0
  while not(i % 2):
    i = int(i / 2)
    count += 1
  c.append(count)
print(min(c))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(input())
a = list(map(int, input().split(" ")))
c = []

for i in a:
  count = 0
  while not(a % 2):
    a = int(a / 2)
    count += 1
    c.append(count)
print(min(c))

Fixed submission:
# -*- coding: utf-8 -*-
 
N = int(input())
a = list(map(int, input().split(" ")))
c = []
 
for i in a:
  count = 0
  while not(i % 2):
    i = int(i / 2)
    count += 1
  c.append(count)
print(min(c))
Buggy python submission (verdict: Runtime Error):
s = input()
ans = ""
for i in range(0, len(s), 2):
  ans = ans + i
print(ans)


Fixed submission:
s = input()
ans = ""
for i in range(0, len(s), 2):
  ans = ans + s[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
L = "abcdefghijklmnopqrstuvwxyz"
for i in a:
  if i in S:
    print(i)
    exit()
print("None")

Fixed submission:
S = input()
L = "abcdefghijklmnopqrstuvwxyz"
for i in L:
  if i not in S:
    print(i)
    exit()
print("None")
Buggy python submission (verdict: Runtime Error):

if 1 <= N <2:
  print(1)
if 2 <= N <4:
  print(2)
if 4 <= N <8:
  print(4)
if 8 <= N <16:
  print(8)
if 16 <= N <32:
  print(16)
if 32 <= N <64:
  print(32)
if 64 <= N <100:
  print(64)

Fixed submission:
N = int(input())
if 1 <= N <2:
  print(1)
if 2 <= N <4:
  print(2)
if 4 <= N <8:
  print(4)
if 8 <= N <16:
  print(8)
if 16 <= N <32:
  print(16)
if 32 <= N <64:
  print(32)
if 64 <= N <= 100:
  print(64)
Buggy python submission (verdict: Runtime Error):
import sys

N, K = map(int, sys.stdin.readline())
L = sorted(list(map(int, sys.stdin.readline().split(" "))), reverse=True)
print(sum(L[0:K]))

Fixed submission:
import sys
 
N, K = map(int, sys.stdin.readline().split(" "))
L = sorted(list(map(int, sys.stdin.readline().split(" "))), reverse=True)
print(sum(L[0:K]))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
ans = len(str(N))
for i in range(2, int(np.sqrt(N)) + 2):
    if not N % i:
        a = max(len(str(i)), len(str(int(N / i))))
        ans = min(ans, a)
print(a)

Fixed submission:
import numpy as np
 
N = int(input())
ans = len(str(N))
for i in range(2, int(np.sqrt(N)) + 2):
    if not N % i:
        a = max(len(str(i)), len(str(int(N / i))))
        ans = min(ans, a)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
ans = 10 ** 10
for i in range(2:int(np.sqrt(N)) + 2):
    if not N % i:
        a = max(len(str(i)), len(str(int(121 / 11))))
        ans = min(ans, a)
print(a)

Fixed submission:
import numpy as np
 
N = int(input())
ans = len(str(N))
for i in range(2, int(np.sqrt(N)) + 2):
    if not N % i:
        a = max(len(str(i)), len(str(int(N / i))))
        ans = min(ans, a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
ans = 0
for i in range(N):
    tmp = A[i]
    while tmp > 1:
        ans += 1
        tmp -= 2
    if i < N - 1 and tmp == 1 and A[i + 1] > 0:
        ans += 1
        A[i + 1] -= 1
print(ans)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
ans = 0
for i in range(N):
    tmp = A[i]
    ans += (tmp // 2)
    if i < N -1 and tmp % 2 and A[i + 1] > 0:
        ans += 1
        A[i + 1] -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(' ')))
if a.index(0) >= 0:
	print(0)
else:
	lim = int(1e18)
	mult = 1
	for v in a:
		if mult > lim:
			break
		else:
			mult *= v
	if mult > lim:
		print("-1")
	else:
		print(mult)

Fixed submission:
n = int(input())
a = list(map(int, input().split(' ')))
if a.count(0) > 0:
	print("0")
else:
	lim = int(1e18)
	mult = 1
	for v in a:
		if mult > lim:
			break
		else:
			mult *= v
	if mult > lim:
		print("-1")
	else:
		print(mult)
Buggy python submission (verdict: Runtime Error):
import math
A,B,N = map(int,input().split())
C = N - N%B
D = A*(C-1)
ans = math.floor(D/B)　-　A * math.floor((C-1)/B)
if B > N:
    ans = math.floor(A*N/B) - A*math.floor(N/B)
print(ans)

Fixed submission:
import math
A,B,N = map(int,input().split())
C = N - N%B
ans = A*(C-1) // B - A*math.floor((C-1)/B)
if B > N:
    ans = A*N // B - A*math.floor(N/B)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = [0]+list(map(int,input().split()))

scores = []
p = 1
for k in range(K):
    p *= A[K-k]
scores.append(p)
for i in range(K+1,N+1):
    p *= A[i]
    p //= A[i-k-1]
    scores.append(p)

l = len(scores)-1
for i in range(l):
    print(["No","Yes"][scores[i+1]>scores[i]])

Fixed submission:
N, K = map(int,input().split())
A = [0]+list(map(int,input().split()))

p = A[1]
for i in range(K+1,N+1):
    print(["No","Yes"][p < A[i]])
    p = A[i-K+1]

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = [0]+list(map(int,input().split()))

scores = []
for i in range(K,N+1):
    p = 1
    for k in range(K):
        p *= A[i-k]
    scores.append(p)

l = len(scores)-1
for i in range(l):
    print(["No","Yes"][scores[i+1]>scores[i]])

Fixed submission:
N, K = map(int,input().split())
A = [0]+list(map(int,input().split()))

p = A[1]
for i in range(K+1,N+1):
    print(["No","Yes"][p < A[i]])
    p = A[i-K+1]
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.reverse()
B.reverse()

t = 0
cnt = 0
c1, c2 = A.pop(), B.pop()
while True:
    
    if t >= K or (t + c1 > K and t + c2 > K):
        break


    if (t + c1 <= K and t + c2 <= K):
        l1 = [c1]
        sum_1 = c1
        for a in A[-1]:
            if t + a <= K:
                l1.append(a)
                sum_1 += a
            else:
                break
        l2 = [c2]
        sum_2 = c2
        for b in B[-1]:
            if t + b <= K:
                l2.append(b)
                sum_2 += b
            else:
                break
        
        if sum_1 <= sum_2:
            t += sum_1
            cnt += len(l1)
            for i in range(len(l1)-1):
                A.pop()
            c1 = A.pop() if bool(A) else 100000000000
        else:
            t += sum_2
            cnt += len(l2)
            for i in range(len(l2)-1):
                B.pop()
            c2 = B.pop() if bool(B) else 100000000000

    elif t + c1 <= K:
        
        t += c1
        cnt += 1
        c1 = A.pop() if bool(A) else 100000000000
    else:
        if t + c2 <= K:
            t += c2
            cnt += 1
            c2 = B.pop() if bool(B) else 100000000000

print(cnt)


Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])
    
ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

d = deque()

N, M = map(int,input().split())

dct = {}
for _ in range(M):
    a, b = map(int,input().split())
    if not a in dct:
        dct[a] = set()
    if not b in dct:
        dct[b] = set()
    dct[a].add(b)
    dct[b].add(a)

#print(dct)
answers = [0]*(N+1)

stack = deque([1,])
lst = []
while len(stack):
    s = stack.popleft()
    lst.append(s)
    #print(dct[s])
    for i in dct[s]:
        if i in lst:
            continue
        if i in stack:
            continue
        stack.append(i)
        answers[i] = s

if answers.count(0) != 2:
    print("No")
else:
    print("Yes")
    for ans in answers[2:]:
        print(ans)

Fixed submission:
N = input()
print(["p","p","h","b","h","h","p","h","p","h"][int(N[-1])]+"on")
Buggy python submission (verdict: Runtime Error):
import math

def perm(n, r):
    return math.factorial(n)//math.factorial(n-r)

def comb(n, r):
    if n == 1:
        return 0
    return perm(n, r)//math.factorial(r)

N, M = map(int,input().split(" "))

ans = comb(N,2) + comb(M,2)


print(int(ans))

Fixed submission:
import math

def perm(n, r):
    return math.factorial(n)//math.factorial(n-r)

def comb(n, r):
    if n <= 1:
        return 0
    return perm(n, r)//math.factorial(r)

N, M = map(int,input().split(" "))

ans = comb(N,2) + comb(M,2)


print(int(ans))

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb

N, M = map(int,input().split(" "))

ans = comb(N,2) + comb(M,2)


print(int(ans))

Fixed submission:
import math

def perm(n, r):
    return math.factorial(n)//math.factorial(n-r)

def comb(n, r):
    if n <= 1:
        return 0
    return perm(n, r)//math.factorial(r)

N, M = map(int,input().split(" "))

ans = comb(N,2) + comb(M,2)


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

cnt_a = cnt_b = 0

for i in range(10*100):
    if cnt_a + cnt_b + A >= N: 
        # N - cnt_a - cnt_b はみ出た分
        ans = cnt_a + N - cnt_a - cnt_b

    else:
        cnt_a += A
        cnt_b += B

print(ans)

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

ans = (N//(A+B))*A + min((N%(A+B)),A)

print(ans)

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

L = []

for i in range(10**100):
    L += A*["b",]
    L += B*["r",]
    if len(L) >= N:
        break

#print(L,L[:N])
cnt = 0
for l in L[:N]:
    if l == "b":
        cnt += 1

print(cnt)

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

ans = (N//(A+B))*A + min((N%(A+B)),A)

print(ans)

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

L = []

for i in range(10*100):
    L += A*["b",]
    L += B*["r",]
    if len(L) >= N:
        break

#print(L,L[:N])
cnt = 0
for l in L[:N]:
    if l == "b":
        cnt += 1

print(cnt)

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

ans = (N//(A+B))*A + min((N%(A+B)),A)

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split(" "))
A = map(int,input().split(" "))
 
import itertools
 
L = []
 
for x in itertools.combinations(A, 2):
    L.append(x[0]*x[1])
 
L.sort()
 
print(L[K-1])

Fixed submission:
L = map(int,input().split(" "))

if len(set(L)) == 2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

N,M = map(int,input().split(" "))
A = []
B = []

for i in range(N):
    a,b = map(int,input().split(" "))
    A.append(a)
    B.append(b)
    


#N 店の軒数


#M 買いたい本数
#A 一本の価格
#B 買える本数
yen = 0

while True:
    i = A.index(min(A))
    y = min(A)
    #print(A,B,i,y)
    if B[i] >= M:
        yen += M*A[i]
        break
    else:#B[i] < M
        yen += B[i] * A[i]
        M -= B[i]
        del B[i]
        del A[i]
        
print(yen)
        
    

Fixed submission:
# coding: utf-8
# Your code here!

N,M = map(int,input().split(" "))
A = []
B = []

for i in range(N):
    a,b = map(int,input().split(" "))
    A.append(a)
    B.append(b)
    
L = list(zip(A,B))
L.sort()

#N 店の軒数


#M 買いたい本数
#A 一本の価格
#B 買える本数
yen = 0

while True:
    i = 0#i = A.index(min(A))
    #y = min(A)
    #print(A,B,M)
    if L[0][1] >= M:
        yen += M*L[0][0]
        break
    else:#B[i] < M
        yen += L[0][1] * L[0][0]
        M -= L[0][1]
        del L[0]
        
        
print(yen)