Why wrong?

Problem name: Rectangular Queries (CodeChef). I have tried to solve this problem with the concept of prefix sum but it is showing me wrong answer (my code: CodeChef) . I don’t know why that’s happening . Would anyone like to tell me what is the wrong in my code?
Thanks for help.