How can I use prefix sum of an array to solve this problem?
Consider a new type of query (t2q, type 2 query) of the form $(index, value)$ where we add $value$ to all items from $index$ to the end.

Then the original type of query (t1q, type 1 query) is equivalent to 2 t2q. $(lower, upper, value) \equiv (lower, value) \oplus (upper+1, -value)$. Notice that the second t2q cancels the first t2q over all items that should not be affected

Now, 2 t2q with the same $index$ could be reduced to a single t2q easily. $(index, valueA) \oplus (index, valueB) \equiv (index, valueA+valueB)$. Therefore, we have at most $N=\text{size of our vector}$ type 2 queries. In other words, we can store all those queries in a vector. And if there is an $index$ with no query associated, we just create a "dummy query" using the identity element of our operation (zero in this particular problem).

$$
(index, value) \equiv t2q[index]=value
$$

Next, a particular item in our vector $v[j]$ is only affected by a t2q iff $index &lt;= j$. In other words, $v[j]$ is affected by all type 2 queries with lower $index$. To calculate the value of a particular $v[j]$ just add all $values$ of t2q with lower $index$ and add the value of $v[j]$ which is zero. 

$$
v'[j] = v[j] + \sum_{i=0}^j{t2q[i]} = \sum_{i=0}^j{t2q[i]}
$$

If we iterate from the beginning, then each item can be calculated in $\mathcal{O}(1)$ if we store the previous sum. And simultaneously, we look for the maximum.

$$
v'[j+1] = \sum_{i=0}^{j+1}{t2q[i]} = t2q[j+1] + v'[j]
$$

Edit

This approach will take $\mathcal{O}(M+N)$-time and $\mathcal{O}(N)$-space, because we first process every query in $\mathcal{O}(1)$ (updating two positions in our vector), adding $\mathcal{O}(M)$, and then we spend $\mathcal{O}(N)$ looking for the maximum.

Like you said, there are $\mathcal{O}(M)$ values different than zero in $t2q$. We can ignore those zeros using a Self-balancing Binary Search Tree instead of a vector. Then we go from $\mathcal{O}(1)$ to $\mathcal{O}(lg\,M)$ while updating every entry (process every query) and from $\mathcal{O}(N)$ to $\mathcal{O}(M)$ for store all those entries.

So now, we first spend $\mathcal{O}(M\,lg\,M)$ to process all queries ($\mathcal{O}(M)$ insertions of $\mathcal{O}(lg\, M)$. Then we traverse in-order looking for the maximum using the previous idea in $\mathcal{O}(M)$.

$$
v'[j] = t2q[j] + v'[i] \, \text{iff} \, (index, 0) \, \forall i &lt; index &lt; j
$$

Finally, this new approach takes $\mathcal{O}(M\,lg\,M)$-time ($\mathcal{O}(M\,lg\,M)$+$\mathcal{O}(M)$) and $\mathcal{O}(M)$-space. Even better, is (reasonably) independent $N$ (now we can handle $N \approx 2^{64}$).