Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 16:01:34 2020

@author: matsui
"""

N=int(input())
A=input().split()

ans='YES'
maxa=int(A[0])
mina=int(A[0])
for i in range(1,N):
    ai=int(A[i])
    if ai<mina:mina=ai
    if ai>maxa:maxa=ai
    if ai>=mina and ai<=maxa:
        if A[i] in A[:i]:
            ans='NO'
            break
    
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 16:01:34 2020

@author: matsui
"""

N=int(input())
A=input().split()
A=[int(a) for a in A]
A.sort()

ans='YES'
for i in range(1,N):
    if A[i]==A[i-1]:
        ans='NO'
        break
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 16:01:34 2020

@author: matsui
"""

N=int(input())
A=input().split()

ans='YES'
for i in range(1,N):
    if A[i] in A[:i]:
        ans='NO'
        break
    
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 16:01:34 2020

@author: matsui
"""

N=int(input())
A=input().split()
A=[int(a) for a in A]
A.sort()

ans='YES'
for i in range(1,N):
    if A[i]==A[i-1]:
        ans='NO'
        break
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 21:01:18 2020

@author: over-
"""

N=int(input())
P=input().split()

c=1
for i in range(1,N):
    bool=True
    for j in range(i):
        if int(P[i])>int(P[j]): 
            bool=False
            break
    if bool: c+=1

print(c)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 21:01:18 2020

@author: over-
"""

N=int(input())
P=input().split()

c=1
m=int(P[0])
for i in range(1,N):
    if m>int(P[i]):
        c+=1
        m=int(P[i])


print(c)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Nov  6 21:49:38 2019

@author: over-
"""

N=int(input())

ans=N
for i in range(1,10**12):
    if i > N: break
    if N%i == 0:
        A=(N/i-1)+(i-1)
        if A < ans:
            ans = A
            
print(int(A))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Nov  6 21:44:44 2019

@author: over-
"""

A,B=map(int,input().split())
if A<10 and B<10:
    print(A*B)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1

for i in range(n):
    ans *= a[i]
    
if(ans > 1000000000000000000):
    print(-1)
    
else:
    print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1

for i in range(n):
    ans *= a[i]
    if(ans > 1000000000000000000):
        break
    
if(ans > 1000000000000000000):
    print(-1)
    
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math

a = int(input())
b = float(input())

print(math.floor(a*b))

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

a = int(a)
b1, b2 = b.split('.')

ans = a * (int(b1) * 100 + int(b2)) // 100
print(ans)

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

a = int(input())
b = float(input())

print(math.floor(a*b))

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

a = int(a)
b1, b2 = b.split('.')

ans = a * (int(b1) * 100 + int(b2)) // 100
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
for i in range(len(ls)):
    ans += ls[i] * (sum(ls[i+1:]))
print(ans%MOD)

Fixed submission:
n = int(input())
ls = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
SUM = sum(ls)
for i in range(len(ls)):
    SUM -= ls[i]
    ans += ls[i] * SUM
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
for i in range(len(ls)):
    for j in range(i+1, len(ls)):
        ans += ls[i]*ls[j]
print(ans%MOD)

Fixed submission:
n = int(input())
ls = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
SUM = sum(ls)
for i in range(len(ls)):
    SUM -= ls[i]
    ans += ls[i] * SUM
print(ans%MOD)
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = list(map(int,input().split()))

ans = 0
maxV = max(list)
maxI = list.index(maxV)

sumV = sum(list[maxI+1, len(list)])
maxM = maxV * (len(list)-1-maxI)
ans += maxM - sumV

if maxI != 0:
    for i in range(0,maxI):
        if i != maxI:
            x = list[i] - list[i+1]
            if x > 0:
                ans += x


print(ans)


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

ans = 0
maxV = max(list)
maxI = list.index(maxV)

sumV = sum(list[maxI:len(list)])
maxM = maxV * (len(list)-maxI)
ans += maxM - sumV

if maxI != 0:
    for i in range(0,maxI):
        if i != maxI-1:
            x = list[i] - list[i+1]
            if x > 0:
                ans += x
                list[i+1] = list[i+1]+x
print(ans)

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

ans = 0
maxV = max(list)
for i in reversed(range(0,len(list))):
    if i != 0:
        sl = list[:i]
        maxV = max(sl)
        if list[i] < maxV:
            ans += maxV - list[i]

print(ans)


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

ans = 0
maxV = max(list)
maxI = list.index(maxV)

