Initial version - TLE on test #58.
Rewrote 359D code in C++
Code for problem 359D.
Code for problem 359C.