human
What is a code to count all distinct pairs of repeating elements from the array for every array element and the other steps required given the following:
Count all distinct pairs of repeating elements from the array for every array element | Function to prthe required count of pairs excluding the current element.
Store the frequency.
Find all the count.
Delete the contribution of each element for equal pairs.
Print the answer.
Driver Code.
Given array arr [ ].
Function call"
Solution in Python:
assistant
#Here is code to count all distinct pairs of repeating elements from the array for every array element and the other steps required.
 def solve ( arr , n ) :
	mp = { }
	for i in arr :
		mp [ i ] = mp . get ( i , 0 ) + 1
	cnt = 0
	for x in mp :
		cnt += ( ( mp [ x ] ) * ( mp [ x ] - 1 ) // 2 )
	ans = [ 0 ] * n
	for i in range ( n ) :
		ans [ i ] = cnt - ( mp [ arr [ i ] ] - 1 )
	for i in ans :
		print ( i , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 1 , 2 , 1 , 2 ]
	N = len ( arr )
	solve ( arr , N )