Facebook Hacker Cup 2012. Qualification round and round1 problems' solutions.