HackerEarth Counting Triangles problem solution - TheCScience