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

Fixed submission:
import sys
import itertools
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=set(l)
if len(s)>=4 :print("No");sys.exit()
if len(s)==1:print("Yes" if 0 in s else "No");sys.exit()
s=list(s);s.sort()
if len(s)==2:
  if 0 not in s:print("No");sys.exit()
  if n%3==1:
    if l.count(0)==(n-1)//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
  elif n%3==2:
    if l.count(0)==(n+1)//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
  elif n%3==0:
    if l.count(0)==n//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
a=l.count(s[0]);b=l.count(s[1]);c=l.count(s[2])
if a!=b or b!=c or c!=a:print("No");sys.exit()
flag=0
for i in itertools.permutations(s):
  if i[0]^i[2]==i[1] and i[1]^i[2]==i[0] and i[0]^i[1]==i[2]:flag+=1
if flag!=0:print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
import itertools
n=int(input())
l=list(map(int,input().split()))
if n!=3:print("No")
else:
  flag=0
  for i in itertools.permutations(s):
    if i[0]^i[2]==i[1] and i[1]^i[2]==i[0] and i[0]^i[1]==i[2]:flag+=1
  if flag!=0:print("Yes")
  else:print("No")

Buggy submission (verdict: Runtime Error):
import sys
import itertools
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=set(l)
if len(s)>=4 :print("No");sys.exit()
if len(s)==1:print("Yes" if 0 in s else "No")
s=list(s)
if len(s)==2:
  if 0 not in s:print("No");sys.exit()
  if n%3==1:
    if l.count(0)==(n-1)//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
  elif n%3==2:
    if l.count(0)==(n+1)//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
  elif n%3==0:
    if l.count(0)==n//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
flag=0
for i in itertools.permutations(s):
  if i[0]^i[2]==i[1] and i[1]^i[2]==i[0] and i[0]^i[1]==i[2]:flag+=1
if flag==6:print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
import sys
import itertools
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=set(l)
if len(s)>=4:print("No");sys.exit()
s=list(s)
flag=0
for i in itertools.permutations(s):
  if i[0]^i[2]==i[1] and i[1]^i[2]==i[0] and i[0]^i[1]==i[2]:flag+=1
if flag==6:print("Yes")
else:print("No")
Problem p02977 (python)

Fixed submission:
n=int(input())
s=len(bin(n))-2
if 2**(s-1)==n:
  print("No")
elif n==3:
  print("Yes")
  for i in range(1,6):
    print(i,i+1)
else:
  print("Yes")
  print(2**(s-1)-1,1+n)
  for i in range(1,2**(s-1)-1):
    print(i,i+1)
    print(i+n,i+n+1)
  print(2**(s-1),2**(s-1)+1)
  print(2**(s-1)+1+n,1)
  print(2**(s-1),1)
  print(2**(s-1)+n,2**(s-1)+1+n)
  for i in range(2**(s-1)+2,n+1):
    print(i,i-1+n)
    print(i+n,i-2**(s-1))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=len(bin(n)-2)
if 2**(s-1)==n:
  print("No")
else:
  print("Yes")
  print(2**(s-1)-1,1+n)
  for i in range(1,2**(s-1)-2):
    print(i,i+1)
    print(i+n,i+n+1)
  print(2**(s-1),2**(s-1)+1)
  print(2**(s-1)+1,1)
  print(2**(s-1)+n,1)
  print(2**(s-1)+n,2**(s-1)+1+n)
  for i in range(2**(s-1)+2,n+1):
    print(i,i-1+n)
    print(i+n,i-2**(s-1))
Problem p02981 (python)

Fixed submission:
n,a,b=map(int,input().split())
print(min(b,n*a))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000000)
n,k=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
MOD=10**9+7
def coloring(node,pre):
  if len(graph[node])>k:
    return 0
  if pre==-1:
    color=k-1
  else:
    color=k-2
  ans=1
  for i in graph[node]:
    if i==pre:continue
    ans*=color
    ans%=MOD
    color-=1
  for i in graph[node]:
    if i==pre:continue
    ans*=coloring(i,node)
    ans%=MOD
  return ans
