Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h,n=map(int,input().split())
a=[0]*n
b=[0]*n
inf=10**10
for i in range(n):
    a[i],b[i]=map(int,input().split())
dp = [[inf for i in range(h+2)] for j in range(n+1)]
for i in range(n):
    cnt=1
    for j in range(h+1):
            if j-a[i]<0:
                dp[i+1][j]=min(dp[i][j],dp[i][j-a[i]]+b[i],b[i]*cnt)
            else:
                dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i],dp[i][j-a[i]]+b[i],b[i]*cnt)
                cnt+=1
"""
for i in range(1,n+1):
    for j in range(h+1):
        if j+a[i]<=h:
            dp[i+1][j+a[i]]=min(dp[i+1][a[i]],dp[i][j]+b[i])"""
print(dp[n][h])
#print(dp)


Fixed submission:
h,n=map(int,input().split())
a=[0]*n
b=[0]*n
inf=10**10
for i in range(n):
    a[i],b[i]=map(int,input().split())
dp = [[inf for i in range(h+1)] for j in range(n+1)]
for i in range(n):
    cnt=1
    for j in range(h+1):
            if j-a[i]<0:
                dp[i+1][j]=min(dp[i][j],dp[i][0]+b[i],b[i]*cnt)
            else:
                dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i],dp[i][j-a[i]]+b[i],b[i]*cnt)
                cnt+=1
"""
for i in range(1,n+1):
    for j in range(h+1):
        if j+a[i]<=h:
            dp[i+1][j+a[i]]=min(dp[i+1][a[i]],dp[i][j]+b[i])"""
print(dp[n][h])
#print(dp)

Buggy python submission (verdict: Runtime Error):
h,n=map(int,input().split())
a=[0]*n
b=[0]*n
inf=10**10
for i in range(n):
    a[i],b[i]=map(int,input().split())
dp = [[inf for i in range(h+1)] for j in range(n+1)]
for i in range(n):
    cnt=1
    for j in range(h+1):
            if j-a[i]<0:
                dp[i+1][j]=min(dp[i][j],dp[i][j-a[i]]+b[i],b[i]*cnt)
            else:
                dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i],dp[i][j-a[i]]+b[i],b[i]*cnt)
                cnt+=1
"""
for i in range(1,n+1):
    for j in range(h+1):
        if j+a[i]<=h:
            dp[i+1][j+a[i]]=min(dp[i+1][a[i]],dp[i][j]+b[i])"""
print(dp[n][h])
#print(dp)


Fixed submission:
h,n=map(int,input().split())
a=[0]*n
b=[0]*n
inf=10**10
for i in range(n):
    a[i],b[i]=map(int,input().split())
dp = [[inf for i in range(h+1)] for j in range(n+1)]
for i in range(n):
    cnt=1
    for j in range(h+1):
            if j-a[i]<0:
                dp[i+1][j]=min(dp[i][j],dp[i][0]+b[i],b[i]*cnt)
            else:
                dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i],dp[i][j-a[i]]+b[i],b[i]*cnt)
                cnt+=1
"""
for i in range(1,n+1):
    for j in range(h+1):
        if j+a[i]<=h:
            dp[i+1][j+a[i]]=min(dp[i+1][a[i]],dp[i][j]+b[i])"""
print(dp[n][h])
#print(dp)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
import fractions as f
n=int(input())
a=list(map(int,input().split()))
cnt=a[0]
for i in range(n):
    cnt=(a[i]*cnt)//f.gcd(a[i],cnt)
ans=0
for i in range(n):
    ans+=cnt//a[i]
    ans=ans%(10**9+7)
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!
import fractions as f
MOD=10**9+7
fac=[i for i in range(10**6+1)]
inv=[0]*(10**6+1)
inv[1]=1
for i in range(2,10**6+1):
    inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
#print(inv)
MOD=10**9+7
n=int(input())
a=list(map(int,input().split()))
cnt=a[0]
for i in range(n):
    cnt=(a[i]*cnt)//f.gcd(a[i],cnt)
ans=0
cnt=cnt%(10**9+7)
for i in range(n):
    ans+=inv[a[i]]*cnt
    ans=ans%(10**9+7)
    #print(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
