When I was in High School I used to pass the time by programming on my graphing calculator. I'm sure these days you can get by with reading a book in class or maybe even a small netbook. If none of those things are possible, just start a project and doodle your algorithms while you're in class and code them up at night.
There are a lot of ways to circumvent the system and do something you like to do, don't just give in to your immediate urges to shut it out. At the very least, you should graduate High School.