For some reason, the Python solution is still 3x faster