Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
food = [int(input()) for i in range(5)]
a = 10

for i in range(5):
    x = food[i] % 10
    if 0 < x < a:
        a = x
        remove = food[i]
        
food.remove(remove)

ans = remove

for i in range(4):
    ans += -(-food[i]//10)*10
    
print(ans)

Fixed submission:
food = [int(input()) for i in range(5)]
a = 10
OK = 0

for i in range(5):
    OK += food[i] % 10
    
if OK == 0:
    print(sum(food))
else:
    for i in range(5):
        x = food[i] % 10
        if 0 < x < a:
            a = x
            remove = food[i]

    food.remove(remove)

    ans = remove

    for i in range(4):
        ans += -(-food[i]//10)*10

    print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = []

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ANS.append(ans)
        ans = 0
        
print(max(ANS))

Fixed submission:
s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = [0]

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ans = 0
        
    ANS.append(ans)
        
print(max(ANS))

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

list_ = []
length = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        length += 1
    else:
        list_.append(length)
        length = 0
        
print(max(list_))

Fixed submission:
s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = [0]

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ans = 0
        
    ANS.append(ans)
        
print(max(ANS))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = list(input())
ac = []

for i in range(n-1):
    if s[i] == "A":
        if s[i+1] == "C":
            ac.append(i)

for _ in range(q):
    l,r = map(int,input().split())
    l -= 1
    r -= 1
    ans = 0
    
    for i in ac:
        if r <= i:
            break
            
        if l <= i < r:
            ans += 1
            
    print(ans)

Fixed submission:
n,q = map(int,input().split())
s = input()
ac = [0] * (n+1)
num = 0

for i in range(n):
    if i != 0:
        if s[i-1:i+1] == "AC":
            num += 1
            
    ac[i+1] = num
    
for i in range(q):
    l,r = map(int,input().split())
    print(ac[r]-ac[l])

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()
ac = [0] * (n+1)
num = 0

for i in range(n):
    if i != 0:
        if s[i-1:i+1] == "AC":
            num += 1
            
    ac[i+1] = num
    
for i in range(q):
    l,r = map(int,input().split())
    print(ac[r]-ac[l])
Buggy python submission (verdict: Runtime Error):
A , B = map(int , input().split())

if B % A == 0:
    print(A+B)
else:
    print(B-a)

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

if B % A == 0:
    print(A+B)
else:
    print(B-A)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(map(int,input().split()))

while a[-2] != 0:
    for i in range(n):
        if a[i] != 0:
            w = a[i]
            wi = i
            break
    
    for i in range(n):
        if i != wi:
            a[i] %= w
            
        a = sorted(a)
        
print(a[-1])

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.append(0)
a = sorted(a)

while len(a) > 2:
    for i in range(2,n):
        a[i] %= a[1]
        
    a = sorted(set(a))
    n = len(a)
    
print(a[1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(map(int,input().split()))

while a[-2] != 0:
    w = 10**9+1
    
    for i in range(n):
        a[i] %= w
        
        if a[i]!=0 and w==10**9+1:
            w = a[i]
            
        a = sorted(a)
        
print(a[-1])

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.append(0)
a = sorted(a)

while len(a) > 2:
    for i in range(2,n):
        a[i] %= a[1]
        
    a = sorted(set(a))
    n = len(a)
    
print(a[1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(map(int,input().split()))

while a[-2] != 0:
    w = 10**9+1
    
    for i in range(n):
        a[i] %= w
        
        if a[i]!=0 and w==10**9+1:
            w = a[i]
            
        a = sorted(a)
        
print(a[-1])

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.append(0)
a = sorted(a)

while len(a) > 2:
    for i in range(2,n):
        a[i] %= a[1]
        
    a = sorted(set(a))
    n = len(a)
    
print(a[1])
Buggy python submission (verdict: Runtime Error):
print((int(input())==2)*(int(input())+int(input())) or "Hello World")

Fixed submission:
N = int(input())

if N == 1:
    print(" Hello World ")
else:
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
print("YNeos"[input() not in input()*3::2])

Fixed submission:
A = list(map(int,input().split()))
print(max(A)-min(A))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = input()
ans = float("inf")

for i in range(n):
    res = S[:i].count("W") + S[i+1:].count("E")
    ans = min(ans,res)
    
print(ans)

Fixed submission:
n = int(input())
S = input()
WE = [[] for _ in range(n)]
w = 0
e = 0

for i in range(n):
    if S[i] == "W":
        w += 1
    else:
        e += 1
    
    WE[i].append(w)
    WE[i].append(e)
    
ans = WE[n-1][1] - WE[0][1]

for i in range(1,n):
    res = WE[i-1][0] + (WE[n-1][1] - WE[i][1])
    ans = min(ans,res)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n,y = map(int,input().split())
ans = [-1,-1,-1]
cnt = 0

for i in range(n+1):
    if cnt == 1:
        break
        
    for j in range(n-i+1):
        k = n-i-j
        
        if i*10000 + j*5000 + k*1000 == y:
            ans = [i,j,k]
            cnt += 1
            break
                
print(*ans,sep=" ")

Fixed submission:
print("2018"+input()[4:])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
B = []

for i in range(n):
    if i % 2 == 0:
        B.append(A[i])
        
    else:
        B = [str(A[i])] + B
        
if n % 2 == 1:
    B = B[::-1]
    
print(*B)

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

odd = A[0::2]
even = A[1::2][::-1]

ans = even + odd

if n % 2 == 1:
    ans = ans[::-1]
    
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic = {}

for i in range(n):
    a = int(input())
    dic[i+1] = a
    
    if a==1 and max(dic.values())<=i+1:
        break
    
light = dic[1]
ans = 1

if len(dic) < n:
    ans = -1
else:
    while light != 2:
        ans += 1
        light = dic[light]
    
print(ans)

Fixed submission:
n = int(input())
dic = {i+1:int(input()) for i in range(n)}
light = dic[1]
ans = 1

for i in range(n):
    if light == 2:
        break
    elif light == 1 or i == n-1:
        ans = -1
        break
    else:
        ans += 1
        light = dic[light]
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic = {}

for i in range(n):
    dic[i+1] = int(input())
    
light = dic[1]
ans = 1

while light != 2:
    ans += 1
    light = dic[light]
    
    if light == 1:
        ans = -1
        break
    
print(ans)

Fixed submission:
n = int(input())
dic = {i+1:int(input()) for i in range(n)}
light = dic[1]
ans = 1

for i in range(n):
    if light == 2:
        break
    elif light == 1 or i == n-1:
        ans = -1
        break
    else:
        ans += 1
        light = dic[light]
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def factorial(n):
    fact = 1
    for i in range(2, n+1):
        fact = (fact * i)
    return fact

print(factorial(int(input()))% (10 ** 9 + 7))

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
x = 0

for i in range(n):
    if s[i] == "I":
        x += 1
    else:
        x -= 1
    ans = max(0,x,ans)
   
print(ans)

Fixed submission:
n = int(input())
s = input()
x = 0
ans = 0

for i in range(n):
    if s[i] == "I":
        x += 1
    else:
        x -= 1
    ans = max(x,ans)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
k,s = map(int,input().split())
ans = 0

for x in range(min(k,s)+1):
    for y in range(min(k,s)+1):
        if 0 <= s - x - y <= min(k,s):
            ans += 1
    
print(ans)

Fixed submission:
print(input().replace(","," "))
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
ans = 0

for x in range(min(k,s)+1):
    for y in range(min(k,s)+1):
        if 0 <= s - x - y <= min(k,s):
            ans += 1
    
print(ans)

Fixed submission:
k,s = map(int,input().split())
ans = 0

for x in range(min(k,s)+1):
    for y in range(min(k,s)+1):
        if 0 <= s - x - y <= min(k,s):
            ans += 1
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = input().split()
arr = list(map(int, arr))
a = 1
for i in arr:
    a*=i
if a>10**18:
    print("-1")
else:
    print(a)


Fixed submission:
def main():
    n = int(input())
    arr = list(map(int, input().split()))
    if 0 in arr:
        print(0)
        return
    a = 1
    for i in arr:
        a*=i
        if a>10**18:
            print("-1")
            return
    
    print(a)
main()
Buggy python submission (verdict: Runtime Error):
rdx = list(map(lambda x: int(x), input().split()))
r = rdx[0]
d = rdx[1]
x = rdx[2]

memo = [0 for i in range(d+1)]

memo[0] = x
for i in range(10):
  memo[i+1] = memo[i] * r - d
  print(memo[i+1])

Fixed submission:
rdx = list(map(lambda x: int(x), input().split()))
r = rdx[0]
d = rdx[1]
x = rdx[2]

memo = [0 for i in range(11)]

memo[0] = x
for i in range(10):
  memo[i+1] = memo[i] * r - d
  print(memo[i+1])
Buggy python submission (verdict: Time Limit Exceeded):
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

gates = [list(map(lambda x: int(x), input().split())) for i in range(m)]

keys = [i+1 for i in range(n)]
key_count = [0 for i in range(n)]

for gate in gates:
  new_key = keys.copy()

  for key in keys:
    if (key >= gate[0] and key <= gate[1]):
      key_count[key-1] += 1
    else:
      new_key.remove(key)
  keys = new_key

print(len(keys))

Fixed submission:
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

gates = [list(map(lambda x: int(x), input().split())) for i in range(m)]

first_max = 0
second_min = 100001
for gate in gates:
  first_max = max(first_max, gate[0])
  second_min = min(second_min, gate[1])

answer = second_min - first_max + 1
if (answer <= 0):
  print(0)
else:
  print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

gates = [list(map(lambda x: int(x), input().split())) for i in range(m)]

key = [0 for i in range(n)]

for gate in gates:
  for i in range(len(key)):
    if (i+1 >= gate[0] and i+1 <= gate[1]):
      key[i] += 1

print(key.count(m))

Fixed submission:
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

gates = [list(map(lambda x: int(x), input().split())) for i in range(m)]

first_max = 0
second_min = 100001
for gate in gates:
  first_max = max(first_max, gate[0])
  second_min = min(second_min, gate[1])

answer = second_min - first_max + 1
if (answer <= 0):
  print(0)
else:
  print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

nm = list(map(lambda x: int(x), input().split()))
n = nm[0]
m = nm[1]

a = list(map(lambda x: int(x), input().split()))
bc = [list(map(lambda x: int(x), input().split())) for i in range(m)]

head_a = []

for a_item in a:
  heapq.heappush(head_a, a_item)

# そーと
bc.sort(key=lambda x: x[1])
bc = list(reversed(bc))

for bc_item in bc:
  for i in range(bc_item[0]):
    head_a_item = heapq.heappop(head_a)
    heapq.heappush(head_a, max(head_a_item, bc_item[1]))

print(sum(head_a))

Fixed submission:
import heapq

nm = list(map(lambda x: int(x), input().split()))
n = nm[0]
m = nm[1]

a = list(map(lambda x: int(x), input().split()))
bc = [list(map(lambda x: int(x), input().split())) for i in range(m)]

head_a = []

for a_item in a:
  heapq.heappush(head_a, a_item)

# そーと
bc.sort(key=lambda x: x[1])
bc = list(reversed(bc))

for bc_item in bc:
  done = False
  for i in range(bc_item[0]):
    head_a_item = heapq.heappop(head_a)
    if (head_a_item >= bc_item[1]):
      heapq.heappush(head_a, max(head_a_item, bc_item[1]))
      done = True
      break
    else:
      heapq.heappush(head_a, max(head_a_item, bc_item[1]))
  if (done):
    break

print(sum(head_a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
edges = [list(map(int, input().split())) for i in range(n-1) ]

# -1 -> Black, 1 -> white, 0 -> not yet
memo = [0 for i in range(n)]
memo[0] = 1

# print("memo", memo)

def paint(index, node_num):
  for edge in edges:
    if (edge[0]==node_num):
      if (edge[2] % 2 == 0):
        # print("edge", edge)
        memo[edge[1]-1] = memo[i]
        edges.remove(edge)
        paint(edge[1]-1, edge[1])
      else:
        # print("edge", edge)
        memo[edge[1]-1] = -memo[i]
        edges.remove(edge)
        paint(edge[1]-1, edge[1])
    if (edge[1]==node_num):
      if (edge[2] % 2 == 0):
        # print("edge", edge)
        memo[edge[0]-1] = memo[i]
        edges.remove(edge)
        paint(edge[0]-1, edge[1])
      else:
        # print("edge", edge)
        memo[edge[0]-1] = -memo[i]
        edges.remove(edge)
        paint(edge[0]-1, edge[1])


for i in range(n):
  if (memo[i] != 0):
    continue
  memo[i] = 1
  node_num = i + 1
  # print("node_num", node_num)
  # print("=======================")
  paint(i, node_num)
  # print("memo", memo)
  # print("=======================")

# print("memo", memo)

for item in memo:
  if (item == 1):
    print("1")
  else:
    print("0")

Fixed submission:
nk = list(map(lambda x: int(x), input().split()))
n = nk[0]
k = nk[1]
s = input()

front = s[:k-1]
back = s[k:]
target = s[k-1].lower()

answer = front + target + back
print(answer)
Buggy python submission (verdict: Runtime Error):
n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(n):
  heapq.heappush(VSubC, -(v[index] - c[index]))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)

Fixed submission:
import heapq

n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(int(n)):
  heapq.heappush(VSubC, -(int(v[index]) - int(c[index])))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

# INPUT
n, x = map(int, input().split())
capitals = list(map(int, input().split()))

# PROCESS
distance_cap = list(map(lambda c: abs(x-c), capitals))
answer = gcd_list(distance_cap)

# OUTPUT
print(answer)




Fixed submission:
from fractions import gcd
from functools import reduce

def gcds(*numbers):
    return reduce(gcd, numbers)

def gcd_list(numbers):
    return reduce(gcd, numbers)

# INPUT
n, x = map(int, input().split())
capitals = list(map(int, input().split()))

# PROCESS
distance_cap = list(map(lambda c: abs(x-c), capitals))
answer = gcd_list(distance_cap)

# OUTPUT
print(answer)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

print(s[1])

Fixed submission:
s = input()
k = int(input())

ans_idx = 0

s = list(s)
for i in range(min(k, len(s))):
  if (s[i] != "1"):
    break
print(s[i])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
Alist=list(map(int,input().split()))
sum=0
for i in range(N-1):
  for j in range((i+1),N):
    sum=(sum+(Alist[i]*Alist[j]))%(10**9+7)
print(sum)

Fixed submission:
N=int(input())
Alist=list(map(int,input().split()))
sum1=0
sum2=0
for i in range(N):
  sum1=sum1+Alist[i]
  sum2=sum2+(Alist[i])**2
ans=(sum1**2-sum2)//2
print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import math
list1=(input()).split()
A=int(list1[0])
B=int(list1[1])
H=int(list1[2])
M=int(list1[3])
p=math.pi
HM=(A**2+B**2-2*A*B*(math.cos(abs(p*H/6-p*M/30))))**0.5
print(HM)

Fixed submission:
K=int(input())
S=input()
list1=[]
if len(S)<=K:
  print(S)
else:
  for i in range(K):
    list1.append(S[i])
  list1.append("...")
  S2="".join(list1)
  print(S2)
Buggy python submission (verdict: Runtime Error):
S=input()
a=S.count("A")
b=S.count("B")
if a==3 or b==3:
  print("No")
else
  print("Yes")

Fixed submission:
S=input()
a=S.count("A")
b=S.count("B")
if a==3 or b==3:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n = input().split()

a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])
s = [j for j in range(a, b+1)]
y = 0

for i in range(c, d+1):
  if i in s:
    y += 1
  
if y != 0:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())

print("ACL"*n)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy

N = int(input())
h = list(map(int, input().split()))
h2 = copy.copy(h)
ans = 0
for i in range(N):
    h2.remove(h[i])
    ans += h[i] * np.sum(h2)
    ans = ans % (10 ** 9 + 7)
print(int(ans))

Fixed submission:
N = int(input())
h = list(map(int, input().split()))
ans = 0
s = [h[N-1]]
for i in range(1, N):
    s.append(s[-1] + h[-i-1])
for i in range(N-1):
    ans += h[i] * s[-i-2]
ans = ans % (10 ** 9 + 7)
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
h = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans += h[i] * h[j]
        ans = ans % (10 ** 9 + 7)
print(ans)

Fixed submission:
N = int(input())
h = list(map(int, input().split()))
ans = 0
s = [h[N-1]]
for i in range(1, N):
    s.append(s[-1] + h[-i-1])
for i in range(N-1):
    ans += h[i] * s[-i-2]
ans = ans % (10 ** 9 + 7)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
import math

X, K, D = map(int, input().split())

a = X - K * D
if a > 0:
    print(a)
    return
if a + 2 * K * D < 0:
    print(abs(a + 2 * K * D))
    return
else:
    b = a / (-2 * D)
    p = math.floor(b)
    q = math.ceil(b)
    r = -(a + 2 * D * p)
    s = a + 2 * D * q
    print(min(r,s))
    return


Fixed submission:
import math
import sys

X, K, D = map(int, input().split())

a = X - K * D
if a > 0:
    print(a)
    sys.exit()
if a + 2 * K * D < 0:
    print(abs(a + 2 * K * D))
    sys.exit()
else:
    b = a / (-2 * D)
    p = math.floor(b)
    q = math.ceil(b)
    r = -(a + 2 * D * p)
    s = a + 2 * D * q
    print(min(r,s))
    sys.exit()
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()))
c = 0
while K > 0:
    if not A == [] and not B == []:
        if A[0] <= B[0]:
            K = K - A[0]
            A.remove(A[0])
            if K >= 0:
                c += 1
        else:
            K = K - B[0]
            B.remove(B[0])
            if K >= 0:
                c += 1
    if A == []:
        K = K - B[0]
        B.remove(B[0])
        if K >= 0:
            c += 1
    if B == []:
        K = K - A[0]
        A.remove(A[0])
        if K >= 0:
            c += 1
print(c)

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 j in range(M):
    b.append(b[j] + B[j])

ans = 0
j = M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j = j -1
    ans = max(ans, i+j)
    
print(ans)

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()))
c = 0
while K > 0:
    if not A == [] and not B == []:
        if A[0] >= B[0]:
            K = K - A[0]
            A.remove(A[0])
            if K >= 0:
                c += 1
        else:
            K = K - B[0]
            B.remove(B[0])
            if K >= 0:
                c += 1
    if A == []:
        K = K - B[0]
        B.remove(B[0])
        if K >= 0:
            c += 1
    if B == []:
        K = K - A[0]
        A.remove(A[0])
        if K >= 0:
            c += 1
