HackerEarth Cocktail Range Query problem solution - TheCScience