sumV = sum(list[maxI:len(list)])
maxM = maxV * (len(list)-maxI)
ans += maxM - sumV

if maxI != 0:
    for i in range(0,maxI):
        if i != maxI-1:
            x = list[i] - list[i+1]
            if x > 0:
                ans += x
                list[i+1] = list[i+1]+x
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

rate = 600
rank = 8

while true:
    if n < rate:
        print(rank)
        break
    rate += 200
    rank -= 1

Fixed submission:
n = int(input())

if n < 600:
    print(8)
elif n < 800:
    print(7)
elif n < 1000:
    print(6)
elif n < 1200:
    print(5)
elif n < 1400:
    print(4)
elif n < 1600:
    print(3)
elif n < 1800:
    print(2)
elif n < 2000:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
t = input()

if t[0] == "?":
    t = "D" + t[1:]

for i in range(1,len(t)):
    if t[i] == "?":
        t = t[:i] + "D" + t[i+1:]
print(t)


Fixed submission:
t = input()
print(t.replace("?", "D"))

# if t[0] == "?":
#     t = "D" + t[1:]

# for i in range(1,len(t)):
#     if t[i] == "?":
#         t = t[:i] + "D" + t[i+1:]
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))
 
if n[0] > 10:
  print(l[1])
else:
  print(n[1] + 100*(10-n[0]))

Fixed submission:
n = list(map(int, input().split()))
 
if n[0] > 10:
  print(n[1])
else:
  print(n[1] + 100*(10-n[0]))

Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
 
if l[0] > 10:
  print(l[1])
else:
  print(100*(10-l[])))

Fixed submission:
n = list(map(int, input().split()))
 
if n[0] > 10:
  print(n[1])
else:
  print(n[1] + 100*(10-n[0]))
