the code from the book "Algorithm wo manabou"