I'm not able to find the mistake in my code

I’m getting a wrong answer for the testcases.