Language: C

import std.array;
import std.range;
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;

void main()
{
	while(true) {
		string[] input = split(chomp(readln()));	
		int N = to!int(input[0]);
		int M = to!int(input[1]);
		if(N==0&&M==0) break;
		

		int[] inp = new int[N+1];
		inp[0] = 0;

		for(int i=0; i<N; i++) {
			input = split(chomp(readln()));
			inp[i+1] = to!int(input[0]);
		}

		N++;

		int[] add2 = new int[N * N];

		for(int i=0; i<N; i++)
		for(int j=0; j<N; j++)
			add2[j*N + i] =  inp[i] + inp[j];

		auto sorted = array(uniq(sort(add2)));	
		auto r = assumeSorted(sorted);

		int res;
		foreach(v; sorted)
		{
			if(v > M) break;
			res = max(res, v + r.lowerBound(M-v).back);
		}

		writeln(res);
	}
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import std.array;
      | ^~~~~~
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import std.array;
      |           ^
main.c:2:1: error: unknown type name 'import'
    2 | import std.range;
      | ^~~~~~
main.c:2:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | import std.range;
      |           ^
main.c:3:1: error: unknown type name 'import'
    3 | import std.stdio;
      | ^~~~~~
main.c:3:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 | import std.stdio;
      |           ^
main.c:4:1: error: unknown type name 'import'
    4 | import std.conv;
      | ^~~~~~
main.c:4:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    4 | import std.conv;
      |           ^
main.c:5:1: error: unknown type name 'import'
    5 | import std.string;
      | ^~~~~~
main.c:5:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    5 | import std.string;
      |           ^
main.c:6:1: error: unknown type name 'import'
    6 | import std.algorithm;
      | ^~~~~~
main.c:6:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    6 | import std.algorithm;
      |           ^
main.c: In function 'main':
main.c:10:15: error: 'true' undeclared (first use in this function)
   10 |         while(true) {
      |               ^~~~
main.c:1:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
  +++ |+#include <stdbool.h>
    1 | import std.array;
main.c:10:15: note: each undeclared identifier is reported only once for each function it appears in
   10 |         while(true) {
      |               ^~~~
main.c:11:17: error: 'string' undeclared (first use in this function)
   11 |                 string[] input = split(chomp(readln()));
      |                 ^~~~~~
main.c:11:24: error: expected expression before ']' token
   11 |                 string[] input = split(chomp(readln()));
      |                        ^
main.c:12:25: error: 'to' undeclared (first use in this function)
   12 |                 int N = to!int(input[0]);
      |                         ^~
main.c:12:27: error: expected ',' or ';' before '!' token
   12 |                 int N = to!int(input[0]);
      |                           ^
main.c:13:27: error: expected ',' or ';' before '!' token
   13 |                 int M = to!int(input[1]);
      |                           ^
main.c:17:20: error: expected identifier or '(' before '[' token
   17 |                 int[] inp = new int[N+1];
      |                    ^
main.c:18:17: error: 'inp' undeclared (first use in this function); did you mean 'int'?
   18 |                 inp[0] = 0;
      |                 ^~~
      |                 int
main.c:21:25: error: 'input' undeclared (first use in this function); did you mean 'int'?
   21 |                         input = split(chomp(readln()));
      |                         ^~~~~
      |                         int
main.c:21:33: error: implicit declaration of function 'split' [-Wimplicit-function-declaration]
   21 |                         input = split(chomp(readln()));
      |                                 ^~~~~
main.c:21:39: error: implicit declaration of function 'chomp' [-Wimplicit-function-declaration]
   21 |                         input = split(chomp(readln()));
      |                                       ^~~~~
main.c:21:45: error: implicit declaration of function 'readln' [-Wimplicit-function-declaration]
   21 |                         input = split(chomp(readln()));
      |                                             ^~~~~~
main.c:22:38: error: expected ';' before '!' token
   22 |                         inp[i+1] = to!int(input[0]);
      |                                      ^
      |                                      ;
main.c:27:20: error: expected identifier or '(' before '[' token
   27 |                 int[] add2 = new int[N * N];
      |                    ^
main.c:31:25: error: 'add2' undeclared (first use in this function)
   31 |                         add2[j*N + i] =  inp[i] + inp[j];
      |                         ^~~~
main.c:33:22: error: type defaults to 'int' in declaration of 'sorted' [-Wimplicit-int]
   33 |                 auto sorted = array(uniq(sort(add2)));
      |                      ^~~~~~
main.c:33:31: error: implicit declaration of function 'array' [-Wimplicit-function-declaration]
   33 |                 auto sorted = array(uniq(sort(add2)));
      |                               ^~~~~
main.c:33:37: error: implicit declaration of function 'uniq'; did you mean 'unix'? [-Wimplicit-function-declaration]
   33 |                 auto sorted = array(uniq(sort(add2)));
      |                                     ^~~~
      |                                     unix
main.c:33:42: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   33 |                 auto sorted = array(uniq(sort(add2)));
      |                                          ^~~~
main.c:34:22: error: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
   34 |                 auto r = assumeSorted(sorted);
      |                      ^
main.c:34:26: error: implicit declaration of function 'assumeSorted' [-Wimplicit-function-declaration]
   34 |                 auto r = assumeSorted(sorted);
      |                          ^~~~~~~~~~~~
main.c:37:17: error: implicit declaration of function 'foreach' [-Wimplicit-function-declaration]
   37 |                 foreach(v; sorted)
      |                 ^~~~~~~
main.c:37:25: error: 'v' undeclared (first use in this function)
   37 |                 foreach(v; sorted)
      |                         ^
main.c:37:26: error: expected ')' before ';' token
   37 |                 foreach(v; sorted)
      |                        ~ ^
      |                          )
main.c:37:35: error: expected ';' before '{' token
   37 |                 foreach(v; sorted)
      |                                   ^
      |                                   ;
   38 |                 {
      |                 ~