My answers to SPOJ Problem Set