Language: Java

import java.awt.Point;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	/** ????§??????? */
	static final String WHITE_SPACE = " ";

	/** ??????????????????_X */
	static int mapSizeX = 0;

	/** ??????????????????_Y */
	static int mapSizeY = 0;

	/** ??????????????° */
	static int maxNode = 0;

	/** ????????? */
	static String[] map = new String[1000 * 1000];

	/** ????????¢??????????????? */
	static List<Point> pachimonList = new ArrayList<Point>();

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextLine()) {
			readMap(scanner);
		}

	}

	/**
	 * ?????????????????????????????????
	 * @param scanner ????????£??????
	 */
	private static void readMap(Scanner scanner) {
		String[] mapSizeLine = scanner.nextLine().split(WHITE_SPACE);
		if (mapSizeLine.length < 2) {
			return;
		}

		// ??????????????±????????????
		pachimonList.removeAll(pachimonList);
		maxNode = 0;
//		mapSizeX = Integer.parseInt(mapSizeLine[0]);
//		mapSizeY = Integer.parseInt(mapSizeLine[1]);
//		initializeMap(mapSizeX, mapSizeY);
		boolean startFlg = false;
		boolean goalFlg = false;

		while (scanner.hasNextLine()) {
			for (int i = 0; i < mapSizeY; i++) {
				String mapInfoLine = scanner.nextLine();
				mapInfoLine = mapInfoLine.replaceAll(".", "9");
				mapInfoLine = mapInfoLine.replaceAll("S", "0");
				mapInfoLine = mapInfoLine.replaceAll("G", "6");
				for (int j = 0; j < mapSizeX; j++) {
					int val = Integer.valueOf(mapInfoLine.charAt(j));
					if (val < 9) {
						maxNode++;
						// ??????????????°??????????´¢
						if (!startFlg) {
							if (val == 0) {
								pachimonList.add(createPos(0, calcIndex(j, i)));
								startFlg = true;
								break;
							}
						}
						// ??´????????°??????????´¢
						if (!goalFlg) {
							if (val == 6) {
								pachimonList.add(createPos(6, calcIndex(j, i)));
								goalFlg = true;
								break;
							}
						}
						// ???????????¢????????°????¨????
						pachimonList.add(createPos(Integer.valueOf(val), calcIndex(j, i)));
					}
				}
			}
		}

		Collections.sort(pachimonList, new Comparator<Point>() {
			@Override
			public int compare(Point o1, Point o2) {
				return o1.x - o2.x;
			}
		});
	}

	/**
	 * ??????????????¨??????????´???????????????§?????????
	 */
	private static void initializeMap(int sizeX, int sizeY) {
		for (int i = 0; i < sizeX * sizeY; i++) {
			map[i] = "";
		}
	}

	/**
	 * X????????????????????´?????????????????¢???????±???§????¨????<br>
	 * ????????????:0?????´??????:6???????????¢???????±???§:1???5<br>
	 * Y????????????????????????????????????????´?
	 * @param type ?????????????????´?????????????????¢???????±???§
	 * @param index ??????????????????????????????
	 * @return
	 */
	private static Point createPos(int type, int index) {
		return new Point(type, index);
	}

	/**
	 * X??§?¨???¨Y??§?¨???????????????£?????????????????????????????????????????´?????????
	 *
	 * @param x X??§?¨?
	 * @param y Y??§?¨?
	 * @return
	 */
	private static int calcIndex(int x, int y) {
		return x * mapSizeY + y;
	}
}
import java.awt.Point;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	/** ????§??????? */
	static final String WHITE_SPACE = " ";

	/** ??????????????????_X */
	static int mapSizeX = 0;

	/** ??????????????????_Y */
	static int mapSizeY = 0;

	/** ??????????????° */
	static int maxNode = 0;

	/** ????????? */
	static String[] map = new String[1000 * 1000];

	/** ????????¢??????????????? */
	static List<Point> pachimonList = new ArrayList<Point>();

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextLine()) {
			readMap(scanner);
		}

	}

	/**
	 * ?????????????????????????????????
	 * @param scanner ????????£??????
	 */
	private static void readMap(Scanner scanner) {
		String[] mapSizeLine = scanner.nextLine().split(WHITE_SPACE);
		if (mapSizeLine.length < 2) {
			return;
		}

		// ??????????????±????????????
		pachimonList.removeAll(pachimonList);
		maxNode = 0;
//		mapSizeX = Integer.parseInt(mapSizeLine[0]);
//		mapSizeY = Integer.parseInt(mapSizeLine[1]);
//		initializeMap(mapSizeX, mapSizeY);
		boolean startFlg = false;
		boolean goalFlg = false;

		while (scanner.hasNextLine()) {
			for (int i = 0; i < mapSizeY; i++) {
				String mapInfoLine = scanner.nextLine();
				mapInfoLine = mapInfoLine.replaceAll(".", "9");
				mapInfoLine = mapInfoLine.replaceAll("S", "0");
				mapInfoLine = mapInfoLine.replaceAll("G", "6");
				for (int j = 0; j < mapSizeX; j++) {
					int val = Integer.valueOf(mapInfoLine.charAt(j));
					if (val < 9) {
						maxNode++;
						// ??????????????°??????????´¢
						if (!startFlg) {
							if (val == 0) {
								pachimonList.add(createPos(0, calcIndex(j, i)));
								startFlg = true;
								break;
							}
						}
						// ??´????????°??????????´¢
						if (!goalFlg) {
							if (val == 6) {
								pachimonList.add(createPos(6, calcIndex(j, i)));
								goalFlg = true;
								break;
							}
						}
						// ???????????¢????????°????¨????
						pachimonList.add(createPos(Integer.valueOf(val), calcIndex(j, i)));
					}
				}
			}
		}

		Collections.sort(pachimonList, new Comparator<Point>() {
			@Override
			public int compare(Point o1, Point o2) {
				return o1.x - o2.x;
			}
		});
	}

	/**
	 * ??????????????¨??????????´???????????????§?????????
	 */
	private static void initializeMap(int sizeX, int sizeY) {
		for (int i = 0; i < sizeX * sizeY; i++) {
			map[i] = "";
		}
	}

	/**
	 * X????????????????????´?????????????????¢???????±???§????¨????<br>
	 * ????????????:0?????´??????:6???????????¢???????±???§:1???5<br>
	 * Y????????????????????????????????????????´?
	 * @param type ?????????????????´?????????????????¢???????±???§
	 * @param index ??????????????????????????????
	 * @return
	 */
	private static Point createPos(int type, int index) {
		return new Point(type, index);
	}

	/**
	 * X??§?¨???¨Y??§?¨???????????????£?????????????????????????????????????????´?????????
	 *
	 * @param x X??§?¨?
	 * @param y Y??§?¨?
	 * @return
	 */
	private static int calcIndex(int x, int y) {
		return x * mapSizeY + y;
	}
}

Compiler output:
Main.java:131: error: class, interface, enum, or record expected
import java.awt.Point;
^
Main.java:132: error: class, interface, enum, or record expected
import java.util.ArrayList;
^
Main.java:133: error: class, interface, enum, or record expected
import java.util.Collections;
^
Main.java:134: error: class, interface, enum, or record expected
import java.util.Comparator;
^
Main.java:135: error: class, interface, enum, or record expected
import java.util.List;
^
Main.java:136: error: class, interface, enum, or record expected
import java.util.Scanner;
^
6 errors