Code for algorithmic contest