print((k*coloring(0,-1))%MOD)
Problem p02985 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
n,k=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
MOD=10**9+7
def coloring(node,pre):
  if len(graph[node])>k:
    return 0
  if pre==-1:
    color=k-1
  else:
    color=k-2
  ans=1
  for i in graph[node]:
    if i==pre:continue
    ans*=color
    ans%=MOD
    color-=1
  for i in graph[node]:
    if i==pre:continue
    ans*=coloring(i,node)
    ans%=MOD
  return ans
print((k*coloring(0,-1))%MOD)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
MOD=10**9+7
def coloring(node,pre):
  if len(graph[node])>k:
    return 0
  if pre==-1:
    color=k-1
  else:
    color=k-2
  ans=1
  for i in graph[node]:
    if i==pre:continue
    ans*=color
    ans%=MOD
    color-=1
  for i in graph[node]:
    if i==pre:continue
    ans*=coloring(i,node)
    ans%=MOD
  return ans
print((k*coloring(0,-1))%MOD)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
MOD=10**9+7
def coloring(node,pre):
  if len(graph[node])>k:
    return 0
  if pre==-1:
    color=k-1
  else:
    color=k-2
  ans=1
  for i in graph[node]:
    if i==pre:continue
    ans*=color
    ans%=MOD
    color-=1
  for i in graph[node]:
    if i==pre:continue
    ans*=coloring(i,node)
    ans%=MOD
  return ans
print(k*coloring(0,-1))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
MOD=10**9+7
def coloring(node,pre):
  if len(graph[node])>k:
    return 0
  if pre==-1:
    color=k
  if pre==0:
    color=k-1
  else:
    color=k-2
  ans=1
  for i in graph[node]:
    if i==pre:continue
    ans*=i
    ans%=MOD
    i-=1
  for i in graph[node]:
    if i==pre:continue
    ans*=coloring(i,node)
    ans%=MOD
  return ans
print(coloring(0,-1))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
ans=k;MOD=10**9+7
def coloring(node,pre):
  if len(graph[node])>k:
    return 0
  if pre=0:
    color=k-1
  else:
    color=k-2
  for i in range(color-len(graph[node])+1,color+1):
    if i==pre:continue
    ans*=i
    ans%=MOD
  for i in graph[node-1]:
    if i==pre:continue
    ans*=coloring(i,node)
    ans%=MOD
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
ns=1
dis=0
i=0
while dis<=x:
  
  dis+=l[i]
  i+=1
  if dis>x:
    break
  elif i==n:
    ns+=1
    break
  ns+=1
print(ns)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
ns=1
dis=0
i=0
while dis<=x:
  
  dis+=l[i]
  i+=1
  if dis>x:
    break
  ns+=1
print(ns)
Problem p03006 (python)

Fixed submission:
from collections import Counter
n=int(input())
balls=[]
distance=[]
if n==1:
  print(1)
