Speaking as someone who attended a public high school with competitive admissions, the students are much more important than the teachers or the education itself. Being around a group of talented and driven people motivates you to do well. I also previously attended special education when my academic abilities were questionable, at best. I benefitted from intensive education on phonics and basic literacy skills, rath…
Which ultimately means it's up to the parents more than anything. I suspect that's why magnet schools perform well. The parents interested and capable of going out of their way to put their child into a good school district are more likely to also be invested in their child's educational outcomes which can make all the difference.