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

Fixed submission:
s=input()
flag=1
if s=='keyence':
  flag=0
for i in range(len(s)):
  for j in range(1,len(s)-i+1):
    if (s[:i]+s[i+j:])=='keyence':
      flag*=0
if flag==0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
s=input()
pos=0
cnt=0
flag=False
check='keyence'
for i in range(len(s)):
  if s[i]==check[pos]:
    pos+=1
    flag=True
  else:
    if flag==True:
      cnt+=1
      flag=False
if pos==7 and cnt<=1:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
s=input()
pos=0
cnt=0
flag=False
check='keyence'
for i in range(len(s)):
  if s[i]==check[pos]:
    pos+=1
    flag=True
  else:
    if flag==True:
      cnt+=1
      flag=False
if pos==7 and flag<=1ju:
  print('YES')
else:
  print('NO')
Problem p03160 (python)

Fixed submission:
n=int(input())
arr=(list(map(int,input().split())))
dp=[0]*n
dp[0]=0
dp[1]=abs(arr[1]-arr[0])
for i in range(2,n):
     dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=(list(map(int,input().split())))
dp=[0]*n
dp[0]=0
dp[1]=abs(arr[1]-arr[0])
for i in range(2,n):
     dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]))
print(dp[n])
Problem p03162 (python)

Fixed submission:
n=int(input())
dp=[[0 for i in range(n+1)] for j in range(3)]
for i in range(1,n+1):
  a,b,c=map(int,input().split())
  dp[0][i]=max(dp[1][i-1]+a,dp[2][i-1]+a)
  dp[1][i]=max(dp[0][i-1]+b,dp[2][i-1]+b)
  dp[2][i]=max(dp[0][i-1]+c,dp[1][i-1]+c)
print(max(dp[0][n],dp[1][n],dp[2][n]))

Buggy submission (verdict: Runtime Error):
n=int(input())
dp=[[0 for i in range(n+1)] for j in range(3)]
for i in range(1,n+1):
  a,b,c=map(int,input().split())
  for j in range(3):
    if j==0:
      dp[i][j]=max(dp[i-1][1]+a,dp[i-1][2]+a)
    elif j==1:
      dp[i][j]=max(dp[i-1][0]+b,dp[i-1][2]+b)
    else:
      dp[i][j]=max(dp[i-1][0]+c,dp[i-1][1]+c)
print(max(dp[n][0],dp[n][1],dp[n][2]))
Problem p03163 (python)

Fixed submission:
import sys
input=sys.stdin.readline
 
n,w=map(int,input().split())
dp=[0]*(w+1)
 
def ans(n,w):
  for _ in range(n):
    c,p=map(int,input().split())
    for j in range(w,c-1,-1):
      tmp=dp[j-c]+p
      if dp[j]<tmp:
        dp[j]=tmp
  return max(dp)
print(ans(n,w))

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
dp=[0 for j in range(w+1)]
c,p=map(int,input().split())
dp[c]=p
for i in range(1,n+1):
  c,p=map(int,input().split())
  for j in range(w,1,-1):
    if dp[j]<dp[j-c]+p:
      dp[j]=dp[j-c]+p    
print(max(dp))
Problem p03164 (python)

Fixed submission:
n,w=map(int,input().split())
dp=[0]*(n*10**3+1)
c,p=map(int,input().split())
dp[p]=c
mpos=p
for _ in range(n-1):
  c,p=map(int,input().split())
  for i in range(mpos+p,0,-1):
    if dp[i-p]!=0:
      if dp[i]==0:
        dp[i]=dp[i-p]+c
      else:
        dp[i]=min(dp[i-p]+c,dp[i])
  if dp[p]==0:
    dp[p]=c
  else:
    dp[p]=min(dp[p],c)
  mpos=mpos+p
ans=0
for i in range(len(dp)):
  if dp[i]<=w and dp[i]!=0:
    ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
 
n,w=map(int,input().split())
dp=[0]*(w+1)
 
def ans(n,w):
  for _ in range(n):
    c,p=map(int,input().split())
    for j in range(w,c-1,-1):
      tmp=dp[j-c]+p
      if dp[j]<tmp:
        dp[j]=tmp
  return max(dp)
