Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
N, D = map(int, input().split())
times = int(input())  
n = [list(map(int, input().split())) for i in range(times)]
n = np.array(n)
ans = 0
for j in range(n.shape[0]):
  for i in range(n.shape[0]):
    length = np.linalg.norm(n[i]-n[j])
    aaa = math.modf(length)[0]
    if aaa < 0.00001:
      ans +=1
ans = ans - n.shape[0]
ans = int(ans/2)
print(ans)

Fixed submission:
import numpy as np
import math
N, D = map(int, input().split())
 
n = [list(map(int, input().split())) for i in range(N)]
n = np.array(n)
ans = 0
for j in range(n.shape[0]):
  for i in range(n.shape[0]):
    length = np.linalg.norm(n[i]-n[j])
    aaa = math.modf(length)[0]
    if aaa < 0.00001:
      ans +=1
ans = ans - n.shape[0]
ans = int(ans/2)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
N, D = map(int, input().split())
times = int(input())  
n = [list(map(int, input().split())) for i in range(times)]
n = np.array(n)
for j in range(n.shape[0]):
  for i in range(n.shape[0]):
    length = np.linalg.norm(n[i]-n[j])
    aaa = math.modf(length)[0]
    if aaa < 0.00001:
      ans +=1
ans = ans - n.shape[0]
ans = int(ans/2)
print(ans)

Fixed submission:
import numpy as np
import math
N, D = map(int, input().split())
 
n = [list(map(int, input().split())) for i in range(N)]
n = np.array(n)
ans = 0
for j in range(n.shape[0]):
  for i in range(n.shape[0]):
    length = np.linalg.norm(n[i]-n[j])
    aaa = math.modf(length)[0]
    if aaa < 0.00001:
      ans +=1
ans = ans - n.shape[0]
ans = int(ans/2)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
N, D = map(int, input().split())
times = int(input())  
n = [list(map(int, input().split())) for i in range(times)]
n = np.array(n)
for j in range(n.shape[0]):
  for i in range(n.shape[0]):
    length = np.linalg.norm(n[i]-n[j])
    aaa = math.modf(length)[0]
    if aaa < 0.00001:
      ans +=1
ans = ans - n.shape[0]
ans = int(ans/2)
print(ans)

Fixed submission:
import numpy as np
import math
N, D = map(int, input().split())
 
n = [list(map(int, input().split())) for i in range(N)]
n = np.array(n)
ans = 0
for j in range(n.shape[0]):
  for i in range(n.shape[0]):
    length = np.linalg.norm(n[i]-n[j])
    aaa = math.modf(length)[0]
    if aaa < 0.00001:
      ans +=1
ans = ans - n.shape[0]
ans = int(ans/2)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
if n="A":
  print("T")
elif n="T":
  print("A")
elif n="G":
  print("C")
else:
  print("G")

Fixed submission:
n = input()
if n=="A":
  print("T")
elif n=="T":
  print("A")
elif n=="G":
  print("C")
else:
  print("G")

Buggy python submission (verdict: Runtime Error):
n = int(input())
if n="A":
  print("T")
elif n="T":
  print("A")
elif n="G":
  print("C")
else:
  print("G")

Fixed submission:
n = input()
if n=="A":
  print("T")
elif n=="T":
  print("A")
elif n=="G":
  print("C")
else:
  print("G")
Buggy python submission (verdict: Runtime Error):
n=input()
ans=0
anss=[]
for i in range(len(n)):
    
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C":
        ans += 1
    else:
        anss.append(ans)
        ans=0
import numpy as np
anss=np.array(anss)
print(anss.max())

Fixed submission:
n=input()
ans=0
anss=[]
for i in range(len(n)):
    
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C":
        ans += 1
        anss.append(ans)
    else:
        anss.append(ans)
        ans=0

import numpy as np
anss=np.array(anss)
print(anss.max())

Buggy python submission (verdict: Runtime Error):
n=input()
ans=0
anss=[]
for i in range(len(n)):
    
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C":
        ans += 1
    else:
        anss.append(ans)
        ans=0
import numpy as np
anss=np.array(anss)
print(anss.max())

Fixed submission:
n=input()
ans=0
anss=[]
for i in range(len(n)):
    
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C":
        ans += 1
        anss.append(ans)
    else:
        anss.append(ans)
        ans=0

