Optimize program

My programming language is not good.

I wonder then if a quadcopter program is what you should be attempting with all the inherent dangers that an out of control quadcopter implies.

Have you any experience of flying and tuning a quadcopter with a commercial flight controller board ? If not and you are determined to use an Arduino then perhaps you should be considering the Ardupilot board.