PUPPYCT Solution getting WA & SIGSEGV

What’s wrong with my recent submissions to PUPPYCT… https://www.codechef.com/status/PUPPYCT,arpanb8 ?
I have coded the solution based on the editorial.

declare your arrays globally for removing sigsegv error .