Is it okay to report classmates cheating on exams?
As an instructor, I want to know if there is an environment that allows cheating. Even if the student can't provide proof or only told me afterwards or anonymously, I can take action on future exams by better proctoring, exam versioning, and seating charts.

So telling the teacher afterward would protect individual students but improve the quality of the course overall, which is a win-win.