Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-A.count(A[i]))

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 0

for n in c.items():
  if n[1] > 1:
    total += n[1]*(n[1]-1)//2

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

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 0

for n in c.items():
  if n[1] > 1:
    total += n*(n-1)//2

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

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 0

for n in c.items():
  if n[1] > 1:
    total += math.factorial(n[1]) // (math.factorial(n[1]-2) * 2)

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

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)

l = [math.factorial(i[1]) // (math.factorial(i[1]-2) * 2) for i in c.items() if i[1] > 1]
ans = sum(l)

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

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
N = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(N):
  li = A[:i] + A[i+1:]
  c = collections.Counter(li)
  l = [math.factorial(i[1]) // (math.factorial(i[1]-2) * 2) for i in c.items() if i[1] > 1]
  print(sum(l))
  ans = 0

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
N = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(N):
  li = A[:i] + A[i+1:]
  c = collections.Counter(li)
  l = [i[1] for i in c.items() if i[1] > 1]
  for num in l:
    ans += math.factorial(num) // (math.factorial(num-2) * 2)
  print(ans)
  ans = 0

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])

Buggy python submission (verdict: Runtime Error):
import collections
import math
N = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(N):
  li = A[:i] + A[i+1]
  c = collections.Counter(li)
  l = [i for i in C.items() if i > 1]
  for num in l:
    ans += math.factorial(num) // (math.factorial(num-2) * 2)
    
print(ans)

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
total = 1

for n in c.items():
  total += n[1]*(n[1]-1)//2

for i in range(N):
  print(total-c[A[i]])