HackerEarth New World problem solution - TheCScience