Add solution for 2013 Japan elimination contest Problem B.