Students don't use ritalin to achieve high quality cognitive effort, they use it to achieve high quantity cognitive effort. To pass a university exam I don't need to be able to come up with some novel high quality reasoning about a topic, I need to regurgitate 12 weeks worth of lectures on demand. The only way I could do that is by sitting down for 10hrs a day and reading the shit out of those lecture notes, ritalin is quite useful for that.
Your college education sounds very different from my US engineering background.
I have never done worse than when I took an exam on Adderall. The exams required genuine creative thinking and problem-solving using the knowledge built over 15 weeks.
Plus: many, many disciplines require memorization of quite a few facts to pass the course. CS included - you might have just had an easy time/forgotten about your freshman and sophomore courses that covered more basic elements like syntax, best practices, basic algos, etc.