Programming practice for SPOJ