import numpy as np
anss=np.array(anss)
print(anss.max())
Buggy python submission (verdict: Runtime Error):
import numpy as np
def main():
    ttt = []
    n = int(input())
    N, M = map(int, input().split())
    e = list(map(int, input().split()))
    #e = [[int(i) for i in input().split()] for i in range(int(input()))]
    #n = 3
    #e = [[21,-11],[81234,94124,52141
    for j in range(n):
        t = N - e[j]*0.006
        tt = abs(M - t)
        ttt.append(tt)
    ttt = np.array(ttt)
    print(np.argmin(ttt)+1)
main()

Fixed submission:
def main():
  a, b = (int(_) for _ in input().split())
  print(int(a+b/2))
main()

Buggy python submission (verdict: Runtime Error):
import numpy as np
def main():
    ttt = []
    n = int(input())
    N, M = map(int, input().split())
    e = list(map(int, input().split()))
    #e = [[int(i) for i in input().split()] for i in range(int(input()))]
    #n = 3
    #e = [[21,-11],[81234,94124,52141
    for j in range(n):
        t = N - e[j]*0.006
        tt = abs(M - t)
        ttt.append(tt)
    ttt = np.array(ttt)
    print(np.argmin(ttt)+1)
main()


Fixed submission:
def main():
  a, b = (int(_) for _ in input().split())
  print(int(a+b/2))
main()

Buggy python submission (verdict: Runtime Error):
a = input().split()
print(int(a[0]+a[1]/2))

Fixed submission:
def main():
  a, b = (int(_) for _ in input().split())
  print(int(a+b/2))
main()
Buggy python submission (verdict: Runtime Error):
import math

A,B=map(int,(input().split()))    
ABgcd=math.gcd(A,B)
answer=A*B//ABgcd
print(answer)

Fixed submission:
one_two_three=[1,2,3]
a=int(input())
b=int(input())
one_two_three.remove(a)
one_two_three.remove(b)
print(one_two_three[0])

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B=map(int,(input().split()))    
print(lcm(A, B))

Fixed submission:
one_two_three=[1,2,3]
a=int(input())
b=int(input())
one_two_three.remove(a)
one_two_three.remove(b)
print(one_two_three[0])
Buggy python submission (verdict: Runtime Error):
import math

A,B=map(int,(input().split()))    
ABgcd=math.gcd(A,B)
answer=A*B//ABgcd
print(answer)

Fixed submission:
import fractions

A,B=map(int,(input().split()))    
ABgcd=fractions.gcd(A,B)
answer=A*B//ABgcd
print(answer)

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B=map(int,(input().split()))    
print(lcm(A, B))

Fixed submission:
import fractions

A,B=map(int,(input().split()))    
ABgcd=fractions.gcd(A,B)
answer=A*B//ABgcd
print(answer)

Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B=map(int,(input().split()))    
print(lcm(A, B))

Fixed submission:
import fractions

A,B=map(int,(input().split()))    
ABgcd=fractions.gcd(A,B)
answer=A*B//ABgcd
print(answer)
Buggy python submission (verdict: Runtime Error):
A1=int(input())
A2=int(input())
A3=int(input())
point=A1+A2+A3
if point >= 22:
  print("bust")
else:
  print("win")

Fixed submission:
s=list(map(int,input().split()))
point=sum(s)
if point >= 22:
  print("bust")
else:
  print("win")

Buggy python submission (verdict: Runtime Error):
A1=int(input())
A2=int(input())
A3=int(input())
point=A1+A2+A3
if point >= 22:
  print("bust")
else:
  print("win")

Fixed submission:
s=list(map(int,input().split()))
point=sum(s)
if point >= 22:
  print("bust")
else:
  print("win")
Buggy python submission (verdict: Runtime Error):
a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
N=int(input())
li=list(input())
for i in li:
  num=a.index(i)+N
  if num > 26:
    num-=26
  print(a[num],end="")  


Fixed submission:
dic={
     "A":1,
     "B":2,
     "C":3,
     "D":4,
     "E":5,
     "F":6,
     "G":7,
     "H":8,
     "I":9,
     "J":10,
     "K":11,
     "L":12,
     "M":13,
     "N":14,
     "O":15,
     "P":16,
     "Q":17,
     "R":18,
     "S":19,
     "T":20,
     "U":21,
     "V":22,
     "W":23,
     "X":24,
     "Y":25,
     "Z":26

}

