I've solved another Binary Indexed Tree problem today. It is the Div 1 Hard problem from TopCoder SRM 424. This problem is a bit harder to formulate than the previous one. You can check the complete analysis of the problem in the official match editorial. And don't forget to check the tutorial if you have any difficulty understanding BIT.