Why Time Limit Exceeded?

Problem code: SPREAD (CodeChef)
I don’t know why my code (CodeChef) is showing Time Limit Exceeded. I have used binary indexed tree in my code as suggested in the official solution. Would anyone like to help me to find the reason out behind the “Time Limit Exceeded” ?