Solve div2 hard.

* System passed