Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=list(set(L))
x=0
for i in range(len(C)):
  a = L.count(C[i])
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-L.count(L[K])+1)

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=list(set(L))
x=0
for i in range(len(C)):
  x += int((L.count(C[i]))*(L.count(C[i])-1)/2)  
for K in range(N):
  print(x-L.count(L[K])+1)

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
count=[0]*N
C=list(set(L))
x=0
d=[0]*len(C)
e=[0]*N
for i in range(len(C)):
  d[i] = int((L.count(C[i]))*(L.count(C[i])-1)/2)
  x += d[i]  
for K in range(N):
  e[K] = L.count(L[K])-1
  print(x-e[K])


Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
count=[0]*N
C=list(set(L))
x=0
d=[0]*len(C)
e=[0]*N
for i in range(len(C)):
  d[i] = int((L.count(C[i]))*(L.count(C[i])-1)/2)
  x += d[i]  
for K in range(N):
  e[K] = L.count(L[K])-1
  print(x-e[K])


Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
count=[0]*N
for K in range(N):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(L[0:K]+L[K+1:]))
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    d[i] = int((B.count(C[i]))*(B.count(C[i])-1)/2)
    x += d[i]
  print(x)


Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
count=[0]*N
for K in range(N):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(L[0:K]+L[K+1:]))
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    d[i] = int((B.count(C[i]))*(B.count(C[i])-1)/2)
    x += d[i]
  print(x)


Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    d[i] = int((B.count(C[i]))*(B.count(C[i])-1)/2)
    x += d[i]
  return x

for k in range(N):
  count[k]=f(k,A)

for i in count:
  print(i)

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    d[i] = int((B.count(C[i]))*(B.count(C[i])-1)/2)
    x += d[i]
  return x

for k in range(N):
  count[k]=f(k,A)

for i in count:
  print(i)

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    d[i] = int((B.count(C[i]))*(B.count(C[i])-1)/2)
    x += d[i]
  return x


for k in range(N):
  count[k]=f(k,A)

for i in count:
  print(i)

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  c = [0]*len(C)
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    c[i] = B.count(C[i])
    d[i] = int((c[i])*(c[i]-1)/2)
    x += d[i]
  return x


for k in range(N):
  count[k]=f(k,A)

for i in count:
  print(i)

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  c = [0]*len(C)
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    c[i] = B.count(C[i])
    d[i] = int((c[i])*(c[i]-1)/2)
    x += d[i]
  return x


for k in range(N):
  count[k]=f(k,A)

for i in count:
  print(i)

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  c = [0]*len(C)
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    c[i] = B.count(C[i])
    d[i] = int((c[i])*(c[i]-1)/2)
    x += d[i]
  return x


for k in range(N):
  count[k]=f(k,A)

for i in range(len(count)):
  print(count[i])

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  c = [0]*len(C)
  d = [0]*len(C)
  for i in range(len(C)):
    c[i] = B.count(C[i])
    d[i] = int((c[i])*(c[i]-1)/2)
  return sum(d)

for k in range(N):
  count[k]=f(k,A)

for i in range(len(count)):
  print(count[i])

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=[]
for K in range(N):
  a=0
  for i in range(N):
    for j in range(N-1-i):
      if A[i] == A[j+1+i] and (i != K and (j+1+i) != K):
#        print("start")
#        print(i)
#        print(j+1+i)
#        print(K)
#        print(A[i] == A[j+1+i] and (i != K or (j+1+i) != K))
        a += 1
#        print(a)
  count.append(a)
for i in range(len(count)):
  print(count[i])

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=[]
for K in range(N):
  a=0
  for i in range(N):
    for j in range(N-1-i):
      if A[i] == A[j+1+i] and (i != K and (j+1+i) != K):
#        print("start")
#        print(i)
#        print(j+1+i)
#        print(K)
#        print(A[i] == A[j+1+i] and (i != K or (j+1+i) != K))
        a += 1
#        print(a)
  count.append(a)
for i in range(len(count)):
  print(count[i])

Fixed submission:
import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)