Slides and codes for lecture 5