My solution to the Facebook Hacker Cup 2013 qualifying round, using Flex & Bison.