Finding the maximum elements that can be made to 0 in a sequence using a operation


We have a sequence that follows a linear equation y = bx+c (b and c are known). The range of x is 1 to infinity. There is an operation named m-clear. In one m-clear operation, we can decrement 1, from at most m distinct numbers in the sequence. Now given a starting ‘x’ value, a ‘m’ value and another value named ‘k’ which represents the maximum m-clear operations that can be performed, find the maximum number of consequtive elements that can be made to zero starting from y(x) in the sequence.

Example: b = 1 c = 1 x = 7 m = 2 k = 10 Ans is 2