HackerEarth Providing gifts problem solution - TheCScience