Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
W=[]
V=[]

for i in range(n):
	a,b=map(int,input().split())
	W.append(a)
	V.append(b)

def knap(n,w):
	dp=[[0]*(w+1) for i in range(n+1)]
	for i in range(n):
		for j in range(w+1):
			if j<W[i-1]:
				dp[i+1][j]=dp[i][j]
			else:
				dp[i+1][j]=max(dp[i][j],dp[i][j-W[i-1]]+V[i-1])
	return dp[n][w]

print(knap(n,w))


Fixed submission:
n,w=map(int,input().split())
W=[]
V=[]

for i in range(n):
	a,b=map(int,input().split())
	W.append(a)
	V.append(b)

def knap(n,w):
	dp=[[0]*(w+1) for i in range(n+1)]
	for i in range(n):
		for j in range(w+1):
			if j<W[i-1]:
				dp[i+1][j]=dp[i][j]
			else:
				dp[i+1][j]=max(dp[i][j],dp[i][j-W[i-1]]+V[i-1])
	return dp[n][w]

print(knap(n,w))
Buggy python submission (verdict: Runtime Error):
D = int(input)
if D == 25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
else:
    print('Christmas Eve Eve Eve')

Fixed submission:
D = int(input())
if D == 25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
else:
    print('Christmas Eve Eve Eve')
Buggy python submission (verdict: Runtime Error):
n=int(input())

L=[list(map(int,input().split())) for i in range(n)]
LSort=sorted(L,key=lambda x:x[2])
x,y,z=LS[-1]

for cx in range(1,101):
	for cy in range(1,101):
		H=h+abs(x-cx)+abs(y-cy)
		if all([h=max(H-abs(x-cx)-abs(y-cy),0) for x,y,h in LSort])
		print(cx,cy,H)
		exit()

Fixed submission:
n=int(input())
 
L=[list(map(int,input().split())) for i in range(n)]
LSort=sorted(L,key=lambda x:x[2])
x,y,h=LSort[-1]

for cx in range(0,101):
	for cy in range(0,101):
		H=h+abs(x-cx)+abs(y-cy)
		if all([h==max(H-abs(x-cx)-abs(y-cy),0) for x,y,h in LSort]):
		    print(cx,cy,H)
		    exit()

Buggy python submission (verdict: Runtime Error):
n=int(input())

L=[list(map(int,input().split())) for i in range(n)]
LSort=sorted(L,key=lambda x:x[2])
x,y,z=LS[-1]

for cx in range(1,101):
	for cy in range(1,101):
		H=h+abs(x-cx)+abs(y-cy)
		if all([h=max(H-abs(x-cx)-abs(y-cy),0) for x,y,z in LSort])
		print(cx,cy,H)
		exit()

Fixed submission:
n=int(input())
 
L=[list(map(int,input().split())) for i in range(n)]
LSort=sorted(L,key=lambda x:x[2])
x,y,h=LSort[-1]

for cx in range(0,101):
	for cy in range(0,101):
		H=h+abs(x-cx)+abs(y-cy)
		if all([h==max(H-abs(x-cx)-abs(y-cy),0) for x,y,h in LSort]):
		    print(cx,cy,H)
		    exit()
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
n=len(s)
A='abcdefghijklmnopqrstuvwxyz'
i=0
while A and i<n+1:
	if s==t:
		print('Yes')
		exit()
	if s[i]!=t[i]:
		if s[i] in A and t[i] in A:
			s=s.replace(s[i],'X').replace(t[i],s[i]).replace('X',t[i])
			A=A.replace(s[i],'').replace(t[i],'')
	i+=1
print('No')

Fixed submission:
s=input()
t=input()
n=len(s)
A='abcdefghijklmnopqrstuvwxyz'
i=0
while A:
	if s==t:
		print('Yes')
		exit()
	if i==n:
		print('No')
		exit()
	if s[i]!=t[i]:
		if s[i] in A and t[i] in A:
			s=s.replace(s[i],'X').replace(t[i],s[i]).replace('X',t[i])
			A=A.replace(s[i],'').replace(t[i],'')
	i+=1
print('No')
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=n//k
b=n//(k//2)
if k%2==1:
	print(a**3)
else:
	print((b-a)**3+a**3)

Fixed submission:
n,k=map(int,input().split())
a=n//k
if k%2==1 or k==1:
	print(a**3)
else:
	b=n//(k//2)
	print((b-a)**3+a**3)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if L[i][j]=='#':
            if L[i][max(i-1,0)]!='#' and L[i][min(i+1,w-1)]!='#' and L[max(i-1,0)][j]!='#' and L[min(i+1,h-1)][j]!='#':
                print('No')
                exit()
print('Yes')

Fixed submission:
h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if L[i][j]=='#':
            if L[i][max(j-1,0)]!='#' and L[i][min(j+1,w-1)]!='#' and L[max(i-1,0)][j]!='#' and L[min(i+1,h-1)][j]!='#':
                print('No')
                exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if L[i][j]=='#':
            if L[i][max(i-1,0)]!='#' and L[i][min(i+1,w-1)]!='#' and L[max(i-1,0)][j]!='#' and L[min(i+1,h-1)][i]!='#':
                print('No')
                exit()
print('Yes')

Fixed submission:
h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if L[i][j]=='#':
            if L[i][max(j-1,0)]!='#' and L[i][min(j+1,w-1)]!='#' and L[max(i-1,0)][j]!='#' and L[min(i+1,h-1)][j]!='#':
                print('No')
                exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n,k=map(int,input().split())
A=list(map(int,input().split()))
s=len(set(A))
C=Counter(A)
if s>k:
    for i in range(k):
        n-=C.most_common()[i][1]
    print(n)
else:
    print(0)

Fixed submission:
n,k=map(int,input().split())
A=list(map(int,input().split()))
d={}
for a in A:
    if a in d:
        d[a]+=1
    else:
        d[a]=1
D=sorted(d.items(), key=lambda x:x[1], reverse=True)
if len(set(A))>k:
    for i in range(k):
        n-=D[i][1]
    print(n)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
for i in range(n):
    if A.count(A[i])>=2:
        for j in range(i+2,n):
            if A[i+2:].count(A[j])>=2:
                print(A[i]*A[j])
                exit()
print(0)

Fixed submission:
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
C=sorted(Counter(A).items(),key=lambda x:x[0],reverse=True)
m=len(C)
for i in range(m):
    if C[i][1]>=4:
        print(C[i][0]**2)
        exit()
    elif C[i][1]>=2:
        a=C[i][0]
        for j in range(i+1,m):
            if C[j][1]>=2:
                print(a*C[j][0])
                exit()
print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
for i in range(n):
    if A.count(A[i])>=2:
        for j in range(i+2,n):
            if A[i+2:].count(A[j])>=2:
                print(A[i]*A[j])
                exit()
print(0)

Fixed submission:
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
C=sorted(Counter(A).items(),key=lambda x:x[0],reverse=True)
m=len(C)
for i in range(m):
    if C[i][1]>=4:
        print(C[i][0]**2)
        exit()
    elif C[i][1]>=2:
        a=C[i][0]
        for j in range(i+1,m):
            if C[j][1]>=2:
                print(a*C[j][0])
                exit()
print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
m=0
i=0
while i<len(A):
    if A[i:].count(A[i])>=2:
        if m==0:
            m=A[i]
            i+=2
        else:
            n=A[i]
            print(m*n)
            exit()
    else:
        i+=1
print(0)

Fixed submission:
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
C=sorted(Counter(A).items(),key=lambda x:x[0],reverse=True)
m=len(C)
for i in range(m):
    if C[i][1]>=4:
        print(C[i][0]**2)
        exit()
    elif C[i][1]>=2:
        a=C[i][0]
        for j in range(i+1,m):
            if C[j][1]>=2:
                print(a*C[j][0])
                exit()
print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
for a in A:
    if A.count(a)>=2:
        if A.count(a)>=4:
            print(a**2)
            exit()
        else:
            for b in A:
                if b!=a:
                    if A.count(b)>=2:
                        print(a*b)
                        exit()
print(0)

Fixed submission:
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
C=sorted(Counter(A).items(),key=lambda x:x[0],reverse=True)
m=len(C)
for i in range(m):
    if C[i][1]>=4:
        print(C[i][0]**2)
        exit()
    elif C[i][1]>=2:
        a=C[i][0]
        for j in range(i+1,m):
            if C[j][1]>=2:
                print(a*C[j][0])
                exit()
print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
r=2*10**14
if n==2:
    print(abs(A[0]-A[1]))
else:
    for i in range(1,n-1):
        s=abs(sum(A[:i])-sum(A[i:]))
        r=min(r,s)
    print(r)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
L=[A[0]]
R=[A[-1]]
for i in range(1,n-1):
    l=L[i-1]+A[i]
    L.append(l)
    r=R[i-1]+A[-(i+1)]
    R.append(r)
c=2*10**14
for i in range(n-1):
    s=abs(L[i]-R[-(i+1)])
    c=min(c,s)
