Solved problem 10 in python and c++. 146359th person