My solutions for SPOJ problems - Happy time