Problem p02837 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
        
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
for i,x,y in info:
    bl = (~A[:,i]) | (A[:,x] == bool(y))
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
        
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
for i,x,y in info:
    bl = (A[:,i]) & (A[:,x] == bool(y))
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
#print(info)

#info=[(0, 1, 1), (1, 0, 1), (2, 1, 0)]

N=3
#A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)

for i,x,y in info:
    # print(~A[:,i])
    # print(A[:,x])
    bl = (~A[:,i]) | (A[:,x] == bool(y))
    # bl = (A[:,i]) & A[:,x] == bool(y)
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
#print(info)

#info=[(0, 1, 1), (1, 0, 1), (2, 1, 0)]

N=3
#A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)

for i,x,y in info:
    # print(~A[:,i])
    # print(A[:,x])
    # bl = (~A[:,i]) | (A[:,x] == bool(y))
    bl = (A[:,i]) & A[:,x] == bool(y)
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
#print(info)

#info=[(0, 1, 1), (1, 0, 1), (2, 1, 0)]

N=3
#A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)

for i,x,y in info:
    # print(~A[:,i])
    # print(A[:,x])
    # bl = (~A[:,i]) | (A[:,x] == bool(y))
    bl = (A[:,i]) & A[:,x] == bool(y)
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)