Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03543 (python)

Fixed submission:
n=list(input())
print('Yes' if n[0]==n[1]==n[2] or n[3]==n[1]==n[2] or  n[0]==n[2]==n[3]==n[1] else 'No')

Buggy submission (verdict: Runtime Error):
n=list(input())
print('Yes' if n[0]==n[1]==n[2] or n[3]==n[1]==n[2] or n[2]==n[3]==n[4] else 'No')
Problem p03556 (python)

Fixed submission:
N = int(input())
print(int(N**0.5)**2)

Buggy submission (verdict: Runtime Error):
Not found
Problem p03610 (python)

Fixed submission:
s = input()
for i in range(0,len(s),2):
    print(s[i],end="")

Buggy submission (verdict: Runtime Error):
s = list(input())
for i in range(10**5):
    if i%2==0:
        s[i].replace(s[i],'')
print(s)

Buggy submission (verdict: Runtime Error):
Not found
Problem p03611 (python)

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
    a.append(a[i]+1)
    a.append(a[i]-1)
c=collections.Counter(a)
print(c.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n**4
for i in a:
    ans[i]+=1
    ans[i+1]+=1
    ans[i+2]+=1
print(max(ans))
Problem p03624 (python)

Fixed submission:
s=input()
s=list(set(s))

A=[]
for i in range(97,123):
    A.append(chr(i))


for i in range(len(A)):
    if A[i] in s:
        continue
    else:
        print(A[i])
        exit()

print("None")

Buggy submission (verdict: Runtime Error):
s=sorted(set(input()))
ro='abcdefghijklmnopqrstuvwxyz'
if len(s)==len(ro):
    print('None')
else:
    for i in range(len(ro)):
        if s[i]!=ro[i]:
            print(ro[i])
            break
Problem p03679 (python)

Fixed submission:
x,a,b=map(int,input().split())
if b-a<=x:
    if b-a<=0:
        print('delicious')
    else:
        print('safe')
else:
    print('dangerous')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b-a<x:
    print('delicious')
elif b-a=x:
    print('safe')
else:
    print('dangerous')
Problem p03720 (python)

Fixed submission:
N,M = map(int, input().split())
A=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    A[a-1] += 1
    A[b-1] += 1
for h in range(N):
    print(A[h])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
while m>0:
Problem p03814 (python)

Fixed submission:
s = input()
print(s.rfind("Z") - s.find("A") + 1)

Buggy submission (verdict: Runtime Error):
Not found
Problem p03827 (python)

Fixed submission:
n = int(input())
s = input()
a = []
a.append(0)

for i in range(n):
    if s[i] == 'I':
        a.append(a[i]+1)
    else:
        a.append(a[i]-1)
print(max(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
x=[]
for i in range(n):
    if s[i]=='I':
        ans+=1
        x.append(ans)
    else:
        ans-=1
print(max(x))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
x=[]
for i in range(n):
    if s[i]=='I':
        ans+=1
        x.append(ans)
    else:
        ans-=1
print(max(x))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
x=0
for i in range(n):
    if s[i]=='I':
        ans+=1
    x=max(0,ans)
    else:
        ans-=1
print(x)
Problem p03909 (python)

Fixed submission:
h,w=map(int,input().split())
s=[input().split() for i in range(h)]
al=[chr(i) for i in range(65,65+26)]
for i in range(h):
    if 'snuke' in s[i]:
        print(al[s[i].index('snuke')]+str(i+1))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
alp=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
l=[]
for i in range(h):
    a=list(map(str,input().split()))
    l.append(a)
for j in range(w):
    for k in range(h):
        if l[j][k]=='snuke':
            print(str(alp[j])+str(k+1))
print(l)
Problem p03944 (python)

Fixed submission:
w, h, n = map(int, input().split())
xa = 0
xb = w
ya = 0
yb = h
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        xa = max(x, xa)
    if a == 2:
        xb = min(x, xb)
    if a == 3:
        ya = max(y, ya)
    if a == 4:
        yb = min(y, yb)
        
print(max(max(xb - xa, 0) * max(yb - ya, 0), 0))

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
s=w*h
while n>0:
    x,y,a=map(int,input().split())
    if
Problem p04012 (python)

Fixed submission:
w = input()
wd = list(set(w))
 
for word in wd:
    if w.count(word) % 2 != 0:
        print("No")
        break
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
a = str(input())

if a.count('a') % 2 == 0 and a.count('b') % 2 == 0 and a.count('c') % 2 == 0 and a.count('d') % 2 == 0
and a.count('e') % 2 == 0 and a.count('f') % 2 == 0 and a.count('g') % 2 == 0 and a.count('h') % 2 == 0
and a.count('i') % 2 == 0 and a.count('j') % 2 == 0 and a.count('k') % 2 == 0 and a.count('l') % 2 == 0
and a.count('m') % 2 == 0 and a.count('n') % 2 == 0 and a.count('o') % 2 == 0 and a.count('p') % 2 == 0
and a.count('q') % 2 == 0 and a.count('r') % 2 == 0 and a.count('s') % 2 == 0 and a.count('t') % 2 == 0
and a.count('u') % 2 == 0 and a.count('v') % 2 == 0 and a.count('w') % 2 == 0 and a.count('x') % 2 == 0
and a.count('y') % 2 == 0 and a.count('z') % 2 == 0:
    print('Yes')
    
else:
    print('No')
Problem p02657 (python)

Fixed submission:
A,B = map(int,input().split())

print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())

print(A*B
Problem p02687 (python)

Fixed submission:
S = input()

if S == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
H = []
H = list(map(int,input().split()))
route = []
h_max = 0
count = 0
h_max_list = []
for i in range(M):
    route.append(list(map(int,input().split())))

for i in range(1,N+1):
    for j in range(M):
        if i in route[j]:
            h_max = max(H[route[j][0]-1],H[route[j][1]-1])
            if H.index(h_max)+1 == i:
                h_max_list.append(H.index(h_max)+1)

print(len(set(h_max_list)))
Problem p02934 (python)

Fixed submission:
num = int(input())
box1 = [int(s) for s in input().split()]
box = []
for i in box1:
  box.append(1/i)
print(1/sum(box))

Buggy submission (verdict: Runtime Error):
num = int(input())
box = []
for i range(num):
  box.append(1/int(input()))
print(1/sum(box))
Problem p02945 (python)

Fixed submission:
nums = [int(s) for s in input().split()]
a = nums[0]
b = nums[1]

box = []
box.append(a + b)
box.append(a - b)
box.append(a * b)
print(max(box))

Buggy submission (verdict: Runtime Error):
num = int(input())
words = []
answer = 0

for i in range(num):
  words.append(sorted(list(input())))

for i in range(num):
  for j in range(num -i - 1):
    p = 0
    for k in range(10):
      if words[i][k] == words[j + 1 + i][k]:
        p += 1
      else:
        break
    if p == 10:
      answer += 1

print(answer)
Problem p02947 (python)

Fixed submission:
import math
num = int(input())
words = {}

for i in range(num):
  a = str(sorted(list(input())))
  
  if a in words:
    words[a] += 1
  else:
  	words[a] = 1

points = list(words.values())
sum = 0
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(len(points)):
  if points[i] > 1:
  	sum += combinations_count(points[i], 2)
print(sum)

Buggy submission (verdict: Runtime Error):
import math
num = int(input())
words = {}

for i in range(num):
  a = str(sorted(list(input())))
  
  if a in words:
    words[a] += 1
  else:
  	words[a] = 1

points = list(words.values())
sum = 0
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(len(points)):
  sum += combinations_count(points[i], 2)
print(sum)
Problem p02642 (python)

Fixed submission:
from collections import Counter

n=int(input())
a=list(map(int, input().split()))
a.sort()

m=a[-1]+1
dp=[1]*m
c=Counter(a)
ans=0
for i in a:
    if dp[i] and c[i]==1:
        ans+=1

    for j in range(2*i, m, i):
        dp[j]=0

print(ans)
#print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
a = list(map(int,input().split()))
b=0
a.sort()

for i in range(n-1):
    if a[i]==a[i+1]:
        b+=1
nl=[]
while 1:
    p=a.pop(a[1])
    for i in a:
        if i%p!=0:
            nl.append(i)
    nl.append(p)
    if len(a)==len(nl):
        print(len(a)-b)
        exit()
    a=nl[::]
Problem p02696 (python)

Fixed submission:
a,b,n=map(int,input().split())
l=[]
m=a//b
if b==1:
    print(0)
    exit()
if n>=b:
    for x in range(b-1,n+1,b):
        y=a*x//b-a*(x//b)
        #l.append(y)
        m=max(m,y)
    x=n
    y=a*x//b-a*(x//b)
    m=max(m,y)
else:
    x=n
    y=a*x//b-a*(x//b)
    #l.append(y)
    xx=n-1
    yy=a*xx//b-a*(xx//b)
    m=max(y,yy)


print(m)

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
l=[]

if n>b:
    for x in range(b-1,n):
        y=a*x//b-a*(x//b)
        l.append(y)

else:
    for x in range(1,n):
        y=a*x//b-a*(x//b)
        l.append(y)


print(max(l))
Problem p02747 (python)

Fixed submission:
s=input()
a=[str(c) for c in s]
if len(a)%2!=0:
    print("No")
    exit()
for i in range(len(a)):
    if i%2==1:
        if a[i]!="i":
            print("No")
            exit()
    else:
        if a[i]!="h":
            print("No")
            exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n,T=map(int,input().split())
ck=[]
times=[]
l=[]
t=0
s=0
count=0
for i in range(n):
    ck=list(map(str,input().split()))

nck=sorted(ck,reverse=True)
for i in range(n):
    for i in range(n):
        t+=1
        s=t*int(nck[i-1][0])+int(nck[i-1][1])
        t+=s
        count+=1
        if t>T:
            t-=s
            n-=1
            times.append(count)
            nck.remove(nck[0])
            break
print(max(times))
Problem p02748 (python)

Fixed submission:
a,b,m=map(int,input().split())
ak=list(map(int,input().split()))
bk=list(map(int,input().split()))
kei=[]
w=min(ak)+min(bk)
kei.append(w)
for i in range(m):
    x,y,c=map(int,input().split())
    pay=ak[x-1]+bk[y-1]-c
    kei.append(pay)
print(min(kei))

Buggy submission (verdict: Runtime Error):
a,b,m=map(int,input().split())
ak=list(map(int,input().split()))
bk=list(map(int,input().split()))
kei=[]
for i in range(m):
    x,y,c=map(int,input().split())
    pay=[ak[x]+bk[y]-c]
    kei+=pay
print(min(kei))

Buggy submission (verdict: Runtime Error):
a,b,m=map(int,input().sprit())
ak=list(map(int,input().split()))
bk=list(map(int,input().split()))
kei=[]
for i in range(m):
    x,y,c=map(int,input().split())
    pay=ak[x]+bk[y]-c
    kei+=pay
print(mim(kei))

Buggy submission (verdict: Runtime Error):
a,b,m=map(int,input().sprit())
ak=list(map(int,input().split()))
bk=list(map(int,input().split()))
kei=[]
for i in range(m):
    x,y,c=map(int,input().split())
    pay=ak[x]+bk[y]-c
    kei+=pay
print(mim(kei))
Problem p03361 (python)

Fixed submission:
n,w=map(int,input().split())
st=[]
for i in range(n):
    st.append(list(input())) #0~n-1までの列ができる
if n==w==1:
    print("Yes")
    exit()

for i in range(1,n-1):
    for j in range(1,w-1): #i,jに1足しても引いても範囲内だから安心！
        if st[i][j]=="#":
            if st[i+1][j]=="." and st[i][j-1]=="." and st[i][j+1]=="." and st[i-1][j]==".":
                print("No")
                exit()
        

print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n,w=map(int,input().split())
st=[[str(a) for s in b.strip()] for b in sys.stdin]
count=0
for i in range(1,n-2):
    for j in range(1,w-2):
        if st[i][j]=="#":
            count+=1
            if st[i][j]!=st[i-1][j] and st[i][j]!=st[i][j-1] and st[i][j+1]!=st[i][j] and st[i][j]!=st[i+1][j]:
                print("No")
                exit()
if st[0][0]=="#" and st[0][0]!=st[0][1] and st[1][0]!=st[0][0]:
    print("No")
    exit()

if st[0][w-1]=="#" and st[0][0]!=st[0][w-2] and st[1][w-1]!=st[0][w-1]:
    print("No")
    exit()

if st[n-1][w-1]=="#" and st[n-1][w-1]!=st[n-1][w-2] and st[n-1][w-1]!=st[n-2][w-1]:
    print("No")
    exit()
if st[n-1][0]=="#" and st[n-1][0]!=st[n-1][1] and st[n-2][0]!=st[n-1][0]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n,w=map(int,input().split())
st=[[a for s in b.strip()] for b in sys.stdin]
count=0
for i in range(1,n-2):
    for j in range(1,w-2):
        if st[i][j]=="#":
            count+=1
            if st[i][j]!=st[i-1][j] and st[i][j]!=st[i][j-1] and st[i][j+1]!=st[i][j] and st[i][j]!=st[i+1][j]:
                print("No")
                exit()
if st[0][0]=="#" and st[0][0]!=st[0][1] and st[1][0]!=st[0][0]:
    print("No")
    exit()

if st[0][w-1]=="#" and st[0][0]!=st[0][w-2] and st[1][w-1]!=st[0][w-1]:
    print("No")
    exit()

if st[n-1][w-1]=="#" and st[n-1][w-1]!=st[n-1][w-2] and st[n-1][w-1]!=st[n-2][w-1]:
    print("No")
    exit()
if st[n-1][0]=="#" and st[n-1][0]!=st[n-1][1] and st[n-2][0]!=st[n-1][0]:
    print("No")
    exit()
print("Yes")
Problem p02657 (python)

Fixed submission:
N, M = input().split(' ')
N, M = int(N), int(M)

print(N*M)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output > 10**18:
      print(-1)
      sys.exit()

  print(output)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output > 10**18:
      print('-1')
      sys.exit()

  print(output)

Buggy submission (verdict: Runtime Error):
N = int(input())
M = int(input())

print(N*M)
Problem p02658 (python)

Fixed submission:
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output > 10**18:
      print(-1)
      sys.exit()

  print(output)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

if 0 in nums:
  print(0)
  
else:
  for x in nums:
    output *= x

    if output > 10**18
      print('-1')
      sys.exit()

  print(output)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output > 10**18:s
      print('-1')
      sys.exit()

  print(output)
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())

N=a*b

if N%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())

if a*b%==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
N=int(input())
x=[0]
y=[0]
t=[0]

flag=1
for i in range(1,N+1):
  t_tmp,x_tmp,y_tmp=map(int,input().split())
  t.append(t_tmp)
  x.append(x_tmp)
  y.append(y_tmp)
  time=abs(t[i-1]-t[i])
  d=abs(x[i-1]-x[i])+abs(y[i-1]-y[i])
  if d>time or (d%2)!=(time%2):
    print("No")
    flag=0
    break
    
if flag==1:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
x=[0]
y=[0]

flag=1
for i in range(1,N+1):
  t,x_tmp,y_tmp=map(int,input().split())
  x.append(x_tmp)
  y.append(y_tmp)
  d=abs(x[i-1]-x[i])+abs(y[i-1]-y[i])
  if d>t or (d%2)!=(t%2):
    print("No")
    flag=0
    break
    
if flag==1:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
x=[0]
y=[0]

for i in range(1,N):
  t,x_tmp,y_tmp=map(int,input().split())
  x.append(x_tmp)
  y.append(y_tmp)
  d=abs(x[i-1]-x[i])+abs(y[i-1]-y[i])
  if d>t or d%2!=t%2:
    print("No")
    flag=0
    break
  else:
    flag=1
    
if flag==1:
  print("Yes")
Problem p03456 (python)

Fixed submission:
a,b=input().split()
N=int(a+b)
 
flag=1
for i in range(1,N):
  s=N//i
  if N%i==0 and s==i:
    print("Yes")
    flag=0
    break
if flag==1:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b=input().split()
N=int(a+b)

for i in range(N):
  s=N//i
  if N%i==0 and s==i:
    pritn("Yes")
  else:
    print("No")
Problem p03493 (python)

Fixed submission:
input_line=input()
s=list(map(int,input_line))
print(sum(s))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
 
flg=1
count=0
while True:
    for i in A: #全て偶数か確かめる
        if i%2==1:
            flg=0
            break

    if flg==1:
        for i in A:
            i=i//2
        count+=1
    else:
        break
print(count)
Problem p03545 (python)

Fixed submission:
J=list(input())
n=len(J)

def dfs(i,f,sum_num):
    if i==n-1:
        if sum_num==7:
            print(f+"=7")
            exit()
    else:
        dfs(i+1,f+"+"+J[i+1],sum_num+int(J[i+1]))
        dfs(i+1,f+"-"+J[i+1],sum_num-int(J[i+1]))
dfs(0,J[0],int(J[0]))

Buggy submission (verdict: Runtime Error):
J=list(input())
n=len(J)

def dfs_formula(i,f):
    if i==n-1:
        return [f]
    return dfs_formula(i+1,f+"+"+J[i+1])+dfs_formula(i+1,f+"-"+J[i+1])
    
def dfs_sum(i,f):
    if i==n-1:
        return f
    return str(dfs_sum(i+1,f+int(J[i+1])))+" "+str(dfs_sum(i+1,f-int(J[i+1])))

A=dfs_formula(0,J[0])
S=dfs_sum(0,int(J[0]))

for i in range(len(S)):
    if S[i]=='7':
        print(A[i]+"=7")
        break
Problem p02658 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mul=1
key=0
for i in range(len(a)):
    if a[i]==0:
        key=1
        print(0)
        break;
if key==0:
    for i in range(len(a)):
        mul=mul*a[i]
        if mul>1000000000000000000:
            break
    if(mul<1000000000000000001):
        print(mul)
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
mul=1
key=0
for i in range(len(a)):
    if a[i]==0:
        key=1
        print(0)
        break;
if key==0:
    for i in range(len(a)):
        mul=mul*a[i]
        if mul>1000000000000000000:
        break
    if(mul<1000000000000000001):
        print(mul)
    else:
        print(-1)
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

P = list(map(int, input().split()))

for i in range(101):
    p = X - i not in P
    p1 = X + i not in P
    if p1 or p:
        if p:
            print(X - i)
            exit()
        print(X + i)
        exit()

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

P = list(map(int, input().split()))
minmin = []
minn = 101
for i in range(1, 101):
    if i in P:
        continue
    abs1 = abs(i - X)
    if minn >= abs1:
        minn = abs1
        minmin.append(i)

if len(minmin) > 2 and abs(X - minmin[-1]) == abs(X - minmin[-2]):
    print(minmin[-2])
    exit()
print(minmin[-1])

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

P = list(map(int, input().split()))
minmin = []
minn = 101
for i in range(1, 101):
    abs1 = abs(i - X)
    if not i in P and minn >= abs1:
        minn = abs1
        minmin.append(i)

if len(minmin) > 2 and abs(X - minmin[-1]) == abs(X - minmin[-2]):
    print(minmin[-2])
    exit()
print(max(minmin))

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

P = list(map(int, input().split()))
minmin = []
minn = 101
for i in range(1, 101):
    abs1 = abs(i - X)
    if not i in P and minn > abs1:
        minn = abs1
        minmin.append(i)

print(max(minmin))
Problem p02677 (python)

Fixed submission:
import math

a, b, h, m = map(int, input().split())

if h * 360 / 12 + m * 360 / 60 / 12 > m * 360 / 60:
    r = (h * 360 / 12 + m * 360 / 60 / 12) - m * 360 / 60
else:
    r = m * 360 / 60 - (h * 360 / 12 + m * 360 / 60 / 12)

if r > 180:
    r = 360 - r

# if r == 90:
#     t = a ** 2 + b ** 2
#     print(math.sqrt(t))
# else:
c = a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(r))
print(math.sqrt(c))

