USACO training solutions by David