Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

num = input()
num = int(num)

str = input()
list_in = list(map(int, str.split()))

count_arr = np.zeros((num+1), dtype=np.int32)

for item in list_in:
    count_arr[item] += 1

sum = 0
for i in range(num+1):
    tmp = count_arr[i]
    tmp = (tmp * (tmp -1))//2
    sum += tmp

for item in list_in:
    tmp = count_arr[item]
    result = sum - (tmp - 1)
    print(result)


Fixed submission:
import numpy as np

num = input()
num = int(num)

str = input()
list_in = list(map(int, str.split()))

count_arr = [0]*num

for item in list_in:
    count_arr[item-1] += 1

sum = 0
for i in range(num):
    tmp = count_arr[i-1]
    tmp = (tmp * (tmp -1))//2
    sum += tmp

for item in list_in:
    tmp = count_arr[item-1]
    result = sum - (tmp - 1)
    print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

num = input()
num = int(num)

str = input()
list_in = str.split()
list_in = [int(x) for x in list_in]

count_arr = np.zeros((num+1), dtype=np.int32)

for item in list_in:
    count_arr[int(item)] += 1

sum = 0
for i in range(len(count_arr)):
    tmp = count_arr[i]
    tmp = (tmp * (tmp -1))//2
    sum += tmp

for item in list_in:
    tmp = count_arr[item] - 1
    result = (sum - tmp)
    print(result)


Fixed submission:
import numpy as np

num = input()
num = int(num)

str = input()
list_in = list(map(int, str.split()))

count_arr = [0]*num

for item in list_in:
    count_arr[item-1] += 1

sum = 0
for i in range(num):
    tmp = count_arr[i-1]
    tmp = (tmp * (tmp -1))//2
    sum += tmp

for item in list_in:
    tmp = count_arr[item-1]
    result = sum - (tmp - 1)
    print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

num = input()
num = int(num)

str = input()
list_in = str.split()

count_arr = np.zeros((num+1))
sum_arr = np.zeros((num+1))

for item in list_in:
    count_arr[int(item)] += 1

sum = 0
for i in range(len(count_arr)):
    tmp = count_arr[i]
    tmp = (tmp * (tmp -1))
    sum += tmp
    sum_arr[i] = tmp

for item in list_in:
    tmp = int(item)
    old_sum = sum_arr[tmp]
    tmp = count_arr[tmp] - 1
    tmp = (tmp * (tmp -1))
    result = (sum - old_sum + tmp)/2
    print(int(result))


Fixed submission:
import numpy as np

num = input()
num = int(num)

str = input()
list_in = list(map(int, str.split()))

count_arr = [0]*num

for item in list_in:
    count_arr[item-1] += 1

sum = 0
for i in range(num):
    tmp = count_arr[i-1]
    tmp = (tmp * (tmp -1))//2
    sum += tmp

for item in list_in:
    tmp = count_arr[item-1]
    result = sum - (tmp - 1)
    print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

num = input()
num = int(num)

str = input()
list_in = str.split()

count_arr = np.zeros((num+1))
sum_arr = np.zeros((num+1))

for item in list_in:
    count_arr[int(item)] += 1

sum = 0
for i in range(len(count_arr)):
    tmp = count_arr[i]
    tmp = (tmp * (tmp -1)) / 2
    sum += tmp
    sum_arr[i] = tmp

for item in list_in:
    tmp = int(item)
    old_sum = sum_arr[tmp]
    tmp = count_arr[tmp] - 1
    tmp = (tmp * (tmp -1)) / 2
    result = sum - old_sum + tmp
    print(int(result))


Fixed submission:
import numpy as np

num = input()
num = int(num)

str = input()
list_in = list(map(int, str.split()))

count_arr = [0]*num

for item in list_in:
    count_arr[item-1] += 1

sum = 0
for i in range(num):
    tmp = count_arr[i-1]
    tmp = (tmp * (tmp -1))//2
    sum += tmp

for item in list_in:
    tmp = count_arr[item-1]
    result = sum - (tmp - 1)
    print(result)