qyliang/CodeNanoFix huggingface dataset:
Buggy code:
a=input();print('YNEOS'['AA'not in a or a.replace('A','')!='KIHBR'::2])

Fixed code:
a=input();print('YNEOS'['AA'in a or 'KIH' not in a or a.replace('A','')!='KIHBR'::2])
Buggy code:
import sys
S = list(input())

L = list("KIHBR")
for l in L:
    if not l in "".join(S):
        print("NO")
        sys.exit(0)

        N = []
for i in range(len(S)-1):
    if S[i] == "H" or S[i] == "B" or S[i] == "R":
        if S[i+1] != "A":
            N.append(i+1)

i = 0
for n in N:
    S.insert(n+i, "A")
    i += 1
    
if "".join(S) in "AKIHABARA":
    print("YES")
else:
    print("NO")

Fixed code:
import sys
S = list(input())

L = list("KIHBR")
for l in L:
    if not l in "".join(S):
        print("NO")
        sys.exit(0)

N = []
for i in range(len(S)-1):
    if S[i] == "H" or S[i] == "B" or S[i] == "R":
        if S[i+1] != "A":
            N.append(i+1)

i = 0
for n in N:
    S.insert(n+i, "A")
    i += 1
    
if "".join(S) in "AKIHABARA":
    print("YES")
else:
    print("NO")
Buggy code:
s = input()
ans=[]
for i in range(len(s)):
    if s[i]!='A':
        ans+=s[i]
print(len(s))
if ''.join(ans)=='KIHBR' and len(s)<=9 and 'AA' not in s and 'AAA' not in s and 'AAAA' not in s and 'KIH' in s:
    print('YES')
else:
    print('NO')

Fixed code:
s = input()
ans=[]
for i in range(len(s)):
    if s[i]!='A':
        ans+=s[i]

if ''.join(ans)=='KIHBR' and len(s)<=9 and 'AA' not in s and 'AAA' not in s and 'AAAA' not in s and 'KIH' in s:
    print('YES')
else:
    print('NO')
Buggy code:
from itertools import product


candidates = []
non_as = ["KIH", "B", "R", ""]
for seps in product(["A", ""], repeat=4):
    candidates.add("".append(sep + non_a for sep, non_a in zip(seps, non_as)))

print("YES") if input() in candidates else print("NO")


Fixed code:
from itertools import product


candidates = set()
non_as = ["KIH", "B", "R", ""]
for seps in product(["A", ""], repeat=4):
    candidates.add("".join(sep + non_a for sep, non_a in zip(seps, non_as)))

print("YES") if input() in candidates else print("NO")
Buggy code:
import sys
import re


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s=instr()

if re.fullmatch("A?KIHA?BA?RA?", s):
    print("YES")
else:
    print("NO")


Fixed code:
import sys
import re


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s=input()

if re.fullmatch("A?KIHA?BA?RA?", s):
    print("YES")
else:
    print("NO")
Buggy code:
s = input()
t = "AKIHABARA"
idx = 0
ng = 0
for i in range(len(t)):
    if t[i] == s[idx]:
        idx += 1
    elif t[i] != "A":
        ng = 1
        break

    if idx == len(s):
        if i <= len(t) - 2:
            ng = 1
        break
if ng:
    print("NO")
elif idx == len(s):
    print("YES")
else:
    print("NO")


Fixed code:
s = input()
t = "AKIHABARA"
idx = 0
ng = 0
for i in range(len(t)):
    if t[i] == s[idx]:
        idx += 1
    elif t[i] != "A":
        ng = 1
        break
    if idx == len(s):
        if i < len(t) - 2:
            ng = 1

        break

if idx != len(s):
    ng = 1

if ng:
    print("NO")
else:
    print("YES")
Buggy code:
s=input()
AKB={"AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"}

print("YES" if s in pos else "NO")


Fixed code:
s=input()
AKB={"AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"}

print("YES" if s in AKB else "NO")
Buggy code:
s = list(input())
l = ['K','I','H','B','R',-1]
j = 0

