Something Fishy about my code

**This problem is about the most basic segment tree ,i guess that’s what i’ve been told ,i’m trying to learn seg trees so please help me ,dont read and go away ***

In problem GSS1 SPOJ.com - Problem GSS1

i came up with a sol http://ideone.com/5dhFQa ,

but if you observe the lines between 23 to 30 , on line 25 i’ve written M[node].sum = M[2node].sum + M[2node + 1].sum after the execution of this line absurd values take over in M[2node] M[node] and M[2node+1] why ?? you could see the values in the output between “booo” and “booo over”

I am having problem with same question(repeatedly getting WA on test case 9).I have applied pretty much the same algorithm as yours.Can you please help. My code:
http://ideone.com/uruiKW