HackerEarth Magic Potion problem solution - TheCScience