Problem C!

With bonus comments!