my attempts at Spoj problems