else:
  for i in range(n):
    balls.append(list(map(int,input().split())))
    balls.sort(key=lambda x:x[0]+x[1])
  for i in range(n-1):
    for j in range(i+1,n):
      distance.append(str(balls[i][0]-balls[j][0])+","+str(balls[i][1]-balls[j][1]))
  d=Counter(distance)
  print(n-d.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
balls=[]
distance=[]
for i in range(n):
  balls.append(list(map(int,input().split())))
for i in range(n-1):
  for j in range(i+1,n):
    distance.append(str(balls[i][0]-balls[j][0])+" "+str(balls[i][1]-balls[j][1]))
d=Counter(distance)
print(n-d.most_common()[0][1])
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
print((3*a+p)//2)

Buggy submission (verdict: Runtime Error):
a,p=int(input())
print((3*a+p)//2)
Problem p03030 (python)

Fixed submission:
n = int(input())
from operator import itemgetter
a=[]
for i in range(n):
  b,c=map(str,input().split())
  c=int(c)
  a.append([b,c,i])
a1= sorted(a,key=itemgetter(1),reverse=True)
a2=sorted(a1,key=itemgetter(0))
for i in range(n):
  print((a2[i][2]+1))

Buggy submission (verdict: Runtime Error):
n = int(input())
from operator import itemgetter
a=[]
for i in range(n):
  a.append(tuple(map(str,input().split()),i))
a1= sorted(a,key=itemgetter(0))
a2=sorted(a1,key=itemgetter(1),reverse=True)
for i in range(n):
  print(a2[i][2])
Problem p03031 (python)

Fixed submission:
n,m=map(int,input().split())
a=[[0 for h in range(n)] for i in range(2**n)]
b1=[[0 for i in range(m)] for h in range(2**n)]
#0~2**n-1を2進数表記し、リストaに記録する(各位の10はスイッチのonoffに対応)
for i in range(2**n):
  b=i
  for j in range(n):
    c=b//(2**(n-j-1))
    a[i][j]+=c
    b-=c*(2**(n-j-1))
#それぞれの数について、電球が点灯するかどうかを検証する（各位が電球の点灯する条件を満たしているか）
for i in range(m):
  lights=list(map(int,input().split()))
  for j in range(2**n):
    for h in range(len(lights)-1):
      b1[j][i]+=a[j][lights[h+1]-1]
check=list(map(int,input().split()))
#検証パート
ans=0
for i in range(2**n):
  flag=0
  for j in range(m):
    if b1[i][j]%2 != check[j]:
      flag=1
      break
  if flag==0:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[[0 for h in range(n)] for i in range(2**n)]
b=[[0 for i in range(m)] for h in range(2**n)]
#0~2**n-1を2進数表記し、リストaに記録する(各位の10はスイッチのonoffに対応)
for i in range(2**n):
  b=i
  for j in range(n):
    c=b//(2**(n-j-1))
    a[i][j]+=c
    b-=c*(2**(n-j-1))
print(a)
#それぞれの数について、電球が点灯するかどうかを検証する（各位が電球の点灯する条件を満たしているか）
for i in range(m):
  for j in range(2**n):
    lights=list(map(int,input().split()))
    for h in range(len(lights)-1):
      b[j][i]+=a[j][lights[h+1]-1]
check=list(map(int,input().split()))
#検証パート
ans=0
for i in range(2**n):
  flag=0
  for j in range(m):
    if b[i][j]%2!=check[j]:
      flag=1
      break
  if flag==0:
    ans+=1
print(ans)
Problem p03032 (python)

Fixed submission:
n,k=map(int,input().split())
d=list(map(int,input().split()))
d=d*2
ans=0
for i in range(1,min(k+1,n+1)):
  
  for j in range(i+1):
    have=[d[n+c-j] for c in range(i)] #ここにi個の宝石を入れる
    have.sort()
    if i!=k:
      for h in range(k-i):
        if have==[] or have[0]>=0:
          break
        del have[0]
      #いらない宝石を可能な限り詰めた状態
    if sum(have)>ans:
      ans=sum(have)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=list(map(int,input().split()))
d=d*2
ans=0
for i in range(1,k+1):
  
  for j in range(i+1):
    have=[d[n+c-j] for c in range(i)] #ここにi個の宝石を入れる
    have.sort()
    if i!=k:
      for h in range(k-i):
        if have==[] or have[0]>=0:
          break
        del have[0]
      #いらない宝石を可能な限り詰めた状態
    if sum(have)>ans:
      ans=sum(have)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=list(map(int,input().split()))
d=d*2
ans=0
for i in range(1,k+1):
  
  for j in range(i+1):
    have=[d[n+c-j] for c in range(i)] #ここにi個の宝石を入れる
    have.sort()
    print(have)
    if i!=k:
      for h in range(k-i):
        if have==[] or have[0]>=0:
          break
        del have[0]
      #いらない宝石を可能な限り詰めた状態
    if sum(have)>ans:
      ans=sum(have)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=list(map(int,input().split()))
d=d*2
ans=0
for i in range(k):
  
  for j in range(i+1):
    have=[d[n+c-j] for c in range(i)] #ここにi個の宝石を入れる
    have.sort()
    for h in range(k-i):
      if have[0]>=0:
        break
      del have[0]
    #いらない宝石を可能な限り詰めた状態
    if sum(have)>ans:
      ans=sum(have)
print(ans)
Problem p03043 (python)

Fixed submission:
n,k = map(int,input().split())
ans = 1
for i in range(1,n+1):
    if i < k:
      c = i
      d=0
      while c<k:
        c = c*2
        d+=1
      ans -=float((2**d-1)/(n*(2**d)))
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ans = 0
 for i in range(n):
    if i => k:
      ans += float(1/n)
    else:
      c = i
      d=0
      while c<k:
        c = c*2
        d+=1
      ans +=float(1/n*(2**d))
print(ans)
Problem p03046 (python)

Fixed submission:
m,k=map(int,input().split())
if k>=2**m:
  print(-1)
elif m==0:
  print(0,0)
elif m==1:
  if k==0:
    print(0,0,1,1)
  elif k==1:
    print(-1)
else:
  ris=[str(i) for i in range(2**m)]
  ris.remove(str(k))
  l=" ".join(ris)
  r=" ".join(ris[::-1])
  print(l,str(k),r,str(k))

Buggy submission (verdict: Runtime Error):
m,k=map(int,input().split())
if k>=2**m:
  print(-1)
elif m==0:
  print(0,0)
elif m==1:
  if k==0:
    print(0,0,1,1)
  elif k==1:
    print(-1)
else:
  ris=[str(i) for i in range(2**m-1)]
  ris.remove(str(k))
  l=" ".join(ris)
  r=" ".join(ris[::-1])
  print(l,str(k),r,str(k))

Buggy submission (verdict: Runtime Error):
m,k=map(int,input().split())
if k>=2**m-1:
  print(-1)
elif m==0:
  print(0,0)
elif m==1:
  if k==0:
    print(0,0,1,1)
  elif k==1:
    print(-1)
else:
  ris=[i for i in range(m)]
  ris.remove(k)
  print(ris+k+ris[::-1]+k)

Buggy submission (verdict: Runtime Error):
m,k=map(int,input().split())
if m==0:
  print(0,0)
elif m==1:
  if k==0:
    print(0,0,1,1)
  elif k==1:
    print(-1)
else:
  ris=[i for i in range(m)]
  ris.remove(k)
  print(ris+k+ris[::-1]+k)
Problem p03047 (python)

Fixed submission:
n,k = map(int,input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
a=0;b=0;ab=0
for i in range(n):
  s=input()
  ans+=s.count("AB")
  if s[0]=="B":
    b+=1
    if s[-1]=="A":
      ab+=1
      b-=1
  elif s[-1]=="A":
    a+=1
if a+b==0:
    print(ans+max(ab-1,0))
else:
    print(ans+min(a,b)+ab)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
a=0;b=0;ab=0
for i in range(n):
  s=input()
  ans+=s.count("AB")
  if s[0]=="B":
    b+=1
    if s[-1]=="A":
      ab+=1
      b-=1
  elif s[-1]=="A":
    a+=1
if a+b==0:
    print(ans+ab-1)
else:
    print(ans+min(a,b)+ab)
Problem p03048 (python)

Fixed submission:
b,r,g,n=map(int,input().split())
ans=0
for i in range(3000//r+1):
    for j in range(3000//g+1):
        if n-j*g-i*r>=0 and (n-j*g-i*r)%b==0:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
r,g,b,n = map(int,input().split())
lis=[r,g,b]
lis.sort()
cnt=0
for i in range(n//lis[2] + 1):
  for l in range((n-i*lis[2])//lis[1]+1):
    for m in range((n-i*lis[2]-l*lis[1])//lis[0]+1):
      if i*lis[2]+l*lis[1]+m*lis[0] = n:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
r,g,b,n = map(int,input().split())
lis=[r,g,b]
lis.sort()
cnt=0
for i in range(n//lis[2] + 1):
  for l in range(n//lis[1]+1):
    for m in range(n//lis[0]+1):
      if i*lis[2]+l*lis[1]+m*lis[0] = n:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
r,g,b,n = map(int,input().split())
lis=[r,g,b]
lis.sort()
cnt=0
for i in range(n//lis[2] + 1):
  for l in range(n//lis[1]+1):
    for m in range(n//lis[0]+1):
      if i*lis[2]+l*lis[1]+i*lis[0] = n:
        cnt+=1
print(cnt)
Problem p03049 (python)

Fixed submission:
n=int(input())
ans=0
a=0;b=0;ab=0
for i in range(n):
  s=input()
  ans+=s.count("AB")
  if s[0]=="B":
    b+=1
    if s[-1]=="A":
      ab+=1
      b-=1
  elif s[-1]=="A":
    a+=1
if a+b==0:
    print(ans+max(ab-1,0))
else:
    print(ans+min(a,b)+ab)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
a=0;b=0;ab=0
for i in range(n):
  s=input()
  ans+=s.count("AB")
  if s[0]=="B":
    b+=1
    if s[-1]=="A":
      ab+=1
      b-=1
  elif s[-1]=="A":
    a+=1
print(ans+c-1+min(a,b))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [list(input()) for i range(n)]
cnt = 0
cnt_A=0
cnt_B=0
cnt_C=0
for i in range(n):
  if "AB" in a[i]:
    cnt+= 1
for i in range(n):
  if a[i][-1] == "A" and a[i][0] =="B":
    cnt_C+=1  
  elif a[i][-1] == "A" and a[i][0] !="B":
    cnt_A +=1
  elif a[i][0] =="B"and a[i][-1] !="A":
    cnt_B+=1

print(cnt+cnt_A+cnt_B+cnt_C)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [list(input()) for i range(n)]
cnt = 0
cnt_A=0
cnt_B=0
cnt_C=0
for i in range(n):
  if "AB" in a[i]:
    cnt+= 1
for i in range(n):
  if a[i][-1] == "A" and a[i][0] =="B":
    cnt_C+=1  
  elif a[i][-1] == "A": 
    cnt_A +=1
  elif a[i][0] =="B":
    cnt_B+=1

print(cnt+cnt_A+cnt_B+cnt_C)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [list(input()) for i range(n)]
cnt = 0
cnt_A=0
cnt_B=0
cnt_C=0
for i in range(n):
  if "AB" in a[i]:
    cnt+= 1
for i in range(n):
  if a[i][-1] == "A" 
    cnt_A +=1
  elif a[i][0] =="B":
    cnt_B+=1
  elif a[i][-1] == "A" and a[i][0] =="B":
    cnt_C+=1
print(cnt+cnt_A+cnt_B-cnt_C)
Problem p03060 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
i = 0
for c in range(N):
  if A[c]>B[c]:
    i = i +A[c]-B[c]
print (i)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list[int,input().split()]
B = list[int,input().split()]
i = 0
for c in range(N):
  if A[c]>B[c]:
    i = i +A[c]-B[c]
print (i)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list[int,input().split()]
B = list[int,input().split()]
i = 0
for c in range(N):
  if A[c]>B[c]:
    i += (A[c]-B[c])
print (i)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
if a==b:
  print(2*a)
elif a>b:
  print(2*a-1)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A == B:
    print(A+B)
elif A >= B:
    print(2*A-1)
else:
    print(2*B-1)
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
s+="6"
c=0
l=[]
zcnt=0
for i in range(n):
  if s[i]!=s[i+1]:
    if s[i]=="0":zcnt+=1
    l.append((s[i],i+1-c))
    c=i+1
L=len(l)
sl=[0]*(L+1)
for i in range(L):
    sl[i+1]=sl[i]+l[i][1]
if k>=zcnt:print(n);exit()
ans=0
if s[0]=="0":
    for i in range(zcnt-k+1):
        ans=max(ans,sl[min(L,2*k+i*2)]-sl[max(0,i*2-1)])
    print(ans)
else:
    for i in range(zcnt-k+1):
        ans=max(ans,sl[min(L,2*k+i*2+1)]-sl[i*2])
    print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s+="2";c=1
p=[]
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    p.append(c)
    c=1
    continue
  c+=1
if s[0]=="1":
  d=sum(p[:min(2*k+1,len(p))])
  ans=sum(p[:min(2*k+1,len(p))])
  if 2*k+1>=len(p):
    print(ans)
  else:
    m=len(p)-2*k-1
    for i in range(m):
      d-=p[i]
      d+=p[i+m]
      if d>ans:ans=d
    print(ans)
else:
  p=[1]+p
  flag=0
  d=sum(p[:min(2*k+1,len(p))])
  ans=sum(p[:min(2*k+1,len(p))])
  if 2*k+1>=len(p):
    print(ans-1)
  else:
    m=len(p)-2*k-1
    for i in range(m):
      d-=p[i]
      d+=p[i+m]
      if d>ans:
        ans=d
        flag=1
    if flag==0:
      print(ans-1)
    else:
      print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if s[0]=="0":
  a=[0]
else:a=[]
i=0
c=0
while True:
  c+=1
  if s[i]!=s[i+1]:
    a.append(c)
    c=0
  i+=1
  if i==len(s)-1:
    a.append(len(s)-sum(a))
    break
l=len(a)
if 2*k+1>=l:print(l)
else:
  c=sum(a[:2*k+1])
  ans=sum(a[:2*k+1])
  for i in range(l-2*k-1):
    c-=a[i]-a[i+2*k+1]
    if ans<c:
      ans=c
  print(ans)
Problem p03079 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
if a==b and b==c:
  print("Yes")
else:
  print("No")
Problem p03085 (python)

Fixed submission:
b = input()
if b == "T":
  print ("A")
elif b == "A":
  print ("T")
elif b == ("G"):
  print ("C")
else:
  print ("G")

Buggy submission (verdict: Runtime Error):
array = [A,T,G,C]
b = input()
if b == array[0]:
  print (array[1])
elif b == array[1]:
  print (array[0])
elif b == array[2]:
  print (array[3])
else:
  print (array[2])

Buggy submission (verdict: Runtime Error):
b = input()
if b == "T":
  print "A"
elif b == "A":
  print "T"
elif b == "G":
  print "C"
else:
  print "G"

Buggy submission (verdict: Runtime Error):
b = input()
if b == T:
  print A
elif b == A:
  print T
elif b == G:
  print C
else:
  print G
Problem p03086 (python)

Fixed submission:
S = input()
S ="w"+ S + "w"
m = 0
n = 0
lst = []
for i in S:
  n += 1
  if i not in "ACGT":
    lst.append(n)
for y in range(len(lst)-1):
  if (lst[y+1] - lst[y]) > m:
    m = (lst[y+1] - lst[y])
print (m-1)

Buggy submission (verdict: Runtime Error):
S = input()
m = 0
n = 0
lst = []
for i in range(len(S)):
  n += 1
  if i not in "ACGT":
    lst.append(n)
for y in range(len(lst)-1):
  if (lst[y+1] - lst[y]) > m:
    m = (lst[y+1] - lst[y])
print (m-1)
Problem p03095 (python)

Fixed submission:
n=int(input())
s=input()
mod=10**9+7
ans=1
lets=[1]*26
for i in s:
  lets[ord(i)-97]+=1
for i in range(26):
  ans*=lets[i]
  ans%=mod
print(ans-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
for i in range(n-1):
  ans+=1
  for j in range(i+1,n+1):
    if s[i]==s[j]:
      break
    ans+=1
  ans%=(10**9+7)
ans+=1
ans%=10**9+7
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
for i in range(n):
  ans+=1
  for j in range(i+1,n+1):
    if s[i]==s[j]:
      break
    ans+=1
  ans%=(10**9+7)
print(ans)
Problem p03106 (python)

Fixed submission:
import fractions
a,b,c = map(int,input().split())
d = fractions.gcd(a,b)
lst=[]
for i in range(d):
  if d % (d-i) == 0:
    lst.append(i)
print(d-lst[c-1])

Buggy submission (verdict: Runtime Error):
import math 
a,b,c = map(int,input().split())
d = math.gcd(a,b)
lst=[]
for i in range(d):
  if d % (d-i) == 0:
    lst.append(i)
print(d-lst[c-1])
Problem p03110 (python)

Fixed submission:
a=int(input())
ans=0
for i in range(a):
  c,d=map(str,input().split())
  if d=="JPY":
    ans+=int(c)
  else:
    ans+=float(c)*380000
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans=0
for i in range(a):
  c,d=map(str,input().split())
  if d=="JPY":
    ans+=int(c)
  else:
    ans+=float(int(c)*380000)
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans=0
for i in range(a):
  c,d=map(str,input().split())
  if d=="JPY":
    ans+=int(c)
  else:
    ans+=float(c*380000)
print(ans)
Problem p03126 (python)

Fixed submission:
n,m=map(int,input().split())
food=[0 for i in range(m)]
for i in range(n):
  per=list(map(int,input().split()))
  for j in range(1,per[0]+1):
    food[per[j]-1]+=1
ans=0
for i in range(m):
  if food[i] == n:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
food=[0 for i in range(m)]
for i in range(n):
  per=list(map(int,input().split()))
  for j in range(1,per[0]+1):
    food[per[j]]+=1
ans=0
for i in range(m):
  if food[i] == n:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = int(input())
a = []
b = [1 for i in range(m)]
for i in range(n):
  a.append(list(int(input()).split()))
for s in range(m):
  for i in range(n):
    if (s+1) in a[i] == False:
      b[s] = 0
cnt = 0
for d in range(len(b)):
  if b[d] = 1:
    cnt+= 1
print(cnt)