Code for ICFPC 2013 contest