Working solutions for Code Jam 2013 Qualification