SIGSEGV !!!

question: http://www.codechef.com/problems/GERALD3
code: http://www.codechef.com/viewsolution/3144542

Please help. i am just using 2.3 MB of memory.