They have been programming for two months so they are not total beginners, they just have no notion of best practices. They already wrote two 300-line programs. The goal would be to have them read a codebase they didn't write, and optimize it.
I'm not looking for expert refactoring or sophisticated design patterns (they haven't even touched OOP), I just want to show them simple ways to improve their code.