CHANDF ! Can somebody Help me that what's wrong with my code(till SUBTASK 2)

My answer: CodeChef: Practical coding for everyone

Can somebody tell me why my code failed for subtask 2? What wrong with the approach. I tried with many test cases, but it worked …so what’s wrong?