I hate to tell you this, but as a "codechef" problem you are not going to get much help.
MikeyBoy once wrote:
If this is a Codechef problem, you should know that the Codechef adjudicators are aware of this forum, and that people use it to cheat on their contests. If you use this forum to try and cheat, you run the risk of being disqualified.
Also the person that helps you can have problems too.
As far as I know Codechef can't get anything other than our useless ID's and emails...and as far as cheating is concerned their question statement is very unclear and I am not asking for solution but just to expain me a test case