Wrong answer showing up while code is right


For the problem http://www.codechef.com/DEC12/problems/GRANAMA , my code(written below) is covering all possible test cases but wrong answer is coming up. Please see to it.

[code blanked by cyberax. reason: live contest]

You can’t ask someone to help you while the contest is ongoing.
And your code is wrong!