Solved question

Logic seems right but test cases fail

https://codeshare.io/2ENNEX

I thought there is range error so i converted all int to long long

it’s solved…no need to help…unable to delete that’s why edited

If you have any furthur doubts in this question, then you can ask.
Otherwise please mark it as Resolved.

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.