getting runtime error on spoj link:http://www.spoj.com/problems/QTREE2/ my code :https://ideone.com/svhHtv