I wouldn't be so hard on yourself- we are only human and sounds like you've been pushing really hard for a long time. It's not abnormal to run out of stem towards the end. Think of it all more like trial and error and ask yourself how you can improve next time and perhaps pace yourself better.
If you have a trusted professor or guidance counselor at school, it could be worthwhile talking with them.
Hang in there!