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

Fixed submission:
s=input();minn=1000
for i in range(len(s)-2):minn=min(abs(int(s[i:i+3])-753),minn)
print(minn)

Buggy submission (verdict: Runtime Error):
s=input();min=1000
for i in range(len(s)-2):min=min(abs(int(s[i]+s[i+1]+s[i+2])-753),min)
print(min)
Problem p03227 (python)

Fixed submission:
s=input()
if len(s)==2:print(s)
else:print(s[::-1])

Buggy submission (verdict: Runtime Error):
s=input()
if len(s)==2;print(s)
else:print(s[::-1])
Problem p03239 (python)

Fixed submission:
n,t=map(int,input().split());c=[]
for i in range(n):
  a,b=map(int,input().split())
  if b<=t:
    c.append(a)
if c==[]:print("TLE")
else:c.sort();print(c[0])

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split());c=[]
for i in range(n):
  a,b=map(int,input().split())
  if b<=t:
    c.append(a)
c.sort();print(c[0])
Problem p03241 (python)

Fixed submission:
def divisor(n):
  ass=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ass.append(i)
      if i!=n//i:ass.append(n//i)
  return ass
n,m=map(int,input().split())
d=sorted(divisor(m))
for i in d[::-1]:
  if m//i>=n:print(i);break

Buggy submission (verdict: Runtime Error):
def divisor(n):
  ass=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ass.append(i)
      if i!=n//i:ass.append(n//i)
  return ass
n,m=map(int,input().split())
d=divisor(m)
d.sort(reverse=1)
for i in d:
  if m//i>=n:print(i):exit()
Problem p03260 (python)

Fixed submission:
a,b=map(int,input().split());print("Yes"if a%2==b%2==1 else"No")

Buggy submission (verdict: Runtime Error):
print("Yes"if (int(input())+int(input()))%2==0 else"No")
Problem p03261 (python)

Fixed submission:
n=int(input());w=[input()for i in range(n)]
def sortex(X):
  b=sorted(X)
  b.append("null")
  a=[]
  for i in range(len(X)):
    if b[i]!=b[i+1]:a.append(b[i])
  return a
if len(w)!=len(sortex(w)):
  print("No")
  exit()
for i in range(len(w)-1):
  if w[i][-1]!=w[i+1][0]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n,w=int(input()),[input()for i in range(n)]
def sortex(X):
  b=sorted(X)
  b.append("null")
  a=[]
  for i in range(len(X)):
    if b[i]!=b[i+1]:a.append(b[i])
  return a
if len(w)!=len(sortex(w)):
  print("No")
  exit()
for i in range(len(w)-1):
  if w[i][-1]!=w[i+1][0]:
    print("No")
    exit()
print("Yes")
Problem p03274 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=abs(a[0])*2+abs(a[-1])*2#とりあえず最大
for i in range(n-k+1):
  x,y=a[i],a[i+k-1]
  if x*y<0:m=min(abs(x),y)*2+max(abs(x),y)
  else:m=max(abs(x),abs(y))
  ans=min(ans,m)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
k-=1
x=list(map(int,input().split()))
print(min(min(abs(x[i],x[i+k]))+abs(x[i]-x[i+k])for i in range(n-k)))
Problem p03296 (python)

Fixed submission:
n=int(input());a=list(map(int,input().split()));c,ans=1,0
for i in range(n-1):
  if a[i]==a[i+1]:c+=1
  else:
    if c>=2:ans+=c//2
    c=1
if c>=2:ans+=c//2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input());a=list(map(int,input().split()));c,ans=1,0
for i in range(n-1)
  if a[i]==a[i+1]:c+=1
  else:
    if c>=2:ans+=c//2
    c=1
print(ans)
Problem p03303 (python)

Fixed submission:
s,n=input(),int(input());ans=""
for i in range(len(s)):
  if i%n==0:ans+=s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
s,a=input(),int(input());ans=""
for i in range(len(s)):
  if i%n==0:ans+=s[i]
print(ans)
Problem p03319 (python)

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

