Im not getting the proper output.Could you help me resolve the code

@bhogadi.sreeja19,
You are getting incorrect output on sample test case, You should dry run on paper-pen to know where your code fails.

I have tried rechecking the entire code but i do not find any error .could u add or comment the code as needed for the correc

I have tried rechecking the entire code but i do not find any error . Dry run output is 3 .

@bhogadi.sreeja19,
What if cnt < c, that wouldn’t be a valid configuration either, right…?
But your checker function doesn’t checks that condition.

https://ide.codingblocks.com/s/291659 I have changed the condition but only 1TC is passing

@bhogadi.sreeja19,
You are not taking input number of test cases, t.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.