sample code of problems in the book <beauty of programming>