couple observations:
1. The fact that they failed despite getting your help should have been a sign to stop helping them a long time ago. They definitely are moochers.
2. You should not have ever showed them your work. Instead, you should have helped them work through any problems they had. Don't straight up tell them the answer or the steps towards the solution. Make them figure it out by asking them questions that will help them get to the solution. Do it like your professors would.
I feel for you. I always helped people in school, and they definitely took advantage of me. Thing is, I have learned from it. Now, I can quickly tell the difference between a mooch and someone that needs help. Hopefully you will learn the same thing.
If they weren't your roommates/housemates, I would say retaliate. But the fact that you live with one of them makes it a delicate situation. Been in the situation several times where I didn't get along with a roommate, and retaliation made things much worse. I would say be polite to your housemate, but don't be his friend. Don't add more fuel to the fire by being a dick to him. People like that will never learn their lesson despite what you do to them. They just look for new ways to hurt you.
As for your other 'friends', be polite to them too, but avoid them when possible. Yeah, they can say a bunch of shit and whatnot, but don't let it get to you. People like them will do whatever they can to hurt others, and they thrive on seeing it being successful.