If I recall correctly (this issue has been discussed before, search for it if you want, the source code for the judge is around somewhere), SPOJ uses a larger size than 256 (maybe size of int or something), so decrementing from 0 will give you (some huge number). Thats why you can get TLEs from decrementing until 0.