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

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * n
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)


Fixed submission:
import numpy as np

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)

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

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * n
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  nd = d[a[i]]
  ans = sum-(nd*(nd-1))//2
  nd -= 1
  if nd>1:
    ans += (nd*(nd-1))//2
  print(ans)


Fixed submission:
import numpy as np

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)

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

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * n
s = {}

for i in a:
  d[i-1] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  nd = d[a[i]]
  ans = sum-(nd*(nd-1))//2
  nd -= 1
  if nd>1:
    ans += (nd*(nd-1))//2
  print(ans)


Fixed submission:
import numpy as np

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)

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

n = int(input())

a = np.array(list(map(int, input().split())))
d = {}
s = {}

for i in set(a):
  d[i] = len(a[a==i])
  
sum = 0
for k in d.values():
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  nd = d[a[i]]
  ans = sum-(nd*(nd-1))//2
  nd -= 1
  if nd>1:
    ans += (nd*(nd-1))//2
  print(ans)


Fixed submission:
import numpy as np

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)

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

n = int(input())

a = np.array([i for i in list(map(int, input().split()))])
d = {}
s = {}

for i in set(a):
  d[i] = len(a[a==i])
  
sum = 0
for k in d.values():
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  nd = d[a[i]]
  ans = sum-(nd*(nd-1))//2
  nd -= 1
  if nd>1:
    ans += (nd*(nd-1))//2
  print(ans)

Fixed submission:
import numpy as np

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)

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

n = int(input())

a = np.array([i for i in list(map(int, input().split()))])
d = {}
s = {}

for i in sorted(set(a)):
  d[i] = len(a[a==i])
  
sum = 0
for i in d:
  k = d[i]
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  nd = d[a[i]]
  ans = sum-(nd*(nd-1))//2
  nd -= 1
  if nd>1:
    ans += (nd*(nd-1))//2
  print(ans)

Fixed submission:
import numpy as np

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)

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

n = int(input())

a = [i for i in list(map(int, input().split()))]

for i in range(n):
  aa = a[:]
  aa.pop(i)
  ab=np.array(aa)
  num=0
  for j in set(aa):
    ns = len(ab[ab==j])
    if ns>1:
      num += (ns*(ns-1))//2

  print(num)

Fixed submission:
import numpy as np

n = int(input())

a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}

for i in a:
  d[i] += 1
  
sum = 0
for k in d:
  if k>1:
    sum += (k*(k-1))//2

for i in range(n):
  ans=sum-d[a[i]]+1
  print(ans)