2 test cases are showing WA in MAXIMUM SUM QUERY

My code :

Line number 44

temp.leftsum=max(left.leftsum,left.sum+right.rightsum);

in function

segmentNode query(segmentNode *tree,int ss,int se,int qs,int qe,int i,int *a)

is wrong it must be -

temp.leftsum=max(left.leftsum,left.sum+right.leftsum);

Please refrain from making such mistakes it took me 2 hours to find this. If this solves your doubt please mark this as resolved and rate it.