PUPPYCT Solution getting WA & SIGSEGV

What’s wrong with my recent submissions to PUPPYCT… CodeChef: Practical coding for everyone ?
I have coded the solution based on the editorial.

declare your arrays globally for removing sigsegv error .