Following your class mate influence you with idiots and you spoil your study and fail the exam. Do not blame teacher or find some reasons. You reap what you sow.

Paraphrase it

If you allow yourself to be influenced by foolish classmates and neglect your studies, resulting in failure on exams, you have only yourself to blame. Ultimately, you are responsible for the consequences of your actions.