Buggy python submission (verdict: Runtime Error):
for i in range(10000):
    if n > 2**i:
        pass
    elif n == 1:
        print(1)
    elif n == 2**i:
        print(4*(2**(i)//2)-1)
        break
    else:
        print(4*(2**(i-1)//2)-1)
        break

Fixed submission:
n = int(input())
flag = True
ans = 1
now = n
count = 1


for i in range(10000):
    if n > 2**i:
        pass
    elif n == 1:
        print(1)
        break
    elif n == 2**i:
        print(4*(2**(i)//2)-1)
        break
    else:
        print(4*(2**(i-1)//2)-1)
        break
Buggy python submission (verdict: Runtime Error):
n = int(input())
nn = n = int(input())
if n == nn:
  print("Yes")
else:
  print("No")

Fixed submission:
n, nn = map(int, input().split())
if n == nn:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

ans1 = ""
ans2 = ""
for i in range(b):
  ans1.append(a)

for i in range(a):
  ans2.append(b)
  
print(ans1, ans2)

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

ans1 = ""
ans2 = ""
for i in range(b):
  ans1 = ans1 + str(a)

for i in range(a):
  ans2= ans2 + str(b)
  
list = []
list.append(ans1)
list.append(ans2)

list.sort()

print(list[0])
Buggy python submission (verdict: Runtime Error):
#--import&define---------------------
import math
import sys
input = sys.stdin.readline
def yes():
    print("Yes")
def no():
    print("No")

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime
#--以下解答---------------------------------
x = int(input())
prime_list = primes(10**5)

i = x+1
flag = True
while flag == True:
    if prime_list[i] == True:
        print(i)
        sys.exit()
    i += 1
#

Fixed submission:
#--import&define---------------------
import math
import sys
input = sys.stdin.readline
def yes():
    print("Yes")
def no():
    print("No")

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime
#--以下解答---------------------------------
x = int(input())
prime_list = primes(10**6)

i = x
flag = True
while True:
    if prime_list[i] == True:
        print(i)
        sys.exit()
    i += 1
Buggy python submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用した入力
# x,y = map(int,input().split())

#forを利用した入力
#l = []
#for i in range():
#    l.append(int(input()))
#--以下解答---------------------------------
l = []
ans = 0
for i in range(3):
   ans += int(input())
if ans >= 22:
    print("bust")
else:
    print("win")


Fixed submission:
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用した入力
# x,y = map(int,input().split())

#forを利用した入力
#l = []
#for i in range():
#    l.append(int(input()))
#--以下解答---------------------------------
x = input()
x = list(map(int,x.split()))
ans = 0
for i in range(3):
  ans += x[i]

if ans >= 22:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
//不正解

n = int(input())
s = input()
x = int(n/2)

if n%2 != 0:
    print("No")
elif s[:x] == s[x+1:]:
    print("Yes")
else:
    print("No")


Fixed submission:
n = int(input())
s = input()
x = int(n/2)

if n%2 != 0:
    print("No")
elif s[:x] == s[x:]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#--import & define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--memo--------------------------------
#mapを利用した入力
# x,y = map(int,input().split())

#forを利用した入力
#l = []
#for i in range():
#    l.append(int(input()))
#    print(i,l)
#--------------------------------------
l = []
for i in range(6):
   l.append(int(input()))

if l[0]-l[1]>l[5] or l[1]-l[2]>l[5] or l[2]-l[3]>l[5] or l[3]-l[4]>l[5] or:
    no()
else:
    yes()


Fixed submission:
l = []
for i in range(6):
   l.append(int(input()))

if l[4]-l[0]>l[5]:
    print(":(")
else:
    print("Yay!")

Buggy python submission (verdict: Runtime Error):
l = []
for i in range(6):
   l.append(int(input()))
   print(i,l)

if l[0]-l[1]>l[5] or l[1]-l[2]>l[5] or l[2]-l[3]>l[5] or l[3]-l[4]>l[5] or:
    no()
else:
    yes()


Fixed submission:
l = []
for i in range(6):
   l.append(int(input()))

if l[4]-l[0]>l[5]:
    print(":(")
else:
    print("Yay!")

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

def yes():
    print("Yes")
def no():
    print("No")

a,b,c,d,e,k = map(int,input().split())

if a-b > k or b-c > k or c-d > k or d-e > k:
    no()
else:
    yes()


Fixed submission:
l = []
for i in range(6):
   l.append(int(input()))

if l[4]-l[0]>l[5]:
    print(":(")
else:
    print("Yay!")

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

def yes():
    print("Yes")
def no():
    print("No")

a,b,c,d,e,k = map(int,input().split())
if a-b > k or b-c > k or c-d > k or d-e > k:
    no()
else:
    yes()


Fixed submission:
l = []
for i in range(6):
   l.append(int(input()))

if l[4]-l[0]>l[5]:
    print(":(")
else:
    print("Yay!")
Buggy python submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用した入力
# x,y = map(int,input().split())

#forを利用した入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値
#x = 2147483647
#--以下解答---------------------------------
l = []
ansL = []
x = 2147483647
index = 0
for i in range(5):
   l.append( int(input()) )
   ansL.append( int(l[i]%10) )
   if ansL[i]>0 and ansL[i]<x:
      index = i

print(l)
ans = 0
for i in range(5):
    if i == dex:
        ans += l[i]
    elif l[i]%10 != 0:
        ans += int(l[i]/10)*10 +10
    else:
        ans += l[i]
    print(ans)

print(ans)




Fixed submission:
l = []
x = 2147483647
index = 0
for i in range(5):
   l.append( int(input()) )
   n = int(l[i]%10)
   if n>0 and n<x:
      x = n
      index = i

ans = 0
for i in range(5):
    if i == index:
        ans += l[i]
    elif l[i]%10 != 0:
        ans += int(l[i]/10)*10 +10
    else:
        ans += l[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648
#--以下解答---------------------------------

n = int(input())
l = []
# min = 2147483647
for i in range(5):
    l.append(int(input()))
    # min = l[i] if l[i]<min else min
minV = min(l)
print(int((n+minV-1)/min) +4)
# if n%min == 0:
#     print(n//min +4)
# else:
#     tmp = int(n//min) +1
#     print(tmp+4)


Fixed submission:
N,*A = map(int,open(0).read().split())
print((N+min(A)-1)//min(A) + 4)

Buggy python submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648
#--以下解答---------------------------------

n = int(input())
l = []
min = 2147483647
for i in range(n):
    l.append(int(input()))
    min = l[i] if l[i]<min else min

if n%min == 0:
    print(n/min+4)
else:
    tmp = int(n/min) +1
    print(tmp+4)

Fixed submission:
N,*A = map(int,open(0).read().split())
print((N+min(A)-1)//min(A) + 4)

Buggy python submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648
#--以下解答---------------------------------
#分からない

n = int(input())
l = []
min = 2147483647
for i in range(n):
    l.append(int(input()))
    min = l[i] if l[i]<min else min

if n%min == 0:
    print(n/min+4)
else:
    tmp = n/min +1
    print(n/tmp+4)


Fixed submission:
N,*A = map(int,open(0).read().split())
print((N+min(A)-1)//min(A) + 4)

Buggy python submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648 
#--以下解答---------------------------------
n = int(input())
l = []
min = 2147483647
for i in range(n):
   l.append(int(input()))
   min = l[i] if l[i]<min else min

if n%min == 0:
    print(int(n/min)+4)
else:
    tmp = int(n/min) +1
    print(tmp+4)



Fixed submission:
N,*A = map(int,open(0).read().split())
print((N+min(A)-1)//min(A) + 4)
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors



n=int(input())
count=0
for c in range(1,n+1):
	ab=n-c
	tmp=len(make_divisors(ab))
	count+=tmp

print(count)

Fixed submission:
n=int(input())
count=0
for a in range(1,n+1):
	count+=(n-1)//a

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n=int(input())
A=input_array()
ans=0
for i in range(n-1):
	for j in range(i,n):
		if i!=j:
			ans+=A[i]*A[j]

print(ans %(10**9+7))

Fixed submission:
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n=int(input())
A=input_array()
acc_A=[0]

for i in range(n):
	acc_A.append(acc_A[i]+A[i])
ans=0
for i in range(n):
	ans+=A[i]*(acc_A[n]-acc_A[i+1])

print(ans %(10**9+7))
Buggy python submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,x,t=input2()
ans=(math.ceil(n/x))*t
print(ans)

Fixed submission:
import math

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,x,t=input2()
ans=(math.ceil(n/x))*t
print(ans)
Buggy python submission (verdict: Runtime Error):
k=int(input())
num=7%k
L=0
ans=-1


if k%7==0:
	L=(9*k)/7
else:
	L=9*k

if L%2==0 or L%5==0:
	ans=-1
else:
	for i in range(10**5):
		if (num*10)%L==1:
			ans=i
			break
		num=10**i %L
print(ans)

Fixed submission:
k=int(input())
num=7%k
ans=-1

if k%2==0 or k%5==0:
	ans=-1
else:
	for i in range(1,k+10):
		# print(num)
		if num==0:
			ans=i
			break
		num=(num*10+7)%k

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(1000,10001,1000):
	num=i-n
	if num >=0:
      print(num)
      break

Fixed submission:

n=int(input())
for i in range(1000,10001,1000):
	num=i-n
	if num >=0:
		print(num)
		break
Buggy python submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
H,W,K=input2()
c=[list(input()) for _ in range(H)]

ans=0
print(c)

for row_line in product(range(2),repeat=H): #[行]0:そのまま，1:赤く塗る
	for col_line in product(range(2), repeat=W): #[列]0:そのまま，1:赤く塗る
		# 黒("#")の数え上げ
		cnt=0
		for row in range(H):
			for col in range(W):
				if c[row][col]=="#" and row_line[row]==0 and col_line[col]==0:
					cnt+=1

		if cnt==K:
			ans+=1
print(ans)

Fixed submission:
from itertools import product

def input2():
	return map(int,input().split())
  
h,w,k=input2()
C=[list(input()) for _ in range(h)]





ans=0

for row_bit in product(range(2),repeat=h): #[行]0:赤なし，1:赤あり
	for col_bit in product(range(2),repeat=w): #[列]0:赤なし，1:赤あり
		count=0
		# 以下，黒("#")の個数判定
		for row in range(h):
			for col in range(w):
				if C[row][col]=="#" and (row_bit[row]==0 and col_bit[col]==0):
					count+=1
		if count==k:
			ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import heapq

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

n=int(input())
A=input_array()
sortA=sorted(A,reverse=True) #降順にソート

ans=0
q=[]
heapq.heappush(q,-sortA[0])

for i in range(1,n):
	tmp=heapq.heappop(q)
	tmp*=-1
	ans+=tmp
	heapq.heappush(q,-sortA[i])
	heapq.heappush(q,-sortA[i])
	print(q)
print(ans)

Fixed submission:
import heapq

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

n=int(input())
A=input_array()
sortA=sorted(A,reverse=True) #降順にソート

ans=0
q=[]
heapq.heappush(q,-sortA[0])

for i in range(1,n):
	tmp=heapq.heappop(q)
	tmp*=-1
	ans+=tmp
	heapq.heappush(q,-sortA[i])
	heapq.heappush(q,-sortA[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
s=str(input())
t=str(input())
length=len(s)
count=0
for i in range(s):
	if s[i]==t[i]:
		pass
	else:
		count+=1
print(count)

Fixed submission:
s=str(input())
t=str(input())
length=len(s)
count=0
for i in range(length):
	if s[i]==t[i]:
		pass
	else:
		count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
n,m,k=input2()
A=input_array()
B=input_array()

ca=0
cb=0
count=0
SUM=0
for i in range(n+m):
	if ca >= n:
		SUM+=B[cb]
		cb+=1
	elif cb >= m:
		SUM+=A[ca]
		ca+=1
	elif A[ca]<=B[cb]:
		SUM+=A[ca]
		ca+=1
	else:
		SUM+=B[cb]
		cb+=1

	if SUM >k:
		break
	else:
		count+=1
print(count)

Fixed submission:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,m,k=input2()
A=input_array()
B=input_array()
acc_A=[0]
acc_B=[0]

for i in range(n):
	acc_A.append(A[i]+acc_A[i])
for i in range(m):
	acc_B.append(B[i]+acc_B[i])

ans=0
tmp_m=m
for i in range(n+1):
	if acc_A[i]>k:
		break
	for j in range(tmp_m,-1,-1):
		if acc_B[j]<=k-acc_A[i]:
			ans=max(i+j,ans)
			tmp_m=j #探索開始地点の更新
			break
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,k=input2()
A=input_array()
B=input_array()

ca=0
cb=0
count=0
SUM=0
for i in range(10**5):
	if A[ca]<=B[cb]:
		SUM+=A[ca]
		ca+=1
	else:
		SUM+=B[cb]
		cb+=1

	if SUM >=k:
		break
	else:
		count+=1
print(count)

Fixed submission:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,m,k=input2()
A=input_array()
B=input_array()
acc_A=[0]
acc_B=[0]

for i in range(n):
	acc_A.append(A[i]+acc_A[i])
for i in range(m):
	acc_B.append(B[i]+acc_B[i])

ans=0
tmp_m=m
for i in range(n+1):
	if acc_A[i]>k:
		break
	for j in range(tmp_m,-1,-1):
		if acc_B[j]<=k-acc_A[i]:
			ans=max(i+j,ans)
			tmp_m=j #探索開始地点の更新
			break
print(ans)
Buggy python submission (verdict: Runtime Error):
A=[0]*(10**5+1)
for i in a:
	A[i]+=1

for bc in BC:
	diff= bc[1]-bc[0]
	SUM+=diff*A[bc[0]]
	A[bc[1]]+=A[bc[0]]
	A[bc[0]]-=A[bc[0]]
	print(SUM)

Fixed submission:
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

n=int(input())
a=input_array()
q=int(input())
BC=[input_array() for _ in range(q)]
SUM=sum(a)

A=[0]*(10**5+1)
for i in a:
	A[i]+=1

for bc in BC:
	diff= bc[1]-bc[0]
	SUM+=diff*A[bc[0]]
	A[bc[1]]+=A[bc[0]]
	A[bc[0]]-=A[bc[0]]
	print(SUM)

Buggy python submission (verdict: Runtime Error):
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n=int(input())
a=input_array()
q=int(input())
BC=[input_array() for _ in range(q)]
SUM=sum(a)

A=[0]*10**5
for i in a:
	A[i]+=1

for bc in BC:
	diff= bc[1]-bc[0]
	SUM+=diff*A[bc[0]]
	A[bc[1]]+=A[bc[0]]
	A[bc[0]]-=A[bc[0]]
	print(SUM)

Fixed submission:
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

n=int(input())
a=input_array()
q=int(input())
BC=[input_array() for _ in range(q)]
SUM=sum(a)

A=[0]*(10**5+1)
for i in a:
	A[i]+=1

for bc in BC:
	diff= bc[1]-bc[0]
	SUM+=diff*A[bc[0]]
	A[bc[1]]+=A[bc[0]]
	A[bc[0]]-=A[bc[0]]
	print(SUM)
Buggy python submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
x,n=input2()
p=sorted(input_array())
q=[0]*102
result=[10000,-1]
for i in range(n):
	q[p[i]]=1
for i in range(102):
	if q[i]==0:
		num=abs(i-x)
		if num<result[0]:
			result=[num,i]
print(result[1])

Fixed submission:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
x,n=input2()
p=sorted(input_array())
q=[0]*102
result=[10000,-1]
for i in range(n):
	q[p[i]]=1
for i in range(102):
	if q[i]==0:
		num=abs(i-x)
		if num<result[0]:
			result=[num,i]
print(result[1])