Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []

x = []
y = []

for i in range(N):
    temp = int(input())
    A.append(temp)
    temp3 = []
    temp4 = []
    for j in range(temp):
        temp1,temp2 = map(int,input().split())
        temp3.append(temp1)
        temp4.append(temp2)
    x.append(temp3)
    y.append(temp4)

allperson = set(range(N))

res = [0]

for i in range(N):
    honest = {i}
    dishonest = set()
    checked = set()
    temp1 = A[i]
    for j in range(temp1):
        if y[i][j] == 1:
            honest.add(x[i][j]-1)
        elif y[i][j] == 0:
            dishonest.add(x[i][j]-1)

    temp2 = honest
    isOK = True

    while isOK:
        for k in temp2:
            temp3 = A[i]
            for l in range(temp3):
                if y[k][l] == 1:
                    if x[k][l]-1 in dishonest:
                        isOK = False
                        break
                    else:
                        honest.add(x[k][l]-1)
                elif y[k][l] == 0:
                    if x[k][l]-1 in honest:
                        isOK = False
                        break
                    else:
                        dishonest.add(x[k][l]-1)
            if isOK == False:
                break
            checked.add(k)
        if checked == honest:
            isOK = True
            break
        else:
            temp2 = honest - checked

    if isOK == True:
        temp4 = len(honest)
        res.append(temp4)
        # print(i)
        # print(temp4)
        # print(honest)

print(max(res))


Fixed submission:
N = int(input())

A = []

x = []
y = []

for i in range(N):
    temp = int(input())
    A.append(temp)
    temp3 = []
    temp4 = []
    for j in range(temp):
        temp1,temp2 = map(int,input().split())
        temp3.append(temp1)
        temp4.append(temp2)
    x.append(temp3)
    y.append(temp4)

res = 0

for i in range(2 ** N):
    isOK = True
    honest = 0
    for j in range(N):
        if ((i >> j) & 1):
            honest += 1
            for k in range(A[j]):
                if (((i >> (x[j][k]-1)) & 1) ^ y[j][k]):
                    isOK = False
    if isOK:
        res = max(res,honest)

print(res)

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []

x = []
y = []

for i in range(N):
    temp = int(input())
    A.append(temp)
    temp3 = []
    temp4 = []
    for j in range(temp):
        temp1,temp2 = map(int,input().split())
        temp3.append(temp1)
        temp4.append(temp2)
    x.append(temp3)
    y.append(temp4)

allperson = set(range(N))

res = [0]

for i in range(N):
    honest = {i}
    dishonest = set()
    checked = set()
    temp1 = A[i]
    for j in range(temp1):
        if y[i][j] == 1:
            honest.add(x[i][j]-1)
        elif y[i][j] == 0:
            dishonest.add(x[i][j]-1)

    temp2 = honest
    isOK = True

    while isOK:
        for k in temp2:
            temp3 = A[i]
            for l in range(temp3):
                if y[k][l] == 1:
                    if x[k][l]-1 in dishonest:
                        isOK = False
                        break
                    else:
                        honest.add(x[k][l]-1)
                elif y[k][l] == 0:
                    if x[k][l]-1 in honest:
                        isOK = False
                        break
                    else:
                        dishonest.add(x[k][l]-1)
            if isOK == False:
                break
            checked.add(k)
        if checked == honest:
            isOK = True
            break
        else:
            temp2 = honest - checked

    if isOK == True:
        temp4 = len(honest)
        res.append(temp4)
        # print(i)
        # print(temp4)
        # print(honest)

print(max(res))


Fixed submission:
N = int(input())

A = []

x = []
y = []

for i in range(N):
    temp = int(input())
    A.append(temp)
    temp3 = []
    temp4 = []
    for j in range(temp):
        temp1,temp2 = map(int,input().split())
        temp3.append(temp1)
        temp4.append(temp2)
    x.append(temp3)
    y.append(temp4)

res = 0

for i in range(2 ** N):
    isOK = True
    honest = 0
    for j in range(N):
        if ((i >> j) & 1):
            honest += 1
            for k in range(A[j]):
                if (((i >> (x[j][k]-1)) & 1) ^ y[j][k]):
                    isOK = False
    if isOK:
        res = max(res,honest)

print(res)