COJ Progresive Contest 7, solutions.