gyaku={
    1:"A",
    2:"B",
    3:"C",
    4:"D",
    5:"E",
    6:"F",
    7:"G",
    8:"H",
    9:"I",
    10:"J",
    11:"K",
    12:"L",
    13:"M",
    14:"N",
    15:"O",
    16:"P",
    17:"Q",
    18:"R",
    19:"S",
    20:"T",
    21:"U",
    22:"V",
    23:"W",
    24:"X",
    25:"Y",
    26:"Z"
}
N=int(input())
li=list(input())

for i in range(len(li)):
  a=dic[li[i]]+N
  if a>26:
    a-=26
  li[i]=gyaku[a]
for i in range(len(li)):
  print(li[i],end="")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")  

Fixed submission:
a,b=map(int,input().split())
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
#input
N=int(input())
An=list(int(i) for i in input().split())
x=0
point=0
flag=True
while(flag):
  x=0
  for x in range(N):
    if An[x]%2==0:
      An[x]/=2
    else:
      flag=False
      break
    point+=1 
print(point) 

    

Fixed submission:
sample=input()
one_count=0
s=0
for i in sample:
  if sample[s] == "1":
    one_count+=1
    s+=1
  else:
    s+=1  
    
print(one_count)
Buggy python submission (verdict: Runtime Error):
a, b, t = map(int, input().split())

