Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
num=int(input())
line=list(map(int,input().split()))
line2=[0]*num
for student in line:
  line2[int(student)-1] += line.index(student) + 1
print(" ".join(map(str,line2)))

Fixed submission:
num=int(input())
line=list(map(int,input().split()))
line2=[0]*num
for i in range(num):
  line2[line[i]-1]=i+1
print(" ".join(map(str,line2)))

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
line = input().split()
line2 = [0]* num

#studentの数字=出席順
for student in line:
  line2[int(student)-1] += line.index(student) + 1


print(" ".join(map(str,line2)))

Fixed submission:
num=int(input())
line=list(map(int,input().split()))
line2=[0]*num
for i in range(num):
  line2[line[i]-1]=i+1
print(" ".join(map(str,line2)))

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
line = input().split()
line2 = [0]* num

#studentの数字=出席順
for student in line:
  line2[int(student)-1] += line.index(student) + 1

for student in line2:
  print(student, end = " ")

Fixed submission:
num=int(input())
line=list(map(int,input().split()))
line2=[0]*num
for i in range(num):
  line2[line[i]-1]=i+1
print(" ".join(map(str,line2)))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)


Fixed submission:
import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)

Buggy python submission (verdict: Runtime Error):
from scipy.spatial import distance

N, D = map(int, input().split())
xy = [list(map(int, input().split())) for xy in range(N)]
o = [0, 0]
count = 0

for i in range(N):
    if distance.euclidean(xy[i], o) <= D:
        count += 1
    else:
        pass

print(count)


Fixed submission:
import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from scipy.spatial import distance

N, D = map(int, input().split())
xy = [list(map(int, input().split())) for xy in range(N)]
o = [0, 0]
count = 0

for i in range(N):
    if xy[i][0] > D or xy[i][1] >D:
        pass
    else:
        if distance.euclidean(xy[i], o) <= D:
            count += 1
        else:
            pass

print(count)


Fixed submission:
import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from scipy.spatial import distance

N, D = map(int, input().split())
xy = [list(map(int, input().split())) for xy in range(N)]
o = [0, 0]
count = 0

for i in range(N):
    if distance.euclidean(xy[i], o) <= D:
        count += 1
    else:
        pass

print(count)


Fixed submission:
import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)
Buggy python submission (verdict: Runtime Error):
from math import factorial

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

if N == 0:
    combN = 0
else:
    combN = factorial(N) // (factorial(N - 2) * factorial(2))

if M == 0:
    combM = 0
else:
    combM = factorial(M) // (factorial(M - 2) * factorial(2))

print(combN + combM)


Fixed submission:
from math import factorial

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

if N <= 1:
    combN = 0
else:
    combN = factorial(N) // (factorial(N - 2) * factorial(2))

if M <= 1:
    combM = 0
else:
    combM = factorial(M) // (factorial(M - 2) * factorial(2))

print(combN + combM)
Buggy python submission (verdict: Runtime Error):
N = int(input().split())

if N < 1000:
    print('ABC')
else:
    print('ABD')


Fixed submission:
N = int(input())

if N < 1000:
    print('ABC')
else:
    print('ABD')
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n=int(input())
c=0
ans=0
for i in range(n-1):
  c=i+1
  div_list=make_divisors(n-c)
  ans+=len(div_list)
  
print(ans)

Fixed submission:
n=int(input())
ans=0
for i in range(n-1):
  a=i+1
  ans+=(n-1)//a
print(ans)
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==0:
  ans=1
else x==1:
  ans=0
  
print(ans)

Fixed submission:
x=int(input())
if x==0:
  ans=1
elif x==1:
  ans=0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def mod(x):
  return x%((10**9)+7)
n=int(input())
a_list=list(map(int,input().split()))
sum_list=[]
sum_list=[i[0]*i[1] for i in itertools.combinations(a_list,2)]
s=sum(sum_list)
s=mod(s)
print(s)

Fixed submission:
import itertools

n=int(input())
a_list=list(map(int,input().split()))
sum=0
ps = list(itertools.accumulate(a_list))
for i in range(n-1):
  sum+=a_list[i]*(ps[n-1]-ps[i])

