Tiancheng Lou's submission of Paying optimally | CodeChef