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

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
B = copy.copy(A)
Num = list(set(B))
for num in Num:
    count += nC2(B.count(num))
#print(count)

for k in range(n):
    B = copy.copy(A)
    num = B.pop(k)
#    print()
#    print(k, num, B)
    print(count - B.count(num))

Fixed submission:
import copy
from collections import Counter

l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
c = Counter

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
C = Counter(A)
for num in C.values():
    count += num*(num-1)//2
#print(count)

for a in A:
    print(count - (C[a] - 1))

Buggy python submission (verdict: Runtime Error):
import copy

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
B = copy.copy(A)
Num = list(set(B))
for num in Num:
    count += nC2(B.count(num))
#print(count)

for k in range(n):
    B = copy.copy(A)
    num = B.pop(k)
#    print()
#    print(k, num, B)
    print(countAll - B.count(num))

Fixed submission:
import copy
from collections import Counter

l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
c = Counter

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
C = Counter(A)
for num in C.values():
    count += num*(num-1)//2
#print(count)

for a in A:
    print(count - (C[a] - 1))

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

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

for k in range(n):
    B = copy.copy(A)
    B.pop(k)
#    print()
#    print(k, B)
    Num = list(set(B))
    
    count = 0
    for num in Num:
        count += nC2(B.count(num))
#        print(num, B.count(num))
    print(count)

Fixed submission:
import copy
from collections import Counter

l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
c = Counter

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
C = Counter(A)
for num in C.values():
    count += num*(num-1)//2
#print(count)

for a in A:
    print(count - (C[a] - 1))

Buggy python submission (verdict: Runtime Error):
import copy
import math

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

for k in range(n):
    B = copy.copy(A)
    B.pop(k)
#    print()
#    print(k, B)
    Num = list(set(B))
    
    count = 0
    for num in Num:
        count += combination(B.count(num), 2)
#        print(num, B.count(num))
    print(count)

Fixed submission:
import copy
from collections import Counter

l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
c = Counter

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
C = Counter(A)
for num in C.values():
    count += num*(num-1)//2
#print(count)

for a in A:
    print(count - (C[a] - 1))

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

def combination(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for k in range(n):
    B = copy.copy(A)
    B.pop(k)
#    print()
#    print(k, B)
    Num = list(set(B))
    
    count = 0
    for num in Num:
        count += combination(B.count(num), 2)
#        print(num, B.count(num))
    print(count)

Fixed submission:
import copy
from collections import Counter

l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
c = Counter

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
C = Counter(A)
for num in C.values():
    count += num*(num-1)//2
#print(count)

for a in A:
    print(count - (C[a] - 1))