Wrong answer on segment tree for last test case, please help

Hi, I am begineer in segment tree and solving one of the problem on segment tree from spoj (SPOJ.com - Problem GSS1), but at the time of submission it fails at probably last test case (it failed for masterd test case).

Here is my JAVA solution, please take a look.