Buggy python submission (verdict: Time Limit Exceeded):
#TLE
n = int(input())
a = input().split()
dic = {}
ans = 0
a_copy = a.copy()
while a_copy != []:
    num = a_copy.count(a_copy[0]) - 1
    ans += num * (num+1)
    dic[a_copy[0]] = num
    a_copy = [i for i in a_copy if i != a_copy[0]]
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]]))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

Buggy python submission (verdict: Time Limit Exceeded):
#TLE
n = int(input())
a = input().split()
dic = {}
ans = 0
for i in range(n):
    if not a[i] in dic:
        num = a.count(a[i]) - 1
        ans += num * (num+1)
        dic[a[i]] = num
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]]))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()
ans = 0
for l in range(N):
    ans += A.count(A[l]) - 1
ans /= 2
for k in range(N):
    print(int(ans - (A.count(A[k]) - 1)))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

Buggy python submission (verdict: Time Limit Exceeded):
#TLE
N = int(input())
A = input().split()
ans = 0
for l in range(N):
    ans += A.count(A[l]) - 1
ans /= 2
for k in range(N):
    answer = ans - (A.count(A[k]) - 1)
    print(int(answer))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

Buggy python submission (verdict: Time Limit Exceeded):
#TLE
N = int(input())
A = list(map(int, input().split()))
ans = 0
for l in range(N):
    ans += A.count(A[l]) - 1
ans /= 2
for k in range(N):
    answer = ans - (A.count(A[k]) - 1)
    print(int(answer))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

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

input_1 = input()
input_2 = input_1.split()

for k in range(N):
    A = map(int, input_2)

    def equal(num):
        return num / 1
    A = [equal(x) for x in A]

    ans = 0

    A.remove(A[k])

    for l in range(N - 1):
        for m in range(N - 1):
            if A[l] == A[m]:
                ans += 1
        
        ans -= 1

    ans = ans / 2

    print(int(ans))


Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

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

input_1 = input()
input_2 = input_1.split()

A = map(int, input_2)

def equal(num):
    return num
A = [equal(x) for x in A]

ans = 0

for l in range(N):
    ans += A.count(A[l]) - 1

ans = ans / 2
re = ans

for k in range(N):
    ans -= A.count(A[k]) - 1

    print(int(ans))

    ans = re

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

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

input_1 = input()
input_2 = input_1.split()

A = map(int, input_2)

def equal(num):
    return num
A = [equal(x) for x in A]

for k in range(N):
    ans = 0

    re = A[k]
    A.remove(A[k])

    for l in range(N - 1):
        ans += A.count(A[l]) - 1

    ans = ans / 2

    A.insert(k,re)

    print(int(ans))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

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

input_1 = input()
input_2 = input_1.split()

for k in range(N):
    A = map(int, input_2)

    def equal(num):
        return num
    A = [equal(x) for x in A]

    ans = 0

    A.remove(A[k])

    for l in range(N - 1):
        ans += A.count(A[l]) - 1

    ans = ans / 2

    print(int(ans))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

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

input_1 = input()
input_2 = input_1.split()

for k in range(N):
    A = map(int, input_2)

    def equal(num):
        return num / 1
    A = [equal(x) for x in A]

    ans = 0

    A.remove(A[k])

    for l in range(N - 1):
        for m in range(N - 1):
            if A[l] == A[m]:
                ans += 1
        
        ans -= 1

    ans = ans / 2

    print(int(ans))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))

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

input_1 = input()
input_2 = input_1.split()

for k in range(N):
    A = map(int, input_2)

    #?
    def half(num):
        return num / 2
    def double(num):
        return num * 2
    A = [half(x) for x in A]
    A = [double(x) for x in A]
    #?

    ans = 0

    A.remove(A[k])

    for l in range(N - 1):
        for m in range(N - 1):
            if A[l] == A[m]:
                ans += 1
        
        ans -= 1

    ans = ans / 2

    print(int(ans))

Fixed submission:
#TLE
n = int(input())
a = input().split()
ans = 0
import collections
dic = collections.Counter(a)
for i in dic.values():
    ans += i * (i-1)
ans /= 2
for i in range(n):
    print(int(ans - dic[a[i]] + 1))