unable to point out the error
Shows correct answer for custom test case but wrong upon final submission
You are getting wrong answer because of integer overflow. Please use long long int.
Yeah the Time limit is way too strict, so had to use scanf for taking input.
Here is the code https://ide.codingblocks.com/s/238815