Problem code:EOEO ....not able to run on codechef

The code is running and giving the correct outputs to test cases on my IDE but not on code-chef…can anyone tell me whats wrong?
This is the submission link along with the problem …
I know the method is not an efficient one so…any suggestions is appreciated also.