working through a competitive programming book and solving the solutions here as I go along