the final competition code

This is the code used in the competition that ended up winning.