solved p135, and optimized solution