SIGABRT in C++

Problem - http://www.spoj.com/problems/BABTWR/
Code - http://ideone.com/CHtatC
Issue - SIGABRT
Help!

//