Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k=np.array(list(Counter(a).keys()))
t=np.array(list(Counter(a).values()))
l=np.ones(len(t))
for i in range(n):
  s=np.copy(t)
  s[int(np.where(k==a[i])[0])]-=1
  print(int(sum(s*(s-l)//2)))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k=np.array(list(Counter(a).keys()))
t=np.array(list(Counter(a).values()))
l=np.ones(len(t))
for i in range(n):
  s=np.copy(t)
  s[int(np.where(k==a[i])[0])]-=1
  print(int(sum(s*(s-l)//2)))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k=np.array(list(Counter(a).keys()))
t=np.array(list(Counter(a).values()))
l=np.ones(len(t))
for i in range(n):
  s=np.copy(t)
  s[int(np.where(k==a[i])[0])]-=1
  print(int(sum(s*(s-l)//2)))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
import numpy as np
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
k=list(Counter(a).keys())
t=list(Counter(a).values())
for i in range(n):
  s=np.array(copy.copy(t))
  s[k.index(a[i])]-=1
  d = int(sum(s*(s-np.ones(len(s)))//2))
  print(d)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])

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

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  ans = 0
  b = copy.copy(a)
  b.pop(i)
  c = np.array(list(collections.Counter(b).values()))
  d = int(sum(c*(c-np.ones(len(c)))//2))
  print(d)
  

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])

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

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  ans = 0
  b = copy.copy(a)
  b.pop(i)
  c = np.array(list(collections.Counter(b).values()))
  d = int(sum(c*(c-np.ones(len(c)))//2))
  print(d)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  ans = 0
  b = copy.copy(a)
  b.pop(i)
  c = list(set(b))
  for j in range(len(c)):
    d = b.count(c[j])
    ans += (d*(d-1))//2
  print(ans)
  
         

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])