Whats wrong in this code?

@Nitya_Somani,
The code is incorrect.
https://ide.codingblocks.com/s/325131 corrected code. The input format I have corrected and the output format as well.

You need to change you code though. Gives wrong answer for the sample test case