human
Minimum operations to make counts of remainders same in an array | Function to return the minimum number of operations required.
To store modulos values.
If it 's size greater than k  it needed to be decreased.
If it 's size is less than k  it needed to be increased.
Driver code"
Solution in Python:
assistant
#Here is code to minimum operations to make counts of remainders same in an array and the other steps required.
 def minOperations ( n , a , m ) :
	k = n // m
	val = [ [ ] for i in range ( m ) ]
	for i in range ( 0 , n ) :
		val [ a [ i ] % m ] . append ( i )
	ans = 0
	extra = [ ]
	for i in range ( 0 , 2 * m ) :
		cur = i % m
		while len ( val [ cur ] ) > k :
			elem = val [ cur ] . pop ( )
			extra . append ( ( elem , i ) )
		while ( len ( val [ cur ] ) < k and len ( extra ) > 0 ) :
			elem = extra [ - 1 ] [ 0 ]
			mmod = extra [ - 1 ] [ 1 ]
			extra . pop ( )
			val [ cur ] . append ( elem )
			ans += i - mmod
	return ans
if __name__ == " _ _ main _ _ " :
	m = 3
	a = [ 3 , 2 , 0 , 6 , 10 , 12 ]
	n = len ( a )
	print ( minOperations ( n , a , m ) )