A midterm exam consists of $5$ problems. Students who solve two of those problems correctly get a passing grade. There are $32$ students in the class, and only $8$ students passed. Prove that one of the problems was solved correctly by at most $12$ students.
So $16$ questions were solved correctly, so at least one problem was solved at least $3$ times by the pigeon hole principle. Where do the $12$ students come from? I mean can't the $24$ students solve $0$ questions or do I assume that at least each student solve one question? Thanks.
Based on what you wrote, it is not true that "only 16 questions were solved correctly". What we know is that "at least 16 questions were solved correctly".
It might be possible that $8\times5 = 40$ questions were solved correctly, like if those who passed got all questions correct.
Hint: Consider the $32-8=24$ people who failed. Can we guarantee that there is a problem that is solved by at most 4 people?
Corollary: That problem is solved by at most $4+8=12$ people.