Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):


A = input()
B = input()
result = False
Amin = int(round(A * 12.5)) 
Amax = int(round((A+1) * 12.5)-1)
Bmin = B * 10
Bmax = (B+1) * 10


for i in range(Amin,Amax+1):
    for j in range(Bmin,Bmax+1):
        
        if(i == j):
            print(i)
            result = True
            break

    if(result):

        break



if(result==False):
    print(-1)        
       
    


Fixed submission:

A,B = map(int, raw_input().split())

result = False
Amin = int(round(A * 12.5)) 
Amax = int(round((A+1) * 12.5)-1)
Bmin = B * 10
Bmax = (B+1) * 10 - 1


for i in range(Amin,Amax+1):
    for j in range(Bmin,Bmax+1):
        if(i == j):
            print(i)
            result = True
            break

    if(result):

        break



if(result==False):
    print(-1)
Buggy python submission (verdict: Runtime Error):
p=list(map(int,input().split()))
count=1
for item in p:
  if item==0:
    return count
  else:
    count+=1
    
  


Fixed submission:
p=list(map(int,input().split()))
count=1
for item in p:
  if item==0:
    print(count)
  else:
    count+=1
    continue
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=map(int,input().split())
p=list(map,input().split())
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
  if flag==0:
    print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
p=list(map(int,input().split()))
x=np.prod(p,axis=1)
if x<10**18:
  print(x)
else:
  print(-1)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
  if flag==0:
    print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
lista=[]
p=input().split()
for i in range(N):
  print(p[i])
  lista.append(p[i])
if np.prod(lista)<10**18:
  print(np.prod(lista))
else:
  print(-1)


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
  if flag==0:
    print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
p=list(int,input().split())
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
  if flag==0:
    print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
p=[int(input()) for i in range(N)]
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
  if flag==0:
    print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(float,input().split())
a=int(a)
b=str(b)
b.replace(".","")
x=a*int(b)/100
print(x)

