And if they are mean to you, do not be mean back; simply ask if (s)he just wants attention. Of course, if they are being an -------, you will go into self-defense mode, hit him/her back, etc, and think it is justified. Slapping them back might be- MIGHT be- justified up to a point, that is- self defense and all.
Mirror neurons exist. People smile back when you smile. (Try not to smile at a "Petersens" video on YouTube; I dare you). But if they are mean to you, those mirror neurons will make you mean back at them as a result- shout back. Punch back.
Learning how to control such impulses is tricky, since some of these impulses are evolutionary. Animals are aggressive back at other animals. It has to do with survival.
But, you and I can learn how to pull back.
RE: Treat others the way you want them to treat you.