Buggy python submission (verdict: Runtime Error):
N = int(input())
total = 0
tmp = 0
A = []
xy = []
l = []
for i in range(N):
  A.append(int(input())
  for j in range(A[i]):
    l.append(list(map(int,input().split())))
  xy.append(l)
  l.clear()
for i in range(2**N):
  flag = 1
  t = format(i, '0{}b'.format(N))
  for k in range(N):
    if t[k] == '1':
      tmp += 1
      for l in range(A[k]):
        if int(t[xy[k][l][0]-1]) != xy[k][l][1]:
          flag = 0
          break
      else:
        continue
      break
  if flag == 1 and total < tmp:
    total = tmp
  tmp = 0
print(total)
          


Fixed submission:
#標準入力受け取り
N = int(input())
shougen = []
A_lis = []
for _ in range(N):
    A = int(input())
    A_lis.append(A)
    minishougen = []
    for j in range(A):
        xy = list(map(int, input().split()))
        minishougen.append(xy)
    shougen.append(minishougen)

#ビットの配列作る
bit_lis = []
for i in range(2 ** N):
    mini_bit_lis = []
    for j in range(N):
        mini_bit_lis.append(i % 2)
        i = i // 2
    bit_lis.append(mini_bit_lis)
    
#ビットの配列について全探索を行う
ans = 0
for i in range(2 ** N):
    flag = 0
    for l in range(N):
        if bit_lis[i][l] == 1:
            for k in range(A_lis[l]): 
                if shougen[l][k][1] != bit_lis[i][shougen[l][k][0] - 1]:
                    flag = 1
                    break
        if flag == 1:
            break
    if flag == 0:
        tmp = sum(bit_lis[i])
        if tmp > ans :
            ans = tmp
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
total = 0
tmp = 0
A = []
xy = []
l = []
for i in range(N):
  A.append(int(input())
  for j in range(A[i]):
    l.append(list(map(int,input().split())))
  xy.append(l)
  l.clear()
for i in range(2**N):
  flag = 1
  i = format(i, '0{}b'.format(N))
  for k in range(N):
    if i[k] == '1':
      tmp += 1
      for l in range(A[k]):
        if int(i[xy[k][l][0]]) != xy[k][l][1]:
          flag = 0
          break
      else:
        continue
      break
  if flag == 1 and total < tmp:
    total = tmp
  tmp = 0
print(total)
          


Fixed submission:
#標準入力受け取り
N = int(input())
shougen = []
A_lis = []
for _ in range(N):
    A = int(input())
    A_lis.append(A)
    minishougen = []
    for j in range(A):
        xy = list(map(int, input().split()))
        minishougen.append(xy)
    shougen.append(minishougen)

#ビットの配列作る
bit_lis = []
for i in range(2 ** N):
    mini_bit_lis = []
    for j in range(N):
        mini_bit_lis.append(i % 2)
        i = i // 2
    bit_lis.append(mini_bit_lis)
    
#ビットの配列について全探索を行う
ans = 0
for i in range(2 ** N):
    flag = 0
    for l in range(N):
        if bit_lis[i][l] == 1:
            for k in range(A_lis[l]): 
                if shougen[l][k][1] != bit_lis[i][shougen[l][k][0] - 1]:
                    flag = 1
                    break
        if flag == 1:
            break
    if flag == 0:
        tmp = sum(bit_lis[i])
        if tmp > ans :
            ans = tmp
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
total = 0
tmp = 0
A = []
xy = []
for i in range(N):
  A.append(int(input())
  t = [list(map(int,input().split())) for j in range(A[i])]
  xy.append(t)
for i in range(2**N):
  flag = 1
  i = format(i, '0{}b'.format(N))
  for k in range(N):
    if i[k] == '1':
      tmp += 1
      for l in range(A[k]):
        if int(i[xy[k][l][0]]) != xy[k][l][1]:
          flag = 0
          break
      else:
        continue
      break
  if flag == 1 and total < tmp:
    total = tmp
  tmp = 0
print(total)
          


Fixed submission:
#標準入力受け取り
N = int(input())
shougen = []
A_lis = []
for _ in range(N):
    A = int(input())
    A_lis.append(A)
    minishougen = []
    for j in range(A):
        xy = list(map(int, input().split()))
        minishougen.append(xy)
    shougen.append(minishougen)

#ビットの配列作る
bit_lis = []
for i in range(2 ** N):
    mini_bit_lis = []
    for j in range(N):
        mini_bit_lis.append(i % 2)
        i = i // 2
    bit_lis.append(mini_bit_lis)
    
#ビットの配列について全探索を行う
ans = 0
for i in range(2 ** N):
    flag = 0
    for l in range(N):
        if bit_lis[i][l] == 1:
            for k in range(A_lis[l]): 
                if shougen[l][k][1] != bit_lis[i][shougen[l][k][0] - 1]:
                    flag = 1
                    break
        if flag == 1:
            break
    if flag == 0:
        tmp = sum(bit_lis[i])
        if tmp > ans :
            ans = tmp
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
total = 0
tmp = 0
A = []
xy = []
for i in range(N):
  A.append(int(input())
  t = [list(map(int,input().split())) for j in range(A[i])]
  xy.append(t)
for i in range(2**N):
  flag = 1
  i = format(i, '0{}b'.format(N))
  for k in range(N):
    if i[k] == '1':
      tmp += 1
      for l in range(A[k]):
        if int(i[xy[k][l][0]]) != xy[k][l][1]:
          flag = 0
          break
      else:
        continue
      break
  if flag == 1 and total < tmp:
    total = tmp
  tmp = 0
print(total)
          


Fixed submission:
#標準入力受け取り
N = int(input())
shougen = []
A_lis = []
for _ in range(N):
    A = int(input())
    A_lis.append(A)
    minishougen = []
    for j in range(A):
        xy = list(map(int, input().split()))
        minishougen.append(xy)
    shougen.append(minishougen)

#ビットの配列作る
bit_lis = []
for i in range(2 ** N):
    mini_bit_lis = []
    for j in range(N):
        mini_bit_lis.append(i % 2)
        i = i // 2
    bit_lis.append(mini_bit_lis)
    
#ビットの配列について全探索を行う
ans = 0
for i in range(2 ** N):
    flag = 0
    for l in range(N):
        if bit_lis[i][l] == 1:
            for k in range(A_lis[l]): 
                if shougen[l][k][1] != bit_lis[i][shougen[l][k][0] - 1]:
                    flag = 1
                    break
        if flag == 1:
            break
    if flag == 0:
        tmp = sum(bit_lis[i])
        if tmp > ans :
            ans = tmp
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
total = 0
tmp = 0
A = []
xy = []
for i in range(N):
  A.append(int(input())
  t = [list(map(int(input().split()))) for j in range(A[i])]
  xy.append(t)
for i in range(2**N):
  flag = 1
  i = format(i, '0{}b'.format(N))
  for k in range(N):
    if i[k] == '1':
      tmp += 1
      for l in range(A[k]):
        if int(i[xy[k][l][0]]) != xy[k][l][1]:
          flag = 0
          break
      else:
        continue
      break
  if flag == 1 and total < tmp:
    total = tmp
  tmp = 0
print(total)
          

Fixed submission:
#標準入力受け取り
N = int(input())
shougen = []
A_lis = []
for _ in range(N):
    A = int(input())
    A_lis.append(A)
    minishougen = []
    for j in range(A):
        xy = list(map(int, input().split()))
        minishougen.append(xy)
    shougen.append(minishougen)

#ビットの配列作る
bit_lis = []
for i in range(2 ** N):
    mini_bit_lis = []
    for j in range(N):
        mini_bit_lis.append(i % 2)
        i = i // 2
    bit_lis.append(mini_bit_lis)
    
#ビットの配列について全探索を行う
ans = 0
for i in range(2 ** N):
    flag = 0
    for l in range(N):
        if bit_lis[i][l] == 1:
            for k in range(A_lis[l]): 
                if shougen[l][k][1] != bit_lis[i][shougen[l][k][0] - 1]:
                    flag = 1
                    break
        if flag == 1:
            break
    if flag == 0:
        tmp = sum(bit_lis[i])
        if tmp > ans :
            ans = tmp
print(ans)