print(ans(n,w))
Problem p03175 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

mod=10**9+7
def dfs(v):
  if checked[v]==1:
    return
  checked[v]=1
  dp[v][0]=1
  dp[v][1]=1
  for u in g[v]:
    if checked[u]==0:
      dfs(u)
      dp[v][0]=(dp[v][0]*(dp[u][0]+dp[u][1]))%mod
      dp[v][1]=(dp[v][1]*dp[u][0])%mod

n=int(input())
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
dp=[[0,0] for _ in range(n+1)]
checked=[0]*(n+1)
dfs(1)
print((dp[1][0]+dp[1][1])%mod)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
def dfs(v):
  if checked[v]==1:
    return
  checked[v]=1
  dp[v][0]=1
  dp[v][1]=1
  for u in g[v]:
    if checked[u]==0:
      dfs(u)
      dp[v][0]*=dp[u][0]+dp[u][1]
      dp[v][0]%=mod
      dp[v][1]*=dp[u][0]
      dp[v][1]%=mod      

n=int(input())
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
dp=[[0,0] for _ in range(n+1)]
checked=[0]*(n+1)
dfs(1)
print((dp[1][0]+dp[1][1])%mod)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
def dfs(v):
  if checked[v]==1:
    return
  checked[v]=1
  dp[v][0]=1
  dp[v][1]=1
  for u in g[v]:
    if checked[u]==0:
      dfs(u)
      dp[v][0]*=dp[u][0]+dp[u][1]
      dp[v][0]%=mod
      dp[v][1]*=dp[u][0]
      dp[v][1]%=mod      

n=int(input())
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
dp=[[0,0] for _ in range(n+1)]
checked=[0]*(n+1)
dfs(1)
print(dp[1][0]+dp[1][1])
Problem p03227 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
if len(s)==2:
  print(s)
else:
  print(s.reverse())
Problem p03260 (python)

Fixed submission:
a,b=map(int,input().split())
if a%2==0 or b%2==0:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a%2==0 or b%2==0:
  print('No')
else:
  print('Yes')
Problem p03262 (python)

Fixed submission:
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
  
n,x=map(int,input().split())
arr=list(map(int,input().split()))
arr.append(x)
arr=sorted(arr)
arr2=[]
for i in range(n):
  arr2.append(arr[i+1]-arr[0])
if n==1:
  print(arr2[0])
else:
  ans=gcd(arr2[0],arr2[1])
  for i in range(1,n):
    ans=gcd(ans,arr2[i])
  print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
  
n,x=map(int,input().split())
arr=list(map(int,input().split()))
arr.append(x)
arr=sorted(arr)
arr2=[]
for i in range(n-1):
  arr2.append(arr[i+1]-arr[0])
if n==1:
  print(abs(arr[0]-x))
else:
  ans=gcd(arr2[0],arr2[1])
  for i in range(1,n):
    ans=gcd(ans,arr2[i])
  print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
  
n,x=map(int,input())
arr=list(map(int,input().split()))
arr.append(x)
arr=sorted(arr)
arr2=[]
for i in range(n-1):
  arr2.append(arr[i+1]-arr[0])
if n==1:
  print(abs(arr[0]-x))
else:
  ans=gcd(arr2[0],arr2[1])
  for i in range(1,n):
    ans=gcd(ans,arr2[i])
  print(ans)
Problem p03281 (python)

Fixed submission:
n=int(input())
if n<105:
  print(0)
elif n<135:
  print(1)
elif n<165:
  print(2)
elif n<189:
  print(3)
elif n<195:
  print(4)
else:
  print(5)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n<105:
  print(0)
elif n<135:
  print(1)
elif n<165:
  print(2):
elif n<189:
  print(3)
elif n<195:
  print(4)
else:
  print(5)
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())
if s[0]!='1':
  print(s[0])
else:
  pos=0
  for i in range(len(s)):
    if i!=s[:i].count('1'):
      break
    pos=i
  if k<=pos:
    print('1')
  else:
    print(s[pos])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
