sisgev and limits in quetion

my code runs well in my computer ,and all test cases are satisfied.But codechef doesnot except it says runtime error sisegev something like that.What should i do .I think it has limits issue but i tried to resolve but still same error please help me…
http://www.codechef.com/viewsolution/4057793

Taken from FAQs

Why do I get a SIGSEGV?

This is an error caused by an invalid memory reference or segmentation fault. The most common causes are accessing an array element out of bounds, or using too much memory.

It might be from this for loop in you’re time fucntion :

for(i=l;i<=r;i++)

//