In high school, I practiced 4 hours/day and did the standard school day. I also took 4-5 AP classes in both my junior and senior years (only 2 as a sophomore, though), so I had 3-4 hours of homework every night, as well. Fortunately, I had a block schedule, so I could do a lot of homework on the days that I didn't have practice. My district requires a study hall, so I did homework the entire time. I also did homework during lunch, when we had extra time in class, and before classes started. Basically, I did homework whenever I had any extra time-- even doing one math problem before a class started helps in the long run. I'm not sure if other gyms are okay with this, but I also did homework while stretching (we're supervised during stretching, so I wasn't slacking off or just doing HW).
Also, you might want to sit down with your coaches and discuss your goals for the future. I switched gyms my junior year to a stricter and more competitive gym. However, my parents and I were very clear from the get-go that my goal was a full ride for academics, not for gymnastics, so we hoped that they would be a little flexible if I had to miss practices or meets for school-related activities.