Not passing all test cases

Can someone tell me why I’m failing the first three test cases?
Thanks.

Link to my code: https://ide.codingblocks.com/s/209603

@kapurm17
you need to use long long int instead of int. Other than that your logic is correct.