3D Structure in Fenwick Section

My understanding of this problem is equivalent to find values within some specific volume, and for that we need to reduce the start from (0,0,0) to (startX,startY,startZ). And for that we need to take care of the overlapping volume. Let me know whether the approach is the right one or not as I am finding all wrong answer in all of the test cases at https://ide.codingblocks.com/s/158841.

Your approach is fine.
There’s some issue in your query .
Please have a look at this query function.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.