algorithms written for online contest practice