s=sum%(10**9+7)
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def mod(x):
  return x%((10**9)+7)
n=int(input())
a_list=list(map(int,input().split()))
sum_list=[]
for i in itertools.combinations(a_list,2):
  sum_list.append((i[0]*i[1]))

s=sum(sum_list)
s=mod(s)
print(s)

Fixed submission:
import itertools

n=int(input())
a_list=list(map(int,input().split()))
sum=0
ps = list(itertools.accumulate(a_list))
for i in range(n-1):
  sum+=a_list[i]*(ps[n-1]-ps[i])

s=sum%(10**9+7)
print(s)
Buggy python submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
if (n<=1) and (m<=1):
  ans=0
else:
  if n==0:
    ans=comb(m,2)
  elif m==0:
    ans=comb(n,2)
  else:
    ans=comb(n,2)+comb(m,2)
  
print(ans)
  

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
if (n<=1) and (m<=1):
  ans=0
else:
  if n<=1:
    ans=comb(m,2)
  elif m<=1:
    ans=comb(n,2)
  else:
    ans=comb(n,2)+comb(m,2)
  
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
if (n<=1) and (m<=1):
  ans=0
elif (n==0) or (m==0):
  ans=0
else:
  ans=comb(n,2)+comb(m,2)
  
print(ans)

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
if (n<=1) and (m<=1):
  ans=0
else:
  if n<=1:
    ans=comb(m,2)
  elif m<=1:
    ans=comb(n,2)
  else:
    ans=comb(n,2)+comb(m,2)
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
li = list(map(int,input().split()))
ans=0
for i in range(n):
        ans+=(li[i]*sum(li[i+1:]))
print(ans%(10**9+7))

Fixed submission:
n=int(input())
li = list(map(int,input().split()))
ans=0
check=0
ans+=(sum(li))**2
for i in range(n):
    check+=li[i]**2
ans=ans-check
ans//=2
print(ans%((10**9)+7))
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
ans=0
while a//10!=0:
    ans+=a%10
    a=a//10
ans+=a
if ans%9==0:
    print("Yes")
else:
    print("No")

Fixed submission:
a=int(input())
if a%9==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
li = list(map(int,input().split()))
for i in range(1,n+1):
    print(li.count(i))


Fixed submission:
n=int(input())
li=list(map(int,input().split()))
ans=[0]*n
check=1
for i in range(len(li)):
    ans[li[i]-1]+=1
for i in range(len(ans)):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
h,n=map(int,input().split())
att=list(map()int,input().split())
if sum(att)>=h:
  print("Yes")
else:
  print("No")

Fixed submission:
h,n=map(int,input().split())
att=list(map(int,input().split()))
if sum(att)>=h:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
def eratosthenes(n):
    """n以下の素数をエラトステネスの篩によって求める.リストをかえす"""
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
ans=eratosthenes(10**5+3)
for i in  range(len(ans)):
	if ans[i]>=x:
    	print(ans[i])
	else:
      pass

Fixed submission:
import math
x=int(input())
def eratosthenes(n):
    """n以下の素数をエラトステネスの篩によって求める.リストをかえす"""
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
ans=eratosthenes(10**5+3)
for i in  range(len(ans)):
    if ans[i]>=x:
        print(ans[i])
        exit()
    else:
        pass
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())	
print(max(0,x-2y))

Fixed submission:
x,y = map(int,input().split())	
print(max(0,x-2*y))
Buggy python submission (verdict: Runtime Error):
N=int(input())
aa=list(map(int,input().split()))
s=list[]
for i in range(N):
  s[i]=1/s[i]
  s.attend(s[i])
Q=sum(s)  
print(1/Q)  

Fixed submission:
N=int(input())
aa=list(map(int,input().split()))
for i in range(N):
  aa[i]=1/aa[i]
Q=sum(aa)
print(1/Q)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if x%2!==y%2:
  print('IMPOSSIbLE')
else: print((x+y)/2)  

Fixed submission:
x,y = map(int,input().split())
if x%2!=y%2:
  print('IMPOSSIBLE')
else:
  print(int((x+y)/2))
