I have received “SIGABRT” error. But I don’t know the reason.
Can I have the input file that codechef test my code with it and test my program in my computer
Sorry, you can’t. It’s against the rules.
Codechef has a policy of not disclosing test cases even after contests. Please refer to this post for a discussion on the topic.
As far you error is concerned i would suggest you read this FAQ for more information on the error. I think the SIGABRT is being caused by your vector P using too much memory.