Problem: There are N people numbered 1 to N. Each of them is either an _honest_ person whose testimonies are always correct or an _unkind_ person whose testimonies may be correct or not.  Person i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.  How many honest persons can be among those N people at most?

Submission attempts (in order):
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")


def main():
    N = int(input())

    A = []
    x = []
    y = []

    for i in range(N):
        Ai = int(input())
        xi = []
        yi = []
        A.append(Ai)
        x.append(xi)
        y.append(yi)

        for j in range(Ai):
            xij, yij = map(int, input().split(' '))
            xi.append(xij)
            yi.append(yij)

    logging.info(A)
    logging.info(x)
    logging.info(y)

    ok_list = [0]
    for bits in range(2 ** N):
        ok_flag = True
        for i in range(N):
            if (bits >> i) & 1 == 0:
                continue

            for j in range(A[i]):
                if (bits >> (x[i][j] - 1) & 1) != y[i][j]:
                    ok_flag = False

    if ok_flag:
        ok_list.append(bin(bits).count('1'))

    print(max(ok_list))

    
if __name__ == "__main__":
    main()


import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")


def main():
    N = int(input())

    A = []
    x = []
    y = []

    for i in range(N):
        Ai = int(input())
        xi = []
        yi = []
        A.append(Ai)
        x.append(xi)
        y.append(yi)

        for j in range(Ai):
            xij, yij = map(int, input().split(' '))
            xi.append(xij)
            yi.append(yij)

    logging.info(A)
    logging.info(x)
    logging.info(y)

    ok_list = []
    for bits in range(2 ** N):
        ok_flag = True
        for i in range(N):
            if (bits >> i) & 1 == 0:
                continue

            for j in range(A[i]):
                if (bits >> (x[i][j] - 1) & 1) != y[i][j]:
                    ok_flag = False

    if ok_flag:
        ok_list.append(bin(bits).count('1'))

    print(max(ok_list))

    
if __name__ == "__main__":
    main()


import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")


def main():
    N = int(input())

    A = []
    x = []
    y = []

    for i in range(N):
        Ai = int(input())
        xi = []
        yi = []
        A.append(Ai)
        x.append(xi)
        y.append(yi)

        for j in range(Ai):
            xij, yij = map(int, input().split(' '))
            xi.append(xij)
            yi.append(yij)

    logging.info(A)
    logging.info(x)
    logging.info(y)

    ok_list = []
    for bits in range(2 ** N):
        ok_flag = True
        for i in range(N):
            if (bits >> i) & 1 == 0:
                continue

            for j in range(A[i]):
                if (bits >> (x[i][j] - 1) & 1) != y[i][j]:
                    ok_flag = False

        if ok_flag:
            ok_list.append(bin(bits).count('1'))

    print(max(ok_list))

    
if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Runtime Error

Accepted