for i in range(len(s)):
    if s[i] == 'A':
        if i == 0:
            pass
        elif s[i-1] == 'A':
            print('NO')
            exit(0)
        elif j == 1 or j == 2:
            print('NO')
            exit(0)
        else:
            pass
    elif s[i] != l[j]:
        print('NO')
        exit(0)
    else:
        j += 1
        if l[j] == -1:
            print('NO')
            exit(0)

if j == 5:
    print('YES')
else:
    print('NO')

Fixed code:
s = list(input())
l = ['K','I','H','B','R',-1]
j = 0

for i in range(len(s)):
    if s[i] == 'A':
        if i == 0:
            pass
        elif s[i-1] == 'A':
            print('NO')
            exit(0)
        elif j == 1 or j == 2:
            print('NO')
            exit(0)
        else:
            pass
    elif s[i] != l[j]:
        print('NO')
        exit(0)
    elif j > 4 and s[i] != 'A':
        print('NO')
        exit(0)
    else:
        j += 1

if j == 5:
    print('YES')
else:
    print('NO')
Buggy code:
s=input()
l=list("AKIHABARA".split("A"))[1:-1]
print(l)
for ii in range(2**4):
  p="A" if ii%2 else ""
  i=ii
  for j in range(3):
    p+=l[j]
    p+="A" if i%2 else ""
    i//=2

  if s==p:print("YES");exit()
print("NO")

Fixed code:
s=input()
l=list("AKIHABARA".split("A"))[1:-1]

for ii in range(2**4):
  p="A" if ii%2 else ""
  i=ii
  for j in range(3):
    p+=l[j]
    i//=2
    p+="A" if i%2 else ""
  if s==p:print("YES");exit()
print("NO")
Buggy code:
import sys
input = sys.stdin.readline

# A - AKIBA
substring = ['', 'KIH', 'B', 'R']
akihabara = []

for i in range(16):
	b = format(i, 'b')
	bin_str = b.zfill(4)
	s = ''

	for j in range(4):
		s += substring[j]
		
		if bin_str[j] == '1':
			s += 'A'

	akihabara.append(s)

if input() in akihabara:
	print('YES')
else:
	print('NO')

Fixed code:
# A - AKIBA
substring = ['', 'KIH', 'B', 'R']
akihabara = []

for i in range(16):
	b = format(i, 'b')
	bin_str = b.zfill(4)
	s = ''

	for j in range(4):
		s += substring[j]
		
		if bin_str[j] == '1':
			s += 'A'

	akihabara.append(s)

if input() in akihabara:
	print('YES')
else:
	print('NO')
Buggy code:
data =input()
data = list(data)
deter =""
cnt2 =0
cnt =[0]*5
for t in range(len(data)):
  if t =="I":
    cnt[0] +=1
  if t =="K":
    cnt[1] +=1
  if t =="H":
    cnt[2] +=1
  if t =="B":
    cnt[3] +=1
  if t =="R":
    cnt[4] +=1
if cnt[0] ==1 and cnt[1] ==1 and cnt[2] ==1 and cnt[3] ==1 and cnt[4] ==1:
  cnt2 +=1 

if len(data) >9 or cnt2 ==0 :
  print("NO")
if len(data) >=5 and len(data)<=9  and cnt2 ==1:
  if data[0] !="A":
    data.insert(0,"A")
  if data[4] !="A":
    data.insert(4,"A")
  if data[6] !="A":
    data.insert(6,"A")
  if len(data) ==8:
    data.append("A")
  else:
    if data[8] !="A":
      data.insert(8,"A")
 
  for s in range(len(data)):
    deter +=data[s]
  
  if deter =="AKIHABARA":
    print("YES")
  else:
    print("NO")

 
if len(data) <=4:
  print("NO")


Fixed code:
data =input()
data = list(data)
deter =""
cnt2 =0
cnt =[0]*5
cnt3 =0
for t in range(len(data)):
  if data[t] =="I":
    cnt[0] +=1
  if data[t] =="K":
    cnt[1] +=1
  if data[t] =="H":
    cnt[2] +=1
  if data[t] =="B":
    cnt[3] +=1
  if data[t] =="R":
    cnt[4] +=1
  
