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

N = int(input())
A = np.array(list(map(int,input().split())))
maxim = max(A)
select_num = 0
count_num = np.array([0]*(maxim+1))
for i in A:
  count_num[i] += 1
for i in range(1,maxim+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
N = int(input())
A = np.array(list(map(int,input().split())))
maxim = max(A)
select_num = 0
count_num = np.array([0]*(maxim+1))
for i in range(1,maxim+1):
  temp = np.count_nonzero(A == i)
  count_num[i] = temp
  select_num += (temp)*(temp - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

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

input = sys.stdin.readline

N = int(input())
A = np.array(list(map(int,input().split())))
maxim = max(A)
select_num = np.array([0]*(maxim+1))
select_num2 = np.array([0]*(maxim+1))
count_num = np.array([0]*(maxim+1))


for i in range(1,maxim+1):
  temp = np.count_nonzero(A == i)
  count_num[i] = temp
  if(temp > 1):
    select_num[i] = (temp)*(temp - 1)//2
    select_num2[i] = temp - 1
sumS = np.sum(select_num)
ans1,ans2 = sumS,select_num2
for i in A:
  print(ans1 -ans2[i])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline

N = int(input())
A = np.array(list(map(int,input().split())))
maxim = max(A)
#select_num = np.array([0 for _ in range(0,maxim+1)])
select_num = np.array([0]*(maxim+1))
select_num2 = np.array([0]*(maxim+1))
count_num = np.array([0]*(maxim+1))
for i in range(1,maxim+1):
  temp = np.count_nonzero(A == i)
  count_num[i] = temp
  if(temp > 1):
    select_num[i] = (temp)*(temp - 1)//2
    select_num2[i] = temp - 1
sumS = np.sum(select_num)
for i in range(N):
  print(sumS -select_num2[A[i]])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
maxim = max(A)
select_num = [0 for i in range(0,maxim+1)]
select_num2 = [0 for i in range(0,maxim+1)]
count_num = [0 for i in range(0,maxim+1)]
for i in range(1,maxim+1):
  count_num[i] = A.count(i)
  if(count_num[i] > 1):
    select_num[i] = (count_num[i])*(count_num[i] - 1)//2
    select_num2[i] = count_num[i] - 1
sumS = sum(select_num)
for i in range(N):
  print(sumS -select_num2[A[i]])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
maxim = max(A)
select_num = [0 for i in range(0,maxim+1)]
select_num2 = [0 for i in range(0,maxim+1)]
count_num = [0 for i in range(0,maxim+1)]
for i in range(1,maxim+1):
  count_num[i] = A.count(i)
  if(count_num[i] > 1):
    select_num[i] = (count_num[i])*(count_num[i] - 1)//2
    select_num2[i] = count_num[i] - 1
sumS = sum(select_num)
for i in range(N):
  print(sumS -select_num2[A[i]])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
maxim = max(A)
select_num = [0 for i in range(0,maxim+1)]
select_num2 = [0 for i in range(0,maxim+1)]
count_num = [0 for i in range(0,maxim+1)]
for i in range(1,maxim+1):
  count_num[i] = A.count(i)
  if(count_num[i] > 1):
    select_num[i] = (count_num[i])*(count_num[i] - 1)//2
    select_num2[i] = count_num[i] - 1
sumS = sum(select_num)
for i in range(N):
  print(sumS -select_num2[A[i]])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
maxim = max(A)
select_num = [0 for i in range(0,maxim+1)]
select_num2 = [0 for i in range(0,maxim+1)]
count_num = [0 for i in range(0,maxim+1)]
for i in range(1,maxim+1):
  count_num[i] = A.count(i)
  if(count_num[i] > 1):
    select_num[i] = (count_num[i] - 0)*(count_num[i] - 1)//2
  	select_num2[i] = count_num[i] - 1
sumS = sum(select_num)
for i in range(N):
  print(sumS -select_num2[A[i]])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
select_num = [0 for i in range(N+1)]
select_num2 = [0 for i in range(N+1)]
maxim = max(A)
count_num = [0 for i in range(maxim+1)]
for i in range(1,maxim+1):
  count_num[i] = A.count(i)
  select_num[i] = (count_num[i] - 0)*(count_num[i] - 1)//2
  select_num2[i] = count_num[i] - 1
sumS = sum(select_num)
for i in range(N):
  s = select_num2[A[i]] 
  print(sumS -s)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

select_num = 0
count_num = [0]*(N+1)
for i in A:
  count_num[i] += 1
for i in range(1,N+1):
  select_num += (count_num[i])*(count_num[i] - 1)//2
for i in A:
  print(select_num -count_num[i] + 1)