Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    n = int(input())

    testimony = {}
    for i in range(n):
        a = int(input()) # 証言数
        for j in range(a):
            who, ans = list(map(int, input().split(' ')))
            if j == 0:
                testimony[i + 1] = [{
                    'who': who,
                    'ans': ans
                }]
            else:
                testimony[i + 1].append({
                    'who': who,
                    'ans': ans
                })

    # print(testimony)
    # testimony = {1: [{'who': 2, 'ans': 1}], 2: [{'who': 1, 'ans': 1}], 3: [{'who': 2, 'ans': 0}]}

    max_honest = 0
    for i in reversed(range(2 ** n)):
        check_list = bin(i)[2:].zfill(n)
        # print(check_list) # 000 - 111
        ng_flag = 0
        for j in range(n):
            if check_list[j] == '1':
                for k in testimony[j + 1]: #正直者j +1さんの意見を順にチェック
                    if check_list[k['who'] - 1] != str(k['ans']):
                        ng_flag = 1
                        break
        if ng_flag == 0:
            if check_list.count('1') > max_honest:
                max_honest = check_list.count('1')

    print(max_honest)

Fixed submission:
if __name__ == '__main__':
    n = int(input())

    testimony = {}
    for i in range(n):
        a = int(input()) # 証言数
        for j in range(a):
            who, ans = list(map(int, input().split(' ')))
            if j == 0:
                testimony[i + 1] = [{
                    'who': who,
                    'ans': ans
                }]
            else:
                testimony[i + 1].append({
                    'who': who,
                    'ans': ans
                })

    # print(testimony)
    # testimony = {1: [{'who': 2, 'ans': 1}], 2: [{'who': 1, 'ans': 1}], 3: [{'who': 2, 'ans': 0}]}

    max_honest = 0
    for i in reversed(range(2 ** n)):
        check_list = bin(i)[2:].zfill(n)
        # print(check_list) # 000 - 111
        ng_flag = 0
        for j in range(n):
            if check_list[j] == '1' and (j + 1) in testimony:
                for k in testimony[j + 1]: #正直者j +1さんの意見を順にチェック
                    if check_list[k['who'] - 1] != str(k['ans']):
                        ng_flag = 1
                        break
        if ng_flag == 0:
            if check_list.count('1') > max_honest:
                max_honest = check_list.count('1')

    print(max_honest)

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    n = int(input())

    info = {}
    for i in range(n):
        a = int(input())
        for j in range(a):
            x, y = list(map(int, input().split(' ')))
            if j == 0:
                info[i] = [(x, y)]
            else:
                info[i].append((x, y))

    # print(info)

    max_p = 0
    for i in reversed(range(2 ** n)):
        check_list = bin(i)[2:].zfill(n)
        # print(check_list)
        ng_flag = 0
        for j in range(n):
            if check_list[n - j - 1] == '1':
                for k in info[j]:
                    if check_list[n - k[0]] != str(k[1]):
                        ng_flag = 1
                        break
        if ng_flag == 0:
            if check_list.count('1') > max_p:
                max_p = check_list.count('1')

    print(max_p)

Fixed submission:
if __name__ == '__main__':
    n = int(input())

    testimony = {}
    for i in range(n):
        a = int(input()) # 証言数
        for j in range(a):
            who, ans = list(map(int, input().split(' ')))
            if j == 0:
                testimony[i + 1] = [{
                    'who': who,
                    'ans': ans
                }]
            else:
                testimony[i + 1].append({
                    'who': who,
                    'ans': ans
                })

    # print(testimony)
    # testimony = {1: [{'who': 2, 'ans': 1}], 2: [{'who': 1, 'ans': 1}], 3: [{'who': 2, 'ans': 0}]}

    max_honest = 0
    for i in reversed(range(2 ** n)):
        check_list = bin(i)[2:].zfill(n)
        # print(check_list) # 000 - 111
        ng_flag = 0
        for j in range(n):
            if check_list[j] == '1' and (j + 1) in testimony:
                for k in testimony[j + 1]: #正直者j +1さんの意見を順にチェック
                    if check_list[k['who'] - 1] != str(k['ans']):
                        ng_flag = 1
                        break
        if ng_flag == 0:
            if check_list.count('1') > max_honest:
                max_honest = check_list.count('1')

    print(max_honest)