print(c)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
A=[]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
S=sorted(A,key=lambda,x:x[0])
i=0
while k>0:
    k-=A[i][1]
    i+=1
print(A[i][0])

Fixed submission:
n,k=map(int,input().split())
A=[]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
S=sorted(A,key=lambda x:x[0])
i=0

while i<n:
    a=S[i][1]
    if k<=a:
        print(S[i][0])
        exit()
    else:
        k-=S[i][1]
        i+=1

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
A=[]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
S=sorted(A,key=lambda,x:x[0])
i=0
while k>0:
    k-=a[i][1]
    i+=1
print(a[i][0])

Fixed submission:
n,k=map(int,input().split())
A=[]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
S=sorted(A,key=lambda x:x[0])
i=0

while i<n:
    a=S[i][1]
    if k<=a:
        print(S[i][0])
        exit()
    else:
        k-=S[i][1]
        i+=1
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
r=1
for i in range(1,n+1):
    r=r*i
print(r%(10**9+7))

Fixed submission:
n=int(input())
r=1
for i in range(1,n+1):
    r=r*i%(10**9+7)
print(r)

Buggy python submission (verdict: Runtime Error):
def t(n):
    if n==1:
        return 1
    return n*t(n-1)
print(t(int(input()))%(10**9+7))

Fixed submission:
n=int(input())
r=1
for i in range(1,n+1):
    r=r*i%(10**9+7)
print(r)

Buggy python submission (verdict: Runtime Error):
def t(n):
    if n==1:
        return 1
    return n*t(n-1)
print(t(int(input())))

Fixed submission:
n=int(input())
r=1
for i in range(1,n+1):
    r=r*i%(10**9+7)
print(r)
Buggy python submission (verdict: Runtime Error):
def prime_factrization(n):
    a=[]
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            n//=i
            a.append(i)
    if a==[]:
        a.append(n)
    else:
        if n!=1:
            a.append(n)
    return a
    
n=int(input())
if n==1:
    print(1%(10**9+7))
else:
    L=[]
    for i in range(2,n+1):
        L+=prime_factrization(i)
    LC=Counter(L)
    r=1
    for v in LC.values():
        r*=(v+1)
    print(r%(10**9+7))

Fixed submission:
from collections import Counter

def prime_factrization(n):
    a=[]
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            n//=i
            a.append(i)
    if a==[]:
        a.append(n)
    else:
        if n!=1:
            a.append(n)
    return a
    
n=int(input())
if n==1:
    print(1%1000000007)
else:
    L=[]
    for i in range(2,n+1):
        L+=prime_factrization(i)
    LC=Counter(L)
    r=1
    for v in LC.values():
        r*=(v+1)
    print(r%1000000007)
Buggy python submission (verdict: Runtime Error):
sx,sy=map(int,input().split())
tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
print('U'*dy+'R'*dx+'D'*dy+'L'*dx+'L'+'U'*(dy+1)+'R'*(dx+1)+'D'+'R'+'D'*(dy+1)+'L'*(dx+1)+'U')