Buggy python submission (verdict: Runtime Error):
#5
#1 3 5 4 2
#2
N=int(input())
num=list(map(int,input().split()))
cnt=0
for i in range(N-2):
  if li[i]<li[i+1]<li[i+2] or li[i+2]<li[i+1]<li[i]:
    cnt+=1
print(cnt)    
    

Fixed submission:
#5
#1 3 5 4 2
#2
N=int(input())
li=list(map(int,input().split()))
cnt=0
for i in range(N-2):
  if li[i]<li[i+1]<li[i+2] or li[i+2]<li[i+1]<li[i]:
    cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,p= map(int,input().split())
if a>=13:
  print(b)
elif 6<=a<=12:
  print(b/2)
else:
  print(0)

Fixed submission:
a,p= map(int,input().split())
if a>=13:
  print(p)
elif 6<=a<=12:
  print(int(p/2))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
b=input()
if b==("A"):
  print("T")
if b==('T'):
  print("A")
if b==('G'):
  print("C"):
else:
  print('G')

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

Buggy python submission (verdict: Runtime Error):
b=input()
if b==("A"):
  print("T")
if b==('T'):
  print("A")
if b==('G'):
  print('C'):
else:
  print('G')

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

if x==7:
  	print("Yes")
elif x==5:
  	print("Yes")
elif x==3:
  	print("Yes")
