Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)
count_dict_fake = [0] * N
for each in a_types:
    count_dict_fake[each - 1] = A.count(each)

count_dict = [0] * N
for each in A:
    count_dict[each - 1] += 1

all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a - 1] + 1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)
for each in a_types:
    count_dict[each - 1] += A.count(each)

count_dict = [0] * N
for each in A:
    count_dict[each - 1] += 1

all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a - 1] + 1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
A = list(map(int, input().split()))

count_dict = [0] * N
for each in A:
    count_dict[each] += 1

all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a] + 1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = [0] * N
for each in A:
    count_dict[each] = A.count(each)

all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a] + 1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = [0] * N
for each in a_types:
    count_dict[each] = A.count(each)

all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a] + 1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = {}
for each in a_types:
    count_dict[each] = A.count(each)

all_types = 0
for value in count_dict.values():
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a] + 1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = {}
for each in a_types:
    count_dict[each] = A.count(each)

all_types = 0
for value in count_dict.values():
    all_types += value * (value - 1) // 2

result_dict = {}
for each in a_types:
    result_dict[each] = int(all_types - count_dict[each] + 1)

for a in A:
    print(result_dict[a])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = {}
for each in a_types:
    count_dict[each] = A.count(each)

all_types = 0
for value in count_dict.values():
    all_types += value * (value - 1) / 2

result_dict = {}
for each in a_types:
    result_dict[each] = int(all_types - count_dict[each] + 1)

for a in A:
    print(result_dict[a])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = {}
for each in a_types:
    count_dict[each] = A.count(each)

all_types = 0
for value in count_dict.values():
    all_types += value * (value - 1) / 2

for a in A:
    print(int(all_types - count_dict[a] + 1))
# no_execlusion_results = {}
# for each in a_types:
#     no_execlusion_results[each] = 
# result_dict = {}
# for each in a_types:
#     tmp_dict = copy.deepcopy(count_dict)
#     tmp_dict[each] = count_dict[each] - 1
#     combinations = 0
#     for value in tmp_dict.values():
#         combinations += int(value * (value - 1) / 2)
#     result_dict[each] = combinations
# 
# print(result_dict)
# for a in A:
#     print(result_dict[a])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = {}
for each in a_types:
    count_dict[each] = A.count(each)

result_dict = {}
for each in a_types:
    tmp_dict = copy.deepcopy(count_dict)
    tmp_dict[each] = count_dict[each] - 1
    combinations = 0
    for value in tmp_dict.values():
        combinations += int(value * (value - 1) / 2)
    result_dict[each] = combinations

for a in A:
    print(result_dict[a])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = {}
for each in a_types:
    count_dict[each] = A.count(each)

for a in A:
    tmp_dict = copy.deepcopy(count_dict)
    tmp_dict[a] = count_dict[a] - 1
    combinations = 0
    for value in tmp_dict.values():
        combinations += int(value * (value - 1) / 2)
    print(combinations)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)