I had a history teacher in school that liked me even though I barely paid attention in class. I was bored in the class itself, but loved history and would spend the entire period just reading the textbook because I found it interesting. So even though I didn't pay attention I would still ace assignments like nobody else in there.
I was usually a couple chapters past the class at any given time.
I think at a certain point, you should be able to drop math as a subject and take programming instead. There's no shortage of math concepts in programming that still require understanding of underlying concepts, but I can easily say if I had that option in school, I'd have learned way more in a programming class than I ever did in math.