=int(input())
count=1
ans=10000000000000
k=c
for i in range(1,int(c**(1/2)+100000)):
    if c%i==0:
        count*=i
        k=int(k/i)
        if ans>count+k:
            ans=count+k
            count=0
            k=c
        else:
            count=0
            k=c
print(ans-2)


Fixed submission:
c=int(input())
count=1
ans=10000000000000
k=c
for i in range(1,int(c**(1/2)+100000)):
    if c%i==0:
        if ans>i+int(c/i):
            ans=i+int(c/i)
        else:
            continue
print(ans-2)

Buggy python submission (verdict: Runtime Error):
c=int(input())
count=1
ans=10000000000000
k=c
a=[]
for i in range(1,int(c**(1/2))):
    if c%i==0:
        count*=i
        k=int(k/i)
        a.append(count+k)
        count=1
        k=c
print(a)
print(min(a)-2)


Fixed submission:
c=int(input())
count=1
ans=10000000000000
k=c
for i in range(1,int(c**(1/2)+100000)):
    if c%i==0:
        if ans>i+int(c/i):
            ans=i+int(c/i)
        else:
            continue
print(ans-2)

Buggy python submission (verdict: Runtime Error):
c=int(input())
count=1
ans=10000000000000
k=c
a=[]
for i in range(1,int(c**(1/2))):
    if c%i==0:
        count*=i
        k=int(k/i)
        a.append(count+k)
        count=1
        k=c
print(a)
print(min(a)-2)

Fixed submission:
c=int(input())
count=1
ans=10000000000000
k=c
for i in range(1,int(c**(1/2)+100000)):
    if c%i==0:
        if ans>i+int(c/i):
            ans=i+int(c/i)
        else:
            continue
print(ans-2)

Buggy python submission (verdict: Runtime Error):
c=int(input())
count=1
ans=10000000000000
k=c
a=[]
for i in range(1,int(c**(1/2))):
    if c%i==0:
        count*=i
        k=int(k/i)
        a.append(count+k)
print(min(a)-2)

Fixed submission:
c=int(input())
count=1
ans=10000000000000
k=c
for i in range(1,int(c**(1/2)+100000)):
    if c%i==0:
        if ans>i+int(c/i):
            ans=i+int(c/i)
        else:
            continue
print(ans-2)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
a, b = map(int, input().split())
c=fractions.gcd(a, b)
ans=1
def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return table
d=sieve(c)
for i in range(len(d)):
    if c%d[i]==0:
        ans+=1
print(ans)

Fixed submission:
import fractions
a, b = map(int, input().split())
c=fractions.gcd(a, b)
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
d=list(set(prime_decomposition(c)))
ans=len(d)+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int, input().split())
Q=[]
for j in range(q):
    Q.append(input())
for l in range(1,n+1):
    a=Q.count(str(l))
    if k>(q-a):
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q = map(int, input().split())
Q=[]
S=[]
if k>q:
    for i in range(n):
        print("Yes")
else:
    for j in range(q):
        Q.append(int(input()))
    for m in range(n):
        S.append(k)
    for l in range(q):
        S[Q[l]-1]+=1
    for x in range(n):
        S[x]-=q
    for z in range(n):
        if S[z]<=0:
            print("No")
        else:
            print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
S=list(s)
count=1
a=[]
a.append(S[0])
S.remove(S[0])
while 0<len(S):
        x=S[0]
        if a[len(a)-1]!=x:
            a.append(x)
            S.remove(S[0])
        else:
            S.remove(S[0])
            while x==a[len(a)-1] and len(S)>0:
                x+=S[0]
                S.remove(S[0])
            if x!=a[len(a)-1]:
                a.append(x)
#print(a)
print(len(a))

Fixed submission:
s=input()
S=list(s)
count=1
a=[]
a.append(S[0])
S.remove(S[0])
x=''
for i in range(len(S)):
    x+=S[i]
    if a[len(a)-1]!=x:
        a.append(x)
        x=''
        count+=1
    else:
        continue
