August Long Challenge 2018: Sheokand and Number Question

My solution is at https://www.codechef.com/viewsolution/19601171.

I was wondering why did I get a RE SIGXFSZ. I was wondering if my formula was at error or was it io error.

For the array, I just skipped the step to make that array. This is my method of how I get that array.

First I power two to N until I reach a number that is larger than 10 to the power of 9. Each time I power two to a new N, I store the result in an array. After that is done, I find all the possible sum between any two values of the first array, except those that sum to itself. After I got that array when the input value is between the value of two sums, whichever way is the closest is the result value. It hard to explain in word, but I give you the code to get that array.

$p = [];
$s = [];
$m = 10000000000;
$p[] = $t = 1;

while ( $t < $m ){
    $t *= 2;
    $p[] = $t;
}
for ( $i = 0; $i < 35; $i++ ){
    for ( $ind = 0; $ind < 35; $ind++ ){
        if ( $ind !== $i ) $s[] = $p[$i] + $p[$ind];
    }     
}
$s = array_unique($s);
sort($s);

Nevermind that, I think I know my error. I did not think of what happens when the input number is less than the first sum. I will test that.

The new solution is at https://www.codechef.com/viewsolution/19739174 and the result is wrong. I was wondering why?