print(c)

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 j in range(M):
    b.append(b[j] + B[j])

ans = 0
j = M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j = j -1
    ans = max(ans, i+j)
    
print(ans)

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()))
c = 0
while K > 0:
    if not A == [] and not B == []:
        if A[0] >= B[0]:
            K = K - A[0]
            A.remove(A[0])
            if K >= 0:
                c += 1
        else:
            K = K - B[0]
            B.remove(B[0])
            if K >= 0:
                c += 1
    if A == []:
        K = K - B[0]
        B.remove(B[0])
        if K >= 0:
                c += 1
    if B == []:
        K = K - A[0]
        A.remove(A[0])
        if K >= 0:
                c += 1
print(c)

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 j in range(M):
    b.append(b[j] + B[j])

ans = 0
j = M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j = j -1
    ans = max(ans, i+j)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections

N = int(input())
h = list(map(int, input().split()))
h.sort(reverse = True)
l = []
for i in range(0, N):
    d = []
    for j in range(0, max(0, len(l))):
        if l[j] % h[i] == 0:
            d.append(l[j])
    for k in range(0, len(d)):
        l.remove(d[k])
    l.append(h[i])
if len(collections.Counter(h)) == 1:
    l.clear()
print(len(l))

Fixed submission:
X, N = map(int, input().split())
h = list(map(int, input().split()))
ans = []
for i in range(0, N+1):
    if X+i not in h:
        ans.append(X+i)
    if X-i not in h:
        ans.append(X-i)
    if ans != []:
        break
print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
h = list(map(int, input().split()))
c = 1
for i in range(0, len(h)):
    c *= h[i]
if c > 10**18:
    print(-1)
else:
    print(c)

Fixed submission:
import sys

N = int(input())
h = list(map(int, input().split()))
c = 1
if 0 in h:
    print(0)
    sys.exit()
for i in range(0, len(h)):
    c *= h[i]
    if c > 10**18:
        print(-1)
        sys.exit()
print(c)
Buggy python submission (verdict: Runtime Error):
S = str(input())
if S = 'ABC':
  print('ARC')
else:
  print('ABC')

Fixed submission:
S = str(input())
if S == 'ABC':
    print('ARC')
else:
    print('ABC')
Buggy python submission (verdict: Time Limit Exceeded):
import math

A, B, N = (int(x) for x in input().split())
h = []
a = 0
for i in range(0, N+1):
    a = math.floor(A * i / B) - A * math.floor(i / B)
    h.append(a)
print(max(h))

Fixed submission:
import math

A, B, N = (int(x) for x in input().split())
ans = math.floor(A * min(B-1, N) / B)
print(ans)