Buggy python submission (verdict: Runtime Error):
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
ans=[0]*n
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for a,b in data_cnt.items():
    if 2<=b:
        ans[a]=int(count-b+1)
for i in data:
    print(ans[i-1])

Fixed submission:
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for i in data:
    ans=count-data_cnt[i]+1
    print(int(ans))

Buggy python submission (verdict: Runtime Error):
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
ans=[0]*n
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for a,b in data_cnt.items():
    ans[a]=int(count-b+1)
for i in data:
    print(ans[i])

Fixed submission:
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for i in data:
    ans=count-data_cnt[i]+1
    print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for i in data:
    ans=count+(calc_combi2(data_cnt[i]-1)-calc_combi2(data_cnt[i]))
    print(int(ans))

Fixed submission:
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for i in data:
    ans=count-data_cnt[i]+1
    print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import math
import copy
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
for i in range(n):
    count=0
    cp=copy.copy(data)
    cp.pop(i)
    cp_cnt=list(collections.Counter(cp).values())
    for j in cp_cnt:
        if 2<=j:
            count+=int(calc_combi2(j))
    print(count)
    

Fixed submission:
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for i in data:
    ans=count-data_cnt[i]+1
    print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import math
import copy
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
for i in range(n):
    count=0
    cp=copy.copy(data)
    cp.pop(i)
    cp_cnt=collections.Counter(cp)
    for j in cp_cnt.values():
        count+=int(calc_combi2(j))
    print(count)
    

Fixed submission:
import math
import collections
def calc_combi2(n):
    if n<=1:
        return 0
    return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))
n=int(input())
data=list(map(int,input().split()))
data_cnt=collections.Counter(data)
count=0
for i in data_cnt.values():
    count+=calc_combi2(i)
for i in data:
    ans=count-data_cnt[i]+1
    print(int(ans))