I had very good grades in high school, but struggled emotionally at the same time (depression, anxiety).
I did not cope when I went to university, which was much more unstructured, and I failed quite a few courses because I just didn't have the emotional energy to complete work or social confidence to see my tutors about it (there was no concept of Asperger's Syndrome at that time, and I was not diagnosed until many years later).
It wasn't until I moved into a supportive and rehabilitative environment in my twenties that I was able to stop floundering and make some headway academically, romantically, and in employment. I still have problems with executive function, sensory sensitivity, and emotional regulation (e.g. meltdowns), but I also have a successful career in research and IT, as well as a wife and family.