Fixed submission:
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
print('U'*dy+'R'*dx+'D'*dy+'L'*dx+'L'+'U'*(dy+1)+'R'*(dx+1)+'D'+'R'+'D'*(dy+1)+'L'*(dx+1)+'U')
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=sorted((map(int,input().split())))
G=sorted([2*(i+1) for i in range(n//2)]*2+[0])
K=sorted([(2*i+1) for i in range(n//2)]*2)
if n%2:
	if A!=G:
		print(0)
		exit()
else:
	if A!=K:
		print(0)
		exit()
print(2**(n//2)%(10**9+7)

Fixed submission:
n=int(input())
A=sorted((map(int,input().split())))
G=sorted([2*(i+1) for i in range(n//2)]*2+[0])
K=sorted([(2*i+1) for i in range(n//2)]*2)
if n%2:
	if A!=G:
		print(0)
		exit()
else:
	if A!=K:
		print(0)
		exit()
print(2**(n//2)%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a,b=map(int,input().split())
if n!=1:
	for _ in range(n-1):
		A,B=map(int,input().split())
		c=0
		d=0
		k=1
		while a>c or b>d:
			c=k*A
			d=k*B
			k+=1
		a=c
		b=d
print(a+b)

Fixed submission:
n=int(input())
a,b=map(int,input().split())
if n!=1:
	for _ in range(n-1):
		A,B=map(int,input().split())
		k=max(1,(a+A-1)//A,(b+B-1)//B)
		a=k*A
		b=k*B
print(a+b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = input()
a = l.split(' ')

tmp = 0
tmp2 = 0

for i in range(n):
    tmp += int(a[i])

for i in range(n):
    tmp2 += int(a[i])*int(a[i])

total = (tmp*tmp-tmp2)/2

while(total > 1000000007):
    total -= 1000000007

print(int(total))

Fixed submission:
n = int(input())
l = input()
a = l.split(' ')

tmp = 0
total2 = 0

for i in range(n):
    tmp += int(a[i])

for i in range(n):
    total2 += int(a[i])*(tmp-int(a[i]))
    tmp -= int(a[i])

print(total2%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
count = 0

while(n>0):
    count += n%10
    count = count%9
    n = n//10

if(count%9 == 0):
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())

if(n%9 == 0):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
count = 0

while(n>0):
    count += n%10
    n = n//10

if(count%9 == 0):
    print("Yes")
else:
    print("No")


Fixed submission:
n = int(input())

if(n%9 == 0):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
count = 0

while(n>0):
    count += n%10
    n = n//10

if(count%9 == 0):
    print("Yes")
else:
    print("No")


Fixed submission:
n = int(input())

if(n%9 == 0):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n, k = (int(x) for x in input().split())
a = input().split()

for i in range(1,n-k+1):
    if(int(a[i-1]) >= int(a[k+i-1])):
        print("No")
    else:
        print("Yes")


Fixed submission:

M = int(input())

if(M>=400 and M<600):
    print("8")
elif(M>=600 and M<800):
    print("7")
elif(M>=800 and M<1000):
    print("6")
elif(M>=1000 and M<1200):
    print("5")
elif(M>=1200 and M<1400):
    print("4")
elif(M>=1400 and M<1600):
    print("3")
elif(M>=1600 and M<1800):
    print("2")
elif(M>=1800 and M<2000):
    print("1")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = (int(x) for x in input().split())
a = input().split()

point = []

for j in range(n-k+1):
    temp = int(a[j])
    for i in range(j+1,k+j):
        temp = temp * (int(a[i]))
    point.append(temp)

for i in range(1,n-k+1):

    if(point[i-1] >= point[i]):
        print("No")
    else:
        print("Yes")


Fixed submission:

n, k = (int(x) for x in input().split())
a = input().split()

for i in range(1,n-k+1):
    if(int(a[i-1]) >= int(a[k+i-1])):
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
n = input()
x = n//1000
print(n-x*1000)


Fixed submission:
n = int(input())
if(n%1000==0):
    print(0)
else:
    x = n//1000
    print((x+1)*1000-n)
Buggy python submission (verdict: Runtime Error):
X=input()
if X>=30:
    print('Yes')
else:
    print('No')

Fixed submission:
X=int(input())
if X>=30:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = []
temp = N
n = 0
if N == 1:
    print(0)
else:
    for i in range(2, int(-(-N**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt=cnt+1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])

    for i in range(len(arr)):
        a = 0
        b = arr[i]
        while a < b[1]:
            a = a+a+1
            n = n+1
    print(n)

Fixed submission:
A, B = map(int,input().split())
print(A*B)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = [b for b in input().split()]
a = 1
for l in range(N):
    a = a*int(list[l-1])
if a > 10**18:
    print(-1)
else:
    print(a)

Fixed submission:
N = int(input())
list = [b for b in input().split()]
a = 1
if "0" in list:
    print(0)
else:
    for l in range(N):
        a = a*int(list[l])
        if a > 10**18:
            print(-1)
            break
    else:
        print(a)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

def factorization(n):
    ret = []
    tmp = n
    for i in range(2, int(n ** 0.5 + 1)):
        cnt = 0
        if tmp % i == 0:
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            ret.append([i, cnt])

    if tmp != 1:
        ret.append([tmp, 1])
    if ret == []:
        ret.append[n, 1]

    return ret


def main():
    n = int(input())
    ret = 1
    for i in range(2, n+1):
        fact = factorization(i)
        add = 1
        for f in fact:
            add *= f[1] + 1
        ret += i * add

    print(ret)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python

def main():
    n = int(input())
    ret = 0
    for i in range(1, n+1):
        x = n // i
        ret += i * x * (x+1) // 2

    print(ret)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    x = int(input())
    for i in range(100):
        for j in range(0, i+1):
            y = i ** 5 - j ** 5
            z = i ** 5 + j ** 5
            if x == y:
                a = i
                b = j
                break
            elif x == z:
                a = i
                b = -j
                break
    print(a, b)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python

def main():
    x = int(input())
    for i in range(1000):
        for j in range(0, i+1):
            y = i ** 5 - j ** 5
            z = i ** 5 + j ** 5
            if x == y:
                a = i
                b = j
                break
            elif x == z:
                a = i
                b = -j
                break
    print(a, b)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    x = int(input())

    fact = factorization(x)
    fact = [[1]] + fact
    chk = 1
    for q in fact:
        p = q[0]
        a = p
        b = 0
        y = p ** 5
        while y <= x:
            y = a ** 5 - b ** 5
            if x == y:
                ret_a, ret_b = a, b
                chk = 0
                break
            a += 1
            b += 1
        if chk == 0:
            break

        a = p
        b = 0
        while a >= b:
            z = a ** 5 + b ** 5
            if x == z:
                ret_a, ret_b = a, -b
                chk = 0
                break
            a -= 1
            b += 1
        if chk == 0:
            break

    print(ret_a, ret_b)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python

def main():
    x = int(input())
    for i in range(1000):
        for j in range(0, i+1):
            y = i ** 5 - j ** 5
            z = i ** 5 + j ** 5
            if x == y:
                a = i
                b = j
                break
            elif x == z:
                a = i
                b = -j
                break
    print(a, b)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

def main():
    n = int(input())
    a = list(map(int, input().split()))

    cnt = 0

    for i in range(n-1):
        b = a[i]
        c = 0
        for j in range(i+b, n):
            if a[j] == c:
                cnt += 1
            c += 1
    print(cnt)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python

def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0

    lst1 = [0] * n
    lst2 = [0] * n

    for i in range(1, n+1):
        p = i - a[i-1]
        q = i + a[i-1]

        if 0 <= p < n:
            lst1[p] += 1
        if 0 <= q < n:
            lst2[q] += 1

    for i in range(n):
        cnt += lst1[i] * lst2[i]

    print(cnt)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

def main():
    n = int(input())
    s = input()

    rgb = {'r':[], 'g':[], 'b':[]}

    for i in range(n):
        if s[i] == 'R':
            rgb.get('r').append(i+1)
        elif s[i] == 'G':
            rgb.get('g').append(i+1)
        elif s[i] == 'B':
            rgb.get('b').append(i+1)

    count = 0
    for r_num in rgb.get('r'):
        for g_num in rgb.get('g'):
            for b_num in rgb.get('b'):
                i, j, k = tuple(sorted([r_num, g_num, b_num]))
                if j - i != k - j:
                    count += 1

    print(count)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python

def main():
    n = int(input())
    s = input()

    r = []
    g = []
    b = []

    for i in range(n):
        if s[i] == 'R':
            r.append(i+1)
        elif s[i] == 'G':
            g.append(i+1)
        elif s[i] == 'B':
            b.append(i+1)

    count = len(r) * len(g) * len(b)
    for r_num in r:
        for g_num in g:
            dif = abs(r_num - g_num)
            i, j = tuple(sorted([r_num, g_num]))

            if i - dif > 0:
                if s[i - dif - 1] == 'B':
                    count -= 1
            if j + dif <= n:
                if s[j + dif - 1] == 'B':
                    count -= 1
            if dif % 2 == 0:
                if s [i + dif // 2 - 1] == 'B':
                    count -= 1

    print(count)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))

sum_ = sum(a)

if sum_ <= 21:
    print(win)
else:
    print(bust)


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

sum_ = sum(a)

if sum_ <= 21:
    print('win')
else:
    print('bust')
Buggy python submission (verdict: Runtime Error):
import math
a,b,V = map(int, input().split())

if V >= a * a * b / 2:
    theta = math.atan( a**3 / (2 * (a**2 * b - V)) )

else:
    theta = math.atan(2 * V / (a * b**2))

print(90 - theta * 180 / math.pi)


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

if V == a*a*b:
    print(0)
else:    
    if V >= a * a * b / 2:
        theta = math.atan( a**3 / (2 * (a**2 * b - V)) )

    else:
        theta = math.atan(2 * V / (a * b**2))

    print(90 - theta * 180 / math.pi)
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().sprit())
C = A - B * 2
if C<0:
  print(0)  
else:
  print(C)

Fixed submission:
A,B = map(int, input().split())
C = A - B * 2
if C<0:
  print(0)  
else:
  print(C)

Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().sprit())
C = A - B * 2
if C<0:
  print(0)  
else:
  print(C)

Fixed submission:
A,B = map(int, input().split())
C = A - B * 2
if C<0:
  print(0)  
else:
  print(C)