Google code jam 2012: Qualification Round: solutions