Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B = input().split(' ')

A = int(A)
B100 = int(B.replace('.', ''))

ans = A * B * 0.01

print(ans)

Fixed submission:
from decimal import *
A, B = input().split()
print(int(int(A) * Decimal(B)))
Buggy python submission (verdict: Runtime Error):
A, B, N = [int(i) for i in input().split(' ')]

if B > N:
    x = N
else:
    X = B - 1

m = int(A * x / B) - A * int(x / B)

print(m)

Fixed submission:
A, B, N = [int(i) for i in input().split(' ')]

if B > N:
    x = N
else:
    x = B - 1

m = int(A * x / B) - A * int(x / B)

print(m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

count = 0

for i in range(N):
    for j in range(i, N):
        for k in range(j, N):
            if (j - i) == (k - j):
                continue
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                count += 1

print(count)



Fixed submission:
N=int(input())
S=input()
r=S.count('R')
b=S.count('B')
g=S.count('G')
ans=r*b*g
for i in range(N):
    for s in range(N):
        j=i+s
        k=j+s
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections
import math

def nC2(n):
    if n == 1:
        return 0
    return nCr(n, 2)

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

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

c = collections.Counter(A)
sum_values = sum(map(nC2, c.values()))

for n in range(N):
    print(int(sum_values - (nC2(c[A[n]]) - nC2(c[A[n]] - 1))))

Fixed submission:
import collections
import math

def nC2(n):
    return n * (n - 1) / 2

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

c = collections.Counter(A)
sum_values = sum(map(nC2, c.values()))

for n in range(N):
    if c[A[n]] == 1:
        print(int(sum_values))
    else:
        print(int(sum_values - (c[A[n]] - 1)))

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

def nC2(n):
    if n == 1:
        return 0
    return nCr(n, 2)

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

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

c = collections.Counter(A)
sum_values = sum(map(nC2, c.values()))

for n in range(N):
    if c[A[n]] == 1:
        print(int(sum_values))
    else:
        print(int(sum_values - (nC2(c[A[n]]) - nC2(c[A[n]] - 1))))

Fixed submission:
import collections
import math

def nC2(n):
    return n * (n - 1) / 2

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

c = collections.Counter(A)
sum_values = sum(map(nC2, c.values()))

for n in range(N):
    if c[A[n]] == 1:
        print(int(sum_values))
    else:
        print(int(sum_values - (c[A[n]] - 1)))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

S = input()
Q = int(input())

ANS = deque(S)

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        ANS.reverse()
    else:
        f, c = query[1:]
        if f == '1':
            ANS.appendleft(c)
        else:
            ANS.append(c)

print(''.join(ANS))

Fixed submission:
from collections import deque

S = input()
Q = int(input())

ANS = deque(S)

rev = 0

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        rev = rev ^ 1
    else:
        f, c = int(query[1]), query[2]
        if (f - 1) ^ rev:
            ANS.append(c)
        else:
            ANS.appendleft(c)

if rev:
    ANS.reverse()

print(''.join(ANS))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

S = input()
Q = int(input())

ANS = deque(S)

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        ANS = list(ANS)
        ANS = ANS[::-1]
        ANS = deque(ANS)
    else:
        f, c = query[1:]
        if f == '1':
            ANS.appendleft(c)
        else:
            ANS.append(c)

print(''.join(ANS))

Fixed submission:
from collections import deque

S = input()
Q = int(input())

ANS = deque(S)

rev = 0

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        rev = rev ^ 1
    else:
        f, c = int(query[1]), query[2]
        if (f - 1) ^ rev:
            ANS.append(c)
        else:
            ANS.appendleft(c)

if rev:
    ANS.reverse()

print(''.join(ANS))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

ANS = S

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        ANS = ANS[::-1]
    else:
        f, c = query[1:]
        if f == '1':
            ANS = c + ANS
        else:
            ANS = ANS + c

print(ANS)

Fixed submission:
from collections import deque

S = input()
Q = int(input())

ANS = deque(S)

rev = 0

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        rev = rev ^ 1
    else:
        f, c = int(query[1]), query[2]
        if (f - 1) ^ rev:
            ANS.append(c)
        else:
            ANS.appendleft(c)

if rev:
    ANS.reverse()

print(''.join(ANS))

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

ANS = S

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        ANS = ANS[::-1]
    else:
        f, c = query[1:]
        if f == '1':
            ANS = c + ANS
        else:
            ANS = ANS + c

print(ANS)

Fixed submission:
from collections import deque

S = input()
Q = int(input())

ANS = deque(S)

rev = 0

for _ in range(Q):
    query = input().split(' ')
    if len(query) == 1:
        rev = rev ^ 1
    else:
        f, c = int(query[1]), query[2]
        if (f - 1) ^ rev:
            ANS.append(c)
        else:
            ANS.appendleft(c)

if rev:
    ANS.reverse()

print(''.join(ANS))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split(' '))
p = list(map(int, input().split(' ')))

