HackerEarth Prom Night problem solution - TheCScience