Google Code Jam 2014 R2
Problem B