if s[0]!='1':
  print(s[0])
else:
  pos=0
  for i in range(len(s)):
    if i!=s[:i].count('1'):
      break
    pos=i
  if k<=pos:
    print('1')
  else:
    print(s[pos+1])
Problem p03290 (python)

Fixed submission:
import math

n,g=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
comp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]
ans=10**10
for i in range(2**n):
  flag=format(i,'b')
  if len(flag)<n:
    flag='0'*(n-len(flag))+flag
  tsum=0
  tans=0
  for i in range(n):
    if flag[i]=='1':
      tsum+=comp[i]
      tans+=arr[i][0]
  if tsum>=g:
    ans=min(ans,tans)
  else:
    pos=flag[::-1].index('0')
    tq=math.ceil((g-tsum)/(100*(n-pos)))
    if tq<=arr[n-pos-1][0]:
      ans=min(ans,tans+tq)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n,g=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
comp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]
ans=10**10
for i in range(2**n):
  flag=format(i,'b')
  if len(flag)<n:
    flag='0'*(n-len(flag))+flag
  tsum=0
  tans=0
  for i in range(n):
    if flag[i]=='1':
      tsum+=comp[i]
      tans+=arr[i][0]
  if tsum>=g:
    ans=min(ans,tans)
  else:
    pos=flag[::-1].index('0')
    tq=math.ceil(g-tsum)/(100*(n-pos)))
    if tq<=arr[n-pos-1][0]:
      ans=min(ans,tans+tq)
print(ans)
Problem p03292 (python)

Fixed submission:
a,b,c=map(int,input().split())
s=abs(a-b)+abs(b-c)+abs(c-a)
m=max(abs(a-b),abs(b-c),abs(c-a))
print(s-m)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
s=abs(a-b)+abs(b-c)+abs(c-a)
mn=max(abs(a-b)+abs(b-c)+abs(c-a))
print(s-mn)
Problem p03316 (python)

Fixed submission:
def S(num):
  ret=0
  for i in range(10):
    ret+=int((num%(10**(i+1)))/(10**i))
  return ret

n=int(input())
a=S(n)
if n%a == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def S(num):
  ret=0
  for i in range(9):
    ret+=int((num%(10**(i+1)))/(10**i))
  return ret

n=int(input())
a=S(n)
if n%a == 0:
  print('Yes')
else:
  print('No')
Problem p03354 (python)

Fixed submission:
class UnionFind():
  def __init__(self,n):
    self.n=n
    self.root=[-1]*(n+1)
    self.rank=[0]*(n+1)
  def FindRoot(self,x):
    if self.root[x]<0:
      return x
    else:
      self.root[x]=self.FindRoot(self.root[x])
      return self.root[x]
  def Unite(self,x,y):
    x=self.FindRoot(x)
    y=self.FindRoot(y)
    if x==y:
      return
    else:
      if self.rank[x]>self.rank[y]:
        self.root[x]+=self.root[y]
        self.root[y]=x
      elif self.rank[x]<=self.rank[y]:
        self.root[y]+=self.root[x]
        self.root[x]=y
        if self.rank[x]==self.rank[y]:
          self.rank[y]+=1
  def isSameGroup(self,x,y):
    return self.FindRoot(x)==self.FindRoot(y)
  def Count(self,x):
    return -self.root[self.FindRoot(x)]

n,m=map(int,input().split())
arr=list(map(int,input().split()))
t=UnionFind(n+1)
for _ in range(m):
  a,b=map(int,input().split())
  t.Unite(a,b)
ans=0
for i in range(n):
  if arr[i]==(i+1):
    ans+=1
  else:
    if t.isSameGroup((i+1),arr[i]):
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind():
  def __init__(self,n):
    self.n=n
    self.root=[-1]*(n+1)
    self.rank=[0]*(n+1)
  def FindRoot(self,x):
    if self.root[x]<0:
      return x
    else:
      self.root[x]=self.FindRoot(self.root[x])
      return self.root[x]
  def Unite(self,x,y):
    x=self.FindRoot(x)
    y=self.FindRoot(y)
    if x==y:
      return
    else:
      if self.rank[x]>self.rank[y]:
        self.root[x]+=self.root[y]
        self.root[y]=x
      elif self.rank[x]<=self.rank[y]:
        self.root[y]+=self.root[x]
        self.root[x]=y
        if self.rank[x]==self.rank[y]:
          self.rank[y]+=1
  def isSameGroup(self,x,y):
    return self.FindRoot(x)==self.FindRoot(y)
  def Count(self,x):
    return -self.root[self.FindRoot(x)]

