Some useful algorithms for Competitive programming