At 8.13 sec in the 45th line, I think it should be q.push(v[i].first) instead of q.push(i)
hello @vageesha
u are asking about line 47 right? it is correct. it should be q.push(i) only