Buggy python submission (verdict: Runtime Error):
n = int(input())
LST = [0] * n
for i in range(n):
    p = int(input())
    lst = [[0]*2 for _ in range(p)]
    for j in range(p):
        a, b = list(map(int, input().split()))
        lst[j][0] = a - 1
        lst[j][1] = b
    LST[i] = lst

def checker(bit):
    flag = True
    for i in range(n):
        if not ((bit >> (2-i)) & 1):
            continue
        num = len(LST[i])
        for j in range(num):
            people = LST[i][j][0]
            TF = LST[i][j][1]
            if TF == 0 and ((bit >> (2-people)) & 1) == 1:
                flag = False
            if TF == 1 and ((bit >> (2-people)) & 1) != 1:
                flag = False
    return flag

max_num = 0
for k in range(n ** 2 - 1):
    cnt = 0
    if checker(k):
        for l in range(n):
            if((k >> l) & 1):
                cnt += 1
        if cnt > max_num:
            max_num = cnt

print(max_num)

Fixed submission:
n = int(input())
words_list = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        words_list[i].append((x - 1, y))

ans = 0
for i in range(2 ** n):
    peoples = []
    flag = True
    for j in range(n):
        if (i >> j & 1):
            peoples.append(1)
        else:
            peoples.append(0)
    for k in range(n):
        if peoples[k] == 1:
            words = words_list[k]
            for word in words:
                if peoples[word[0]] != word[1]:
                    flag = False
                    break
    if flag:
        ans = max(ans, sum(peoples))

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
LST = [0] * n
for i in range(n):
    p = int(input())
    lst = [[0]*2 for _ in range(p)]
    for j in range(p):
        a, b = list(map(int, input().split()))
        lst[j][0] = a - 1
        lst[j][1] = b
    LST[i] = lst

def checker(bit):
    flag = True
    for i in range(n):
        if not ((bit >> 2-i) & 1):
            continue
        num = len(LST[i])
        for j in range(num):
            people = LST[i][j][0]
            TF = LST[i][j][1]
            if TF == 0 and ((bit >> 2-people) & 1) == 1:
                flag = False
            if TF == 1 and ((bit >> 2-people) & 1) != 1:
                flag = False
    return flag

max_num = 0
for k in range(n ** 2 - 1):
    cnt = 0
    if checker(k):
        for l in range(n):
            if((k >> l) & 1):
                cnt += 1
        if cnt > max_num:
            max_num = cnt

print(max_num)

Fixed submission:
n = int(input())
words_list = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        words_list[i].append((x - 1, y))

ans = 0
for i in range(2 ** n):
    peoples = []
    flag = True
    for j in range(n):
        if (i >> j & 1):
            peoples.append(1)
        else:
            peoples.append(0)
    for k in range(n):
        if peoples[k] == 1:
            words = words_list[k]
            for word in words:
                if peoples[word[0]] != word[1]:
                    flag = False
                    break
    if flag:
        ans = max(ans, sum(peoples))

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
LST = [0] * n
for i in range(n):
    p = int(input()) # people num
    lst = [[0]*2 for _ in range(p)]
    for j in range(p):
        a, b = list(map(int, input().split())) # talk
        lst[j][0] = a - 1 # 0-indexed
        lst[j][1] = b
    LST[i] = lst

def checker(bit):
    flag = True
    # i番目の人が正直者かどうかをチェック
    for i in range(n):
        # i番目の人が正直者でないなら発言の真偽は両方の可能性があるので無視する
        if not ((bit >> 2-i) & 1):
            continue
        # i番目の人が正直なので発言を見にいく
        num = len(LST[i])  # 何人について発言しているか
        for j in range(num):
            people = LST[i][j][0] # i番目の人のj個目の発言の対象者
            TF = LST[i][j][1] # i番目の人のj個目の発言の対象者が0(=正直者でない)なのか1(=正直者)
            if TF == 0 and ((bit >> 2-people) & 1) == 1:
                flag = False
            if TF == 1 and ((bit >> 2-people) & 1) != 1:
                flag = False
    return flag

max_num = 0
for k in range(n ** 2 - 1):
    cnt = 0
    if checker(k):
        # bitの中で1が立っている(=正直者)をカウント
        for l in range(n):
            if((k >> l) & 1):
                cnt += 1
        if cnt > max_num:
            max_num = cnt

print(max_num)

Fixed submission:
n = int(input())
words_list = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        words_list[i].append((x - 1, y))

ans = 0
for i in range(2 ** n):
    peoples = []
    flag = True
    for j in range(n):
        if (i >> j & 1):
            peoples.append(1)
        else:
            peoples.append(0)
    for k in range(n):
        if peoples[k] == 1:
            words = words_list[k]
            for word in words:
                if peoples[word[0]] != word[1]:
                    flag = False
                    break
    if flag:
        ans = max(ans, sum(peoples))

print(ans)