Many people solved this problem using maps in STL, but as I am not familiar with STL, I used a simple BST approach, and I have implemented it quite well - My Solution
My code is running for all possible test cases I have made but still it is giving WA.
Help Needed!
Thanks in advance