Code from practise rounds of Topcoder SRMs