Test Cases Not Passed

According to my logic, the code works fine.
I am unable to think about any particular test case where it can fail.
Please explain me the error in logic and if possible please give an example test case where it fails
CODE FILE: https://ide.codingblocks.com/s/218631

@prat98 look at the constraints ,you need to use long long int