Unable to pass the test case please review

I have edited your code, try to submit now,

can you please tell what was the mistake i was doing

I have edited your cal_max_sum by using if else condition , and i have combined the loop of line no 34 and 42 ,