What can i do in this situation

I already posted this in r/bullying but i post it here to so maybe i get some more help. So there is a guy, who sits behind me in class, and sometimes slaps me on the neck, and i cant do anything because if i try to hit him back, he just lean backwards and i cant reach him, and when we get out of class, i just dont do anything while i could, why, i dont think im scared, i just dont do anything. Also yesterday a guy hit me in the head with some heavy stuff he was carrying, everyone laughed and i didnt do anything, that guy also a good fighter, and knowing my abilities, the only person i could beat up is myself. I (17M) dont wanna fight because they are doing this to some other classmates too so im not a the target, they are not doing this to make someone feel like shit, they just do this beacuse they think its funny, and its like a joke to them, because if i get slapped or something, its never hard. Anyways, i just want some advice how to actually do somethings and not let them get away with shit like this. Some extra info: this will be my 8th month im going to the gym, so from going to the gym i did not gain confidence as some people said i will.