Can anyone help me in this question? I am getting TLE for 6 out of 10 test cases.

the question link is: https://www.hackerearth.com/practice/basic-programming/bit-manipulation/basics-of-bit-manipulation/practice-problems/algorithm/and-operation-3-0b1a025c/description/

how are you solving this exactly?

Using simple approach, updating array elements with each passing operations

see , when you ask someone why I am getting TLE you should either tell your approach or show the code (this one is preferred).

Based on your comment it looks like you are using brute force approach so getting TLE is only obvious in this problem because we have to handle queries here.

I think this problem can be solved using this logic : Constant time range add operation on an array - GeeksforGeeks

instead of add you have to perform AND operation.