print(len(a))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans='Yes'
for i in range(n-1,0,-1):
    print(h[i])
    if h[i]>h[i-1]:
        continue
    elif h[i]+1==h[i-1]:
        h[i-1]-=1
    else:
        ans='No'
print(ans)

Fixed submission:
a, b, c = map(int, input().split())
if b+c>a:
    print(b+c-a)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
if b-a+1>c*d//(math.gcd(c,d)):
    print(b-b//c-b//d+b//(c*d//(math.gcd(c,d)))-a+a//c+a//d-a//(c*d//math.gcd(c,d))+1)
else:
    print(b-b//c-b//d+b//(c*d//(math.gcd(c,d)))-a+a//c+a//d-a//(c*d//math.gcd(c,d)))


Fixed submission:
import fractions as ff
a,b,c,d=map(int,input().split())
if a%c==0 or a%d==0:
    cnt=1
else:
    cnt=0
if cnt==1:
    print((b-b//c-b//d+b//(c*d//ff.gcd(c,d)))-(a-a//c-a//d+a//(c*d//ff.gcd(c,d))))
else:
    print((b-b//c-b//d+b//(c*d//ff.gcd(c,d)))-(a-a//c-a//d+a//(c*d//ff.gcd(c,d)))+1)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
w,h,x,y=map(int,input().split())
#print(min(max(x*h,(w-x)*h),max(y*w,(h-y)*w)))
if w==x+x and h==y+y:
    print(float(w)*float(h)/2,1)
else:
    print(float(w)*float(h)/2,0)



Fixed submission:
x,a=map(int,input().split())
if(x>=a):
    print(10)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
ans=[10*9]*n
if a[0]==1:
    ans[0]=0
else:
    ans[0]=1
if len(ans)>1:
    ans[1]=ans[0]+1
for i in range(m):
    ans[a[i]-1]=0
for j in range(n-2):
    if ans[j+2]==0:
        continue
    else:
        ans[j+2]=ans[j+1]+ans[j]
        ans[j+2]=ans[j+2]%(1000000007)
    #print(ans)
print(ans[n-1])
#print(ans)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
ans=[10*9]*n
ans[0]=1
for i in range(m):
    ans[a[i]-1]=0
if len(ans)>1 and ans[1]!=0:
    ans[1]=ans[0]+1
for j in range(n-2):
    if ans[j+2]==0:
        continue
    else:
        ans[j+2]=ans[j+1]+ans[j]
        ans[j+2]=ans[j+2]%(1000000007)
    #print(ans)
print(ans[n-1])
#print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
ans=[n]*n
ans[0]=1
for i in range(m):
    ans[a[i]-1]=0
ans[1]=ans[0]+1
for j in range(n-2):
    if ans[j+2]==0:
        continue
    else:
        ans[j+2]=ans[j+1]+ans[j]
        ans[j+2]=ans[j+2]%(1000000007)
    #print(ans)
print(ans[n-1])
#print(ans)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
ans=[10*9]*n
ans[0]=1
for i in range(m):
    ans[a[i]-1]=0
if len(ans)>1 and ans[1]!=0:
    ans[1]=ans[0]+1
for j in range(n-2):
    if ans[j+2]==0:
        continue
    else:
        ans[j+2]=ans[j+1]+ans[j]
        ans[j+2]=ans[j+2]%(1000000007)
    #print(ans)
print(ans[n-1])
#print(ans)
Buggy python submission (verdict: Runtime Error):
x=input()
if x==A:
  print(T)
elif x==T:
  print(A)
elif x==G:
  print(C)
else:
  print(G)


Fixed submission:
x=input()
if x=='A':
    print('T')
elif x=='T':
    print('A')
elif x=='G':
    print('C')
elif x=='C':
    print('G')

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

Fixed submission:
x=input()
if x=='A':
    print('T')
elif x=='T':
    print('A')
elif x=='G':
    print('C')
elif x=='C':
    print('G')
Buggy python submission (verdict: Runtime Error):
import math
a,b,k=map(int,input().split())
count=0
ans=0
x=math.gcd(a,b)
for i in range(x,0,-1):
    if a%i==0 and b%i==0:
        count+=1
        ans=i
        if count==k:
            break
print(ans)

Fixed submission:
a,b,k=map(int,input().split())
ans=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        ans.append(i)
#print(ans)
print(ans[len(ans)-k])
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n-k>=1:
    print('YES')
else:
    print('NO')

Fixed submission:
n,m=map(int,input().split())
if (n+1)//2>=m:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
def changemin(a,b):
    if a>b:
        a=b
        return a
    return a
dp=[]
dp.append(0)
for i in range(1,n):
    dp.append(1000000)
for m in range(1,n):
    for j in range(1,k+1):
        dp[m]=changemin(dp[m],dp[m-j]+abs(h[m]-h[m-j]))
print(dp[n-1])

Fixed submission:
# educational DP contest A
n,k=map(int,input().split())
h=list(map(int,input().split()))
def changemin(a,b):
    if a>b:
        a=b
        return a
    return a
dp=[]
dp.append(0)
for i in range(1,n):
    dp.append(100000000000)
for m in range(n):
    for j in range(1,min(k+1,n-m)):
        dp[m+j]=changemin(dp[m+j],dp[m]+abs(h[m]-h[m+j]))
print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
def changemin(a,b):
    if a>b:
        a=b
        return a
    return a
dp=[]
dp.append(0)
for i in range(1,n):
    dp.append(1000000)
for m in range(1,n):
    for j in range(1,k+1):
        dp[m]=changemin(dp[m],dp[m-j]+abs(h[m]-h[m-j]))
        if m+j==n-1:
            break
print(dp[n-1])

Fixed submission:
# educational DP contest A
n,k=map(int,input().split())
h=list(map(int,input().split()))
def changemin(a,b):
    if a>b:
        a=b
        return a
    return a
dp=[]
dp.append(0)
for i in range(1,n):
    dp.append(100000000000)
for m in range(n):
    for j in range(1,min(k+1,n-m)):
        dp[m+j]=changemin(dp[m+j],dp[m]+abs(h[m]-h[m+j]))
print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
def changemin(a,b):
    if a>b:
        a=b
        return a
    return a
dp=[]
dp.append(0)
for i in range(1,n):
    dp.append(1000000)
for j in range(1,n):
    for l in range(1,k):
        dp[j]=changemin(dp[j],dp[j-l]+abs(h[j]-h[j-l]))
print(dp[n-1])

Fixed submission:
# educational DP contest A
n,k=map(int,input().split())
h=list(map(int,input().split()))
def changemin(a,b):
    if a>b:
        a=b
        return a
    return a
dp=[]
dp.append(0)
for i in range(1,n):
    dp.append(100000000000)
for m in range(n):
    for j in range(1,min(k+1,n-m)):
        dp[m+j]=changemin(dp[m+j],dp[m]+abs(h[m]-h[m+j]))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
#メモ化したもの(修正版)
n,w=map(int,input().split())
a=[]
dp=[]
for i in range(n):
   a.append(list(map(int,input().split())))
for k in range(n+1):
   dp.append([])
   for l in range(w+1):
       dp[k].append(-1)
def rec(i,j):
   if dp[i][j]>=0:
       return dp[i][j]
   if i==n:
       res=0
   elif j<a[i][0]:
       res=rec(i+1,j)
   else:
       res=max(rec(i+1,j),rec(i+1,j-a[i][0])+a[i][1])
   dp[i][j]=res
   return res
print(rec(0,w))

Fixed submission:
#dpテーブルのみでの解法(順方向)
n,w=map(int,input().split())
a=[]
dp=[]
for i in range(n):
   a.append(list(map(int,input().split())))
for k in range(n+1):
  dp.append([])
  for l in range(w+1):
      dp[k].append(0)
for i in range(n):
   for j in range(w+1):
       if j<a[i][0]:
           dp[i+1][j]=dp[i][j]
       else:
           dp[i+1][j]=max(dp[i][j],dp[i][j-a[i][0]]+a[i][1])
print(dp[n][w])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input(),split())
if c<=a+b:
    print(b+c)
else:
    print(a+2*b)

Fixed submission:
a,b,c=map(int,input().split())
if c<=a+b+1:
    print(b+c)
else:
    print(a+2*b+1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n==22:
  print(Christmas Eve Eve Eve)
elif n==23:
  print(Christmas Eve Eve)
elif n==24:
  print(Christmas Eve)
else:
  print(Christmas)


Fixed submission:
n=int(input())
if n==22:
  print('Christmas Eve Eve Eve')
elif n==23:
  print('Christmas Eve Eve')
elif n==24:
  print('Christmas Eve')
else:
  print('Christmas')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
l=[0]*n
c=0
for i in range(n):
    l[i]=int(input())
    if l.count(l[i])>=k:
        print(0)
        c=1
if c==0:
    l.sort()
    print(l[k-1]-l[0])

Fixed submission:
# coding: utf-8
# Your code here!
n,k=map(int,input().split())
h=[]
for i in range(n):
    h.append(int(input()))
ans=10**10
c=0
h.sort()
for i in range(n-k+1):
    c=h[i+k-1]-h[i]
    if c<ans:
        ans=c
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
l=[0]*n
c=0
for i in range(n):
    l[i]=int(input())
    if l.count(l[i])>=k:
        print(0)
        c=1
if c==0:
    l.sort()
    print(l[k-1]-l[0])

Fixed submission:
# coding: utf-8
# Your code here!
n,k=map(int,input().split())
h=[]
for i in range(n):
    h.append(int(input()))
ans=10**10
c=0
h.sort()
for i in range(n-k+1):
    c=h[i+k-1]-h[i]
    if c<ans:
        ans=c
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        b+=a//2
        a=a//2
    if i%2!=0:
        a+=b//2
        b=b//2
print(a,b)

Fixed submission:
s=input()
S=list(s)
if len(S)==2:
    print(s)
else:
    print(S[2]+S[1]+S[0])
Buggy python submission (verdict: Runtime Error):
import fractions
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=abs(x-a[0])
a.sort()
if n==1:
    print(abs(x-a[0]))
else:
    cnt=abs(a[1]-a[0])
    for j in range(n-1):
        cnt=min(abs(a[j+1]-a[j]),cnt)
    for i in range(n):
        ans=min(abs(x-a[i]),ans)
    print(min(ans,cnt))
    

Fixed submission:
a,b=map(int,input().split())
if a%2!=0 and b%2!=0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import fractions
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=abs(x-a[0])
cnt=abs(a[1]-a[0])
for j in range(n-1):
    cnt=min(abs(a[j+1]-a[j]),cnt)
for i in range(n):
    ans=min(abs(x-a[i]),ans)
print(min(ans,cnt))
    

Fixed submission:
n=int(input())
w=[]
ans='Yes'
for i in range(n):
    w.append(list(input()))
    if i==0:
        continue
    if w[i][0]!=w[i-1][len(w[i-1])-1]:
            ans='No'
            break
    for j in range(i):
        if w[i]==w[j]:
            ans='No'
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[]
for i in range(h):
    a.append(list(input()))
j=0
lis=[]
while j<len(a):
    if '#' not in set(a[j]):
        a.remove(a[j])
    j+=1
for k in range(len(a)):
    for l in range(w):
        if a[k][l]=='.':
            c=0
            while c<len(a):
                if a[c][l]!='.':
                    break
                if c==len(a)-1 and l not in set(lis):
                    lis.append(l)
                c+=1
ans=''
#print(lis)
tmp=0

for o in range(len(lis)):
    tmp=lis[o]
    for s in range(len(a)):
        del a[s][tmp]
for q in range(len(a)):
    for e in range(len(a[0])):
        ans+=a[q][e]
    print(ans)
    ans=''


Fixed submission:
h,w=map(int,input().split())
a=[]
for i in range(h):
    a.append(list(input()))
j=0
lis=[]
l=[]
count=0
for i in range(h):
    for j in range(w):
        if a[i][j]!='.':
            break
        if j==w-1:
            l.append(i)
x=0
while x<len(l):
    del a[l[x]-count]
    count+=1 
    x+=1
#print(a)
for k in range(len(a)):
    for l in range(w):
        if a[k][l]=='.':
            c=0
            while c<len(a):
                if a[c][l]!='.':
                    break
                if c==len(a)-1 and l not in set(lis):
                    lis.append(l)
                c+=1
ans=''
#print(lis)
tmp=0
count=0
for o in range(len(lis)):
    tmp=lis[o]
    for s in range(len(a)):
        del a[s][tmp-count]
    count+=1    
for q in range(len(a)):
    for e in range(len(a[0])):
        ans+=a[q][e]
    print(ans)
    ans=''
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(int,input().split())
print(sum(a)-n)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(sum(a)-n)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    print(1)
else:
    ans=0
    cnt=k
    for i in range(2,n):
        cnt+=(k-1)
        if cnt>=n:
            ans=i
            break
    print(ans)

Fixed submission:
s=list(input())
ans=0
for i in range(4):
    if s[i]=='+':
        ans+=1
    else:
        ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
if abs(a-c)<=d:
    print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d:
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(a-c)<=d:
    print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
x=int(input())
ans=[]
for i in range(1,x+1):
    for j in range(2,x+1):
        if i**j<=x:
            ans.append(i**j)
        else:
            break
ans.sort(reverse=True)
print(ans[0])
#print(ans)

Fixed submission:
# coding: utf-8
# Your code here!
x=int(input())
ans=[]
if x==1:
    print(1)
else:
    for i in range(1,x+1):
        for j in range(2,x+1):
            if i**j<=x:
                ans.append(i**j)
            else:
                break
    ans.sort(reverse=True)
    print(ans[0])
#print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
k=list(str(n))
ans=0
print(max(sum(k),9*len(k)-9+k[0]-1))


Fixed submission:
n=int(input())
k=list(str(n))
ans=0
for i in range(len(k)):
    k[i]=int(k[i])
print(max(sum(k),9*len(k)-9+k[0]-1))
Buggy python submission (verdict: Runtime Error):
n,y=map(int,input().split())
ans=[-1,-1,-1]
for i in range(n+1):
  for j in range(n-i+1):
    if y-10000*i-5000*j==1000*(n-i-j):
      ans=[i,j,n-i-j]
      print(ans[1],ans[2],ans[3])
      exit()
print(ans[1],ans[2],ans[3])

Fixed submission:
n,y=map(int,input().split())
ans=[-1,-1,-1]
for i in range(n+1):
  for j in range(n-i+1):
    if y-10000*i-5000*j==1000*(n-i-j):
      ans=[i,j,n-i-j]
      print(ans[0],ans[1],ans[2])
      exit()
print(ans[0],ans[1],ans[2])

Buggy python submission (verdict: Runtime Error):
n,y=map(int,input().split())
ans=[-1,-1,-1]
for i in range(n+1):
  for j in range(n-i+1):
    if y-10000＊i-5000＊j==1000＊(n-i-j):
      ans=[i,j,n-i-j]
      print(ans[1],ans[2],ans[3])
      exit()
print(ans[1],ans[2],ans[3])

Fixed submission:
n,y=map(int,input().split())
ans=[-1,-1,-1]
for i in range(n+1):
  for j in range(n-i+1):
    if y-10000*i-5000*j==1000*(n-i-j):
      ans=[i,j,n-i-j]
      print(ans[0],ans[1],ans[2])
      exit()
print(ans[0],ans[1],ans[2])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(min(a*b,c)

Fixed submission:
a,b,c=map(int,input().split())
print(min(a*b,c))
Buggy python submission (verdict: Runtime Error):
s=list(input())
if s.count('K')==1 and s.count('I')==1 and s.count('H')==1 ands.count('B')==1 ands.count('R')==1:
    print('YES')
else:
    print('NO')

Fixed submission:
import copy
s=list(input())
if len(s)>=10 or len(s)<=3:
    print('NO')
else:
    n=len(s)
    cnt=''.join(s)
    ans=[cnt]
    for i in range(2**(n+1)):
        c=copy.deepcopy(s)
        cc=0
        #print(c)
        for j in range(n+1):
            if (i >> j) & 1:
                c.insert(j+cc,'A')
                cc+=1
        cnt=''.join(c)
        ans.append(cnt)
    if 'AKIHABARA'in ans:
        print('YES')
    else:
        print('NO')
    #print(ans)