I was solving this problem from hackerearth

I have seen someones code where he was storing max sum at each node . After going through that i got to know the i can easily update maximum at every node but how can i find the sum of that node while updating using lazy propagation also as there are two kind of updates how can i determine that the lazy value if from update 1 or update 2 How to handle these cases i have already spent alot of my time figuring out . Thanks in advance