m = 0
mi = 0

for i in range(N - K + 1):
    s = sum(p[i:i+K])
    if m < s:
        m = s
        mi = i

ans = (m + K) / 2

print(ans)



Fixed submission:
from collections import deque

N, K = map(int, input().split(' '))
P = list(map(int, input().split(' ')))

# 累積和
sum_list = [0] * (N + 1)
sum_list[0] = 0
for i in range(1, N+1):
    sum_list[i] = sum_list[i-1] + P[i-1]

max_sum = 0
for i in range(N-K+1):
    s = sum_list[i+K] - sum_list[i]
    if max_sum < s:
        max_sum = s

ans = (max_sum + K) / 2

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

N = int(input())
L = list(map(int, input().split(' ')))

L = sorted(L)

count = 0

for i in range(N - 1):
    for j in range(i + 1, N - 1):
        x, y = L[i], L[j]
        top = N
        bottom = j + 1
        tmp = (top + bottom) // 2
        
        while(top - bottom > 1):
            if L[tmp] >= x + y:
                top = tmp
                tmp = (top + bottom) // 2
            elif L[tmp] < x + y:
                bottom = tmp
                tmp = (top + bottom) // 2
        if bottom - j == 1:
            if L[bottom] < x + y:
                count += 1
        else:
            count += (bottom - j)

print(count)

Fixed submission:
import itertools
import bisect

N = int(input())
L = list(map(int, input().split(' ')))

L = sorted(L)

count = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        x, y = L[i], L[j]
        limit = x + y
        index = bisect.bisect_left(L, limit)
        count += max(0, index - j - 1)

print(count)

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

N = int(input())
L = list(map(int, input().split(' ')))

count = 0
for l in list(itertools.combinations(L, 3)):
    if l[0] < l[1] + l[2] and l[1] < l[0] + l[2] and l[2] < l[0] + l[1]:
        count += 1

print(count)

Fixed submission:
import itertools
import bisect

N = int(input())
L = list(map(int, input().split(' ')))

L = sorted(L)

count = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        x, y = L[i], L[j]
        limit = x + y
        index = bisect.bisect_left(L, limit)
        count += max(0, index - j - 1)

print(count)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split(' '))

N = 2019


ans = 2019

for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod
        if ans = 0:
            print(ans)
            exit(0)

print(ans)

Fixed submission:
L, R = map(int, input().split(' '))

N = 2019


ans = 2019

for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod
        if ans == 0:
            print(ans)
            exit(0)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split(' '))

N = 2019

if R - L == 1:
    print((R * L) % N)
    exit(0)

q = L // N
L_min = L % N
R_min = R - N * q

ans = 2019

for i in range(L_min, R_min):
    for j in range(i + 1, R_min + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod

print(ans)

Fixed submission:
L, R = map(int, input().split(' '))

N = 2019


ans = 2019

for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod
        if ans == 0:
            print(ans)
            exit(0)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(i) for i in input().split()]

_sum = 0

for i in range(N):
    a.remove(max(a))
    _sum += max(a)
    a.remove(max(a))

print(_sum)


Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]

a.sort(reverse=True)
print(sum(a[1:2*N][::2]))
Buggy python submission (verdict: Runtime Error):
x=int(input())
y=int(input())
ans=x+int(y/2)
print(ans)

Fixed submission:
x,y=map(int,input().split())
ans=x+int(y/2)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
def findMax(a):
    l=len(a)
    if(l==0):
        return 0
    elif(l==1):
        return 0
    else:
        i=1
        while(i<l):
            if(a[i]>a[i-1]):
                return(max(i-1,findMax(a[i:])))
            i+=1
        return l-1

print(findMax(a))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
startpt=0
indexer=0
maxi=0
i=1
while(i<n):
    if(a[i]>a[i-1]):
        maxi=max(i-startpt-1,maxi)
        startpt=i
        
    i+=1
