improve solve.py