How do you cope with being with bad friends just because there is no one else in the class?
That's hard. Try to find other people outside of school who make you feel good. If you can't, either keep them if you want, or ditch them. Having no friends is better than having bad friends. It's hard, but in the end you'll be happier with your choice.