Problem:
Score : 100 points

Problem Statement

AtCoDeer has three cards, one red, one green and one blue.

An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.

We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.

Is this integer a multiple of 4?

Constraints

1 ≤ r, g, b ≤ 9

Input

Input is given from Standard Input in the following format:

r g b

Output

If the three-digit integer is a multiple of 4, print YES (case-sensitive); otherwise, print NO.

Sample Input 1

4 3 2

Sample Output 1

YES

432 is a multiple of 4, and thus YES should be printed.

Sample Input 2

2 3 4

Sample Output 2

NO

234 is not a multiple of 4, and thus NO should be printed.

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
 
class Main implements Runnable {
	public static void main(String[] args) {
		new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start();
	}
 
	public void run() {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		String s = sc.next();
		for (int i = 0; i < mem.length; ++i) {
			for (int j = 0; j < mem[i].length; ++j) {
				mem[i][j] = "";
			}
		}
		System.out.println(f(0, s.length(), s));
	}
 
	String[][] mem = new String[101][101];
 
	// [s,t)
	String f(int s, int t, String S) {
		if (t - s == 1) {
			return "()";
		} else if (t - s < 1) {
			return "";
		}
		if (!mem[s][t].equals("")) {
			return mem[s][t];
		}
		String ans = "";
		for (int m = s + 1; m < t; ++m) {
			// [s,m),[m,t)に分割
			ans = next(ans, f(s, m, S) + f(m, t, S));
		}
		if (S.charAt(s) == '(' && S.charAt(t - 1) == ')') {
			ans = next(ans, "(" + f(s + 1, t - 1, S) + ")");
		} else {
			if (S.charAt(s) == '(')
				ans = next(ans, "(" + f(s + 1, t, S) + ")");
			if (S.charAt(t - 1) == ')') {
				ans = next(ans, "(" + f(s, t - 1, S) + ")");
			}
		}
		//return mem[s][t] = ans;
return ans;
	}
 
	String next(String cur, String ns) {
		if (cur.equals("") || cur.length() > ns.length() || (cur.length() == ns.length() && cur.compareTo(ns) > 0)) {
			return ns;
		} else {
			return cur;
		}
	}
 
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
 
}