human
Cake Distribution Problem | Function to return the remaining count of cakes.
Sum for 1 cycle.
no . of full cycle and remainder.
Driver code"
How can the above be solved in Python?

What is a code to cake Distribution Problem and the other steps required?
assistant
#Here is code to cake Distribution Problem and the other steps required.
 def cntCakes ( n , m ) :
	sum = ( n * ( n + 1 ) ) // 2
	quo , rem = m // sum , m % sum
	ans = m - quo * sum
	x = int ( ( - 1 + ( 8 * rem + 1 ) ** 0.5 ) / 2 )
	ans = ans - x * ( x + 1 ) // 2
	return ans
def main ( ) :
	n = 4
	m = 11
	ans = cntCakes ( n , m )
	print ( ans )
main ( )