cpp implementation of Max Points on a Line