Add solution for 96; slow version in python and fast version in c++