else:
  	print("No"

Fixed submission:
a = input()
a = int(a)

if a == 7 or a == 5 or a == 3:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N=int(input())
a='ABD'
b='ABC'
if a<=999:
  print(b)
else:
  print(a)

Fixed submission:
N=int(input())
a='ABD'
b='ABC'

if N<=999:
  print(b)
else:
  print(a)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a='ABD'
b=N+1
print(a+b)

Fixed submission:
N=int(input())
a='ABD'
b='ABC'

if N<=999:
  print(b)
else:
  print(a)
Buggy python submission (verdict: Runtime Error):
N=int(input())
arare=list(input())
if Y in arare:
  print('Four')
else:
  print('Three')

Fixed submission:
N=int(input())
arare=list(input())
if 'Y' in arare:
  print('Four')
else:
  print('Three')
Buggy python submission (verdict: Runtime Error):
N=int(input())
li=list(map(int,input().split()))
lis=list.sort(reverse=True)
lisAlice=lis[0::2]
lisbob=lis[1::2]
print(sum(lislalice)-sum(lisbob))

Fixed submission:
N=int(input())
li=list(map(int,input().split()))
lis=sorted(li,reverse=True)
lisalice=lis[0::2]
lisbob=lis[1::2]
print(sum(lisalice)-sum(lisbob))
Buggy python submission (verdict: Runtime Error):
a,b=list(int,input().split())
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a,b=map(int, input().split())
w=a*b
if w%2==0:
  print ("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
N=int(input())
num=list(map(int,input().split()))
cnt=0
while num[i]%2==0 for i in range(N):
  cnt+=1
  num[x]/2 for x in range(N):
print(N)    

Fixed submission:
N=int(input())
num=list(map(int,input().split()))
cnt=0
while all(num[i]%2==0 for i in range(N)):
  cnt+=1
  num=[i/2 for i in num]
print(cnt)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
lp=[a*i/b-c for i in range(10*10)]
if 0 in ;p:
  print('YES')
else:
  print('NO')

Fixed submission:
a, b, c = map(int, input().split())
lp=list((a*i%b for i in range(1,b+1)))
if c in lp:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
S=input()
if S[-1]==s:
    print("S"+"es")
else:
    print("S"+"s")

Fixed submission:
S=input()
if S[-1:]=="s":
    print(S+"es")
else:
    print(S+"s")

Buggy python submission (verdict: Runtime Error):
S=input()
if S[-1]==s:
    print(S+"es")
else:
    print(S+"s")

Fixed submission:
S=input()
if S[-1:]=="s":
    print(S+"es")
else:
    print(S+"s")

Buggy python submission (verdict: Runtime Error):
S=str(input())
if S[-1]==s:
    print(S+"es")
else:
    print(S+"s")

Fixed submission:
S=input()
if S[-1:]=="s":
    print(S+"es")
else:
    print(S+"s")

Buggy python submission (verdict: Runtime Error):
S=str(input())
if S[-1]==s:
    print(S+"es")
else:
    print(S+"s")


Fixed submission:
S=input()
if S[-1:]=="s":
    print(S+"es")
else:
    print(S+"s")

Buggy python submission (verdict: Runtime Error):
S=str(input())
if s[-1]=s:
    print(S+"es")
else:
    print(S+"s")

Fixed submission:
S=input()
if S[-1:]=="s":
    print(S+"es")
else:
    print(S+"s")
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==0;
    print(1)
else;
    print(0)

Fixed submission:
x=int(input())
if x==0:
    print("1")
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
N,M,T=map(int,input().split())
print((N//X)*T+1)

Fixed submission:
N,X,T=map(int,input().split())
if N%X==0:
  print((N//X)*T)
else:
  print(((N//X)*T)+T)
Buggy python submission (verdict: Runtime Error):
N,D=map(int,input().split())
n=0
for x,y=map(int,input().split()) in range(N):
    if (x**2+y**2)**(1/2)<=D:
        n+=1
print(n)

Fixed submission:
N,D=map(int,input().split())
n=0
for i in range(N):
    x,y=map(int,input().split())
    if (x**2+y**2)**(1/2)<=D:
        n+=1
print(n)

Buggy python submission (verdict: Runtime Error):
while True:
    i=0
    x,y=map(int,input().split())
    (x**2+y**2)**(1/2)
    i+=1
    print(i)

Fixed submission:
N,D=map(int,input().split())
n=0
for i in range(N):
    x,y=map(int,input().split())
    if (x**2+y**2)**(1/2)<=D:
        n+=1
print(n)
Buggy python submission (verdict: Runtime Error):
a,b,c,x=map(int,input().split())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                ans+=1
print(ans)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
n=0
for i in range (1,n+1):
    result=sum(list(map(int,str(i))))
    if result>=a and result<=b:
        ans+=i
print(ans) 

Fixed submission:
n,a,b=map(int,input().split())
ans=0
for i in range (1,n+1):
    result=sum(list(map(int,str(i))))
    if result>=a and result<=b:
        ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
an=list(map(int,input().split()))
n=0
for i in range(N):
    if an[i]%2==0:
        an[i]//2
        n+=1
print(n)


Fixed submission:
print(input().count('1'))
Buggy python submission (verdict: Runtime Error):
N=int(input())
an=list(map(int,input().split()))
n=0
for i in range(N):
    if an%2==0:
        n+=1
print(an/2)

Fixed submission:
N=int(input())
an=list(map(int,input().split()))
n=0
while(all(a%2==0 for a in an)):
    an=[a//2 for a in an]
    n+=1
print(n)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
num1 = (a//2)*(b//2)

if a == 1 :
    print(b)
else if b==1:
  	print(a)
else:
    
    # print(num1)
    p = b//2
    q = a//2
    num2 = (b - p )*(a - q)
    ans = num1+num2
    print(num1+num2)

Fixed submission:
a,b = map(int,input().split())
num1 = (a//2)*(b//2)

if a == 1 or b==1:
    print(1)
else:
    
    # print(num1)
    p = b//2
    q = a//2
    num2 = (b - p )*(a - q)
    ans = num1+num2
    print(num1+num2)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def main():
    N = int(input())
    ans = [0]*(N+1)

    end = N

    for i in range(3,end+1):
        sn = i
        x = 1
        y = 1
        z = sn - 2
        zt = z
        if(cal(x,y,z) < N):
            ans[cal(x,y,z)] += func(x,y,z)
        while True:
            x = 1
            z = zt
            y += 1
            z -= 1
            zt = z
            if x > z or y > z:
                break
            if(cal(x,y,z) < N):
                ans[cal(x,y,z)] += func(x,y,z)
            for j in range(y - 1):
                if y < x + 1:
                    break
                x += 1
                z -= 1
                if x > z or y > z:
                    break
                if(cal(x,y,z) < N):
                    ans[cal(x,y,z)] += func(x,y,z)
    
    for i in range(1,N+1):
        print(ans[i])
        

def func(x,y,z):
    # print(x,y,z)
    if x == y and y == z and z == x:
        return 1
    elif x != y and y != z and z != x:
        return 6
    else:
        return 3

def cal(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

main()

Fixed submission:
import math

def main():
    N = int(input())
    ans = [0]*(N+1)

    rn = math.ceil(math.sqrt(N))

    for x in range(1,rn):
        for y in range(1,rn):
            for z in range(1,rn):
                k = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if k <= N:
                    ans[k-1] += 1
    
    for i in range(len(ans) - 1):
        print(ans[i])
    
main()

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

def main():
    N = int(input())
    ans = [0]*(N+1)

    end = N

    for i in range(3,end+1):
        sn = i
        x = 1
        y = 1
        z = sn - 2
        ans[cal(x,y,z)] += func(i,x,y,z)
        while z >= math.ceil(sn / 2):
            y += 1
            z -= 1
            if x > z or y > z:
                break
            ans[cal(x,y,z)] += func(i,x,y,z)
            for j in range(y):
                x += 1
                z -= 1
                if x > z or y > z:
                    break
                ans[cal(x,y,z)] += func(i,x,y,z)
    
    for i in range(1,N+1):
        print(ans[i])
        

def func(n,x,y,z):
    if x == y and y == z and z == x:
        return 1
    elif x != y and y != z and z != x:
        return 6
    else:
        return 3

def cal(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

main()

Fixed submission:
import math

def main():
    N = int(input())
    ans = [0]*(N+1)

    rn = math.ceil(math.sqrt(N))

    for x in range(1,rn):
        for y in range(1,rn):
            for z in range(1,rn):
                k = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if k <= N:
                    ans[k-1] += 1
    
    for i in range(len(ans) - 1):
        print(ans[i])
    
main()
Buggy python submission (verdict: Runtime Error):
from collections import deque

def solve():
    N, M, K = map(int, input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    sumA = 0
    sumB = 0

    tmp = 0

    dA = deque(A)
    dB = deque(B)

    dsA = deque()
    dsB = deque()

    while dA:
        tmp = dA.popleft()
        if sumA + tmp <= K:
            dsA.append(tmp)
            sumA += tmp
        else:
            break
    
    while dB:
        tmp = dB.popleft()
        if sumB + tmp <= K:
            dsB.append(tmp)
            sumB += tmp
        else:
            break

    sumall = sumA + sumB
    lenall = len(dsA) + len(dsB)
    Atmp = 0
    Btmp = 0

    while sumall > K:
        if Atmp == 0:
            Atmp = dsA.pop()
        if Btmp == 0:
            Btmp = dsB.pop()
        if Atmp >= Btmp:
            sumall -= Atmp
            lenall -= 1
            Atmp = 0
        else:
            sumall -= Btmp
            lenall -= 1
            Btmp = 0

    print(lenall)
                 
solve()

Fixed submission:

a = int(input())

print(a+a**2+a**3)
Buggy python submission (verdict: Runtime Error):
from collections import deque

def solve():
    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 = 0
    j = M

    for i in range(len(A)):
        if a[i] > K:
            break
        while b[j] < K - a[i]:
            j -= 1
        ans = max(ans, i+j)
    
    print(ans)
            
solve()

Fixed submission:
from collections import deque
 
def solve():
    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 = 0
    j = M
 
    for i in range(len(a)):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        ans = max(ans, i+j)
    
    print(ans)
            
solve()

Buggy python submission (verdict: Runtime Error):
from collections import deque

def solve():
    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 = 0
    j = M

    for i in range(len(A)):
        if a[i] > K:
            break
        while b[j] < K - a[i]:
            j -= 1
        ans = max(ans, i+j)
    
    print(ans)
            
solve()

Fixed submission:
from collections import deque
 
def solve():
    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 = 0
    j = M
 
    for i in range(len(a)):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        ans = max(ans, i+j)
    
    print(ans)
            
solve()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans = 0
for i in range(1,N+1):
    for j in range(1,N+1):
        if i % j == 0:
            ans += i

print(ans)

Fixed submission:
import math
N = int(input())

ans = 0
for i in range(1,N+1):
    K = int(N/i)
    anstemp = i * K * (K+1) // 2
    ans += anstemp
print(ans)