Code for problem 76 - not working yet.
Fixed some bugs, still have TLE.
Code for problem 76.