if cnt[0] ==1 and cnt[1] ==1 and cnt[2] ==1 and cnt[3] ==1 and cnt[4] ==1:
  cnt2 +=1 

if len(data) >9 or cnt2 ==0 :
  print("NO")
  cnt3 +=1
if len(data) >=5 and len(data)<=9  and cnt2 ==1:
  if data[0] !="A":
    data.insert(0,"A")
  if data[4] !="A":
    data.insert(4,"A")
  if data[6] !="A":
    data.insert(6,"A")
  if len(data) ==8:
    data.append("A")
  else:
    if data[8] !="A":
      data.insert(8,"A")
 
  for s in range(len(data)):
    deter +=data[s]
  
  if deter =="AKIHABARA":
    print("YES")
  else:
    print("NO")

 
if len(data) <=4 and cnt3==0:
  print("NO")
Buggy code:
import itertools
def S(): return input()
S = S()
AKIBA_list = list(itertools.accumulate('AKIHABARA'))
for i,x in enumerate(AKIBA_list):
    if S[:i+1]==x:
        continue
    S = S[:i]+'A'+S[i:]
    if S[:i+1]==x:
        continue
    print('NO')
    break
else:
    print('Yes')


Fixed code:
import itertools
def S(): return input()
S = S()
AKIBA_list = list(itertools.accumulate('AKIHABARA'))
for i,x in enumerate(AKIBA_list):
    if S[:i+1]==x:
        continue
    S = S[:i]+'A'+S[i:]
    if S[:i+1]==x:
        continue
    print('NO')
    break
else:
    if S=='AKIHABARA':
        print('YES')
    else:
        print('NO')
Buggy code:
s = input()
# AKIHABARA
if (s == "AKIHABARA") or (s == "AKIHABAR") or (s == "AKIHABRA") or (s == "AKIHABR") or (s == "AKIHBARA") or (s == "AKIHBAR") or (s == "AKIHBRA") or (s == "AKIHBR")
or (s == "KIHABARA") or (s == "KIHABAR") or (s == "KIHABRA") or (s == "KIHABR") or (s == "KIHBARA") or (s == "KIHBAR") or (s == "KIHBRA") or (s == "KIHBR"):
     print("YES")
else:
    print("NO")

Fixed code:
S = input()
if S == 'KIHBR' or S == 'KIHBRA' or S == 'AKIHBR' or S == 'KIHABR' or S == 'KIHBAR' or S == 'AKIHABR' or S == 'AKIHBAR' or S == 'AKIHBRA' or S == 'KIHABAR' or S == 'KIHABRA' or S == 'KIHBARA' or S == 'AKIHABAR' or S == 'AKIHABRA' or S == 'AKIHBARA' or S == 'KIHABARA' or S == 'AKIHABARA':
    print('YES')
else:
    print('NO')
Buggy code:
s=input()
for bit in range(2**(len(s)+1)):
    T = ""
    for j in range(len(s)+1):
        if ((bit >> j) & 1):
            T += "A"
        if j<(len(s)):
            T += s[j]
    if T=='AKIHABARA':
        print('YES')
        exit

print('NO')    

Fixed code:
s=input()
if len(s)>10:
    print('NO')
    exit()

for bit in range(2**(len(s)+1)):
    T = ""
    for j in range(len(s)+1):
        if ((bit >> j) & 1):
            T += "A"
        if j<(len(s)):
            T += s[j]
    if T=='AKIHABARA':
        print('YES')
        exit()

print('NO')
Buggy code:
s = input()

if s[0:3] == 'KIH':
    s = 'A'+s
elif s[0:4] != 'AKIH':
    print('NO')
    exit(0)

if s[4:5] == 'B':
    s = s[0:4]+'A'+s[4:]
elif s[4:6] != 'AB':
    print('NO')
    exit(0)

if s[5:6] == 'B':
    s = s[0:6]+'A'+s[6:]
