backtracking
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []



#define mod 1000000007
class Solution {
public:
    
    int findmax(int idx,vector<int> & nums, vector<int>&dp){
        int maxi=INT_MIN;
        if(idx>=nums.size()){
            return 0;
        }
        if(dp[idx]!=-1) return dp[idx];

        int keep= nums[idx] + findmax(idx+2,nums,dp);
        int dkeep= findmax(idx+1,nums,dp);
        return dp[idx]=max(keep,dkeep);
    }
    int maximumSumSubsequence(vector<int>& nums, vector<vector<int>>& queries) {
        int n=nums.size();
        int m=queries.size();
        int ans=0;
        for( auto query:queries){
            int pos=query[0];
            int x=query[1];
            nums[pos]=x;
            vector<int> dp(n,-1);
            int longest= findmax(0,nums,dp);
            ans= (ans+longest)%mod;

        }
        return ans;
    }
};
```
['C++']