HackerEarth Three rectangles problem solution - TheCScience