Buggy python submission (verdict: Runtime Error):
import numpy as np
 
def comb2(n):
    return n*(n-1)//2

n = int(input())
 
a = np.array([int(i) for i in input().split()])
 
b = a+a.reshape(n,1)
 
e = np.ones(n, dtype=int) - np.identity(n, dtype=int)
 
c = b * e
 
for nums in c:
    sums = 0
    tmp, counts = np.unique(nums, return_counts=True)
    for num in counts:
        sums += comb2(num)
    print(sums)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
 
from collections import Counter
c=Counter(a)
 
max_c=0			# max combination
for i in c.values():
    max_c+=i*(i-1)//2     # 6+1+1 = 8
 
for num in a:
    k=c[num]      # 4 2 4 2 2 4 2 4
 
    print(max_c-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
                # 8 - 6 + 3
                # 5

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
 
from collections import Counter
c=Counter(a)
 
max_c=0			# max combination
for i in c.values():
    max_c+=i*(i-1)//2     # 6+1+1 = 8
 
for num in a:
    k=c[num]      # 4 2 4 2 2 4 2 4
 
    print(ans-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
                # 8 - 6 + 3
                # 5

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
 
from collections import Counter
c=Counter(a)
 
max_c=0			# max combination
for i in c.values():
    max_c+=i*(i-1)//2     # 6+1+1 = 8
 
for num in a:
    k=c[num]      # 4 2 4 2 2 4 2 4
 
    print(max_c-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
                # 8 - 6 + 3
                # 5

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

from collections import Counter
c=Counter(A)

ANS=0	# max combination
for i in C.values():
    ANS+=i*(i-1)//2     # 6+1+1 = 8
 
for a in A:
    k=C[a]      # 4 2 4 2 2 4 2 4
 
    print(ANS-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
                # 8 - 6 + 3
                # 5

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
 
from collections import Counter
c=Counter(a)
 
max_c=0			# max combination
for i in c.values():
    max_c+=i*(i-1)//2     # 6+1+1 = 8
 
for num in a:
    k=c[num]      # 4 2 4 2 2 4 2 4
 
    print(max_c-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
                # 8 - 6 + 3
                # 5

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

def comb2(n):
    return int(n*(n-1)/2)

n = int(input())

a = np.array([int(i) for i in input().split()])

b = a+a.reshape(n,1)

e = np.ones(n, dtype=int) - np.identity(n, dtype=int)


c = b * e

for nums in c:
    sums = 0
    tmp, counts = np.unique(nums, return_counts=True)
    for num in counts:
        sums += comb2(num)
    print(sums)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
 
from collections import Counter
c=Counter(a)
 
max_c=0			# max combination
for i in c.values():
    max_c+=i*(i-1)//2     # 6+1+1 = 8
 
for num in a:
    k=c[num]      # 4 2 4 2 2 4 2 4
 
    print(max_c-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
                # 8 - 6 + 3
                # 5

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

def comb2(n):
    return int(n*(n-1)/2)

n = int(input())

a = np.array([int(i) for i in input().split()])

b = a+a.reshape(n,1)

e = np.ones(n, dtype=int) - np.identity(n, dtype=int)


c = b * e

for i in range(n):
    sums = 0
    tmp, counts = np.unique(c[i], return_counts=True)
    for num in counts:
        sums += comb2(num)
    print(sums)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
 
from collections import Counter
c=Counter(a)
 
max_c=0			# max combination
for i in c.values():
    max_c+=i*(i-1)//2     # 6+1+1 = 8
 
for num in a:
    k=c[num]      # 4 2 4 2 2 4 2 4
 
    print(max_c-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
                # 8 - 6 + 3
                # 5