Add solution for 2013 asia regional Japan Problem B.