Language: Java

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader in =
new BufferedReader(new InputStreamReader(System.in))) {
			
String line;
line = in.readLine();

int n = Integer.parseInt(line);

int[][] sayTable = new int[n][];
for (int i = 0; i < n; ++i) {
line = in.readLine();
int a = Integer.parseInt(line);
sayTable[i] = new int[a];
for (int j = 0; j < a; ++j) {
line = in.readLine();
String[] params = line.split(" ");
	int x = Integer.parseInt(params[0]) - 1;
	int y = Integer.parseInt(params[1]);
		sayTable[i][x] = y + 1;
	}
}
int maxHonest = search(say, new int[n]);
System.out.println(maxHonest);
}
	}

	public static int search(
int[][] sayTable, int[] honest, int i, int count) {

		if (i >= sayTable.length) {
			return (int) Arrays.stream(honest)
.filter(say -> say == 2)
.count();
		}

		int[] sayArray = sayTable[i];

		int count = 0;
		{
		int[] copyHonest = Arrays.copyOf(honest);
		if (checkHonest(honest, sayArray)) {
int c = search(sayTable, copyHonest, i + 1);
count = Math.max(c, count);
		}
	}
	{
		int[] copyHonest = Arrays.copyOf(honest);
		if (checkUnkind(honest, sayArray)) {
int c = search(sayTable, copyHonest, i + 1);
count = Math.max(c, count);
		}
	}
return count;
}



	public static boolean checkHonest(int[] honest, int[] sayArray) {
		for (int i = 0; i < sayArray.length; ++i) {
			int say = sayArray[i];
			if (say < 0) {
				continue;
			}
			int h = honest[i];
			if (h == 0 || h != say) {
return false;				
			}
		}
return true;
	}

	public static boolean checkUnkind(int[] honest, int[] sayArray) {
		for (int i = 0; i < sayArray.length; ++i) {
			int say = sayArray[i];
			if (say < 0) {
				continue;
			}
			int h = honest[i];
			if (h == 0 || h == say) {
return false;				
			}
		}
return true;
	}

public static boolean setHonest(int[] honest, int[] sayArray) {
		for (int i = 0; i < sayArray.length; ++i) {
			int say = sayArray[i];
			if (say == 1) {
				honest[i] = 1;
			} else if (say == 2) {
				honest[i] = 2;
			}
		}
return true;
	}

	public static boolean setUnkind(int[] honest, int[] sayArray) {
		for (int i = 0; i < sayArray.length; ++i) {
			int say = sayArray[i];
			if (say == 1) {
				honest[i] = 2;
			} else if (say == 2) {
				honest[i] = 1;
			}
		}
return true;
	}



}



Compiler output:
Main.java:27: error: cannot find symbol
int maxHonest = search(say, new int[n]);
                       ^
  symbol:   variable say
  location: class Main
Main.java:43: error: variable count is already defined in method search(int[][],int[],int,int)
		int count = 0;
		    ^
Main.java:45: error: no suitable method found for copyOf(int[])
		int[] copyHonest = Arrays.copyOf(honest);
		                         ^
    method Arrays.<T#1>copyOf(T#1[],int) is not applicable
      (cannot infer type-variable(s) T#1
        (actual and formal argument lists differ in length))
    method Arrays.<T#2,U>copyOf(U[],int,Class<? extends T#2[]>) is not applicable
      (cannot infer type-variable(s) T#2,U
        (actual and formal argument lists differ in length))
  where T#1,T#2,U are type-variables:
    T#1 extends Object declared in method <T#1>copyOf(T#1[],int)
    T#2 extends Object declared in method <T#2,U>copyOf(U[],int,Class<? extends T#2[]>)
    U extends Object declared in method <T#2,U>copyOf(U[],int,Class<? extends T#2[]>)
Main.java:47: error: method search in class Main cannot be applied to given types;
int c = search(sayTable, copyHonest, i + 1);
        ^
  required: int[][],int[],int,int
  found:    int[][],int[],int
  reason: actual and formal argument lists differ in length
Main.java:52: error: no suitable method found for copyOf(int[])
		int[] copyHonest = Arrays.copyOf(honest);
		                         ^
    method Arrays.<T#1>copyOf(T#1[],int) is not applicable
      (cannot infer type-variable(s) T#1
        (actual and formal argument lists differ in length))
    method Arrays.<T#2,U>copyOf(U[],int,Class<? extends T#2[]>) is not applicable
      (cannot infer type-variable(s) T#2,U
        (actual and formal argument lists differ in length))
  where T#1,T#2,U are type-variables:
    T#1 extends Object declared in method <T#1>copyOf(T#1[],int)
    T#2 extends Object declared in method <T#2,U>copyOf(U[],int,Class<? extends T#2[]>)
    U extends Object declared in method <T#2,U>copyOf(U[],int,Class<? extends T#2[]>)
Main.java:54: error: method search in class Main cannot be applied to given types;
int c = search(sayTable, copyHonest, i + 1);
        ^
  required: int[][],int[],int,int
  found:    int[][],int[],int
  reason: actual and formal argument lists differ in length
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
6 errors