Buggy submission (verdict: Runtime Error):
import math

A, B, H, M = map(int, input().split())

KA = H / 12 * 360 + ((M / 60) * (360 / 12))
KB = M / 60 * 360

K = abs(KA - KB)
if K > 180:
    K = 360 - K
# if K == 180:
#     print(A + B)
#     exit()
# if K == 0:
#     print(abs(B - A))
#     exit()
# cosB = round(math.cos(math.radians(K)), 13)
cosB = math.cos(math.radians(K)), 13
cc = A ** 2 + B ** 2 - (2 * B * A * cosB)
print(math.sqrt(cc))
Problem p03031 (python)

Fixed submission:
N, M = map(int, input().split())
K = []
S = []
for m in range(M):
    inp = list(map(int, input().split()))
    # K.append(inp[0])
    S.append(inp[1:])

P = list(map(int, input().split()))

X = []


def dfs(A):
    if N == len(A):
        X.append(A.copy())
        return
    for i in [0, 1]:
        A.append(i)
        dfs(A)
        A.pop()


dfs([])


def s(m, x):
    s = 0
    for mm in m:
        s += x[mm - 1]
    return s


count = 0
for x in X:
    flg = True  # 一つでも点灯しないものがあったらFalse
    for m, p in zip(S, P):  # 電球ループ
        su = s(m, x)
        if su % 2 != p:
            flg = False
    if flg:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
