I have submitted the code but it's not working for all the testcases

Can you please check the code and let me know the loop hole. On my personal pc it working with different test cases.

@Kolhar_Prashant i do not have knowledge of python please close this doubt and re-ask this doubt by mentioning python in problem statement