Improve performance of problem 39.
Add optimization flag for Haskell solutions.
Improve performance of Ruby's problem 44.