There is an array consisting of $n$ integers. Some values of the array will be updated, and after each update, your task is to report the maximum subarray sum in the array.
The first input line contains integers $n$ and $m$ : the size of the array and the number of updates. The array is indexed $1,2,\ldots,n$ .
The next line has $n$ integers: $x_1,x_2,\ldots,x_n$ : the initial contents of the array.
Then there are $m$ lines describing the changes. Each line has two integers $k$ and $x$ : the value at position $k$ becomes $x$ .
After each update, print the maximum subarray sum. Empty subarrays (with sum $0$ ) are allowed.
5 3 1 2 -3 5 -1 2 6 3 1 2 -2
· \n · · · · \n · \n · \n · \n
9 13 6
\n \n \n