Language: Java

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CSwitches solver = new CSwitches();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSwitches {
        long ans = 0;
        int n;
        int m;
        int p;
        ArrayList<Integer> a;

        public void cases(StringBuilder b, int n) {
            if (n == 0) {
                int count = 0;
                for (int i = 0; i < m; i++) {
                    count = 0;
                    for (int j = 0; j < a[i].size(); j++) {
                        if (b.charAt(j) == '1') count++;
                    }
                    if (count % 2 != p[i]) {
                        return;
                    }
                }
                ans++;
                return;
            } else {
                cases(new StringBuilder(b.toString() + "0"), n - 1);
                cases(new StringBuilder(b.toString() + "1"), n - 1);
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            a = new ArrayList[m];
            for (int i = 0; i < m; i++) a[i] = new ArrayList<Integer>();
            p = new int[m];
            for (int i = 0; i < m; i++) {
                int k = in.nextInt();
                for (int j = 0; j < k; j++) a[i].add(in.nextInt() - 1);
            }
            for (int i = 0; i < m; i++) p[i] = in.nextInt();
            cases(new StringBuilder(""), n);
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Compiler output:
Main.java:41: error: array required, but ArrayList<Integer> found
                    for (int j = 0; j < a[i].size(); j++) {
                                         ^
Main.java:44: error: array required, but int found
                    if (count % 2 != p[i]) {
                                      ^
Main.java:59: error: incompatible types: ArrayList[] cannot be converted to ArrayList<Integer>
            a = new ArrayList[m];
                ^
Main.java:60: error: array required, but ArrayList<Integer> found
            for (int i = 0; i < m; i++) a[i] = new ArrayList<Integer>();
                                         ^
Main.java:61: error: incompatible types: int[] cannot be converted to int
            p = new int[m];
                ^
Main.java:64: error: array required, but ArrayList<Integer> found
                for (int j = 0; j < k; j++) a[i].add(in.nextInt() - 1);
                                             ^
Main.java:66: error: array required, but int found
            for (int i = 0; i < m; i++) p[i] = in.nextInt();
                                         ^
7 errors