As an FYI - unlike Reddit A2C, most posters here on CC are your parents’ age or older. Just something to keep in mind for the future.
An A- I’m Comp Sci Principles won’t impact you all that much.
Were you submitting at the last minute? If everyone else submitted ahead of time and you were the only one trying to beat the buzzer, I can see how your teacher might not view that very sympathetically.
It’s fine, stuff like this happens. Just give yourself more time in the future.