Challenges : Segment Tree, Query Bits

Why is it not working correctly?

Hello @deep4013 you have taken the code from somewhere or written yourself.
i am not sure about your code why it is failing.

I have written by myself after watching hint video.

@deep4013 i am not able to think.
check this if this can help you: