very easy code|| c++ || simple
class NumArray {\n    vector arr;\n     int sum;\npublic:\n    NumArray(vector& nums) {\n        arr = nums;\n        sum  = accumulate(arr.begin(),arr.end(),0)
class NumArray {\n    vector<int> arr;\n     int sum;\npublic:\n    NumArray(vector<int>& nums) {\n        arr = nums;\n        sum  = accumulate(arr.begin(),arr.end(),0);\n    }\n    \n    void update(int index, int val) {\n        sum -= arr[index];\n        arr[index] = val;\n        sum += arr[index];\n    }\n    \n    int sumRange(int left, int right) {\n        int ans = sum ;\n        for(int i = 0; i<left;i++){\n        ans -= arr[i];\n        } \n        for(int i = right+1; i<arr.size();i++){\n        ans -= arr[i];\n        } \n        return ans;\n    }\n};\n\n/**\n * Your NumArray object will be instantiated and called as such:\n * NumArray* obj = new NumArray(nums);\n * obj->update(index,val);\n * int param_2 = obj->sumRange(left,right);\n */
['C', 'C++']