Solutions to Spoj Problems