Solutions for SPOJ Problems