Solutions to random problems I encountered on spoj