n,q=map(int,input().split())
t=UnionFind(n)
for _ in range(q):
  p,a,b=map(int,input().split())
  if p==0:
    t.Unite(a,b)
  elif p==1:
    if t.isSameGroup(a,b):
      print('Yes')
    else:
      print('No')


n,m=map(int,input().split())
arr=list(map(int,input().split()))
t=UnionFind(n+1)
for _ in range(m):
  a,b=map(int,input().split())
  t.Unite(a,b)
ans=0
for i in range(n):
  if arr[i]==(i+1):
    ans+=1
  else:
    if t.isSameGroup((i+1),arr[i]):
      ans+=1
print(ans)
Problem p03360 (python)

Fixed submission:
arr=list(map(int,input().split()))
n=int(input())
arr=sorted(arr)
print(arr[0]+arr[1]+arr[2]*(2**n))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
n=int(input())
arr=[a,b,c]
arr=sort(arr)
print(arr[0]+arr[1]+arr[2]*(2**n))
Problem p03371 (python)

Fixed submission:
a,b,c,x,y=map(int,input().split())
if x>y:
  ans=min(a*x+b*y,2*c*x,2*c*y+a*(x-y))
else:
  ans=min(a*x+b*y,2*c*y,2*c*x+b*(y-x))
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,x,y=map(int,input().split())
if 2*c<=min(a,b):
  print(2*c*max(x,y))
elif max(a,b)<=2*c:
  print(a*x+b*y)
elif a>=2*c:
  print(2*c*x+b*max(y-x,0))
elif b>=2*c:
  prinr(2*c*y+a*max(x-y,0))

Buggy submission (verdict: Runtime Error):
a,b,c,x,y=map(int,input().split())
if 2*c<=min(a,b):
  print(2*c*max(x,y))
elif (a+b)<=2*c:
  print(a*x+b*y)
elif a>=2*c:
  print(2*c*x+b*max(y-x,0))
elif b>=2*c:
  prinr(2*c*y+a*max(x-y,0))
Problem p03424 (python)

Fixed submission:
n=int(input())
arr=list(map(str,input().split()))
count=0
if arr.count('P')!=0:
  count+=1
if arr.count('Y')!=0:
  count+=1
if arr.count('W')!=0:
  count+=1
if arr.count('G')!=0:
  count+=1
if count==3:
  print('Three')
if count==4:
  print('Four')

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=[input() for _ in range(n)]
count=0
if arr.count('P')!=0:
  count+=1
if arr.count('Y')!=0:
  count+=1
if arr.count('W')!=0:
  count+=1
if arr.count('G')!=0:
  count+=1
if count==3:
  print('Three')
if count==4:
  print('Four')
Problem p03427 (python)

Fixed submission:
n=input()
if len(n)==1:
  print(int(n))
else:
  cnt=n[1:].count('9')
  if cnt==len(n)-1:
    print(int(n[0])+9*(len(n)-1))
  else:
    print(int(n[0])-1+9*(len(n)-1))

Buggy submission (verdict: Runtime Error):
n=input()
if len(n)==1:
  print(int(n))
else:
  cnt=n[1:].count('9')
  if cnt1==len(n)-1:
    print(int(n[0])+9*(len(n)-1))
  else:
    print(int(n[0])-1+9*(len(n)-1))
Problem p03435 (python)

Fixed submission:
b=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
for i in range(max(0,b[0]-100,b[1]-100,b[2]-100),min(100,b[0],b[1],b[2])+1):
  t1=set()
  t2=set()
  for j in range(3):
    t1.add(a2[j]-(b[j]-i))
    t2.add(a3[j]-(b[j]-i))
  if len(t1)==1 and len(t2)==1 and list(t1)[0]>=0 and list(t2)[0]>=0:
    print('Yes')
    break
