Please write a brief description of what you did and what problems are you facing. Is your code passing the sample input/output?
Edit— As far as I can see, whenever you are pushing a pair in the answer vector, the second argument is either -1 or 0.
So, your answer can never print out the type 2 queries correctly.