As in the general forum there is more feedback on C(++) problems I post my problem here as well:
http://www.spoj.pl/forum/viewtopic.php?f=3&t=9302