K = []
S = []
for m in range(M):
    inp = list(map(int, input().split()))
    # K.append(inp[0])
    S.append(inp[1:])

P = list(map(int, input().split()))

X = []


def dfs(A):
    if N == len(A):
        X.append(A.copy())
        return
    for i in [0, 1]:
        A.append(i)
        dfs(A)
        A.pop()


dfs([])


def s(m, x):
    s = 0
    for mm in m:
        s += x[mm - 1]
    return s


count = 0
for x in X:
    flg = True  # 一つでも点灯しないものがあったらFalse
    for m, p in zip(S, P):  # 電球ループ
        su = s(m, x)
        if su % 2 != p:
            flg = False
    if flg:
        count += 1

print(count)
Problem p03086 (python)

Fixed submission:
S = input()

res = []
tmp = []
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp.append(s)
    else:
        res.append(len(tmp))
        tmp = []
res.append(len(tmp))
print(max(res))

Buggy submission (verdict: Runtime Error):
S = input()

res = []
tmp = []
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp.append(s)
    else:
        res.append(len(tmp))
        tmp = []

print(max(res))

Buggy submission (verdict: Runtime Error):
S = input()

res = []
tmp = ['']
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp.append(s)
    else:
        res.append(len(tmp))
        tmp = ['']

print(max(res))

Buggy submission (verdict: Runtime Error):
S = input()

res = []
tmp = []
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp.append(s)
    else:
        res.append(len(tmp))
        tmp = []

print(max(res))