vector<int> constructBITree(const vector<int>& arr) {
int n = arr.size();
vector<int> BITree(n + 1, 0);
for (int i = 0; i < n; i++)
updateBIT(BITree, i, arr[i]);
return BITree;
}
int main() {
vector<int> freq = {2, 1, 1, 3, 2, 3, 4, 5, 6, 7, 8, 9};
vector<int> BITree = constructBITree(freq);
cout << "Sum of elements in arr[0..5] is "<< getSum(BITree, 5);
freq[3] += 6;
updateBIT(BITree, 3, 6);
cout << "\nSum of elements in arr[0..5] after update is " << getSum(BITree, 5);
return 0;
}