Solutions to SPOJ