^^Don't fret too much about it, we all have had our fair shares of failures and I hope next time will be awesome for you.
BTW I have done a similar mistake too.
That's unfortunate. Though at least you know where you went wrong. There is nothing wrong with failure, so long as you don't fail for the same reason twice. If you can overcome that which defeated you previously, then you will pass the next time.
I ****ed up two years of my life in pre uni because I was being lazy and did not study. It was too late before I realized anything.
My high school friends will have degree next year, I still have 3 years to go.