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

n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([int(sum_c - data[i]) for i in a])

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))

Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum_c = 0
c = collections.Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum_c += val
print('\n'.join([int(sum_c - data[i]) for i in a])


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))

Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum_c = 0
for i, v in collections.Counter(a).items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum_c += val
print('\n'.join([int(sum_c - data[i]) for i in a])

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))

Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum = 0
for i, v in collections.Counter(a).items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum += val
print('\n'.join([int(sum - data[i]) for i in a])

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))

Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum = 0
for i, v in collections.Counter(a).items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum += val
print('\n'.join([int(sum_count - data[i]) for i in a])

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
a = list(map(int, input().split()))
coun = collections.Counter(a)
k = list(coun.keys())
num = list(coun.values())
num_2 = []
for i in range(len(num)):
    B = num[:]
    B[i] = B[i] - 1
    num_2 += [int(sum(list(map(lambda x: (x - 1) * (2 + (x - 2)) / 2, B))))]
dic = dict(zip(k, num_2))
for i in range(n):
    print(dic[a[i]])


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
a = list(map(int, input().split()))
for k in range(n):
    a_2 = a[:k] + a[k + 1:]
    coun = collections.Counter(a_2)
    num = list(coun.values())
    num_2 = map(lambda x: (x - 1) * (2 + (x - 2)) / 2, num)
    print(int(sum(num_2)))


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))