SPOJ ABSYS Getting Runtime Error (segmentation fault) link to code : http://ideone.com/k2mM54

Although the code successfully compiles and execute on code blocks but getting runtime error on ideone and on spoj, problem link:SPOJ.com - Problem ABSYS link to code : k2mM54 - Online C++ Compiler & Debugging Tool - Ideone.com