Some test cases are failing

Hello sir I tried to write the code using the exact approach as in the video but some of the test cases are failing :(.

Code: https://ide.codingblocks.com/s/652184

Could you please tell on which conditions the code is giving the incorrect answer and the necessary corrections that I need to make in the code.

Thank You

just use long long int instead of int
logic of code is correct
Modified Code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.