Buggy submission (verdict: Runtime Error):
n,k,*_=open(0);print(((int(n)-2)//(int(k)-1))+1)
Problem p03323 (python)

Fixed submission:
a,b=map(int,input().split())
if max(a,b)>8:print(":(")
else:print("Yay!")

Buggy submission (verdict: Runtime Error):
if max(int(input()),int(input()))>8:print(":(")
else:print("Yay!")
Problem p03331 (python)

Fixed submission:
n=int(input());minn=100
def digit_sum(x):
  a,b=0,str(x)
  for i in range(len(b)):a+=int(b[i])
  return a
for i in range(1,n//2+1):a=digit_sum(i)+digit_sum(n-i);minn=min(minn,a)
print(minn)

Buggy submission (verdict: Runtime Error):
n=int(input());minn=100
def digit_sum(x):
  a,b=0,str(x)
  for i in range(len(b)):a+=int(b[i])
  return a
for i in range(1,n//2+1):
  a=digit_sum(i),digit_sum(n-i)
  minn=min(100,a)
print(minn)
Problem p03337 (python)

Fixed submission:
a,b=map(int,input().split());print(max(max(a+b,a-b),a*b))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if abs(a-c)<=d or abs(a-b)<=d>=abs(b-c):print("Yes")
else:print("No")
Problem p03339 (python)

Fixed submission:
n,s=int(input()),input()
a=[0]
for i in s:a.append(a[-1]+(i=="W"))
m=999999
for i in range(1,n+1):m=min(m,a[i-1]+((n-i)-(a[-1]-a[i])))
print(m)

Buggy submission (verdict: Runtime Error):
n,s=int(input()),input()
a=[s[0]=="E"]
for i in s[1:]:a.append(a[-1]+(i=="E"))
m=999999
for i in range(n):m=min(m,a[:i]+((n-i-1)-(a[-1]-a[i])))
print(m)

Buggy submission (verdict: Runtime Error):
n,s=int(input()),input()
a=[s[0]=="E"]
for i in s[1:]:a.append(a[-1]+i=="E")
m=999999
for i in range(n):m=min(m,a[:i]+((n-i-1)-(a[-1]-a[i])))
print(m)
Problem p03343 (python)

Fixed submission:
n,k,q=map(int,input().split())
a=list(map(int,input().split()))
ans=10**10
for x in a:
  b=[[]]
  can=0
  for i in a:
    if i<x:
      if len(b[-1]):b.append([])
    else:b[-1].append(i)
  if len(b[-1])==0:del b[-1]
  for i in range(len(b)):b[i].sort()
  c=[]
  for i in b:
    i.sort()
    if len(i)>=k:c+=i[:len(i)-k+1]
  if len(c)<q:continue
  c.sort()
  ans=min(ans,c[q-1]-c[0])
print(ans)

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=list(map(int,input().split()))
ans=10**10
for y in a:
	t=[[]]
	for i in a:
		if i<y:
			if len(t[-1]):t.append([])
		else:
			t[-1].append(i)
	if len(t[-1])==0:del t[-1]
	co=0
	m=[]
	for i in range(len(t)):
		co+=max(len(t[i])-k+1,0)
		t[i].sort()
		m+=t[i][:-k+1]
	if co<q:continue
	m.sort()
	ans=min(ans,m[q-1]-y)
print(ans)
Problem p03351 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(a-c)<=d or (abs(a-b)<=d and d>=abs(b-c)):print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if abs(a-c)<=d or abs(a-b)<=d=>abs(b-c):print("Yes")
else:print("No")
Problem p03353 (python)

Fixed submission:
s=input()
k=int(input())
a={s}
for i in range(k):
  for j in range(len(s)-i):a.add(s[j:j+i+1])
print(sorted(list(a))[k-1])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
a={}
for i in range(k):
  for j in range(len(s)-i):a.append(s[j:j+i+1])
print(sorted(list(a))[k-1])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
a=[]
for i in range(k):
  for j in range(len(s)-i):a.append(s[j:j+i+1])
a.sort()
for i in range(1,len(a)):
  if a[-i]==a[-i-1]:del a[-i]
print(a[k-1])
Problem p03355 (python)

Fixed submission:
s=input()
k=int(input())
a={s}
for i in range(k):
  for j in range(len(s)-i):a.add(s[j:j+i+1])
print(sorted(list(a))[k-1])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
n=len(s)
ans=[]
for i in range(1,n+1):
  for j in range(n-i+1):ans.append(s[j:j+i])
  if len(ans)>=k:break
ans=sorted(list(set(ans)))
print(ans[k-1])
Problem p03360 (python)

Fixed submission:
a,x=list(map(int,input().split())),int(input());print(sum(a)+max(a)*((2**x)-1))

Buggy submission (verdict: Runtime Error):
x=list(map(int,input().split())),int(input());print(sum(a)+max(a)*((2**x)-1)

Buggy submission (verdict: Runtime Error):
a,x=list(map(int,input().split()),int(input());print(sum(a)+max(a)*((2**x)-1)
Problem p03361 (python)

Fixed submission:
h,w=map(int,input().split());a=[input()for i in range(h)]
def che(i,j):
  global h,w,a
  if i==0:
    if a[i+1][j]=="#":return
  elif i==h-1:
    if a[i-1][j]=="#":return
  else:
    if a[i-1][j]=="#"or a[i+1][j]=="#":return
  print("No");exit()
for i in range(h):
  s=a[i]
  if s[:2]=="#.":che(i,0)
  if s[-2:]==".#":che(i,w-1)
  for j in range(w-2):
    if s[j]+s[j+1]+s[j+2]==".#.":che(i,j+1)
print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
b=[list("."*(w+2))]
for i in range(w):
  b.append(list("."+input()+"."))
b.append(list("."*(w+2)))
ans="Yes"
dx=[0,1,0,-1]
dy=[1,0,-1,0]
for i in range(1,h+1):
  for j in range(1,w+1):
    if b[i][j]==".":continue
    flag=True
    for x,y in zip(dx,dy):
      if b[i][j]==b[i+x][j+y]:flag=False
    if flag:ans="No"
print(ans)
Problem p03363 (python)

Fixed submission:
n,a=int(input()),list(map(int,input().split()));b=[0]
for i in range(n):b.append(b[i]+a[i])
b.sort();c=1;ans=0
for i in range(n):
  if b[i]==b[i+1]:c+=1
  else:
    if c>=2:ans+=(c*(c-1))//2
    c=1
if c>=2:ans+=(c*(c-1))//2
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def aPb(a,b):return(math.factorial(a)//math.factorial(a-b))
def aCb(a,b):return(aPb(a,b)//math.factorial(b))
def ex(X):
  b=X[:]
  b.append("null")
  a=[]
  for i in range(len(X)):
    if b[i]!=b[i+1]:a.append(b[i])
  return a
n,a=int(input()),list(map(int,input().split()));b=[0]
for i in a:b.append(b[-1]+i)
b.sort();d=ex(b)
c=0;ans=0
for i in d:ans+=aCb(b.count(i),2)
print(ans)
Problem p03369 (python)

Fixed submission:
print(input().count("o")*100+700)

Buggy submission (verdict: Runtime Error):

for i in range(10):
	 s=i
	print(s)

Buggy submission (verdict: Runtime Error):
s=input()
if s="ooo":
   if s="ooo":
	   print(1000)

Buggy submission (verdict: Runtime Error):
s=input()
if s="ooo"print(1000)
Problem p03387 (python)

Fixed submission:
a,b,c=sorted(map(int,input().split()))
co=(b-a)//2
if (b-a)%2==1:co+=1;c+=1
co+=c-b
print(co)

Buggy submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input().split()))
co=(b-a)//2
if (b-a)%2==1:counter+=1;c+=1
co+=c-b
print(co)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
def turn(n):
  global a,b,c
  def t(n,a):
    if n==a:return 0
    elif n<a:return a-n
    else:return (a-n+1)//2
  return t(n,a)+t(n,b)+(t,c)
mi=turn(0)
for i in range(1,51):mi=min(turn(i),mi)
print(mi)
Problem p03407 (python)

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

Buggy submission (verdict: Runtime Error):
if int(input())+int(input())<int(input()):print("No")
else:print("Yes")
Problem p03408 (python)

Fixed submission:
n=int(input());a=[input()for i in range(n)];m=int(input());b=[input()for i in range(m)];ans=0
for i in a:ans=max(a.count(i)-b.count(i),ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input());a=[int(input())for i in range(n)];m=int(input());b=[int(input())for i in range(m)];ans=0
for i in a:ans=max(a.count(i)-b.count(i),ans)
print(ans)
Problem p03415 (python)

Fixed submission:
a,b,c=input(),input(),input();print(a[0]+b[1]+c[2])

Buggy submission (verdict: Runtime Error):
a,b,c=input();print(a[0]+b[1]+c[2])
Problem p03424 (python)

Fixed submission:
def sortex(X):
  b=sorted(X)
  b.append("null")
  a=[]
  for i in range(len(X)):
    if b[i]!=b[i+1]:a.append(b[i])
  return a
n,s=int(input()),input().split();s=sortex(s);print("Four"if len(s)==4else"Three")

Buggy submission (verdict: Runtime Error):
def sortex(X):
  b=sorted(X)
  b.append("null")
  a=[]
  for i in range(len(X)):
    if b[i]!=b[i+1]:a.append(b[i])
  return a
n,s=int(input()),input().split();s=sortex(s);print("Four"if len(n)==4else"Three")
Problem p03427 (python)

Fixed submission:
n=input()
if len(n)==1:print(n)
elif n=="9"*len(n):print(9*len(n))
elif n[1:]=="9"*(len(n)-1):print(int(n[0])+9*(len(n)-1))
else:print(9*(len(n)-1)+int(n[0])-1)

Buggy submission (verdict: Runtime Error):
n=input()
if len(n)==1:print(n)
elif n="9"*len(n):print(9*len(n))
else:print(9*(len(n)-1)+int(n[0])-1)
Problem p03458 (python)

Fixed submission:
n,k=map(int,input().split())
a=[(2*k+1)*[0]for _ in range(2*k+1)]
for _ in range(n):
  x,y,c=input().split()
  x=int(x)
  y=int(y)
  if c=="B":y+=k
  x%=2*k
  y%=2*k
  a[x+1][y+1]+=1
ans=0
for i in range(1,2*k+1):
  for j in range(1,2*k+1):a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1]
for i in range(k,2*k+1):
  for j in range(k,2*k+1):
    t=a[i][j]-a[i-k][j]-a[i][j-k]+a[i-k][j-k]
    t+=a[i-k][j-k]
    t+=a[2*k][j-k]-a[i][j-k]
    t+=a[i-k][2*k]-a[i-k][j]
    t+=a[2*k][2*k]-a[i][2*k]-a[2*k][j]+a[i][j]
    ans=max(ans,t,n-t)
print(ans)

Buggy submission (verdict: Runtime Error):
from numpy import*;N,K=map(int,input().split());m=zeros((3*K,3*K),dtype=int);L=2*K;o=0
for _ in[0]*N:x,y,c=input().split();t=c=='W';m[int(x)%L,int(y)%L]+=2*t-1;o+=t
for _ in[0,0]:m[L:]=m[:K];m=cumsum(m,axis=0);m[:L]-=m[K:];m=m.T
m=m[:L,:L];print(o-int((m+roll(roll(m,K,axis=0),K,axis=1)).min()))

Buggy submission (verdict: Runtime Error):
class CumulativeSum2D:
  def __init__(self,a):
    self.h=len(a)
    self.w=len(a[0])
    self.s=[(self.w+1)*[0]for _ in range(self.h+1)]
    for i in range(self.h):
      for j in range(self.w):
        self.s[i+1][j+1]=self.s[i+1][j]+self.s[i][j+1]-self.s[i][j]+a[i][j]
    for i in self.s:print(i)
  def sum(self,i1,j1,i2,j2):
    return self.s[i2+1][j2+1]-self.s[i1][j2+1]-self.s[i2+1][j1]+self.s[i1][j1]
n,k=map(int,input().split())
a=[(3*k+7)*[0]for _ in range(3*k+7)]
for _ in range(n):
  x,y,c=input().split()
  x=int(x)
  y=int(y)
  if c=="W":x+=k
  x%=2*k
  y%=2*k
  a[x][y]+=1
  a[x+k][y]-=1
  a[x][y+k]-=1
  a[x+k][y+k]+=1
  a[x+k][y+k]+=1
  a[x+k+k][y+k]-=1
  a[x+k][y+k+k]-=1
  a[x+k+k][y+k+k]+=1
b=[(3*k+8)*[0] for _ in range(3*k+8)]
ans=0
for i in range(3*k+7):
  for j in range(3*k+7):
    b[i+1][j+1]=b[i+1][j]+b[i][j+1]-b[i][j]+a[i][j]
    ans=max(ans,b[i+1][j+1])
print(ans)
Problem p03469 (python)

Fixed submission:
s=input();print(s[:3]+"8"+s[4:])

Buggy submission (verdict: Runtime Error):
s=input();s[3]="8"
print(s)
Problem p03472 (python)

Fixed submission:
n,h=map(int,input().split())
a=[]
for i in range(n):
  b,c=map(int,input().split())
  a.append([b,0]);a.append([c,1])
a.sort(reverse=1)
i=b=0
while h>0:
  if a[i][1]==1:h-=a[i][0];b+=1
  else:b+=(h-1)//a[i][0]+1;h=0
  i+=1
print(b)

Buggy submission (verdict: Runtime Error):
n,h=map(int,input().split())
a=[]
for i in range(n):
  b,c=map(int,input().split())
  a.append([b,0]);a.append([c,1])
a.sort(reverse=1)
i=0
ans=0
while h>0:
  if a[i][1]==1:h-=a[i][0];ans+=1
  else h=0:ans+=(h-1)//a[i][0]+1
print(ans)

Buggy submission (verdict: Runtime Error):
n,h=map(int,input().split())
a=[]
for i in range(n):
  b,c=map(int,input().split())
  a.append([b,0]);a.append([c,1])
a.sort(reverse=1)
i=0
ans=0
while h>0:
  if a[i][1]==1:h-=a[i][0];ans+=1
  else:h=0:ans+=(h-1)//a[i][0]+1
print(ans)
Problem p03474 (python)

Fixed submission:
a,b=map(int,input().split());s=input().split("-");ans="Yes"
if len(s)!=2:ans="No"
if len(s[0])!=a or len(s[1])!=b:ans="No"
if "--" in s:ans=="No"
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split());c,d=input().split("-");print("Yes"len(c)==a and len(d)==b else"No")
Problem p03488 (python)

Fixed submission:
s=input()
x,y=map(int,input().split())
ss=[len(i) for i in s.split("T")]
x-=ss[0]
a=[]
b=[]
for i in range(1,len(ss)):
  if ss[i]==0:continue
  if i%2==1:b.append(ss[i])
  else:a.append(ss[i])
x=abs(x)
y=abs(y)
if max(x,y)>8000:exit(print("No"))
def check(n,a):
  dp=[[0]*20001 for _ in range(len(a)+1)]
  n+=10000
  dp[0][10000]=1
  for i in range(1,len(a)+1):
    for j in range(20001):
      if j+a[i-1]<=20000:dp[i][j+a[i-1]]|=dp[i-1][j]
      if j-a[i-1]>=0:dp[i][j-a[i-1]]|=dp[i-1][j]
  if dp[len(a)][n]==1:return True
  return False
if check(x,a) and check(y,b):print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
s=input()
x,y=map(int,input().split())
ss=[len(i) for i in s.split("T")]
x-=ss[0]
a=[]
b=[]
for i in range(1,len(ss)):
  if ss[i]==0:continue
  if i%2==1:b.append(ss[i])
  else:a.append(ss[i])
x=abs(x)
y=abs(y)
a.sort()
b.sort()
def check(n,a):
  dp=[[0]*20001 for _ in range(len(a)+1)]
  n+=10000
  dp[0][10000]=1
  for i in range(1,len(a)+1):
    for j in range(20001):
      if j+a[i-1]<=20000:dp[i][j+a[i-1]]|=dp[i-1][j]
      if j-a[i-1]>=0:dp[i][j-a[i-1]]|=dp[i-1][j]
  if dp[len(a)][n]==1:return True
  return False
if check(x,a) and check(y,b):print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
s=input()
x,y=map(int,input().split())
ss=[len(i) for i in s.split("T")]
x-=ss[0]
a=[]
b=[]
for i in range(1,len(ss)):
  if ss[i]==0:continue
  if i%2==1:b.append(ss[i])
  else:a.append(ss[i])
x=abs(x)
y=abs(y)
a.sort()
b.sort()
def check(n,a):
  dp=[[0]*16001 for _ in range(len(a)+1)]
  n+=8000
  dp[0][8000]=1
  for i in range(1,len(a)+1):
    for j in range(16001):
      if j+a[i-1]<=16000:dp[i][j+a[i-1]]|=dp[i-1][j]
      if j-a[i-1]>=0:dp[i][j-a[i-1]]|=dp[i-1][j]
  if dp[len(a)][n]==1:return True
  return False
if check(x,a) and check(y,b):print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
s=input()
x,y=map(int,input().split())
xy=[0,0]
xx=0
f=0
flag=True
for i in s:
  if i=="F":
    if flag and f==0:
      xx+=1
      continue 
    xy[f]+=1
  else:
    f^=1
    flag=False
ans="Yes"
if not(xx-xy[0]<=x<=xx+xy[0]):ans="No"
xy[0]+=xx
if (xy[0]+x)%2==0 and (xy[1]+y)%2==0:print(ans)
  else:print('No')
Problem p03494 (python)

Fixed submission:
n,a=int(input()),list(map(int,input().split()))
ans=0
while 1:
  for i in range(n):
    if a[i]%2==0:a[i]/=2
    else:
      print(ans)
      exit()
  ans+=1

Buggy submission (verdict: Runtime Error):
_,*a=open(0);print(min((int(x)&-int(x)).bit_length()for x in a)-1)
Problem p03501 (python)

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

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

Buggy submission (verdict: Runtime Error):
print(min(int(input())*int(input()),int(input())))
Problem p03545 (python)

Fixed submission:
s=input()
for i in range(2**3):
  b=bin(i)[2:].zfill(3)
  a=s[0]
  for i in range(3):a+=("+"if b[i]=="0"else"-")+s[i+1]
  if eval(a)==7:print(a+"=7");exit()

Buggy submission (verdict: Runtime Error):
a,b,c,d=list(input())
op=lambda i,a:"+" if i&a else "-"
for i in range(8):
  s=a+op(i&1)+e+op(i&2)+c+op(i&4)+d
  if eval(s)==7:print(s+"=7");exit()
Problem p03547 (python)

Fixed submission:
x=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F",]
a,b=input().split();a,b=x.index(a),x.index(b)
if a>b:print(">")
elif a<b:print("<")
else:print("=")

Buggy submission (verdict: Runtime Error):
x=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F",]
a,b=input().split();a,b=x.index(a),x.index(b)
if a>b:print(">")
elif a<b:print("<")
else;print("=")
Problem p03557 (python)

Fixed submission:
n,a=int(input()),[sorted(list(map(int,input().split())))for i in range(3)]
b=[[],[]]
x=0
for i in range(n):
  while a[2][i]>a[1][x]:
    b[1].append(n-i)
    x+=1
    if x==n:break
  if x==n:break
for i in range(n-len(b[1])):b[1].append(0)
for i in range(1,n):b[1][n-i-1]+=b[1][n-i]
x=0
for i in range(n):
  while a[1][i]>a[0][x]:
    b[0].append(b[1][i])
    x+=1
    if x==n:break
  if x==n:break
print(sum(b[0]))

Buggy submission (verdict: Runtime Error):
n,a,b=int(input()),[sorted(list(map(int,input().split())))for i in range(3)],[[],[]]
x=0
for i in range(n):
  while a[2][i]>a[1][x]:
    b[1].append(n-i)
    x+=1
    if x==n:break
  if x==n:break
for i in range(1,n):b[1][n-i-1]+=b[1][n-i]
x=0
for i in range(n):
  while a[1][i]>a[0][x]:
    b[0].append(b[1][i])
    x+=1
    if x==n:break
  if x==n:break
print(sum(b[0]))
Problem p03578 (python)

Fixed submission:
from collections import Counter
n,d,m,t,ans=int(input()),Counter(map(int,input().split())),int(input()),Counter(map(int,input().split())),"YES"
for i in t.keys():
  if i in d.keys():
    if d[i]<t[i]:ans="NO"
  else:ans="NO"
print(ans)

Buggy submission (verdict: Runtime Error):
n,d,m,t,ans=int(input()),list(map(int,input().split())),int(input()),list(map(int,input().split())),"YES"
dn,tn,dc,tc=[],[],[],[]
for i in d:
  if i in dn:dc[dn.index(i)]+=1
  else:dn.append(i);dc.append(1)
for i in t:
  if i in tn:tc[tn.index(i)]+=1
  else:tn.append(i);tc.append(1)
for i in range(len(tn)):
  if tc[i]>dc[dn.index(tn[i])]:ans="NO"
print(ans)
Problem p03579 (python)

Fixed submission:
# 二部グラフ判定
def bipartite_graph_check(n,edge):
  color = [-1] * n
  for i in range(n):
    if color[i] != -1:
      continue
    stack = [i]
    color[i] = 0
    for node in stack:
      for mode in edge[node]:
        if color[mode] == -1:
          stack.append(mode)
          color[mode] = color[node] ^ 1
        elif color[mode] == color[node]:
          return False
  #return True
  return color
n,m=map(int,input().split())
edge=[[]for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge[a].append(b)
  edge[b].append(a)
if bipartite_graph_check(n,edge):
  color=bipartite_graph_check(n,edge)
  print(color.count(0)*color.count(1)-m)
else:
  print(n*(n-1)//2-m)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
edge=[[]for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge[a].append(b)
  edge[b].append(a)
x=[0]*n
x[0]=1
def dfs(r,node):
  for mode in edge[node]:
    if r==mode:continue
    x[mode]=1^x[node]
    dfs(node,mode)
dfs(-1,0)
print(x.count(0)*x.count(1)-m)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
edge=[[]for _ in range(n)]
for _ in range(n):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge[a].append(b)
  edge[b].append(a)
x=[0]*n
x[0]=1
def dfs(r,node):
  for mode in edge[node]:
    if r==mode:continue
    x[mode]=1^x[node]
    dfs(node,mode)
dfs(-1,0)
print(x.count(0)*x.count(1)-m)
Problem p03589 (python)

Fixed submission:
N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    if 1/h+1/n>=4/N:continue
    w=(N*h*n)/(4*h*n-N*(h+n))
    if w==int(w):print(h,n,int(w));exit()

Buggy submission (verdict: Runtime Error):
N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    w=(N*h*n)/(4*h*n-N*(h+n))
    if w%1==0:print(h,n,int(w));exit()
Problem p03591 (python)

Fixed submission:
s=input()
if len(s)<4:print("No")
elif s[:4]=="YAKI":print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if len(s)<4:print("No")
elif s[:3]=print("Yes")
else:print("No")
Problem p03598 (python)

Fixed submission:
n,k,b,ans=int(input()),int(input()),list(map(int,input().split())),0
for i in b:ans+=min(i,k-i)*2
print(ans)

Buggy submission (verdict: Runtime Error):
n,k,b,ans=int(input()),int(input()),[int(input())for i in range(n)],0
for i in b:ans+=min(i,k-i)*2
print(ans)
Problem p03600 (python)

Fixed submission:
n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
b=[[j for j in i]for i in a]
c=[n*[1]for _ in range(n)]
for k in range(n):
  for i in range(n):
    for j in range(n):
      b[i][j]=min(b[i][j],b[i][k]+b[k][j])
      if a[i][j]==a[i][k]+a[k][j]:
        if i!=j and i!=k and j!=k:
          c[i][j]=0
if a!=b:exit(print(-1))
ans=0
for i in range(n):
  for j in range(i):
    if c[i][j]:ans+=a[i][j]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
b=[i.copy() for i in a]
c=[n*[1]for _ in range(n)]
for k in range(n):
  for i in range(n):
    for j in range(n):
      b[i][j]=min(b[i][j],b[i][k]+b[k][j])
      if a[i][j]==a[i][k]+a[k][j]:
        if i!=j and i!=k and j!=k:
          c[i][j]=0
if a!=b:exit(print(-1))
ans=0
for i in range(n):
  for j in range(i):
    if c[i][j]:ans+=a[i][j]
print(ans)
Problem p03611 (python)

Fixed submission:
n,a=int(input()),list(map(int,input().split()));c=[0]*(max(a)+1)
for i in a:
  if i>0:c[i-1]+=1
  if i<len(c)-1:c[i+1]+=1
  c[i]+=1
print(max(c))

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

Fixed submission:
s,d=input(),"abcdefghijklmnopqrstuvwxyz"
for i in range(26):
  if not d[i]in s:
    print(d[i])
    exit()
print("None")

Buggy submission (verdict: Runtime Error):
s,d=input(),"abcdefghijklmnopqrstuvwxyz"
for i in range(27):
  if not d[i]in s:
    print(d[i])
    exit()
print("None")