else:
  print('No')

Buggy submission (verdict: Runtime Error):
b=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
for i in range(max(0,b[0]-100,b[1]-100,b[2]-100),min(100,b[0],b[1],b[2])+1):
  t1=set()
  t2=set()
  for j in range(3):
    t1.add(a2[j]-(b[j]-i))
    t2.add(a3[j]-(b[j]-i))
  if len(t1)==1 and len(t2)==1 and t1[0]>=0 and t2[0]>=0:
    print('Yes')
    break
else:
  print('No')
Problem p03457 (python)

Fixed submission:
n=int(input())
flag=True
ts=0
xs=0
ys=0
for i in range(n):
  te,xe,ye=map(int,input().split())
  if (te-ts)%2 == ((xe+ye)-(xs+ys))%2 and ((xe+ye)-(xs+ys))<=(te-ts):
    flag = True
  else:
    flag = False
    break;
  ts,xs,ys=te,xe,ye
if flag:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=[[0,0,0]+[list(map(int,input().split())) for _ in range(n)]]
for i in range(n):
  t1,x1,y2=arr[i]
  t2,x2,y2=arr[i+1]
  if abs(x1-x2)+abs(y1-y2)>t1+t2:
    print('No')
    exit()
  if (abs(x1-x2)+abs(y1-y2))%2!=(t1+t2)%2:
    print('No')
    exit()
print('Yes')
Problem p03475 (python)

Fixed submission:
n=int(input())
arr=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
  ans=arr[i][0]+arr[i][1]
  for j in range(i+1,n-1):
    if ans<=arr[j][1]:
      ans=arr[j][0]+arr[j][1]
    else:
      if (ans-arr[j][1])%arr[j][2]==0:
        ans+=arr[j][0]
      else:
        ans+=arr[j][0]+arr[j][2]-ans%arr[j][2]
  print(ans)
print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
  ans=arr[i][0]+arr[i][1]
  for j in range(i+1,n-1):
    if ans<=arr[j][1]:
      ans=arr[j][0]+arr[j][1]
    else:
      if (ans-arr[j][1])%ans[j][2]==0:
        ans+=arr[j][0]
      else:
        ans+=arr[j][0]+arr[j][2]-ans%arr[j][2]
  print(ans)
print(0)
Problem p03476 (python)

Fixed submission:
def prime(n):
  if n==1:
    return False
  elif n==2 or n==3:
    return True
  else:
    for i in range(2,int(n**0.5)+1):
      if n%i==0:
        return False
    else:
      return True

