Getting RE (SIGABRT) in chef and dice

I tried an approach similar to the editorial (brute-force) in this solution: https://www.codechef.com/viewsolution/15567149 , and kept getting runtime error. I also checked the discussion forum for this error (SIGABRT), and checked for any abort call in my code, which I couldn’t find. I also checked my code for index out of bounds for vectors in my code, which is not the case AFAIK.

Please help me debug this code to find what is the root cause of this RE (SIGABRT) in this code.

//