Algorithms and classes for the International Collegiate Programming Contest