Buggy python submission (verdict: Time Limit Exceeded):

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])
    
for i in A:
    print(int(count_sum-(np.count_nonzero(A==i)-1)))

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

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

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_sum = np.sum([np.count_nonzero(A==i)*(np.count_nonzero(A==i)-1)/2 for i in A_set])
    
for i in A:
    print(int(count_sum-(np.count_nonzero(A==i)-1)))

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_sum = np.sum([np.count_nonzero(A==i)*(np.count_nonzero(A==i)-1)/2 for i in A_set])
    
for i in A:
    print(int(count_sum-(np.count_nonzero(A==i)-1)))

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

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

N = int(input())
A = list(map(int, input().split()))
A_set = set(A)

count_sum = np.sum([A.count(i)*(A.count(i)-1)/2 for i in A_set])
    
for i in A:
    print(int(count_sum-(A.count(i)-1)))

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

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

count_dic = {}
for i in A_set:
    C = A.count(i)
    count_dic[i] = C*(C-1)/2
    
sum_dic = sum(count_dic.values())
    
for i in A:
    print(int(sum_dic-(A.count(i)-1)))

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
#import collections

N = int(input())
A = list(map(int, input().split()))
#A = [1, 2, 1, 4, 2, 1, 4, 1]

count_dic = {}
for i in A:
    C = A.count(i)
    count_dic[i] = C*(C-1)/2

for i in A:
    print(int(sum(count_dic.values())-(A.count(i)-1)))

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

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

N = int(input())
A = list(map(int, input().split()))
#A = [1, 2, 1, 4, 2, 1, 4, 1]

c = collections.Counter(A)
#print(c)

count_dic = {}
for i in c.keys():
    count = 0
    c_copy = c.copy()
    c_copy[i] = c[i]-1
    #print(c_copy)
    for k in c.keys():
        count += int(c_copy[k]*(c_copy[k]-1)/2)
        count_dic[i] = count
        #print(count)
    #print(count_dic)

for i in range(N):
    print(count_dic[A[i]])

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

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

N = int(input())
A = list(map(int, input().split()))
#A = [1, 2, 1, 4, 2, 1, 4, 1]

c = collections.Counter(A)
#print(c)

count_dic = {}
for i in c.keys():
    count = 0
    c_copy = c.copy()
    c_copy[i] = c[i]-1
    #print(c_copy)
    for k in c.keys():
        count += int(c_copy[k]*(c_copy[k]-1)/2)
        count_dic[i] = count
        #print(count)
    #print(count_dic)

for i in range(N):
    print(count_dic[A[i]])

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)