print((t // a) * b)


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

total = 0

if a > b:
    total = 2 * a - 1
elif b > a:
    total = 2 * b - 1
else:
    total = 2 * a

print(total)
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
	N, M = map(int, input().split())
	prob_list = [0] * (N+1)
	wa = 0
	for i in range(M):
		p, s = input().split()
		p = int(p)
		if s == "AC":
			prob_list[p] = 1
		else:
			if prob_list[p] == 0:
				wa += 1
		# print(prob_list)
	ac = 0
	for i in range(N+1):
		ac += prob_list[i]
	print(f"{ac} {wa}")


Fixed submission:
if __name__ == "__main__":
	N, M = map(int, input().split())
	ac_list = [0] * (N+1)
	wa_list = [0] * (N + 1)
	for i in range(M):
		p, s = input().split()
		p = int(p)
		if s == "AC":
			ac_list[p] = 1
		else:
			if ac_list[p] == 0:
				wa_list[p] += 1
		# print(prob_list)
	ac = 0
	wa = 0
	for i in range(N+1):
		ac += ac_list[i]
		if ac_list[i] == 1:
			wa += wa_list[i]
	print("{0} {1}".format(ac, wa))
Buggy python submission (verdict: Runtime Error):
import numpy as np
mod = 10 ** 9 + 7

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L = np.array(L)
	ans = 0
	for i in range(60 + 2):
		A = L % 2
		L = L // 2
		ans += np.sum(A) * (N - np.sum(A)) * (2 ** i) % mod
	print(ans % mod)

Fixed submission:
if __name__ == "__main__":
	A1, A2, A3 = map(int, input().split())
	if A1 + A2 + A3 <= 21:
		print("win")
	else:
		print("bust")
Buggy python submission (verdict: Runtime Error):
memo = {}

def judge(x):
	if x < 0:
		return False
	elif x == 0:
		return True
	else:
		if x not in memo:
			memo[x] = judge(x - 100) or judge(x - 101) or judge(x - 102) or judge(x - 103) or judge(x - 104) or judge(x - 105)
		return memo[x]


if __name__ == "__main__":
	X = int(input())
	if judge(X):
		print(1)
	else:
		print(0)

Fixed submission:
import sys
sys.setrecursionlimit(10000)

memo = {}

def judge(x):
	if x < 0:
		return False
	elif x == 0:
		return True
	else:
		if x not in memo:
			memo[x] = judge(x - 100) or judge(x - 101) or judge(x - 102) or judge(x - 103) or judge(x - 104) or judge(x - 105)
		return memo[x]


if __name__ == "__main__":
	X = int(input())
	if judge(X):
		print(1)
	else:
		print(0)
Buggy python submission (verdict: Time Limit Exceeded):
def solve(s1, s2, s3, S):
	key = 0
	L = [s1, s2, s3]
	for i in range(len(S)):
		if S[i] == L[key]:
			key += 1
			if key == 3:
				return True
	return False


if __name__ == "__main__":
	N = int(input())
	S = input()
	ans = 0
	for s1 in range(0, 10):
		for s2 in range(0, 10):
			for s3 in range(0, 10):
				if solve(str(s1), str(s2), str(s3), S):
					# print(str(s1) + str(s2) + str(s3))
					ans += 1
	print(ans)

Fixed submission:
import itertools

N = int(input())
S = input()
S = [int(x) for x in S]

left_index = [[-1] * (N+1) for _ in range(10)]

for i,x in enumerate(S,1):
	for j in range(10):
		left_index[j][i] = left_index[j][i-1]
	left_index[x][i] = i


answer = 0
for a,b,c in itertools.product(range(10),repeat=3):
	i = N
	bl = True
	for x in [a,b,c]:
		i = left_index[x][i] - 1
		if i < -1:
			bl = False
			break
	if bl:
		answer += 1

print(answer)

Buggy python submission (verdict: Runtime Error):
def solve(s1, s2, s3, S, N):
	for i in range(N):
		if S[i] == s1:
			left = i
			break
	for i in range(left + 1, N):
		if S[i] == s2:
			mid = i
			break
	for i in range(mid + 1, N):
		if S[i] == s3:
			right = i
			break
	if right < N:
		return True
	else:
		return False

if __name__ == "__main__":
	N = int(input())
	S = input()
	ans = 0
	for s1 in range(0, 10):
		for s2 in range(0, 10):
			for s3 in range(0, 10):
				if solve(str(s1), str(s2), str(s3), S, N):
					ans += 1
	print(ans)

Fixed submission:
import itertools

N = int(input())
S = input()
S = [int(x) for x in S]

left_index = [[-1] * (N+1) for _ in range(10)]

for i,x in enumerate(S,1):
	for j in range(10):
		left_index[j][i] = left_index[j][i-1]
	left_index[x][i] = i


answer = 0
for a,b,c in itertools.product(range(10),repeat=3):
	i = N
	bl = True
	for x in [a,b,c]:
		i = left_index[x][i] - 1
		if i < -1:
			bl = False
			break
	if bl:
		answer += 1

print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
def solve(s1, s2, s3, S):
	flag = 0
	for i in range(len(S)):
		if flag == 0:
			if S[i] == s1:
				flag = 1
		elif flag == 1:
			if S[i] == s2:
				flag = 2
		elif flag == 2:
			if S[i] == s3:
				flag = 3
	if flag == 3:
		return True
	else:
		return False

if __name__ == "__main__":
	N = int(input())
	S = input()
	ans = 0
	for s1 in range(0, 10):
		for s2 in range(0, 10):
			for s3 in range(0, 10):
				if solve(str(s1), str(s2), str(s3), S):
					ans += 1
	print(ans)

Fixed submission:
import itertools

N = int(input())
S = input()
S = [int(x) for x in S]

left_index = [[-1] * (N+1) for _ in range(10)]

for i,x in enumerate(S,1):
	for j in range(10):
		left_index[j][i] = left_index[j][i-1]
	left_index[x][i] = i


answer = 0
for a,b,c in itertools.product(range(10),repeat=3):
	i = N
	bl = True
	for x in [a,b,c]:
		i = left_index[x][i] - 1
		if i < -1:
			bl = False
			break
	if bl:
		answer += 1

print(answer)
Buggy python submission (verdict: Runtime Error):
# import numpy as np
import sys
sys.setrecursionlimit(10000)
e = 1000000000 + 7
N = 1000000 // 3
# dp = np.zeros((N, N))
memo = {}
for n in range(N):
	s = "n: {}, k: {}".format(n, 0)
	memo[s] = 1
	s = "n: {}, k: {}".format(n, n)
	memo[s] = 1
	# dp[n][0] = 1
	# dp[n][n] = 1

def pascal(n, k):
	# if dp[n][k] == 0:
	# 	dp[n][k] = pascal(n - 1, k - 1) % e + pascal(n - 1, k) % e
	# return dp[n][k] % e
	s = "n: {}, k: {}".format(n, k)
	if s not in memo:
		memo[s] = pascal(n - 1, k - 1) % e + pascal(n - 1, k) % e
	return memo[s] % e

# print(pascal(6, 3))

if __name__ == "__main__":
	X, Y = map(int, input().split())
	if (X + Y) % 3 != 0:
		print("0")
	else:
		n = (X + Y) // 3
		k = Y - n
		print(pascal(n, k))

Fixed submission:
MOD = 10 ** 9 + 7

def modPow(a, x, p):
	res = 1
	while x > 0:
		if x % 2 != 0:
			res = res * a % p
		a = a * a % p
		x = x // 2
	return res
 
def modInverse(a, p):
	return modPow(a, p - 2, p)
 
def modBinomial(n, k, p):
	numerator = 1
	for i in range(k):
		numerator = (numerator * (n - i)) % p
	denominator = 1
	for i in range(1, k + 1):
		denominator = (denominator * i) % p
	return (numerator * modInverse(denominator, p)) % p


if __name__ == "__main__":
	X, Y = map(int, input().split())
	if (X + Y) % 3 != 0 or Y > 2 * X or Y < X / 2.:
		print("0")
	else:
		n = (X + Y) // 3
		k = Y - n
		print(modBinomial(n, k, MOD))
Buggy python submission (verdict: Time Limit Exceeded):
def test(x):
	cost = 0
	for i in range(N):
		cost += max(0, A[i] - (x // F[i]))
	return cost <= K

if __name__ == "__main__":
	N, K = map(int, input().split())
	A = list(map(int, input().split()))
	F = list(map(int, input().split()))
	A.sort()
	F.sort(reverse=True)
	left = -1
	right = 10**13
	while left + 1 < right:
		mid = (left + right) // 2
		if test(mid):
			right = mid
		else:
			left = mid
	ans = right
	print(ans)

Fixed submission:
import numpy as np

def test(x, A, F):
	return np.clip(A - x // F, 0, None).sum() <= K

if __name__ == "__main__":
	N, K = map(int, input().split())
	A = np.array([int(a) for a in input().split()])
	F = np.array([int(a) for a in input().split()])
	A = np.sort(A)
	F = np.sort(F)[::-1]
	left = -1
	right = 10**12 + 1
	while left + 1 < right:
		mid = (left + right) // 2
		if test(mid, A, F):
			right = mid
		else:
			left = mid
	ans = right
	print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappush, heappop

if __name__ == "__main__":
	N, K = map(int, input().split())
	A = list(map(int, input().split()))
	F = list(map(int, input().split()))
	A.sort()
	F.sort(reverse=True)
	h = []
	for i in range(N):
		heappush(h, (A[i]*F[i] * -1, i))
	for _ in range(K):
		cost, i = heappop(h)
		if A[i] == 0:
			heappush(h, (cost, i))
			break
		else:
			A[i] -= 1
			heappush(h, (A[i] * F[i] * -1, i))
	ans, _ = heappop(h)
	print(ans * -1)


Fixed submission:
import numpy as np

def test(x, A, F):
	return np.clip(A - x // F, 0, None).sum() <= K

if __name__ == "__main__":
	N, K = map(int, input().split())
	A = np.array([int(a) for a in input().split()])
	F = np.array([int(a) for a in input().split()])
	A = np.sort(A)
	F = np.sort(F)[::-1]
	left = -1
	right = 10**12 + 1
	while left + 1 < right:
		mid = (left + right) // 2
		if test(mid, A, F):
			right = mid
		else:
			left = mid
	ans = right
	print(ans)
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	sum = 0
	for c in range(2, N):
		for b in range(c - 1, 0, -1):
			for a in range(b - 1, -1, -1):
				if L[a] + L[b] > L[c]:
					# print(a, b, c)
					sum += 1
				else:
					break
	print(sum)

Fixed submission:
if __name__ == "__main__":
	A, B = map(int, input().split())
	ans = A - 2 * B
	if ans < 0:
		ans = 0
	print(ans)

Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	sum = 0
	for c in range(2, N):
		for b in range(c - 1, 0, -1):
			for a in range(b - 1, -1, -1):
				if L[a] + L[b] > L[c]:
					# print(a, b, c)
					sum += 1
				else:
					break
	print(sum)

Fixed submission:
if __name__ == "__main__":
	A, B = map(int, input().split())
	ans = A - 2 * B
	if ans < 0:
		ans = 0
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def binarySearch(A, head, tail, key):
	left = head
	right = tail - 1 # 探索範囲:[left, right]
	i = 0
	while left <= right:
		mid = (left + right) // 2
		if key == A[mid]:
			return mid
		elif key < A[mid]:
			right = mid - 1
			i = mid
		else:
			left = mid + 1
			i = mid + 1
	return i

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	# print(L)
	sum = 0
	for a in range(N - 2):
		for b in range(a + 1, N - 1):
			key = L[a] + L[b]
			c = binarySearch(L, b + 1, N, key)
			# print(a, b, c, c - b - 1)
			sum += c - b - 1
	print(sum)

Fixed submission:
from bisect import bisect_left

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	# print(L)
	sum = 0
	for a in range(N - 2):
		for b in range(a + 1, N - 1):
			key = L[a] + L[b]
			i = bisect_left(L, key)
			# print(a, b, i, i - b)
			sum += i - b - 1
	print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	sum = 0
	for c in range(2, N):
		if L[c] < L[c - 1] + L[c - 2]:
			for b in range(c - 1, 0, -1):
				if L[c] < L[b] + L[b - 1]:
					for a in range(b - 1, -1, -1):
						if L[c] < L[b] + L[a]:
							sum += 1
						else:
							break
	print(sum)

Fixed submission:
from bisect import bisect_left

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	# print(L)
	sum = 0
	for a in range(N - 2):
		for b in range(a + 1, N - 1):
			key = L[a] + L[b]
			i = bisect_left(L, key)
			# print(a, b, i, i - b)
			sum += i - b - 1
	print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	sum = 0
	for c in range(2, N):
		for b in range(c - 1, 0, -1):
			for a in range(b - 1, -1, -1):
				if L[a] + L[b] > L[c]:
					# print(a, b, c)
					sum += 1
				else:
					break
	print(sum)

Fixed submission:
from bisect import bisect_left

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	# print(L)
	sum = 0
	for a in range(N - 2):
		for b in range(a + 1, N - 1):
			key = L[a] + L[b]
			i = bisect_left(L, key)
			# print(a, b, i, i - b)
			sum += i - b - 1
	print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	sum = 0
	for c in range(N - 1, 1, -1):
		for b in range(c - 1, 0, -1):
			for a in range(b - 1, -1, -1):
				if L[a] + L[b] > L[c]:
					sum += 1
				else:
					break
	print(sum)

Fixed submission:
from bisect import bisect_left

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	# print(L)
	sum = 0
	for a in range(N - 2):
		for b in range(a + 1, N - 1):
			key = L[a] + L[b]
			i = bisect_left(L, key)
			# print(a, b, i, i - b)
			sum += i - b - 1
	print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]
Pt=[K]*N
for i in range(Q):
    Pt=[k-1 for k in Pt]
    Pt[A[i]-1]=Pt[A[i]-1]+1
for j in range(N):
    print("No" if Pt[j]<=0 else "Yes")

Fixed submission:
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]
Pt=[K-Q]*N
for i in range(Q):
    Pt[A[i]-1]=Pt[A[i]-1]+1
for j in range(N):
    print("No" if Pt[j]<=0 else "Yes")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]
Pt=[K]*N
for i in range(Q):
    Pt=[k-1 for k in Pt]
    Pt[A[i]-1]=Pt[A[i]-1]+1
for j in range(N):
    print("No" if Pt[j]<=0 else "Yes")

Fixed submission:
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]
Pt=[K-Q]*N
for i in range(Q):
    Pt[A[i]-1]=Pt[A[i]-1]+1
for j in range(N):
    print("No" if Pt[j]<=0 else "Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
A=sorted(list(map(float,input().split())),reverse=True)
for i in range(M):
    A[0]=A[0]/2
    A=sorted(A,reverse=True)
A=[int(a) for a in A]
print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
hq=list(map(float,input().split()))
hq=[-n for n in hq]
heapq.heapify(hq)
for i in range(M):
    heapq.heappush(hq,heapq.heappop(hq)/2)
hq=[int(a) for a in hq]
print(-sum(hq))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[]
for i in range(N):
    A.append(-int(input()))
for i in range(N):
    Ai=A[i]
    A[i]=0
    print(-min(A))
    A[i]=Ai

Fixed submission:
print(3*int(input())**2)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
for i in range(Q):
    l,r=map(int,input().split())
    print(S[l-1:r].count("AC"))

Fixed submission:
N,Q=map(int,input().split())
S=input()
cnt=[0]*N
for i in range(1,N):
    cnt[i]+=cnt[i-1]
    if S[i-1:i+1]=="AC": cnt[i]+=1
for j in range(Q):
    l,r=map(int,input().split())
    print(cnt[r-1]-cnt[l-1])
Buggy python submission (verdict: Runtime Error):
lt=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
c=input()
for i in range(26):
  if c=lt[i]:
    break
print(lt[i+1])

Fixed submission:
lt=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
c=input()
for i in range(26):
  if c==lt[i]:
    break
print(lt[i+1])