Solution to Problem C (only the small input) of the qualification round of Google Code Jam 2013. [http://code.google.com/codejam/contest/2270488/dashboard#s=p2]