Initial version.
TLE on test #51.
Some optimization.
Code for problem 35E.