Buggy python submission (verdict: Time Limit Exceeded):
import copy

n=int(input())
a=list(map(int,input().split()))

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in range(0,n):
  print('{:.0f}'.format(c-a.count(a[i])+1))


Fixed submission:
import copy

n=int(input())
a=list(map(int,input().split()))

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in a:
  print('{:.0f}'.format(c-a_uniq[i]+1))

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n=int(input())
a=list(map(int,input().split()))

c=0
a_uniq=list(set(a))

for i in a_uniq:
  c+=sum(range(1, a.count(i)))

for i in range(0,n):
  print('{:.0f}'.format(c-a.count(a[i])+1))


Fixed submission:
import copy

n=int(input())
a=list(map(int,input().split()))

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in a:
  print('{:.0f}'.format(c-a_uniq[i]+1))

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n=int(input())
a=list(map(int,input().split()))

c=0
a_uniq=list(set(a))

for i in a_uniq:
  c+=a.count(i)*(a.count(i)-1)/2

for i in range(0,n):
  print('{:.0f}'.format(c-a.count(a[i])+1))


Fixed submission:
import copy

n=int(input())
a=list(map(int,input().split()))

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in a:
  print('{:.0f}'.format(c-a_uniq[i]+1))

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n=int(input())
a=list(map(int,input().split()))

c=0
a_uniq=list(set(a))

for i in a_uniq:
  c+=a.count(i)*(a.count(i)-1)/2

for i in range(0,n):
  print('{:.0f}'.format(c-a.count(a[i])+1))


Fixed submission:
import copy

n=int(input())
a=list(map(int,input().split()))

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in a:
  print('{:.0f}'.format(c-a_uniq[i]+1))

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n=int(input())
a=list(map(int,input().split()))

for i in range(0,n):
  c=0
  a_c=copy.copy(a)
  a_c.pop(i)
  a_uniq=list(set(a_c))
  for i in a_uniq:
    c+=a_c.count(i)*(a_c.count(i)-1)/2
  print('{:.0f}'.format(c))


Fixed submission:
import copy

n=int(input())
a=list(map(int,input().split()))

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in a:
  print('{:.0f}'.format(c-a_uniq[i]+1))

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n=int(input())
a=list(map(int,input().split()))

for i in range(0,n):
  a_c=copy.copy(a)
  a_c.pop(i)
  a_uniq=list(set(a_c))
  c=0
  for i in a_uniq:
    x=a_c.count(i)
    c+=x*(x-1)/2
  print('{:.0f}'.format(c))


Fixed submission:
import copy

n=int(input())
a=list(map(int,input().split()))

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in a:
  print('{:.0f}'.format(c-a_uniq[i]+1))