I tried with more than 100 inputs and my program gave right output...Yet I can not find any bug :) PLease give me some critical cases :( ... My code will look horrible ..sorry for that :(
my code — http://pastebin.com/cXfF9nXA
problem link — http://www.lightoj.com/volume_showproblem.php?problem=1396