You are given an array A. For a subarray between L and R, energy is derived = A[L] - A[L+1] + A[L+2] ...so on till A[R]. You will be given Q queries.
Update in the question:
We need to find the max energy in every query .. i.e. subarray that has the maxium energy (as defined above).
Queries as:
1 i x: Change A[i] to x
2 L R: Print Energy between subarray [L, R] mod 10^7
Constraints:
1 <= len(A) <= 10^5
1 <= Q <= 10^5
1 <= i, L, R <= 10^5
-10^9 <= A[i], x <= 10^9