Final Code

This is the code used in the competition