There were 2 reasons why I made 2 sets of codes... First to avoid suspicion of plagiarism. Second because I keep on revising the code until the deadline arrived.
I was the only nerd who had interest in MATLAB. Usually I made 2 sets of codes. One I made available for others to copy. Another one I made it exclusively for my own submission.
What we had was... From what I can recall, was the lecturer giving out the questions, relatively simple ones compared to some of the problem you posted. And then giving some core codes. Basically everyone except me are copy and pasting the codes.