Project Euler Hackerrank Solution Cpp