Test case bug on the following problem

In the following problem the system test cases might not be correct please recheck them. getting wrong ans on previous accepted verdicts.