Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
a, b, n = map(int, input().split())

if n < b:
    x = n
    score = math.floor(a*x/b) - a * math.floor(x/b)
    print(score)
    
else:
    x = b-1
    score = math.floor(a*x/b) - a * math.floor(x/b)
    print(max_score)

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

if n < b:
    score = math.floor(a*n/b) - a * math.floor(n/b)
    print(score)
    
else:
    max_score = -10000
    for i in range(1,10):
        x = (b-1)*i
        score = math.floor(a*x/b) - a * math.floor(x/b)
        max_score = max(max_score, score)
    print(max_score)
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())[::-1]
sum_of_digits = 0
cnt = [0] * 2019

cnt[0] = 1
d = 1
for i, c in enumerate(s, start=1):
    sum_of_digits *= 1
    d = 10 ** (i-1)
    d %= 2019
    sum_of_digits += d * int(c)
    sum_of_digits %= 2019
    cnt[sum_of_digits] += 1
    #print(sum_of_digits)

print(sum([i*(i-1)//2 for i in cnt]))

Fixed submission:
s = str(input())[::-1]
sum_of_digits = 0
cnt = [0] * 2019

cnt[0] = 1
d = 1
for c in s:
    d *= 10
    d %= 2019
    sum_of_digits += d * int(c)
    sum_of_digits %= 2019
    cnt[sum_of_digits] += 1

print(sum([i*(i-1)//2 for i in cnt]))

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())[::-1]
sum_of_digits = 0
cnt = [0] * 2019

cnt[0] = 1
d = 1
for i, c in enumerate(s, start=1):
    sum_of_digits *= 1
    d = 10 ** (i-1)
    #d %= 2019
    sum_of_digits += d * int(c)
    sum_of_digits %= 2019
    cnt[sum_of_digits] += 1
    #print(sum_of_digits)

print(sum([i*(i-1)//2 for i in cnt]))

Fixed submission:
s = str(input())[::-1]
sum_of_digits = 0
cnt = [0] * 2019

cnt[0] = 1
d = 1
for c in s:
    d *= 10
    d %= 2019
    sum_of_digits += d * int(c)
    sum_of_digits %= 2019
    cnt[sum_of_digits] += 1

print(sum([i*(i-1)//2 for i in cnt]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
s = str(input())

num_list = []
for j in range(4, len(s)+1):
    for i in range(len(s)-j+1):
        num_list.append(int(s[i:j+i]))
        
print(np.where(np.array(num_list) % 2019 == 0, 1, 0).sum())

Fixed submission:
s = str(input())[::-1]
sum_of_digits = 0
cnt = [0] * 2019

cnt[0] = 1
d = 1
for c in s:
    d *= 10
    d %= 2019
    sum_of_digits += d * int(c)
    sum_of_digits %= 2019
    cnt[sum_of_digits] += 1

print(sum([i*(i-1)//2 for i in cnt]))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
import math
n = int(input())
scores = []
for a, b, c, in list(product(range(1, n+1), repeat=3)):
    gcd_ab = math.gcd(a, b)
    score = math.gcd(gcd_ab, c)
    scores.append(score)
print(sum(scores))

Fixed submission:
import math
n = int(input())
scores = 0
for a in range(1, n+1):
    for b in range(1, n+1):
        gcd_ab = math.gcd(a, b)
        for c in range(1, n+1):
            score = math.gcd(gcd_ab, c)
            scores += score
print(scores)
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n%2 == 0:
    print(1/2)

elif n==1:
    print(1)

else:
    print((math.ceil(n//2)+1)/n)

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

if n%2 == 0:
    print(1/2)

elif n==1:
    print(1)

else:
    print((math.ceil(n//2)+1)/n)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())

k = np.array(range(n))
print(sum(k))

Fixed submission:
n = int(input())
print(round(n*(n-1)//2))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans=0
for i in range(n):
    ans+=i
print(ans)

Fixed submission:
n = int(input())
print(round(n*(n-1)//2))
Buggy python submission (verdict: Runtime Error):
l,r =map(int,input().split())

minimum = l%2019
maximum = r%2019

ans = 10000
if r-l >= 673:
    print(0)    
elif r-l < 2019:
    for i in range(l,r):
        if i%673 ==0:
            flag = 1
        ans = min(i*(i+1)%2019,ans)
    
    if flag==1:
        print(0)
    else:
        print(ans)

Fixed submission:
l,r =map(int,input().split())

ans = 10000
if r-l >= 2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = min(ans, i*j%2019)
    print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())

a=list(map(int,input().split()))
sowa=[a[0]]
for i in range(1,n):
    temp=sowa[-1]+a[i]
    sowa.append(temp)
ans=0
for i in range(n):
    if sowa[i]>=k:
        ans+=1
        for j in reversed(range(i)):
            bubun=sowa[i]-sowa[j]
            if bubun>=k:
                ans+=j+1
                break
print(ans)

Fixed submission:
W,H,x,y=map(int,input().split())

max_menseki=W*H/2
if W%2==0 and W//2==x and H//2==y and H%2==0:
    print(max_menseki,"1")
else:
    print(max_menseki,"0")

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())

a=list(map(int,input().split()))
sowa=[]
for i in range(1,n+1):
    sowa.append(sum(a[:i]))
ans=0
for i in range(n):
    if sowa[i]>=k:
        ans+=1
        for j in reversed(range(i)):
            bubun=sowa[i]-sowa[j]
            if bubun>=k:
                ans+=j+1
                break
print(ans)

Fixed submission:
W,H,x,y=map(int,input().split())

max_menseki=W*H/2
if W%2==0 and W//2==x and H//2==y and H%2==0:
    print(max_menseki,"1")
else:
    print(max_menseki,"0")
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
cnt=0
for r in range(N//R+1):
    for g in range((N-r*R+1)//G+1):
        for b in range((N-r*R-g*G+1)//B+1):
            if R*r+G*g+B*b==N:
                cnt+=1                
print(cnt)

Fixed submission:
R,G,B,N=map(int,input().split())
cnt=0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        b=N-G*g-R*r
        if b%B==0 and b>=0:
            cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N=int(input())
lasta=0
headb=0
spec=0
cnt=0
for _ in range(N):
    s=str(input())
    for i in range(len(s)-1):
        if s[i:i+2]=="AB":
            cnt+=1
    if s[0]=="B" and s[-1]=="A":
        spec+=1
    elif s[-1]=="A":
        lasta+=1
    elif s[0]=="B":
        headb+=1
if abs(headb-lasta)>=spec:
    print(min(headb,lasta)+spec+cnt)
    
elif lasta=0 and headb=0:
    print(spec-1+cnt)
else:
    print(spec-abs(headb-lasta)+max(headb,lasta)+cnt)

Fixed submission:
N=int(input())
lasta=0
headb=0
spec=0
cnt=0
for _ in range(N):
    s=str(input())
    for i in range(len(s)-1):
        if s[i:i+2]=="AB":
            cnt+=1
    if s[0]=="B" and s[-1]=="A":
        spec+=1
    elif s[-1]=="A":
        lasta+=1
    elif s[0]=="B":
        headb+=1
        
if abs(headb-lasta)>=spec:
    print(min(headb,lasta)+spec+cnt)   
elif lasta==0 and headb==0 and spec>0:
    print(spec-1+cnt)
elif lasta==0 and headb==0 and spec==0:
    print(cnt)
else:
    print(spec-abs(headb-lasta)+max(headb,lasta)+cnt)
Buggy python submission (verdict: Runtime Error):
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())

#menu=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()
while menu[0]=="0":
    menu.remove("0")
iti=int(menu[0])

marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
        
print(iti + marume +time)

Fixed submission:
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())

#menu=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()

if int(menu[4])==0:
    iti=0
    marume=0
else:
    while menu[0]=="0":
        menu.remove("0")
    iti=int(menu[0])
    marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
                
print(iti + marume +time)
Buggy python submission (verdict: Runtime Error):
a=atr(input())

if a=="A":
    print("T")
if a=="T":
    print("A")
if a=="G":
    print("C")
if a=="C":
    print("G")

Fixed submission:
a=str(input())
 
if a=="A":
    print("T")
if a=="T":
    print("A")
if a=="G":
    print("C")
if a=="C":
    print("G")
Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
a=input()

list=[0]*(N+1)

for i in range(N):
    list[i+1]=list[i]+1 if a[i:i+2]=="AC" else list[i]
    
for i in range(N):
    l,r = map(int, input().split())
    print(list[r-1]-list[l-1])
    

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

list=[0]*(N+1)

for i in range(N):
    list[i+1]=list[i]+1 if a[i:i+2]=="AC" else list[i]
    
for i in range(Q):
    l,r = map(int, input().split())
    print(list[r-1]-list[l-1])

Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
a=input()

list=[0]*N+1

for i in range(N):
    list[i+1]=list[i]+1 if a[i:i+2]=="AC" else list[i]
    
for i in range(N):
    l,r = map(int, input().split())
    print(list[r-1]-list[l-1])
    

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

list=[0]*(N+1)

for i in range(N):
    list[i+1]=list[i]+1 if a[i:i+2]=="AC" else list[i]
    
for i in range(Q):
    l,r = map(int, input().split())
    print(list[r-1]-list[l-1])

Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
a=input()

list=[0]*N

for i in range(N):
    list[i+1]=list[i]+1 if a[i:i+2]=="AC" else list[i]
    
for i in range(N):
    l,r = map(int, input().split())
    print(list[r-1]-list[l-1])
    

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

list=[0]*(N+1)

for i in range(N):
    list[i+1]=list[i]+1 if a[i:i+2]=="AC" else list[i]
    
for i in range(Q):
    l,r = map(int, input().split())
    print(list[r-1]-list[l-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

b=list(map(int, input().split()))
b=np.array(b)
count=0
for _ in range(M):
    a=list(map(int, input().split()))
    a=np.array(a)
    e=a*b
    d=np.sum(e,axis=0)+C
    if d>0:
        count+=1
print(count)

Fixed submission:
import numpy as np

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

b=list(map(int, input().split()))
b=np.array(b)
count=0
for _ in range(N):
    a=list(map(int, input().split()))
    a=np.array(a)
    e=a*b
    d=np.sum(e,axis=0)+C
    if d>0:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

b=np.array([int, input().split()])
count=0
for _ in range(M):
    a=np.array([map(int, input().split())])
    e=a*b
    d=np.sum(e,axis=0)+C
    if d>0:
        count+=1
print(count)

Fixed submission:
import numpy as np

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

b=list(map(int, input().split()))
b=np.array(b)
count=0
for _ in range(N):
    a=list(map(int, input().split()))
    a=np.array(a)
    e=a*b
    d=np.sum(e,axis=0)+C
    if d>0:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())

listB = list(map(int, input().split()))

listA = [list(map(int, input().split())) for _ in range(a)]
t=0

for i in range(a):
    ans=0
    for i in range(b-1):
        s=listB[i]*listA[i]
        s=sum(s)
        ans= ans+s
    if ans+c>0:
        t+=1
print(t)

Fixed submission:
import numpy as np

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

b=list(map(int, input().split()))
b=np.array(b)
count=0
for _ in range(N):
    a=list(map(int, input().split()))
    a=np.array(a)
    e=a*b
    d=np.sum(e,axis=0)+C
    if d>0:
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())

if A*C < B:
    print(C)

elif A*C = B:
    print(C)

elif A*C > B:
    print(B//A)

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

if A*C < B:
    print(C)

elif A*C == B:
    print(C)

elif A*C > B:
    print(B//A)

Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())

if A*C < B:
    print(C)

if A*C = B:
    print(C)

if A*C > B:
    print(B//A)

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

if A*C < B:
    print(C)

elif A*C == B:
    print(C)

elif A*C > B:
    print(B//A)
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
 
list=[]
list= [i for i in range(1,10) if A%i==0 and B%i==0]
list[K-1]

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

list=[]
for i in range(1,10000):
    if (A%i==0 and B%i==0):
        list.append(i)
    else:
        continue

print(list[-K])

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

list=[]
list= [i for i in range(1,15) if A%i==0 and B%i==0]
a = list[K-1]
ptint(a)

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

list=[]
for i in range(1,10000):
    if (A%i==0 and B%i==0):
        list.append(i)
    else:
        continue

print(list[-K])

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

list=[]
list= [i for i in range(1,10000) if A%i==0 and B%i==0]
a = list[K-1]
ptint(a)

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

list=[]
for i in range(1,10000):
    if (A%i==0 and B%i==0):
        list.append(i)
    else:
        continue

print(list[-K])

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

list=[]
list= [i for i in range(10000) if A%i==0 and B%i==0]
list[K-1]

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

list=[]
for i in range(1,10000):
    if (A%i==0 and B%i==0):
        list.append(i)
    else:
        continue

print(list[-K])

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

list= [i for i in range(10000) if A%i==0 and B%i==0]
list[K-1]

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

list=[]
for i in range(1,10000):
    if (A%i==0 and B%i==0):
        list.append(i)
    else:
        continue

print(list[-K])
Buggy python submission (verdict: Runtime Error):
N=int(input())
otoshidama=0
for _ in range(N):
    x,u=input().split()
    x=int(x)
    if u=="JPY":
        otoshidama+=x
    else:
        otoshidama+=x*380000.0
print(otoshidama)
        

Fixed submission:
n = int(input())
A=[]
for i in range(n):
  A.append(list(input().split()))
 
ans=0
for a in A:
    if a[1] =="JPY":
        ans += float(a[0])
    else:
        ans += float(a[0]) * 380000.0
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A=[]
for i in range(n):
  A.append(list(input().split()))
 
ans=0
for a in A:
    if a[1] =="JPY":
        ans += float(a[1])
    else:
        ans += float(a[0]) * 380000.0
print(ans)

Fixed submission:
n = int(input())
A=[]
for i in range(n):
  A.append(list(input().split()))
 
ans=0
for a in A:
    if a[1] =="JPY":
        ans += float(a[0])
    else:
        ans += float(a[0]) * 380000.0
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A=[]
for i in range(n):
  A.append(list(input().split())

ans=0
for a in A:
    if a[1] =="JPY":
        ans += float(a[1])
    else:
        ans += float(a[0]) * 380000.0
print(ans)

Fixed submission:
n = int(input())
A=[]
for i in range(n):
  A.append(list(input().split()))
 
ans=0
for a in A:
    if a[1] =="JPY":
        ans += float(a[0])
    else:
        ans += float(a[0]) * 380000.0
print(ans)

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

h, w = (input().split() for in range(n))
a=0

if w =="JPY":
  a += h
else:
  a += h * 380000.0

print(a)

Fixed submission:
n = int(input())
A=[]
for i in range(n):
  A.append(list(input().split()))
 
ans=0
for a in A:
    if a[1] =="JPY":
        ans += float(a[0])
    else:
        ans += float(a[0]) * 380000.0
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
1 <= A <= B <= 20

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: 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: 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: 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: Runtime Error):
A, B = map(int, input().split())
 
if A % B == 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: Runtime Error):
A, B = map(int, input().split())
 
if A % B == 0：
    print(A+B)
else:
    print(A-B)
    

Fixed submission:
A, B = map(int, input().split())
 
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
1 <= B <= A <= 20
 
if A % B == 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: Runtime Error):
A, B = map(int, input().split())
1 <= B <= A <= 20
 
if A % B == 0：
    print(A+B)
else:
    print(A-B)

Fixed submission:
A, B = map(int, input().split())
 
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Buggy python submission (verdict: Runtime Error):
A, B = (int(i) for i in input().split())
1 <= B <= A <= 20
 
if A % B == 0：
    print(A+B)
else:
    print(A-B)

Fixed submission:
A, B = map(int, input().split())
 
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Buggy python submission (verdict: Runtime Error):
A, B = (int(i) for i in input().split())
1 <= B <= A <= 20
 
if B % A == 0：
    print(A+B)
else:
    print(A-B)

Fixed submission:
A, B = map(int, input().split())
 
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Buggy python submission (verdict: Runtime Error):
A, B = (int(i) for i in input().split())

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

Fixed submission:
A, B = map(int, input().split())
 
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Buggy python submission (verdict: Runtime Error):
A, B = (int(i) for i in input().split())
1 <= B <= A <= 20

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

Fixed submission:
A, B = map(int, input().split())
 
if B % A == 0:
    print(A + B)
else:
    print(B - A)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
kyori=[]
if n>=m:
    print(0)
    
else:
    for i in range(m-1):
        kyori.append(a[i+1]-a[i])
    b=0
    kyori.sort()
    for i in range(m-n):
        b+=kyori[i]
    
print(b)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
kyori=[]
if n>=m:
    print(0)
    
else:
    for i in range(m-1):
        kyori.append(a[i+1]-a[i])
    b=0
    kyori.sort()
    for i in range(m-n):
        b+=kyori[i]
    
    print(b)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))

a.sort()
start1=a[0]
start2=a[m-1]

a.pop(0)
a.pop(m-2)

centre=(start1+start2)/2
a.append(centre)
a.sort()
c=a.index(centre)
cent_left=a[c-1]
cent_right=a[c+1]

print(abs(cent_left-start1) + abs(start2-cent_right))

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
kyori=[]
if n>=m:
    print(0)
    
else:
    for i in range(m-1):
        kyori.append(a[i+1]-a[i])
    b=0
    kyori.sort()
    for i in range(m-n):
        b+=kyori[i]
    
    print(b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
zahyo=[list(map(int,input().split())) for i in range(n)]

zahyo.sort(key=lambda x:x[2], reverse = 1)
mx,my,mh=zahyo[0]
for Cx in range(101):
    for Cy in range(101):
        H = mh+abs(mx-Cx)+abs(my-Cy)
        if all(h == max(H-abs(x-Cx)+abs(y-Cy),0) for x,y,h in zahyo):
            print(Cx,Cy,h)
            break
            

Fixed submission:
n=int(input())
zahyo=[list(map(int,input().split())) for i in range(n)]

zahyo.sort(key=lambda x:x[2], reverse = 1)
mx,my,mh=zahyo[0]
for Cx in range(101):
    for Cy in range(101):
        H = mh+abs(mx-Cx)+abs(my-Cy)
        if all(h == max(H-abs(x-Cx)-abs(y-Cy),0) for x,y,h in zahyo):
            print(Cx,Cy,H)
            break
Buggy python submission (verdict: Time Limit Exceeded):

N=int(input())
A=list(map(int,input().split()))

mod=10**9+7

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        ans+=(A[i]*A[j])%mod
print(ans%mod)
        

Fixed submission:

N=int(input())
A=list(map(int,input().split()))

mod=10**9+7

sumA=sum(A)

ans=0
for i in range(N):
    ans+=(A[i]*(sumA-A[i]))

ans=ans//2
print(ans%mod)
Buggy python submission (verdict: Runtime Error):

import numpy as np

D=int(input())
C=np.array(list(map(int,input().split())))
minus_list=C.copy()
S=[]
S_sa=[]
sa=[]
for i in range(D):
    minlis=minus_list.tolist()
    print(minlis.index(max(minlis)+1))
    minus_list[minlis.index(max(minlis))]=0
    minus_list+=C

Fixed submission:

D=int(input())
C=list(map(int,input().split()))
S=[]
S_max=[]
for i in range(D):
    s=list(map(int,input().split()))
    S_max.append(max(s))
    S.append(s)

minus=365*sum(C)

for i in range(D):
    A=S[i]
    ma=S_max[i]
    print(A.index(ma)+1)
Buggy python submission (verdict: Runtime Error):
N=int(input())


lista=[chr(i) for i in range(97, 97+26)]
alphlist=[1]
anslist=[]
for i in range(1,12):
    if i==1:
        a=alphlist[i-1]+26**i-1
    else:
        a=alphlist[i-1]+26**i
    alphlist.append(a)

for i in range(12):
    if N<=alphlist[i]:
        keta=i
        break
a=keta
Ni=N
for i in range(a):
    Ni=Ni-sum(alphlist[0:a-i-1])+1
    at=Ni//alphlist[a-i-1]-2
    Ni=Ni-(at+1)*alphlist[a-i-1]
    print(Ni,at)
    anslist.append(lista[at])
print(''.join(anslist))

Fixed submission:

N = int(input())

ans = ""
while N > 0:
    N-=1                        #-1 means "a"
    ans += chr(ord('a') + N%26) #chr: Unicode to character, ord:character to Unicode
    N//=26                      #next power of 26

print(ans[::-1])                #sort reverse