elif s[5:7] != 'BA':
    print('NO')
    exit(0)

print(s)
print(s[7:8])
print(s[7:9])
print(len(s))
if (s[8:10] == 'RA' and len(s) == 10) or (s[7:8] == 'R' and len(s) == 8):
    print('YES')
else:
    print('NO')


Fixed code:
s = input()

if s[0:3] == 'KIH':
    s = 'A'+s
elif s[0:4] != 'AKIH':
    print('NO')
    exit(0)
# print(s)

if s[4:5] == 'B':
    s = s[0:4]+'A'+s[4:]
elif s[4:6] != 'AB':
    print('NO')
    exit(0)
# print(s)

if s[5:7] == 'BR':
    s = s[0:6]+'A'+s[6:]
elif s[5:7] != 'BA':
    print('NO')
    exit(0)

# print(s)
# print(s[7:8])
# print(s[7:9])
# print(len(s))
if (s[7:9] == 'RA' and len(s) == 9) or (s[7:8] == 'R' and len(s) == 8):
    print('YES')
else:
    print('NO')
Buggy code:
s=input()
if s=="AKIHABARA":
    print("YES")
else:
    ans="YES"
    if len(s)>9 or (len(s)==9 and s!="AKIHABARA") or "KIH" not in s:
        ans="NO"
    else:
        s.remove("A")
        if s!="KIHBR":
            ans="NO"
        else:
            k,b,r=s.find("K"),s.find("B"),s.find("R")
            if k>1 or b-k>4 or r-b>2:
                ans="NO"
    print(ans)

Fixed code:
s=input()
if s=="AKIHABARA":
    print("YES")
else:
    ans="YES"
    if len(s)>=9 or "KIH" not in s:
        ans="NO"
    else:
        t=s.replace("A","")
        if t!="KIHBR":
            ans="NO"
        else:
            k,b,r=s.find("K"),s.find("B"),s.find("R")
            if k>1 or b-k>4 or r-b>2:
                ans="NO"
    print(ans)
Buggy code:
def main(s: str):
    if re.fullmatch(r"A?KIHA?BA?RA?", s):
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    s = input()

    main(s)


Fixed code:
import re


def main(s: str):
    if re.fullmatch(r"A?KIHA?BA?RA?", s):
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    s = input()

    main(s)
Buggy code:
S = input()
C = len(S)
M = S.replace("A","")
A = "AKIHABARA"
B = A.replace("A","")
P = 0

for i in range (C-1):
	if S[i] == "A":
		if S[i+1] == "A":
			P=100
	if S[i] == "K":
		if S[i+1] == "I":
			P=200

if B==M and P<=4:
	print("YES")
else:
	print("NO")

Fixed code:
S = input()
C = len(S)
M = S.replace("A","")
A = "AKIHABARA"
B = A.replace("A","")
P = 0

for i in range (C-1):
	if S[i] == "A":
		if S[i+1] == "A":
			P=100
	if S[i] == "K":
		if S[i+1] != "I":
			P=200
	if S[i] == "I":
		if S[i+1] != "H":
			P=200
if B==M and P<=4:
	print("YES")
else:
	print("NO")
Buggy code:
S=list(input())
A="AKIHABARA"
id=0
for i in range(len(A)):
  if A[i]==S[i]:
    continue
  else:
    if A[i]=="A":
      S.insert("A",i)
    else:
      print("NO")
      exit(0)
if "".join(S)==A:
  print("YES")
else:
  print("NO")

Fixed code:
S=list(input())
A="AKIHABARA"
id=0
for i in range(len(A)):
  if len(S) > i and A[i]==S[i]:
    continue
  else:
    if A[i]=="A":
      S.insert(i,"A")
    else:
      print("NO")
      exit(0)
if "".join(S)==A:
  print("YES")
else:
  print("NO")
Buggy code:
s=input()
ans=1

i=0
if s[i]=="A":
  i+=1
if s[i]=="K":
  i+=1
else:
  ans=0
if s[i]=="I":
  i+=1
else:
  ans=0
if s[i]=="H":
  i+=1
