TRPLSRT-MAY-LTIME

Here is a link to my solution: CodeChef: Practical coding for everyone
But it is showing RUNTIME ERROR(SIGSEGV). Can anyone help me out where and what is the problem?