Can you please tell me what's wrong with my code because for custom input im getting correct answer in all the cases but after submission im not getting even single correct test case. Please tell me where my code is failing?

Can you please tell me what’s wrong with my code because for custom input im getting correct answer in all the cases but after submission im not getting even single correct test case. Please tell me where my code is failing?