Problem p03031 (python)

Fixed submission:
n, m = map(int, input().split())
switch = []
for i in range(m):
    switch.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0
for i in range(2**n):
    i = format(i, "0{}b".format(n))
    flag = 1
    for j in range(m):
        count = 0
        for k in range(switch[j][0]):
            if i[switch[j][k+1]-1] == "1":
                count += 1
        if count % 2 == p[j]:
            continue
        else:
            flag = 0
            break
    if flag == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().split()))[1:] for i in range(M)]
p = list(map(int, input().split()))
total = 0
j = 0
for i in range(2 ** N):
  now = format(i, '10b')
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += int(now[-l])
    if tmp % 2 == p[k]:
      j += 1
  if j == M :
    total += 1
  j = 0
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit())) for i in range(M)]
p = list(map(int, input().split()))
total = 0
flag = 1
for i in range(2 ** N):
  now = format(i, "0{}b".format(N))
  for k in range(M):
    tmp = 0
    for l in range(s[k][0]):
      if now[s[k][l+1]-1] == '1':
        tmp += 1
    if tmp % 2 == p[k]:
      continue
    else:
      flag = 0
      break
  if flag == 1:
    total += 1
  flag = 1
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit())) for i in range(M)]
p = list(map(int, input().split()))
total = 0
flag = 1
for i in range(2 ** N):
  now = format(i, "0{}b".format(n))
  for k in range(M):
    tmp = 0
    for l in range(s[k][0]):
      if now[s[k][l+1]-1] == '1':
        tmp += 1
    if tmp % 2 == p[k]:
      continue
    else:
      flag = 0
      break
  if flag == 1:
    total += 1
  flag = 1
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit())) for i in range(M)]
p = list(map(int, input().split()))
total = 0
flag = 1
for i in range(2 ** N):
  now = format(i, "0{}b".format(n))
  for k in range(M):
    tmp = 0
    for l in range(s[k][0]):
      if now[s[k][l+1]-1] == '1':
        tmp += 1
    if tmp % 2 == p[k]:
      continue
    else:
      flag = 0
      break
  if flag == 1
    total += 1
  flag = 1
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit())) for i in range(M)]
p = list(map(int, input().split()))
total = 0
flag = 1
for i in range(2 ** N):
  now = format(i, '010b')
  for k in range(M):
    tmp = 0
    for l in range(s[k][0]):
      if now[-s[k][l+1]] == '1':
        tmp += 1
    if tmp % 2 == p[k]:
      continue
    else:
      flag = 0
      break
  if flag == 1
    total += 1
  flag = 1
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit()))[1:] for i in range(M)]
p = list(map(int, input().split()))
total = 0
j = 0
for i in range(2 ** N):
  now = format(i, '010b')
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += int(now[-l])
    if tmp % 2 == p[k]:
      j += 1
  if j == M:
    total += 1
  j = 0
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit()))[1:] for i in range(M)]
p = list(map(int, input().split()))
total = 0
j = 0
for i in range(2 ** N):
  now = format(i, '10b')
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += int(now[-l])
    if tmp % 2 == p[k]:
      j += 1
  if j == M :
    total += 1
  j = 0
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit())) [1:] for i in range(M)]
p = list(map(int, input().split()))
total = 0
j = 0
for i in range(2 ** N):
  now = format(i, '10b')
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += int(now[-l])
    if tmp % 2 == p[k]:
      j += 1
  if j == M :
    total += 1
  j = 0
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit())) [1:] for i in range(M)]
p = list(map(int, input().split()))
total = 0
j = 0
for i in range(2 ** N):
  now = format(i, 'Nb')
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += int(now[l-1])
    if tmp % 2 == p[k]:
      j += 1
  if j == M :
    total += 1
  j = 0
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().spllit())) [1:] for i in range(M)]
p = list(map(int, input().split()))
total = 0
j = 0
for i in range(2 ** N):
  lis = []
  for j in range(N):
    lis.append((i>>j) & 1)
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += lis[l-1]
    if tmp % 2 == p[k]:
      j += 1
  if j == M :
    total += 1
  j = 0
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int,input().spllit()))[1:] for i in range(M)]
p = list(map(int,input().split()))
total = 0
j = 0
for i in range(2 ** N):
  lis = []
  for j in range(N):
    lis.append((i>>j) & 1)
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += lis[l-1]
    if tmp % 2 == p[k]:
      j += 1
  if j == M :
    total += 1
  j = 0
print(total)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int,input().spllit()))[1:] for i in range(M)]
p = list(map(int,input().split()))
total = 0
j = 0
for i in range(2 ** N):
  lis = []
  for j in range(N):
    lis.append((i>>j) & 1)
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += lis[l-1]
      if tmp % 2 == p[k]:
        j += 1
  if j == M :
    total += 1
  j = 0
print(total)