HackerEarth The exam problem solution - TheCScience