Help in a question (POLMUL)

Here is the link to the question
: CodeChef: Practical coding for everyone

Here is the solution I submited but was getting a WA
https://www.codechef.com/viewsolution/26688013

access denied in the solution link

this might be bcoz it is a past foundation level exam problem.

Check my code:Code