else:
  ans=0
if s[i]=="A":
  i+=1
if s[i]=="B":
  i+=1
else:
  ans=0
if s[i]=="A":
  i+=1
if s[i]=="R":
  i+=1
else:
  ans=0
if s[i]=="A":
  i+=1
if i!=len(s):
  ans=0

if ans:
  print("YES")
else:
  print("NO")

  

Fixed code:
s=input()
ans=1

i=0
if i<len(s) and s[i]=="A":
  i+=1
if i<len(s) and s[i]=="K":
  i+=1
else:
  ans=0
if i<len(s) and s[i]=="I":
  i+=1
else:
  ans=0
if i<len(s) and s[i]=="H":
  i+=1
else:
  ans=0
if i<len(s) and s[i]=="A":
  i+=1
if i<len(s) and s[i]=="B":
  i+=1
else:
  ans=0
if i<len(s) and s[i]=="A":
  i+=1
if i<len(s) and s[i]=="R":
  i+=1
else:
  ans=0
if i<len(s) and s[i]=="A":
  i+=1
if i!=len(s):
  ans=0

if ans:
  print("YES")
else:
  print("NO")
Buggy code:
s = input()
akiba = 'AKIHABARA'
s_i = 0
aki_i = 0
while (s_i < len(s)) & (aki_i < len(akiba)):
    if s[s_i] == akiba[aki_i]:
        s_i += 1
        aki_i += 1
    else:
        if akiba[aki_i] == "A":
            aki_i += 1
        else:
            print("NO")
            exit()
if (s_i == len(s) & (aki_i >= 7)):
    print("YES")
else:
    print("NO")

Fixed code:
s = input()
akiba = 'AKIHABARA'
s_i = 0
aki_i = 0
while (s_i < len(s)) & (aki_i < len(akiba)):
    if s[s_i] == akiba[aki_i]:
        s_i += 1
        aki_i += 1
    else:
        if akiba[aki_i] == "A":
            aki_i += 1
        else:
            print("NO")
            exit()
if ((s_i == len(s)) & (aki_i >= 8)):
    print("YES")
else:
    print("NO")
Buggy code:
from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in ["","A"]:
    for j in ["","A"]:
        for k in ["","A"]:
            for l in ["","A"]:
                s = i + KIH + j + B + k + R + l
                if S == s:
                    flag = True
if flag:
    print("YES")
else:
    print("NO")

Fixed code:
from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in ["","A"]:
    for j in ["","A"]:
        for k in ["","A"]:
            for l in ["","A"]:
                s = i + "KIH" + j + "B" + k + "R" + l
                if S == s:
                    flag = True
if flag:
    print("YES")
else:
    print("NO")
Buggy code:
S = input()

T = list("AKIHABARA")

spos = 0

for i, t in enumerate(T):
    if spos < len(S) and S[spos] == t:
        spos += 1
    elif t == "A":
        continue
    else:
        print("NO")
        exit()

print("YES" if spos == len(S) - 1 else "NO")


Fixed code:
S = input()

T = list("AKIHABARA")

spos = 0

for i, t in enumerate(T):
    if spos < len(S) and S[spos] == t:
        spos += 1
    elif t == "A":
        continue
    else:
        print("NO")
        exit()

print("YES" if spos == len(S) else "NO")
Buggy code:
s = input()

if re.match('A?KIHA?BA?RA?$', s):
    print("YES")
else:
    print("NO")

Fixed code:
import re

s = input()


if re.match('A?KIHA?BA?RA?$', s):
    print("YES")
else:
    print("NO")
Buggy code:
S=input()

T=["AKIHABARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA"]
T+=["AKIHABR","AKIHBAR","KIHABAR","AKIHBRA","KIHABRA","KIHBARA"]
T+=["KIHABR","KIHBAR","KIHBRA","AKIHBR","KIHBR"]
#print(T)

prin("YES" if S in T else "NO")

Fixed code:
S=input()

T=["AKIHABARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA"]
T+=["AKIHABR","AKIHBAR","KIHABAR","AKIHBRA","KIHABRA","KIHBARA"]
T+=["KIHABR","KIHBAR","KIHBRA","AKIHBR","KIHBR"]
#print(T)

print("YES" if S in T else "NO")
Buggy code:
import re;print("YNeos"[(re.match("^A?KIHA?BA?RA?$",input())==None)::2])

Fixed code:
import re;print("YNEOS"[(re.match("^A?KIHA?BA?RA?$",input())==None)::2])
Buggy code:
def main():
    s = input()
    l = ["K", "I", "H", "B", "R"]
    for i in range(len(l)):
        if l[i] not in s:
            print("NO")

    if s.index("KIH") == -1:
        print("NO")
        exit()

    c = 0
    ac = 0
    for i in range(len(s)):
        if c == 0:
            if s[i] == "K":
                c = 1
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 1:
            if s[i] != "I":
                print("NO")
                exit()
            c = 2
        elif c == 2:
            if s[i] != "H":
                print("NO")
                exit()
            c = 3
        elif c == 3:
            if s[i] == "B":
                c = 4
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 4:
            if s[i] == "R":
                c = 5
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 5:
            if s[i] == "A":
                ac += 1
            if ac > 1:
                print("NO")
                exit()
    print("YES")


if __name__ == '__main__':
    main()


Fixed code:
def main():
    s = input()
    l = ["K", "I", "H", "B", "R"]
    for i in range(len(l)):
        if l[i] not in s:
            print("NO")
            exit()

    c = 0
    ac = 0
    for i in range(len(s)):
        if c == 0:
            if s[i] == "K":
                c = 1
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 1:
            if s[i] != "I":
                print("NO")
                exit()
            c = 2
        elif c == 2:
            if s[i] != "H":
                print("NO")
                exit()
            c = 3
        elif c == 3:
            if s[i] == "B":
                c = 4
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 4:
            if s[i] == "R":
                c = 5
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 5:
            if s[i] == "A":
                ac += 1
            else:
                print("NO")
                exit()
            if ac > 1:
                print("NO")
                exit()
    print("YES")


if __name__ == '__main__':
    main()
Buggy code:
# cf17-finalA - AKIBA
def main():
    S = input().rstrip()
    flg = S.replace("A", "") == "KIHBR" and "AA" not in S and "KA
    print("YES" if flg else "NO")


if __name__ == "__main__":
    main()

Fixed code:
# cf17-finalA - AKIBA
def main():
    S = input().rstrip()
    flg = (
        S.replace("A", "") == "KIHBR"
        and "AA" not in S
        and "KA" not in S
        and "IA" not in S
    )
    print("YES" if flg else "NO")


if __name__ == "__main__":
    main()
Buggy code:
s=input()
ss=s.replace.("A","")
print("YES" if ss="KIHBR" and "AA" not in s and "KIH" in s else "NO")
  

Fixed code:
s=input()
ss=s.replace("A","")
print("YES" if ss=="KIHBR" and "AA" not in s and "KIH" in s else "NO")
Buggy code:
S = input()

ans_list = ["AKIHABARA",\
            "KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR",\
            "KIHBARA","KIHABRA","KIHABAR","AKIHBRA","AKIHBAR","AKIHABR",\
            "AKIHBR","KIHABR","KIHBAR","KIHBRA"\
            "KIHBR"]

if S in ans_list:
  print("YES")
else:
  print("NO")

Fixed code:
S = input()
T = ["AKIHABARA","KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR"\
    ,"KIHBARA","KIHABRA","KIHABAR","AKIHBRA","AKIHBAR","AKIHABR"\
    ,"KIHBRA","KIHBAR","KIHABR","AKIHBR","KIHBR"]
print("YES" if S in T else "NO")
Buggy code:
def main():
    S = input().strip()

    i = 0
    aa = False
    for i in range(len(S)-1):
        if S[i] == "A" and S[i+1] == "A":
            aa = True
            break
    if not aa:
        tmp = S.replace("A", "")
        if tmp == "KIHBR":
            print("YES")
            return
    print("No")
    return



if __name__ == "__main__":
    main()


Fixed code:
def main():
    S = input().strip()
    aa = False
    for i in range(len(S)-1):
        if S[i] == "A" and S[i+1] == "A":
            aa = True
            break
    if not aa:
        if "KIH" in S:
            tmp = S.replace("A", "")
            if tmp == "KIHBR":
                print("YES")
                return
    print("NO")
    return



if __name__ == "__main__":
    main()
Buggy code:

import re

s = input()
pattern = re.compile("(A?KIHA?BA?RA?)")

ret = pattern.findall(s)

ret2 = pattern.findall("[^AKIHBR]")
#print(ret)
if ret is not None and len(ret) ==  1 and len(ret2) == 0:
    ans = "YES"
else:
    ans = "NO"

print(ans)

Fixed code:

import re

s = input()
pattern = re.compile("(A?KIHA?BA?RA?)")

ret = pattern.findall(s)

ret2 = pattern.findall("[^AKIHBR]")


#print(ret)
if ret is not None and len(ret) ==  1 and len(ret[0]) == len(s):
    ans = "YES"
else:
    ans = "NO"

print(ans)
Buggy code:
s = input()
if s == "KIHBR" or s == "AKIHBR" or s == "KIHABR" or s == "KIHBAR" or s == "KIHBRA" or s == "AKIHABR" or s == "AKIHBAR"or s == "AKIHBRA"or s == "KIHABAR"or s == "KIHABRA"or s == "KIHBARA"or s == "AKIHABAR"or s == "AKIHABRA"or s == "AKIHBARA"or s == "KIHABARA"or s == "AKIHABARA":
    print("YWS")
else:
    print("NO)

Fixed code:
s = input()
if s == "KIHBR" or s == "AKIHBR" or s == "KIHABR" or s == "KIHBAR" or s == "KIHBRA" or s == "AKIHABR" or s == "AKIHBAR"or s == "AKIHBRA"or s == "KIHABAR"or s == "KIHABRA"or s == "KIHBARA"or s == "AKIHABAR"or s == "AKIHABRA"or s == "AKIHBARA"or s == "KIHABARA"or s == "AKIHABARA":
    print("YES")
else:
    print("NO")
Buggy code:
s = input()

if s.replace("A", "") == "KIHBR":
    b1 = bool(s == "AKIHBR")
    b2 = bool(s == "KIHABR")
    b3 = bool(s == "KIHBAR")
    b4 = bool(s == "KIHBRA")
    b5 = bool(s == "AKIHABR")
    b6 = bool(s == "AKIHBAR")
    b7 = bool(s == "AKIHBRA")
    b8 = bool(s == "AKIHABAR")
    b9 = bool(s == "AKIHABRA")
    b10 = bool(s == "AKIHBARA")
    b11 = bool(s == "KIHABARA")
    b12 = bool(s == "AKIHABARA")
    B1 = b1 or b2 or b3 or b4
    B2 = b5 or b6 or b7 or b8
    B3 = b9 or b10 or b11 or b12
    if B1 or B2 or B3:
        print("YES")
        exit()
print("NO")

Fixed code:
s = input()

if s.replace("A", "") == "KIHBR":
    b1 = bool(s == "AKIHBR")
    b2 = bool(s == "KIHABR")
    b3 = bool(s == "KIHBAR")
    b4 = bool(s == "KIHBRA")
    b5 = bool(s == "AKIHABR")
    b6 = bool(s == "AKIHBAR")
    b7 = bool(s == "AKIHBRA")
    b8 = bool(s == "AKIHABAR")
    b9 = bool(s == "AKIHABRA")
    b10 = bool(s == "AKIHBARA")
    b11 = bool(s == "KIHABARA")
    b12 = bool(s == "AKIHABARA")
    B1 = b1 or b2 or b3 or b4
    B2 = b5 or b6 or b7 or b8
    B3 = b9 or b10 or b11 or b12
    if B1 or B2 or B3 or s == "KIHBR":
        print("YES")
        exit()
print("NO")