Help me debug SIGKILL error.

I have been trying to solve http://www.spoj.com/problems/SUMFOUR/ . But I am getting SIGKILL error in the 10th test case (which I presume is the largest input case). If possible, please help me debugging it. I have used a simple O(n^2(log2(n))) algorithm.

Here goes the code: http://ideone.com/WWEjN8

//