spoj problems solution is available here