it is giving TLE for the Last test case please tell me what to do?
@avinashmallik2017, Use long long in place of int.
long long
int
@avinashmallik2017, Use unordered_map.
unordered_map