HackerEarth Hectic Game problem solution - TheCScience