Fixed submission:
A, B = input().split()
A, B = int(A), int(B.replace('.', ''))
print(A * B // 100)

Buggy python submission (verdict: Runtime Error):
a,b=int(input()),str(input())
b.replace(".","")
print(int(a*b/100))

Fixed submission:
A, B = input().split()
A, B = int(A), int(B.replace('.', ''))
print(A * B // 100)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=str(input())
b.replace(".","")
print(int(a*b/100))

Fixed submission:
A, B = input().split()
A, B = int(A), int(B.replace('.', ''))
print(A * B // 100)

Buggy python submission (verdict: Runtime Error):
import math
a=int(input())
b=float(input())
p=a*b
print(math.floor(p))

Fixed submission:
A, B = input().split()
A, B = int(A), int(B.replace('.', ''))
print(A * B // 100)

Buggy python submission (verdict: Runtime Error):
import math
a,b=int(input()),float(input())
x=a*b
print(math.floor(x))

Fixed submission:
A, B = input().split()
A, B = int(A), int(B.replace('.', ''))
print(A * B // 100)
Buggy python submission (verdict: Runtime Error):
N=int(input())
N_mozi="N"
for i in range N_mozi:
  if i<len(N_mozi)+1:
    continue
  else:
    end_N=i
if end_N==2 or end_N==4 or end_N==5 or end_N==7 or end_N==9:
  print("hon")
elif end_N==3:
  print("bon")
else:
  print("pon")

Fixed submission:
N=int(input())
if N%10==3:
  print("bon")
elif N%10==0 or N%10==1 or N%10==6 or N%10==8:
  print("pon")
else:
  print("hon")
Buggy python submission (verdict: Runtime Error):
K=int(input())
S=input()
if len(S)<K:
  print(S)
else:
  print(S[:,K]+"...")
    

Fixed submission:
K=int(input())
S=input()
if len(S)<=K:
  print(S)
else:
  print(S[:K]+"...")

Buggy python submission (verdict: Runtime Error):
K=int(input())
S=input()
hai=[]
if len(S)<K:
  print(S)
else:
  for i in range(0,K):
    hai.append(S[i])
  print(hai+"...")
    

Fixed submission:
K=int(input())
S=input()
if len(S)<=K:
  print(S)
else:
  print(S[:K]+"...")
Buggy python submission (verdict: Runtime Error):
import math
a=int(input())
print(2.math.pi*a)


Fixed submission:
import math
a=int(input())
print(2*math.pi*a)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
p=list(map(int,input().split()))
if np.sum(p)>M:
  print(-1)
else:
  print(N-np.sum(p))

Fixed submission:
import numpy as np
N,M=map(int,input().split())
p=list(map(int,input().split()))
if np.sum(p)>N:
  print(-1)
else:
  print(N-np.sum(p))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())

ans = 0
for i in range(k):
    if a > 0:
        ans += 1
        a -= 1

    elif b > 0:
        b -= 1

    elif c > 0:
        ans -= 1
        c -= 1
    else:
        break

print(ans)


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

ans = 0
if a < k:
    ans = a
else:
    ans = k

minus = k - (a + b)

if minus > 0:
    ans -= minus

print(ans)

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

ans = 0
for i in range(k):
    if a > 0:
        ans += 1
        a -= 1

    elif b > 0:
        b -= 1

    elif c > 0:
        ans -= 1
        c -= 1

print(ans)


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

ans = 0
if a < k:
    ans = a
else:
    ans = k

minus = k - (a + b)

if minus > 0:
    ans -= minus

print(ans)

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

ans = 0
for i in range(k):
    if a:
        ans += 1
        a -= 1

    elif b:
        b -= 1

    elif c:
        ans -= 1
        c -= 1

print(ans)

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

ans = 0
if a < k:
    ans = a
else:
    ans = k

minus = k - (a + b)

if minus > 0:
    ans -= minus

print(ans)

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

ans = 0
for k in range(kk):
    if a:
        ans += 1
        a -= 1

    elif b:
        b -= 1

    elif c:
        ans -= 1
        c -= 1

print(ans)


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

ans = 0
if a < k:
    ans = a
else:
    ans = k

minus = k - (a + b)

if minus > 0:
    ans -= minus

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


def calc(x, y):
    if x - 1 >= 0:
        return (x - 1, y)
    elif y - 1 >= 0:
        return (x, y - 1)


answers = []
for i in range(n):
    s = list(map(str, input().split()))
    old_a = a
    old_b = b
    old_c = c

    if s == 'AB':
        a, b = calc(a, b)
    elif s == 'AC':
        a, c = calc(a, c)
    elif s == 'BC':
        b, c = calc(b, c)

    if a > old_a:
        answers.append('A')
    elif b > old_b:
        answers.append('B')
    elif c > old_c:
        answers.append('C')

    if a >= 0 and b >= 0 and c >= 0:
        print('No')
        quit()


print('Yes')
for ans in answers:
    print(ans)


Fixed submission:
s = str(input())

a = ''

if s == 'ABC':
    a = 'ARC'
elif s == 'ARC':
    a = 'ABC'

print(a)
Buggy python submission (verdict: Runtime Error):
s = str(input())
j = len(s)
l = []
for i in range(j):
    for ii in range(i, j):
        ss = int(s[i:ii + 1])
        if not ss:
            continue
        sss = ss / 2019
        if sss.is_integer():
            l.append(ss)

print(len(l))


Fixed submission:
s = input()[::-1]

cnts = [0] * 2019
cnts[0] = 1

n, d = 0, 1

for char in s:
    n = (n + int(char) * d) % 2019
    d = d * 10 % 2019
    cnts[n] += 1

ans = 0
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)

Buggy python submission (verdict: Runtime Error):
s = str(input())
j = len(s)
l = []
for i in range(j):
    for ii in range(i, j):
        ss = int(s[i:ii + 1])
        sss = ss / 2019
        if sss.is_integer():
            l.append(ss)

print(len(l))


Fixed submission:
s = input()[::-1]

cnts = [0] * 2019
cnts[0] = 1

n, d = 0, 1

for char in s:
    n = (n + int(char) * d) % 2019
    d = d * 10 % 2019
    cnts[n] += 1

ans = 0
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)

Buggy python submission (verdict: Runtime Error):
s = str(input())
j = len(s)
l = []
for i in range(j):
    for ii in range(i, j):
        ss = int(s[i:ii + 1])
        sss = ss / 2019
        if sss.is_integer():
            l.append(ss)

print(len(l))


Fixed submission:
s = input()[::-1]

cnts = [0] * 2019
cnts[0] = 1

n, d = 0, 1

for char in s:
    n = (n + int(char) * d) % 2019
    d = d * 10 % 2019
    cnts[n] += 1

ans = 0
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def main():
    X, N = map(int, input().split())
    p = list(map(int, input().split()))
    assert N == len(p)
    if N == 0:
        print(X)
        exit()
    abs_list = []
    abs_list2 = list(range(-100, 100))
    abs_list2.sort()
    abs_list2 = sorted(abs_list2, key=abs)
    for i in p:
        abs_list.append(i-X)
    abs_list.sort()
    abs_list = sorted(abs_list, key=abs)
    # print(abs_list)
    # print(abs_list2)
    for i in range(len(abs_list2)):
        if abs_list[i] != abs_list2[i]:
            print(X+abs_list2[i])
            exit()


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    X, N = map(int, input().split())
    p = list(map(int, input().split()))
    assert N == len(p)
    if N == 0:
        print(X)
        exit()
    abs_list = []
    abs_list2 = list(range(-100, 100))
    abs_list2.sort()
    abs_list2 = sorted(abs_list2, key=abs)
    for i in p:
        abs_list.append(i-X)
    abs_list.sort()
    abs_list = sorted(abs_list, key=abs)
    # print(abs_list)
    # print(abs_list2)
    for i in range(N):
        if abs_list[i] != abs_list2[i]:
            print(X+abs_list2[i])
            exit()
    print(X+abs_list2[N])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = 1
    for i in A:
        answer *= i
        if answer > limit:
            print("-1")
            exit()
        elif answer == 0:
            print(answer)
            exit()
    print(answer)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    A, B = map(int, input().split())
    print(A*B)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import operator
import functools
input = sys.stdin.readline


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = functools.reduce(operator.mul, A)
    # for i in A:
    #     answer *= i
    #     if answer > limit:
    #         print("-1")
    #         exit()
    print(answer) if answer <= limit else print("-1")


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = 1
    if 0 in A:
        print(0)
        exit()
    for i in A:
        answer *= i
        if answer > limit:
            print("-1")
            exit()
    print(answer)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = 1
    for i in A:
        answer *= i
    print(answer) if answer <= limit else print("-1")


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = 1
    if 0 in A:
        print(0)
        exit()
    for i in A:
        answer *= i
        if answer > limit:
            print("-1")
            exit()
    print(answer)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def main():
    S = input().strip()
    answer = []
    for i in range(1, len(S)+1):
        [answer.append(j) for j in range(i+4, len(S)+1)
         if int(S[i-1:j]) % 2019 == 0]
    print(len(answer))


if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    S, W = map(int, input().split())
    print("safe") if S > W else print("unsafe")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
result = []
[print(a.count(i+1)) for i in range(n)]


Fixed submission:
import sys
import collections
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for i in range(n):
    print(c[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
del a[n:len(a)-1]
result = []
[print(a.count(i+1)) for i in range(n)]


Fixed submission:
import sys
import collections
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for i in range(n):
    print(c[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
del a[n:len(a)-1]
result = []
[print(a.count(i+1)) for i in range(n)]


Fixed submission:
import sys
import collections
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for i in range(n):
    print(c[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
del a[n:len(a)-1]
result = []
for i in range(n):
    print(a.count(i+1))


Fixed submission:
import sys
import collections
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for i in range(n):
    print(c[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
del a[n:len(a)-1]
for i in range(n):
    count = 0
    for j in a:
        if i+1 == j:
            count += 1
    print(count)


Fixed submission:
import sys
import collections
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for i in range(n):
    print(c[i+1])
Buggy python submission (verdict: Runtime Error):
import sys
import collections
input = sys.stdin.readline
N = int(input())
S = input().strip()
assert 1 <= N <= 4000
assert N == len(S)
r = S.count("R")
g = S.count("G")
b = S.count("B")
total = 0
for j in range(1, N-1):
    for i in range(j):
        k = 2*j-i
        if k < len(S):
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                total += 1
# print(c["R"]*c["G"]*c["B"]-total)
print(r*g*b - total)


Fixed submission:
import sys
input = sys.stdin.readline
N = input()
assert 100 <= int(N) <= 999
print("Yes") if str(7) in N else print("No")

Buggy python submission (verdict: Runtime Error):
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            a = euclidean_algorithm(i, j)
            for k in range(1, K+1):
                total += euclidean_algorithm(a, k)
    print(total)


def euclidean_algorithm(a, b):
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline
N = input()
assert 100 <= int(N) <= 999
print("Yes") if str(7) in N else print("No")

Buggy python submission (verdict: Runtime Error):
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            a = euclidean_algorithm(i, j)
            for k in range(1, K+1):
                total += euclidean_algorithm(a, k)
    print(total)


def euclidean_algorithm(a, b):
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline
N = input()
assert 100 <= int(N) <= 999
print("Yes") if str(7) in N else print("No")

Buggy python submission (verdict: Runtime Error):
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            a = euclidean_algorithm(i, j)
            for k in range(1, K+1):
                total += euclidean_algorithm(a, k)
    print(total)


def gcd_list(numbers):
    return reduce(euclidean_algorithm, numbers)


def euclidean_algorithm(a, b):
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline
N = input()
assert 100 <= int(N) <= 999
print("Yes") if str(7) in N else print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            for k in range(1, K+1):
                total += gcd_list([i, j, k])
    print(total)


def gcd_list(numbers):
    return reduce(euclidean_algorithm, numbers)


def euclidean_algorithm(a, b):
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            a = euclidean_algorithm(i, j)
            for k in range(1, K+1):
                total += euclidean_algorithm(a, k)
    print(total)


def gcd_list(numbers):
    return reduce(euclidean_algorithm, numbers)


def euclidean_algorithm(a, b):
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            for k in range(1, K+1):
                total += gcd_list([i, j, k])
    print(total)


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            a = euclidean_algorithm(i, j)
            for k in range(1, K+1):
                total += euclidean_algorithm(a, k)
    print(total)


def gcd_list(numbers):
    return reduce(euclidean_algorithm, numbers)


def euclidean_algorithm(a, b):
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def main():
    S = input().strip()
    for i in range((len(S)-1)//2-1):
        if S[i] == S[(len(S)-1)//2-i-1] and S[(len(S)+3)//2+i-1] == S[len(S)-i-1]:
            answer = "Yes"
        else:
            print("No")
            exit()
    print(answer)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    S = input().strip()
    N = len(S)
    for i in range(N):
        if S[i] != S[N-i-1]:
            print("No")
            exit()
    for i in range((N-1)//2):
        if S[i] != S[(N-1)//2-i-1] or S[(N+3)//2+i-1] != S[N-i-1]:
            print("No")
            exit()
    print("Yes")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import collections
import math
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    assert len(A) == N
    ball = collections.Counter(A)
    for k in range(N):
        total = []
        ball[A[k]] -= 1
        total = [combinations_count(i, 2) for i in ball.values() if i >= 2]
        ball[A[k]] += 1
        print(sum(total))


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections
import math
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    assert len(A) == N
    ball = collections.Counter(A)
    total = 0
    for i in ball.values():
        if i >= 2:
            total += combinations_count(i, 2)
    for k in range(N):
        if ball[A[k]] == 2:
            print(total - 1)
        elif ball[A[k]] == 1:
            print(total)
        else:
            print(total - ball[A[k]] + 1)


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    main()