Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
M=np.array(M)
c_list=[]
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)

Fixed submission:
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
M=np.array(M)
c_list=[]
ans=0
for i in range(1,max(M)+1):
    num=np.count_nonzero(M == i)
    c_list.append(num)
    #num = M.count(i)
    ans+=(num*(num-1))//2
for k in range(N):
    num=c_list[M[k]-1]-1
    #num = M.count(M[k])-1
    print(ans-num)

Fixed submission:
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
#M=np.array(M)
c_list=[]
ans=0
for i in range(1,max(M)+1):
    #num=np.count_nonzero(M == i)
    num = M.count(i)
    ans+=(num*(num-1))//2
for k in range(N):
    #num=(np.count_nonzero(M ==M[k]))-1
    num = M.count(M[k])-1
    print(ans-num)

Fixed submission:
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
M=np.array(M)
c_list=[]
ans=0
for i in range(1,max(M)+1):
    num=np.count_nonzero(M == i)
    ans+=(num*(num-1))//2
for k in range(N):
    num=(np.count_nonzero(M ==M[k]))-1
    print(ans-num)

Fixed submission:
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
M=np.array(M)
c_list=[]
ans=0
for i in range(1,max(M)+1):
    num=np.count_nonzero(M == i)
    ans+=(num*(num-1))//2
for k in range(N):
    num=(np.count_nonzero(M ==M[k]))-1
    print(ans-num)

Fixed submission:
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
M=np.array(M)
c_list=[]
for i in range(1,N+1):
    c_list.append(np.count_nonzero(M == i))
for k in range(N):
    c_list[M[k]-1]-=1
    l=np.array(list(filter((lambda x: x >=2),c_list)))
    ans=sum(l*(l-1))//2
    print(ans)
    c_list[M[k] - 1] += 1

Fixed submission:
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)