final code for the competition.