Solutions to SPOJ Problems