maxi=max(i-startpt-1,maxi)
print(maxi)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
def findMax(a):
    l=len(a)
    if(l==0):
        return 0
    else:
        i=1
        while(i<l):
            if(a[i]>a[i-1]):
                return(max(i,findMax(a[i:])))
            i+=1
        return l

print(findMax(a)-1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
startpt=0
indexer=0
maxi=0
i=1
while(i<n):
    if(a[i]>a[i-1]):
        maxi=max(i-startpt-1,maxi)
        startpt=i
        
    i+=1
maxi=max(i-startpt-1,maxi)
print(maxi)
Buggy python submission (verdict: Runtime Error):
n=int(input())
i=0
b=[]
pos=0
maxi=0
while(i<n):
  k=int(input())
  b.append(k)
  if(k>maxi):
    pos=i
    maxi=k
  i+=1
b.sort()
ns=b[n-2]
i=0
while(i<n):
  if(i==posi)
  	print(ns)
  else:
    print(b[i])
  i+=1

Fixed submission:
n=int(input())
i=0
b=[]
pos=0
maxi=0
while(i<n):
  k=int(input())
  b.append(k)
  if(k>maxi):
    pos=i
    maxi=k
  i+=1
b.sort()
ns=b[n-2]
i=0
while(i<n):
  if(i==pos):
  	print(ns)
  else:
    print(b[n-1])
  i+=1
Buggy python submission (verdict: Time Limit Exceeded):
a=(list(map(int,input().split())))
l=a[0]
r=a[1]
if(l-r>2021):
	print(0)
else:
	mini=2019
	i=l
	while(i<=r-1):
		j=i+1
		while(j<=r):
			p=(i*j)%2019
			mini=min(mini,p)	
			j+=1

		i+=1
	print(mini)

Fixed submission:
a=(list(map(int,input().split())))
l=a[0]
r=a[1]
if(l-r>2021):
	print(0)
else:
	mini=2019
	i=l
	notFound=True
	while(i<=r-1 and notFound):
		j=i+1
		while(j<=r and notFound):
			p=(i*j)%2019
			
			mini=min(mini,p)
			if(mini==0):
				notFound=False	
			j+=1

		i+=1
	print(mini)
Buggy python submission (verdict: Runtime Error):
w,h,x,y=(map(int,input().split()))
xeven=(w%2==0)
yeven=(h%2==0)
if(xeven and yeven):
	if(x==w//2 and y==w//2):
		print(w*h/2,1)
elif(xeven and x==w//2):
	print(w*h/2,0)
elif(yeven and y==h//2):
	print(w*h/2,0)
else:
	a=[]
	a.append((0,0,0))
	a.append((0,w,0))
	a.append((h,0,0))
	a.append((h,w,0))
	i=0
	while(i<4):
		a[i][2]=(x-a[0])**2+(y-a[1])**2
		i+=1
	a.sort(key=lambda b:b[2])
	mini=a[0]
	maxi=a[4]
	xclose=abs(mini[0]-x)<abs(mini[1]-y)
	slope=abs(x-maxi[0])/abs(y-maxi[1])
	if(xclose):
		ynew=abs(mini[0]-x)/slope
		print(abs(maxi[1]-mini[1])*(abs(x-maxi[0])+ynew)/2,0)
	else:
		ynew=abs(mini[1]-y)*slope
		print(abs(maxi[0]-mini[0])*(abs(y-maxi[1])+ynew)/2,0)

Fixed submission:
w,h,x,y=(map(int,input().split()))


if(x+x==w and y+y==h):
		print(w*h/2,1)
else:
	print(w*h/2,0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
num = 0
l = []

for i in range(n):
    flag = 0
    if i == 0:
        if a[0]==a[1]:
            l.append(a[0])
            continue
        else:
            l.append(a[0])
            continue

    if a[i] in l:
        continue

    for j in l:
        if a[i]%j:
            flag = 1
            break
        else:
            break

    if flag:
        l.append(a[i])
        if i == 0:
            if a[i] != a[i+1]:
                num += 1
        elif i == n-1:
            if a[i] != a[i-1]:
                num += 1
        elif a[i] != a[i+1] and a[i] != a[i-1]:
            num += 1

print(num)


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

l = [0]*(10**6 +1)
for i in a:
    l[i]+=1
num = 0

for i in range(10**6+1):
    if l[i] == 1:
        num += 1
    if l[i] != 0:
        for j in range(2*i, 10**6+1, i):
            if l[j]:
                l[j] += 1
print(num)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
num = 0
l = []

for i in range(n):
    flag = 0
    if i == 0:
        if a[0]==a[1]:
            l.append(a[0])
            continue
        else:
            l.append(a[0])
            num += 1
            continue
    for j in l:
        if a[i]%j:
            flag = 1
            break
        else:
            break
    if flag:
        l.append(a[i])
        num += 1

print(num)

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

l = [0]*(10**6 +1)
for i in a:
    l[i]+=1
num = 0

for i in range(10**6+1):
    if l[i] == 1:
        num += 1
    if l[i] != 0:
        for j in range(2*i, 10**6+1, i):
            if l[j]:
                l[j] += 1
print(num)

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


for i in range(n):
    flag = 0
    if i == 0 and a[0]==a[1]:
        continue
    for j in range(i):
        if not a[i]%a[j]:
            flag = 1
            break

    if not flag:
        num += 1

print(num)


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

l = [0]*(10**6 +1)
for i in a:
    l[i]+=1
num = 0

for i in range(10**6+1):
    if l[i] == 1:
        num += 1
    if l[i] != 0:
        for j in range(2*i, 10**6+1, i):
            if l[j]:
                l[j] += 1
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

num = 1
for k in range(n):
	num *= a[k]

if num > 10**18:
	print("-1")
else:
	print(num)

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

num = 1
if 0 in a:
  num = 0
  
else:
  for k in range(n):
      num *= a[k]
      if num > 10**18:
        num = "-1"
        break

print(num)
Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    num = 1
    l = []
    s = [1]*n

    while s[num-1]:
        l.append(num)
        s[num-1] = 0
        num = a[num-1]
    
    if l.index(num) <= k:
        l2 = l[l.index(num):]
        kk = (k-len(set(l)-set(l2)))%len(l2)
        print(l2[kk])
    else:
        l2 = l[l.index(num):]
        print(l2[k])

main()


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

    num = 1
    l = []
    s = [1]*n

    while s[num-1]:
        l.append(num)
        s[num-1] = 0
        num = a[num-1]

    if l.index(num) <= k:
        l2 = l[l.index(num):]
        kk = (k-len(set(l)-set(l2)))%len(l2)
        print(l2[kk])
    else:
        print(l[k])

main()

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

    num = 1
    l = []
    s = [1]*n

    while s[num-1]:
        l.append(num)
        s[num-1] = 0
        num = a[num-1]

    if l.index(num) <= k:
        l2 = l[l.index(num):]
        kk = (k-len(set(l)-set(l2)))%len(l2)
        print(l2[kk])
    else:
        print(l2[k])

main()

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

    num = 1
    l = []
    s = [1]*n

    while s[num-1]:
        l.append(num)
        s[num-1] = 0
        num = a[num-1]

    if l.index(num) <= k:
        l2 = l[l.index(num):]
        kk = (k-len(set(l)-set(l2)))%len(l2)
        print(l2[kk])
    else:
        print(l[k])

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

max = num = int(a*n/b) - a * int(n/b)

for x in range(0, n+1, b):
    num = int(a*(x-1)/b) - a * int((x-1)/b)
    if num > max:
        max = num

print(max)


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

if n<b:
    print(((a*n)//b) - a * (n//b))
else:
    print(((a*(b-1))//b) - a * ((b-1)//b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

l = []
num = 0
for s in range(n):
    i = input()
    if i not in l:
        l.append(i)
        num += 1

print(num)

Fixed submission:
n = int(input())

l = set()
num = 0
for s in range(n):
    i = input()
    l.add(i)
print(len(l))

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

l = []
for s in range(n):
    i = input()
    if i not in l:
        l.append(i)

print(len(l))

Fixed submission:
n = int(input())

l = set()
num = 0
for s in range(n):
    i = input()
    l.add(i)
print(len(l))

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

l = []
for s in range(n):
    i = input()
    if i not in l:
        l.append(i)

print(len(l))

Fixed submission:
n = int(input())

l = set()
num = 0
for s in range(n):
    i = input()
    l.add(i)
print(len(l))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

total = s.count("R") * s.count("G") * s.count("B")

#l = ["RGB", "RBG", "GRB", "GBR", "BRG", "BGR"]

lR = [0]*n
lG = [0]*n
lB = [0]*n

for i in range(len(s)):
    if s[i] == "R":
        lR[i] += 1
    elif s[i] == "G":
        lG[i] += 1
    else:
        lB[i] += 1

#print(lR)
#print(lG)
#print(lB)

for i in range(n):
    if lR[i]:
        for j in range(n):
            if lG[j]:
                for k in range(n):
                    if lB[k]:
                        if abs(j-i) == abs(k-j) or abs(j-k) == abs(k-i) or abs(j-i) == abs(k-i):
                            total -= 1
print(total)


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

total = s.count("R") * s.count("G") * s.count("B")

#l = ["RGB", "RBG", "GRB", "GBR", "BRG", "BGR"]

lR = [0]*n
lG = [0]*n
lB = [0]*n

for i in range(len(s)):
    if s[i] == "R":
        lR[i] += 1
    elif s[i] == "G":
        lG[i] += 1
    else:
        lB[i] += 1

#print(lR)
#print(lG)
#print(lB)

for i in range(n):
    j = 1
    if lR[i]:
        while i-j >= 0 and i+j < n:
            if lG[i+j]!=0 and lG[i+j] == lB[i-j]:
                total -= 1
            elif lG[i-j]!=0 and lG[i-j] == lB[i+j]:
                total -= 1
            j += 1

    elif lG[i]:
        while i-j >= 0 and i+j < n:
            if lR[i+j]!=0 and lR[i+j] == lB[i-j]:
                total -= 1
            elif lR[i-j]!=0 and lR[i-j] == lB[i+j]:
                total -= 1
            j += 1

    elif lB[i]:
        while i-j >= 0 and i+j < n:
            if lG[i+j]!=0 and lG[i+j] == lR[i-j]:
                total -= 1
            elif lG[i-j]!=0 and lG[i-j] == lR[i+j]:
                total -= 1
            j += 1

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

while True:
    if not n%k:
        n = 0
        break
    num = n
    n = n-k
    if n < 0:
        n = min(abs(n), num)
        break

print(n)

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

a = n%k

num = min(a, abs(a-k))

print(num)

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

while True:
    if not n%k:
        n = 0
        break
    num = n
    n = n-k
    if n < 0:
        n = min(abs(n), num)
        break

print(n)

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

a = n%k

num = min(a, abs(a-k))

print(num)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
total = 0


for i in range(n):
    l.append(a.count(i))


for r in l:
    total += (r*(r-1))/2


#print(l)
#print(total)

for i in a:
    score = total - (l[i]-1)
    print(int(score))


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
total = 0

c = Counter(a)

for r in list(c.values()):
    total += (r*(r-1))/2

#print(l)
#print(total)

for i in a:
    score = total - (c[i]-1)
    print(int(score))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
l = []
total = 0

m = max(a)
mi = min(a)

if mi == m:
    total = ((len(a)-1)*(len(a)-2))/2
    for _ in range(n):
        print(int(total))

else:
    for i in range(mi, m+1):
        r = a.count(i)
        if r:
            total += (r*(r-1))/2
        l.append(r)

    #print(l)
    #print(total)

    for k in range(n):
        score = total
        if l[a[k]-1]:
            score -= (l[a[k]-1]-1)
        print(int(score))


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
total = 0

c = Counter(a)

for r in list(c.values()):
    total += (r*(r-1))/2

#print(l)
#print(total)

for i in a:
    score = total - (c[i]-1)
    print(int(score))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

for i in range(1000000):
    if int(i*0.08) == a and int(i*0.1) == b:
        num = i
        break

    elif a/0.08 < b/0.1:
        num = -1
        break

print(num)


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

if a <= b:
    for i in range(1000000):
        if int(i*0.08) == a and int(i*0.1) == b:
            num = i
            break

        elif int(i*0.08) > a or int(i*0.1) > b:
            break

print(num)

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

for i in range(1001):
    if int(i*0.08) == a and int(i*0.1) == b:
        num = i
        break

    elif a/0.08 < b/0.1:
        num = -1
        break

print(num)

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

if a <= b:
    for i in range(1000000):
        if int(i*0.08) == a and int(i*0.1) == b:
            num = i
            break

        elif int(i*0.08) > a or int(i*0.1) > b:
            break

print(num)