ans=[0]*(10**5+1)
for i in range(3,10**5+1,2):
  if prime(i) and prime((i+1)//2):
    ans[i]=1
for i in range(1,10**5+1):
  ans[i]=ans[i]+ans[i-1]
q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(ans[r]-ans[l-1])

Buggy submission (verdict: Runtime Error):
def prime(n):
  if n==1:
    return False
  elif n==2 or n==3:
    return True
  else:
    for i in range(2,int(n**0.5)+1):
      if n%i==0:
        return False
    else:
      return True

ans=[0]*(10**5+1)
for i in range(3,10**5+1,2):
  if prime(i) and prime((i+1)//2):
    ans[i]=1
for i in range(1,10**5+1)=:
  ans[i]=ans[i]+ans[i-1]
q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(ans[r]-ans[l-1])
Problem p03480 (python)

Fixed submission:
s=input()
l=len(s)
ans=l
for i in range(l-1):
  if s[i]!=s[i+1]:
    tmp=max(i+1,l-i-1)
    ans=min(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
l=len(s)
ans=10**18
for i in range(l-1):
  if s[i]!=s[i+1]:
    tmp=max(i+1,n-i-1)
    ans=min(ans,tmp)
print(ans)
Problem p03533 (python)

Fixed submission:
s=input()
ans=['KIHBR']
for i in range(1,16):
  flag=format(i,'b')
  flag='0'*(4-len(flag))+flag
  tmp='A'*int(flag[0])+'KIH'+'A'*int(flag[1])+'B'+'A'*int(flag[2])+'R'+'A'*int(flag[3])
  ans.append(tmp)
if s in ans:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
s=input()
ans=['KIHBR']
for i in range(1,16):
  flag=format(i,'b')
  tmp='A'*int(flag[0])+'KIH'+'A'*int(flag[1])+'B'+'A'*int(flag[2])+'R'+'A'*int(flag[3])
  ans.append(tmp)
if s in ans:
  print('YES')
else:
  print('NO')
Problem p03544 (python)

Fixed submission:
n=int(input())
list=[0]*(n+1)
list[0]=2
list[1]=1
for i in range(2,n+1):
  list[i]=list[i-1]+list[i-2]
print(list[n])

Buggy submission (verdict: Runtime Error):
n=int(input())
list=[0]*n
list[0]=2
list[1]=1
for i in range(2,n):
  list[i]=list[i-1]+list[i-2]
print(list[n-1])
Problem p03545 (python)

Fixed submission:
s=str(input())
n1=int(s[0])
n2=int(s[1])
n3=int(s[2])
n4=int(s[3])
sum1=0
sum2=0
sum3=0
ans=''
op=['+','-']
for i in range(2):
  if i == 0:
    sum1 = n1+n2
  else:
    sum1 = n1-n2
  for j in range(2):
    if j == 0:
      sum2 = sum1+n3
    else:
      sum2 = sum1-n3
    for k in range(2):
      if k == 0:
        sum3=sum2+n4
      else:
        sum3=sum2-n4
      if sum3==7:
        ans=str(n1)+op[i]+str(n2)+op[j]+str(n3)+op[k]+str(n4)+'=7'
print(ans)

Buggy submission (verdict: Runtime Error):
s=str(input())
n1=s[0]
n2=s[1]
n3=s[2]
n4=s[3]
sum1=0
sum2=0
sum3=0
ans=''
op=['+','-']
for i in range(2):
  if i == 0:
    sum1 = n1+n2
  else:
    sum1 = n1-n2
  for j in range(2):
    if j == 0:
      sum2 = sum1+n3
    else:
      sum2 = sum1-n3
    for k in range(2):
      if k == 0:
        sum3=sum2+n4
      else:
        sum3=sum2-n4
      if sum3==7:
        ans=str(n1)+op[i]+str(n2)+op[j]+str(n3)+op[k]+str(n4)+'=7'
print(ans)
Problem p03547 (python)

Fixed submission:
arr={'A':0, 'B':1, 'C':2, 'D':3, 'E':4, 'F':5}
x,y=map(str,input().split())
if arr[x]>arr[y]:
  print('>')
elif arr[x]<arr[y]:
  print('<')
else:
  print('=')

Buggy submission (verdict: Runtime Error):
arr={'a':0, 'b':1, 'c':2, 'd':3, 'e':4, 'f':5}
x,y=map(str,input().split())
if arr[x]>arr[y]:
  print('>')
elif arr[x]<arr[y]:
  print('<')
else:
  print('=')
Problem p03567 (python)

Fixed submission:
s=input()
flag=False
for i in range(len(s)-1):
  if s[i:i+2]=='AC':
    flag=True
if flag:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
ソースコード 

Copy
Copy
s=input()
flag=False
for i in range(len(s)-1):
  if s[i:i+2]=='AC':
    flag=True
if flag:
  print('Yes')
else:
  print('No')
Problem p03568 (python)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
tmp=1
for i in range(n):
  if arr[i]%2==0:
    tmp*=2
print(3**n-tmp)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=list(map(int,input().split()))
tmp=1
for i in range(i):
  if arr[i]%2==0:
    tmp*=2
print(3**n-tmp)
Problem p03577 (python)

Fixed submission:
s=input()
print(s[:-8])

Buggy submission (verdict: Runtime Error):
s=input()
print(s[:-8]
Problem p03578 (python)

Fixed submission:
n=int(input())
arr1=list(map(int,input().split()))
arr1=sorted(arr1)
m=int(input())
arr2=list(map(int,input().split()))
arr2=sorted(arr2)
pos=0
for i in range(n):
  if arr1[i]==arr2[pos]:
    pos+=1
  if pos==m:
    print('YES')
    break
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
n-int(input())
arr1=list(map(int,input().split()))
arr1=sorted(arr1)
m=int(input())
arr2=list(map(int,input().split()))
arr2=sorted(arr2)
pos=0
for i in range(n):
  if arr1[i]==arr2[pos]:
    pos+=1
  if pos==m:
    print('YES')
    break
else:
  print('NO')
Problem p03592 (python)

Fixed submission:
n,m,k=map(int,input().split())
flag=False
if n==1 or m==1:
  print('Yes')
else:
  for i in range(n+1):
    for j in range(m+1):
      if i*j + (n-i)*(m-j) + k == n*m:
        flag=True
  if flag:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
flag=False
if n==1 or m==1:
  print('Yes')
  else:
  for i in range(n):
    for j in range(m):
      if i*j + (n-i)*(m-j) + k == n*m:
        flag=True
  if flag:
    print('Yes')
  else:
    print('No')
Problem p03598 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
arr=list(map(int,input()))
ans=0
for i in range(n):
  if int(k/2)<arr[i]:
    ans+=arr[i]*2
  else:
    ans+=(k-arr[i])*2
print(ans)
Problem p03599 (python)

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
ans=[100*min(a,b),0]
for i in range(31):
  for j in range(31):
    if i==0 and j==0:
      break
    l1=f-(100*a*i+100*b*j)
    l2=(a*i+b*j)*e
    l=min(l1,l2)
    cc,dc=0,0
    for k in range(l//c+1):
      tc=k
      td=(l-c*tc)//d
      if l-(c*tc+d*td)<l-(c*cc+d*dc):
        cc,dc=tc,td
    wa=100*a*i+100*b*j
    sa=c*cc+d*dc
    tmp=[wa+sa,sa]
    if wa+sa>f or sa>e*(a*i+b*j):
      break
    if tmp[1]/tmp[0]>ans[1]/ans[0]:
      ans=tmp
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,d=map(int,input().split())
ans=[100*a,0]
for i in range(f//(100*a)+1):
  for j in range((f-100*a*i)//(100*b)+1):
    for k in range(f//c+1):
      if i==0 and j==0:
        break
      for l in range((f-c*k)//d+1):
        if 100*a*i+100*b*j+c*k+d*l>f:
          break
        elif c*k+d*l>(a*i+b*j)*e:
          break
        else:
          if (c*k+d*l)/(100*a*i+100*b*j+c*k+d*l)>ans[1]/ans[0]:
            ans=[100*a*i+100*b*j+c*k+d*l,c*k+d*l]
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,d=map(int,input().split())
ans=[100*a,0]
for i in range(f//(100*a)+1):
  for j in range((f-100*a*i)//(100*b)+1):
    if i==0 and j==0:
      break
    for k in range(f//c+1):
      for l in range((f-c*k)//d+1):
        if 100*a*i+100*b*j+c*k+d*l>f:
          break
        elif c*k+d*l>(a*i+b*j)*e:
          break
        else:
          if (c*k+d*l)/(100*a*i+100*b*j+c*k+d*l)>ans[1]/ans[0]:
            ans=[100*a*i+100*b*j+c*k+d*l,c*k+d*l]
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,d=map(int,input().split())
ans=[100*a,0]
for i in range(f//(100*a)+1):
  for j in range((f-100*a*i)//(100*b)+1):
    for k in range(f//c+1):
      for l in range((f-c*k)//d+1):
        if 100*a*i+100*b*j+c*k+d*l>f:
          break
        elif c*k+d*l>(a*i+b*j)*e:
          break
        else:
          if (c*k+d*l)/(100*a*i+100*b*j+c*k+d*l)>ans[1]/ans[0]:
            ans=[100*a*i+100*b*j+c*k+d*l,c*k+d*l]
print(ans[0],ans[1])