Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Program{
	static int N, D, money;
	static int[] prices;
	private static int solve(){
        int answer = 0;
        if (prices[0] * 2 > money) return 0;
        if (prices[prices.Length - 1] + prices[prices.Length - 2] <= money) return prices[prices.Length - 1] + prices[prices.Length - 2];
        for (int i = 0; i < N - 1; i++)
        {
            int index = Arrays.binarySearch(prices, i + 1, prices.Length - i - 1, money - prices[i]);
            if (index > i) return prices[i] + prices[index];
            index = ~index - 1;
            if (index == i) continue;
            answer = Math.max(prices[i] + prices[index], answer);
        }
        return answer;
	}
	public static void main(){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] strs = br.readLine().split(",");
        N = Integer.parseInt(strs[0]); D = Integer.parseInt(strs[1]);
        prices = new int[N];
        for (int i = 0; i < N; i++)
            prices[i] = Integer.parseInt(be.readLine());
        Arrays.Sort(prices);
        for (int i = 0; i < D; i++)
        {
            money = Integer.parseInt(be.readLine());
            System.out.println(solve());
        }
	}
}

Compiler output:
Main.java:5: error: class Program is public, should be declared in a file named Program.java
public class Program{
       ^
Main.java:11: error: cannot find symbol
        if (prices[prices.Length - 1] + prices[prices.Length - 2] <= money) return prices[prices.Length - 1] + prices[prices.Length - 2];
                         ^
  symbol:   variable Length
  location: variable prices of type int[]
Main.java:11: error: cannot find symbol
        if (prices[prices.Length - 1] + prices[prices.Length - 2] <= money) return prices[prices.Length - 1] + prices[prices.Length - 2];
                                                     ^
  symbol:   variable Length
  location: variable prices of type int[]
Main.java:11: error: cannot find symbol
        if (prices[prices.Length - 1] + prices[prices.Length - 2] <= money) return prices[prices.Length - 1] + prices[prices.Length - 2];
                                                                                                ^
  symbol:   variable Length
  location: variable prices of type int[]
Main.java:11: error: cannot find symbol
        if (prices[prices.Length - 1] + prices[prices.Length - 2] <= money) return prices[prices.Length - 1] + prices[prices.Length - 2];
                                                                                                                            ^
  symbol:   variable Length
  location: variable prices of type int[]
Main.java:14: error: cannot find symbol
            int index = Arrays.binarySearch(prices, i + 1, prices.Length - i - 1, money - prices[i]);
                                                                 ^
  symbol:   variable Length
  location: variable prices of type int[]
Main.java:28: error: cannot find symbol
            prices[i] = Integer.parseInt(be.readLine());
                                         ^
  symbol:   variable be
  location: class Program
Main.java:29: error: cannot find symbol
        Arrays.Sort(prices);
              ^
  symbol:   method Sort(int[])
  location: class Arrays
Main.java:32: error: cannot find symbol
            money = Integer.parseInt(be.readLine());
                                     ^
  symbol:   variable be
  location: class Program
9 errors