Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
e=list(set(a))                                                                     s=0                                                                                t=[0]*200000                                                                       for i in a:
    t[i]+=1                                                                        for j in e:                                                                            k=t[j]                                                                             s+=(k*(k-1))//2
for u in a:
    print(s-t[u]+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*n
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
alist=[0]*n
for j in aset:
    k=a.count(j)
    alist[j]=k
    ans+=(k*(k-1))//2
for u in a:
    print(ans-alist[u]+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
alist=[ 0 for i in range(n)]
for j in aset:
    k=a.count(j)
    alist[j-1]=k
    ans+=(k*(k-1))//2
for u in a:
    print(ans-alist[u-1]+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
alist=[ 0 for i in range(n)]
for _ in a:
    alist[_ - 1] += 1
for j in aset:
    k=a.count(j)
    ans += (k*(k-1)) // 2
for u in a:
    print(ans - alist[u - 1]+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
alist=[ 0 for i in range(n)]
for _ in a:
    alist[_ - 1] += 1
for j in aset:
    k=a.count(j)                                                                       ans += (k*(k-1)) // 2                                                          for u in a:
    print(ans - alist[u - 1]+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
alist=[ 0 for i in range(n)]
for _ in a:
    alist[_ - 1] += 1
for j in aset:
    ans += (a.count(j)*(a.count(j)-1)) // 2
for u in a:
    print(ans - alist[u - 1]+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

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

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n=int(input())
a=list(map(int,input().split()))
anslist=[]
alist=[]
for i in range(n):
    if(a[i] in alist):
        anslist.append(0)
        print(anslist[a.index(a[i])])
        continue
    else:
        alist.append(a[i])
        ans = 0
        ad=copy.copy(a)
        del(ad[i])
        adset=list(set(ad))
        for j in adset:
            if(ad.count(j)>=2):
                ans += (ad.count(j)*(ad.count(j)-1)) // 2
            else:
                continue
    anslist.append(ans)
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)

Buggy python submission (verdict: Runtime Error):
import copy
n=int(input())
a=list(map(int,input().split()))
a2=copy.copy(a)
for i in a2:
    a.append(i)
    ad=a[i+1:n+i]
    ans = 0                                                                            adset=list(set(ad))
    for j in adset:
        k = ad.count(j)                                                                    if(k >= 2):                                                                           ans += (k*(k-1))//2                                                             else:
            continue
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+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
    ad=copy.copy(a)
    del(ad[i])
    adset=list(set(ad))
    for j in adset:
        if(ad.count(j)>=2):
           ans += (ad.count(j)*(ad.count(j)-1)) /2
        else:
            continue
    print(int(ans))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
    al[i]+=1
for j in aset:
    k=al[j]
    ans+=(k*(k-1))//2
for u in a:
    print(ans-al[u]+1)