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

u = list(set(A))
c = []
sum = 0
for j in u:
    _ = A.count(j)
    c.append(_)
    sum += int(_ * (_ - 1) / 2)

s = ""
for k in A:
    v = c[u.index(k)]
    s += str(sum - v + 1) + "\n"
print(s)


Fixed submission:
import collections

N = int(input())
A = [int(i) for i in input().split()]

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)

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

u = list(set(A))
c = []
sum = 0
for j in u:
    _ = A.count(j)
    c.append(_)
    sum += int(_ * (_ - 1) / 2)

s = ""
for k in range(N):
    v = c[u.index(A[k])]
    s += str(sum - v + 1) + "\n"
print(s)

Fixed submission:
import collections

N = int(input())
A = [int(i) for i in input().split()]

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])

u = list(np.unique(A))
c = []
sum = 0
for j in u:
    _ = len(np.where(A == j)[0])
    c.append(_)
    sum += int(_ * (_ - 1) / 2)

s = ""
for k in range(N):
    v = c[u.index(A[k])]
    s += str(sum - v + 1) + "\n"
print(s)

Fixed submission:
import collections

N = int(input())
A = [int(i) for i in input().split()]

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])

u = list(np.unique(A))
c = []
sum = 0
for j in u:
    _ = len(np.where(A == j)[0])
    c.append(_)
    sum += int(_ * (_ - 1) / 2)

for k in range(N):
    v = c[u.index(A[k])]
    print(sum - v + 1)

Fixed submission:
import collections

N = int(input())
A = [int(i) for i in input().split()]

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = [int(i) for i in input().split()]


def solve(a):
    ar = np.array(a)
    u= np.unique(ar)
    c = 0
    for j in u:
      v = len(np.where(a==j)[0])
      c += int(v*(v-1)/2)
    print(c)

for k in range(N):
    p_A = A[:k] + A[k+1:]
    solve(p_A)

Fixed submission:
import collections

N = int(input())
A = [int(i) for i in input().split()]

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)

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

N = int(input())
A = [int(i) for i in input().split()]


def solve(a):
    ar = np.array(a)
    u, counts = np.unique(ar, return_counts=True)
    c = 0
    for v in counts:
        c += int(v*(v-1)/2)
    print(c)

for k in range(N):
    p_A = A[:k] + A[k+1:]
    solve(p_A)

Fixed submission:
import collections

N = int(input())
A = [int(i) for i in input().split()]

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)