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):
n = int(input())
l = [False]*n
ls = [0]*n
param_list = [0]*2**n
for i in range(2**(n-1)):
    l = [False]*n
    for id_r, row in enumerate(ls):
        if i & id_r >0:
            l[id_r] = True
    param_list[i] = l 
#1print(param_list)
 
for i in range(2**(n-1)):
    l = [True]+[False]*(n-1)
    for id_r, row in enumerate(ls):
        if i & id_r >0:
            l[id_r] = True
    param_list[i+2**(n-1)] = l 
#print()
#print(param_list)
 
for i in range(n):
    A = int(input())
    for k in range(A):
        a,b = map(int, input().split())
        b = (1==b)
        new_param =[]
        for d in param_list:
            if d[i]:
                if d[a-1] == b:
                    new_param.append(d)
                    pass
                else:
                    #print(2)
                    pass
            #else:
                #if d[a-1] is b:
                    #print(3)
                    #pass
                #else:
                    #print(4)
                    #new_param.append(d)
                    #pass
            
        param_list = new_param
        #print(param_list)
            
ans = 0    
for d in param_list:
    ans = max(ans,d.count(True))
print(ans)

n = int(input())
ls = [0]*n
param_list = [0]*2**n
for i in range(2**n):
    l = [False]*n
    for id_r, row in enumerate(ls):
        if i & (2 ** id_r) >0:
            l[id_r] = True
    param_list[i] = l 
#1print(param_list)
"""
for i in range(2**(n-1)):
    l = [True]+[False]*(n-1)
    for id_r, row in enumerate(ls):
        if i & id_r >0:
            l[id_r] = True
    param_list[i+2**(n-1)] = l 
print()
print(len(param_list))
print(param_list)
a_list = get_unique_list(param_list)
print(len(a_list))
print(a_list)"""

for i in range(n):
    A = int(input())
    for k in range(A):
        a,b = map(int, input().split())
        b = (1==b)
        new_param =[]
        for d in a_list:
            if d[i]:
                if d[a-1] == b:
                    new_param.append(d)
                    pass
                else:
                    #print(2)
                    pass
            else:
                new_param.append(d)
                #if d[a-1] is b:
                    #print(3)
                    #pass
                #else:
                    #print(4)
                    #new_param.append(d)
                    #pass
            
        param_list = new_param
        #print(param_list)
            
ans = 0    
for d in param_list:
    ans = max(ans, d.count(True))
print(ans)

n = int(input())
ls = [0]*n
param_list = [0]*2**n
for i in range(2**n):
    l = [False]*n
    for id_r, row in enumerate(ls):
        if i & (2 ** id_r) >0:
            l[id_r] = True
    param_list[i] = l 


for i in range(n):
    A = int(input())
    for k in range(A):
        a,b = map(int, input().split())
        b = (1==b)
        new_param =[]
        for d in param_list:
            if d[i]:
                if d[a-1] == b:
                    new_param.append(d)
                    pass
                else:
                    #print(2)
                    pass
            else:
                new_param.append(d)
                #if d[a-1] is b:
                    #print(3)
                    #pass
                #else:
                    #print(4)
                    #new_param.append(d)
                    #pass
            
        param_list = new_param
        #print(param_list)
            
ans = 0    
for d in param_list:
    ans = max(ans, d.count(True))
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted