It's Okay to Sit in the Hole for a While
As a student, one of my biggest struggles is tying my self-worth to my achievements. Being put in a label and feeling good about it, building expectations of yourself through the lens of a third-person perspective, and unknowingly creating expectations of yourself that aren't truly yours.
They feel like they are yours, you want to be the person everyone says you are.
But in reality, and most of the time, we hit a block that teaches us the reality of those expectations. A bad result, a failed exam, an unforeseen circumstance, an unplanned gap year. A good humbling experience in short (for sure). But our failures teach us more than our successes; it's a cliché, but it sums it up pretty well. Our failures, and they don't necessarily need to be of our own doing, sometimes it's external factors, it all comes to the same ending of not meeting your expected outcomes.

But failure allows us to slow down, think and reflect a lot more than the rush of success and moving on to the next mountain to climb.
Failure allows you to sit in your little hole, albeit sometimes a sad self-pity hole, but it has taught me a lot about myself, more than I could have learned from getting what I wanted, and sometimes that's just the point.
We don't get everything we want in life, and that's okay. Some people do, yeah, and that's okay too. This one was just not yours for the taking; your path is elsewhere, and sometimes it takes falling into a pit in the path to realise maybe you weren't meant to be heading this way, or that maybe you need to approach this path with a different mindset.
It's okay to be sad about what has happened, and it's totally valid to be sad about all the hard work you have put in, and letting yourself feel sad is a good way to start thinking about the cause of the sadness. Whether it's due to an internal expectation you didn't know you'd created for yourself, a disappointment over a lack of effort, or something else, it's a good way to start planning the next step.
But never let a setback put you down for long; the world is big, and the paths are many. School may teach us that the path to success looks linear, like straight A's, a good college and a good job, but trust me when I say people live such beautiful lives in such unconventional ways, you wouldn't even know a path like that existed until you meet that person.
So keep going, and keep trying, that is all that is required from you, to put in effort, and you will get where you need to be in time