solutions for HOJ