What do you think if I secretly hope my friends fail so I feel better about myself only to then feel worse when I hope my friends fail?
Sounds like you have a predicament. On the flip side, how would you feel if you fail?
Well, I just hope that one day I'll succeed and then I'll feel better about myself, but then I hate myself for hoping for my success and their failure.
It's good that you recognize your behavior isn't helping you, but you shouldn't wish for your friends to fail. It's making you feel bad for hoping it and if they do fail, you will feel even worse. Try supporting your friends instead!
Maybe I'll help them with their work and tell them how it should be done
That's the right approach! How about everyone succeed and everyone be happy? I think this is the best way, and you will probably also feel great about it.