The two most important reasons why I did OK (apart from good luck) were;
1. My parents, though very troubled, were educated and cared about education, so they did a lot at home to make up for the vast deficiencies of my high school, such as taking an interest in my school work and exposing me to enriching activities such as free lectures as the nearest university. (Mother went to Peoria/Central HS and Western Illinois U.)
2. Years earlier, my parents intentionally had looked for and bought a house in a suburb with excellent elementary and junior schools, overreaching financially to do it. That meant that by the time I had to go to high school in the nearest big city (because the suburb didn't have one), I'd had such a good foundation in the basics like reading and math that my terrible high school hurt me less than it did others who went to bad schools earlier. It was hard when I was young, because my parents really couldn't afford our suburb, but I was profoundly grateful late when I realized how much worse off I'd have been if they hadn't.
Thanks for asking!