Help required in MAXBTY

I’m getting WA whenever I try to update the value at an index using lazy propagation. I believe the culprit is updIndex(). Can somebody help me with this issue?
Link to the code.

your_code

3 changes
make Pre long long
use upd instead of updIndex
cout << sr.range_max(y, n) + max( 0LL , sl.range_max(1, x-1)) << “\n”;

2 Likes

Thank you. I saw your latest submission. Upon inspection, I found that updateInd() gives segmentation fault on some test cases.