qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S = input()
T = input()
rec = []
for i in range(len(S)):
    flag = True
    Z = S
    for j in range(len(T)):
        if Z[i] == T[j]:
            for e in range(i-j):
                if Z[e] == "?":
                    Z = Z.replace("?","a",1)
            print(Z[i])
            print(T[j])
            for k in range(len(T)-j+1):
                if Z[i+k-j] == T[k]:
                    continue
                elif Z[i+k-j] == "?":

                    Z = Z.replace("?",T[k],1)
                    print(Z)
                else:
                    flag = False
            if flag:
                Z = Z.replace("?", "a")
                rec.append(Z)
if rec == []:
    print("UNRESTORABLE")
else:
    print(rec[-1])

Fixed code:
S = input()
T = input()
rec = []
for i in range(len(S)):
    flag = True
    Z = S
    for j in range(len(T)):
        if Z[i] == T[j]:
            if len(S)-i < len(T):
                flag = False
                break
            for e in range(i - j):
                if Z[e] == "?":
                    Z = Z.replace("?", "a", 1)
            for k in range(len(T)):
                if Z[i + k - j] == T[k]:
                    continue
                elif Z[i + k - j] == "?":
                    Z = Z.replace("?", T[k], 1)
                else:
                    flag = False
            if flag:
                Z = Z.replace("?", "a")
                rec.append(Z)
        elif Z[i] == "?":
            if len(S)-i < len(T):
                flag = False
                break
            for e in range(i):
                if Z[e] == "?":
                    Z = Z.replace("?", "a", 1)
            for k in range(len(T)):
                if Z[i + k] == T[k]:
                    continue
                elif Z[i + k] == "?":
                    Z = Z.replace("?", T[k], 1)
                else:
                    flag = False
            if flag:
                Z = Z.replace("?", "a")
                rec.append(Z)

if rec == []:
    print("UNRESTORABLE")
else:
    print(rec[-1])
Buggy code:
S = list(input())
T = list(input())

s_reversed = list(reversed(S))
T_reversed = list(reversed(T))
F = 0

for i in range(len(S)-len(T)+1):
    s = s_reversed[i:i+len(T)]
    flag = 0
    for j in range(len(T)):
        if s[j] == T_reversed[j] or s[j] == '?':
            continue
        else:
            flag += 1
            break
    if flag:
        F += 1
        for j in range(len(T)):
            s_reversed[i+j-1] = T_reversed[j]
        break

if F:
    print('UNRESTORABLE')
else:
    R = ''.join(list(reversed(s_reversed)))
    print(R.replace('?','a'))





Fixed code:
S = list(input())
T = list(input())

s_reversed = list(reversed(S))
T_reversed = list(reversed(T))
F = 0

for i in range(len(S)-len(T)+1):
    s = s_reversed[i:i+len(T)]
    flag = 0
    for j in range(len(T)):
        if s[j] == T_reversed[j] or s[j] == '?':
            continue
        else:
            flag += 1
            break
    if flag ==0:
        F += 1
        for j in range(len(T)):
            s_reversed[i+j] = T_reversed[j]
        break

if F ==0:
    print('UNRESTORABLE')
else:
    R = ''.join(list(reversed(s_reversed)))
    print(R.replace('?','a'))
Buggy code:
S=list(input())
T=list(input())
A=[]
for i in range(len(S)-len(T)+1):
    is_ok=1
    for j in range(i, i+len(T)):
        if S[j]!=T[j-i] and S[j]!='?':
            is_ok=0
    if is_ok:
        tmp=S[:]
        is_con=1
        for j in range(i, i+len(T)):
            tmp[j]=T[j-i]
        A.append(tmp)
print(A)
if len(A)==0:
    print("UNRESTORABLE")
    exit(0)
B=[]
for a in A:
    for i in range(len(a)):
        if a[i]=='?':
            a[i]='a'
    B.append(''.join(a))
B.sort()
print(B[0])


Fixed code:
S=list(input())
T=list(input())
A=[]
for i in range(len(S)-len(T)+1):
    is_ok=1
    for j in range(i, i+len(T)):
        if S[j]!=T[j-i] and S[j]!='?':
            is_ok=0
    if is_ok:
        tmp=S[:]
        is_con=1
        for j in range(i, i+len(T)):
            tmp[j]=T[j-i]
        A.append(tmp)
if len(A)==0:
    print("UNRESTORABLE")
    exit(0)
B=[]
for a in A:
    for i in range(len(a)):
        if a[i]=='?':
            a[i]='a'
    B.append(''.join(a))
B.sort()
print(B[0])
Buggy code:
s,t=input(),input();l,m=len(s),len(t)
for i in range(l-m+1):
 if all(c in"?"+d for c,d in zip(S[-i-m:],t)):s=s.replace(*"?a");exit(print(s[:-i-m]+t+s[l-i:]))
print("UNRESTORABLE")

Fixed code:
s,t=input(),input();l,m=len(s),len(t)
for i in range(l-m+1):
 if all(c in"?"+d for c,d in zip(s[-i-m:],t)):s=s.replace(*"?a");exit(print(s[:-i-m]+t+s[l-i:]))
print("UNRESTORABLE")
Buggy code:
import re
s, t = input().replace('?', '.'), input()
l, m = len(s), len(t)

if l < m:
    print("UNRESTORABLE")
    exit()

can = []  # candidates
for i in range(l - m + 1):
    if re.match(s[i:i + m], t)
        can.append((s[:i] + t + s[i + m:]).replace('.', 'a'))
print(min(can) if can else "UNRESTORABLE")

Fixed code:
import re
s, t = input().replace('?', '.'), input()
l, m = len(s), len(t)

if l < m:
    print("UNRESTORABLE")
    exit()

can = []  # candidates
for i in range(l - m + 1):
    if re.match(s[i:i + m], t):
        can.append((s[:i] + t + s[i + m:]).replace('.', 'a'))
print(min(can) if can else "UNRESTORABLE")
Buggy code:
# time complexity: O(|S - T|*|T|)
# space complexity: O(|S - T|)

S_d = input()
T = input()
len_T = len(T)


def replacable(string, T):
    for char_s, char_t in zip(string, T):
        if char_s == char_t or char_s == '?':
            continue
        else:
            return False
    else:
        return True


# see if S_d can contain T
t_start_index_list = []
# O(|S - T|)
for start_idx in range(len(S_d) - len_T + 1):
    string = S_d[start_idx:start_idx + len_T]
    # O(|T|)
    if replacable(string, T):
        t_start_index_list.append(start_idx)

if len(t_start_index_list) == 0:
    print("UNRESTORABLE")
else:
    S_candidate_list = []
    for t_start_index in t_start_index_list:
        print(t_start_index)
        S = S_d[:t_start_index] + T + S_d[t_start_index + len_T:]
        S = S.replace('?', 'a')
        S_candidate_list.append(S)
    S_candidate_list.sort()
    print(S_candidate_list[0])


Fixed code:
# time complexity: O(|S - T|*|T|)
# space complexity: O(|S - T|)

S_d = input()
T = input()
len_T = len(T)


def replacable(string, T):
    for char_s, char_t in zip(string, T):
        if char_s == char_t or char_s == '?':
            continue
        else:
            return False
    else:
        return True


# see if S_d can contain T
t_start_index_list = []
# O(|S - T|)
for start_idx in range(len(S_d) - len_T + 1):
    string = S_d[start_idx:start_idx + len_T]
    # O(|T|)
    if replacable(string, T):
        t_start_index_list.append(start_idx)

if len(t_start_index_list) == 0:
    print("UNRESTORABLE")
else:
    S_candidate_list = []
    for t_start_index in t_start_index_list:
        S = S_d[:t_start_index] + T + S_d[t_start_index + len_T:]
        S = S.replace('?', 'a')
        S_candidate_list.append(S)
    S_candidate_list.sort()
    print(S_candidate_list[0])
Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 14:28:43 2020

@author: NEC-PCuser
"""

S = input()
T = input()

start = 0

i = -1
for i in range(0, len(S) - len(T) + 1):
    k = 0
    for b in T:
        if S[i + k] != b and S[i + k] != '?':
            break
        k += 1
    else:
        start = i

if i == -1:
    print("UNRESTORABLE")
else:
    s = list(S)
    s[start:start + len(T)] = T
    S = "".join(s)
    
    print(S.replace('?', 'a'))
    
    

Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 14:28:43 2020

@author: NEC-PCuser
"""

S = input()
T = input()

start = -1

i = 0
for i in range(0, len(S) - len(T) + 1):
    k = 0
    for b in T:
        if S[i + k] != b and S[i + k] != '?':
            break
        k += 1
    else:
        start = i

if start == -1:
    print("UNRESTORABLE")
else:
    s = list(S)
    s[start:start + len(T)] = T
    S = "".join(s)
    
    print(S.replace('?', 'a'))
Buggy code:
s = list(input())
t = list(input())

count = 0
n = 0
ans = []
flag = 0
while n <len(s)-len(t)+1:
    count = 0
    for m in range(len(t)):
        if s[n+m] == "?" or s[n+m]==t[m]:
            count += 1
    if count == len(t):
        flag = 1
        ans = s[0:n+m+1]
        break
    n += 1
#print(n,m)
if flag == 1:
    for i in range(n):
        if ans[i] == "?":
            ans[i] = "a"
    for i in range(m+1):
        ans[n+i] =t[i]
    for _ in ans:
        #print(*_,end="")
else:
    print("UNRESTORABLE")

Fixed code:
s = list(input())
t = list(input())

count = 0
n = 0
ans = []
flag = 0
n=len(s)-len(t)
while n >=0:
    count = 0
    for m in range(len(t)):
        if s[n+m] == "?" or s[n+m]==t[m]:
            count += 1
        else:
            break
    if count == len(t):
        flag = 1
        break
    else:
        n -= 1

if flag == 1:
    for i in range(len(s)):
        if s[i] == "?":
            s[i] = "a"
    for i in range(m+1):
        s[n+i] =t[i]
    
    for _ in s:
        print(*_,end="")

else:
    print("UNRESTORABLE")
Buggy code:
ef agree(s1, t1):
    for i in range(len(t1)):
        if not(s1[i] == t1[i] or s1[i] =='?'):
            return False
    return True

s = input()
t = input()  
ls, lt  = len(s), len(t)

ss =[]
for i in range(ls - lt +1):
    #print(s[i:i+lt], t)
    if agree(s[i:i+lt], t):
        ss.append( (s[:i]+t).replace('?', 'a') )
#print(ss)

if ss:
    print(min(ss))
else:
    print('UNRESTORABLE')

Fixed code:
def agree(s1, t1):
    for i in range(len(t1)):
        if not(s1[i] == t1[i] or s1[i] =='?'):
            return False
    return True

s = input()
t = input()  
ls, lt  = len(s), len(t)

ss =[]
for i in range(ls - lt +1):
    #print(s[i:i+lt], t)
    if agree(s[i:i+lt], t):
        ss.append( (s[:i] + t + s[i+lt:]).replace('?', 'a') )
#print(ss)

if ss:
    print(min(ss))
else:
    print('UNRESTORABLE')
Buggy code:
import copy
S_dash = input()
T = input()

len_S = len(S_dash)
len_T = len(T)

candidate0 = list(S_dash)


ans = "z"*51

if len_S >= len_T:
  for s in range(len_S):
    cha_S = S_dash[s]
    if cha_S != "?" and cha_S in list(T):
      for t in range(len_T):
        cha_T = T[t]
        if cha_S == cha_T:
          S_cut = S_dash[s-t:s-t+len_T]
          
          candidate1 = copy.deepcopy(candidate0)
          
          for x in range(len_T):
            if S_cut[x] == "?":
              candidate1[s-t+x] = T[x]
            elif  S_cut[x] != T[x]:
              break
          
          else:
            if candidate1[s-t:s-t+len_T].count("?") == 0:
              if ans > "".join(candidate1).replace('?', 'a'):
                ans = "".join(candidate1).replace('?', 'a')
                
if ans = "z"*51:
  ans = "UNRESTORABLE"
print(ans)

Fixed code:
import copy
S_dash = input()
T = input()

len_S = len(S_dash)
len_T = len(T)

candidate0 = list(S_dash)


ans = "z"*51

if len_S >= len_T:
  for s in range(len_S):
    cha_S = S_dash[s]
    if cha_S != "?" and cha_S in list(T):
      for t in range(len_T):
        cha_T = T[t]
        if cha_S == cha_T and 0<= s-t < len_S and  0< s-t+len_T <= len_S:
          S_cut = S_dash[s-t:s-t+len_T]
          candidate1 = copy.deepcopy(candidate0)
          for x in range(len_T):
            if S_cut[x] == "?":
              candidate1[s-t+x] = T[x]
            elif  S_cut[x] != T[x]:
              break
          else:
            if "".join(candidate1[s-t:s-t+len_T]) == T:
              if ans > "".join(candidate1).replace('?', 'a'):
                ans = "".join(candidate1).replace('?', 'a')
  
  
  
  for u in range(len_S-len_T+1):
    cut_S = S_dash[u:u+len_T]
    if cut_S.count("?") == len_T:
      candidate1 = copy.deepcopy(candidate0)
      for t in range(len_T):
        candidate1[u+t] = T[t]
      if ans > "".join(candidate1).replace('?', 'a'):
        ans = "".join(candidate1).replace('?', 'a')
                
if ans == "z"*51:
  ans = "UNRESTORABLE"
print(ans)
Buggy code:
def main():
  s = str(input())
  ans = s.replace('?', 'z')
  flag = False
  t = str(input())
  for i in range(len(s)-len(t)+1):
    temp_flag = True
    temp_ans = list(s)
    for j in range(len(t)):
      if s[i + j] == '?':
        temp_ans[i + j] = t[j]
        continue
      elif s[i+j] != t[j]:
        temp_flag = False
    if temp_flag:
      flag = True
      temp_ans = "".join(temp_ans)
      temp_ans = temp_ans.replace('?', 'a')
      ans = min(ans, temp_ans)
  if flag:
    print(ans)
  else:
    print("UNRESTORABLE")
    
if __name__ == "__main__":
  main()
  else:
    print("UNRESTORABLE")
    
if __name__ == "__main__":
  main()
      
        

Fixed code:
def main():
  s = str(input())
  ans = s.replace('?', 'z')
  flag = False
  t = str(input())
  for i in range(len(s)-len(t)+1):
    temp_flag = True
    temp_ans = list(s)
    for j in range(len(t)):
      if s[i + j] == '?':
        temp_ans[i + j] = t[j]
        continue
      elif s[i+j] != t[j]:
        temp_flag = False
    if temp_flag:
      flag = True
      temp_ans = "".join(temp_ans)
      temp_ans = temp_ans.replace('?', 'a')
      ans = min(ans, temp_ans)
  if flag:
    print(ans)
  else:
    print("UNRESTORABLE")
    
if __name__ == "__main__":
  main()
Buggy code:
s = input()
t = input()
ans = []
a = ''
for i in range(len(s)-len(t)+1):
    flag = True
    a = s[:i]
    for j in range(len(t)):
        if s[i+j] == t[j] or s[i+j] == '?':
            a += t[j]
        else:
            flag = False
            break
    a += s[i+j+1:]
    if flag:
        ans.append(a.replace('?','a'))
if ans:
    ans.sort()
    print(ans)
    print(ans[0])
else:
    print('UNRESTORABLE')

Fixed code:
s = input()
t = input()
ans = []
for i in range(len(s)-len(t)+1):
    flag = True
    for j in range(len(t)):
        if not (s[i+j] == t[j] or s[i+j] == '?'):
            flag = False
            break
    if flag:
        ans.append(i)
if ans:
    ans2 = []
    for i in ans:
        ans2.append(s[:i].replace('?','a') + t + s[i+len(t):].replace('?','a'))
    ans2.sort()
    print(ans2[0])
else:
    print('UNRESTORABLE')
Buggy code:
input_A = input()
input_T = input()
input_A, input_T = list(input_A), list(input_T)

for i in range(len(input_A)-len(input_T), 0, -1):
    clear_flg = True
    for j in range(len(input_T)):
        if not (input_A[i + j] == '?' or input_A[i + j] == input_T[j]):
            clear_flg = False
            break

    if clear_flg is True:
        input_A[i:i + len(input_T)] = input_T
        input_A = ''.join(input_A).replace('?', 'a')
    else:
        input_A = 'UNRESTORABLE'
print(input_A)


Fixed code:
input_A = input()
input_T = input()
input_A, input_T = list(input_A), list(input_T)

if len(input_A) >= len(input_T):
    for i in range(len(input_A)-len(input_T), -1, -1):
        clear_flg = True
        for j in range(len(input_T)):
            if not (input_A[i + j] == '?' or input_A[i + j] == input_T[j]):
                clear_flg = False
                break

        if clear_flg is True:
            input_A[i:i + len(input_T)] = input_T
            input_A = ''.join(input_A).replace('?', 'a')
            break
else:
    clear_flg = False

if clear_flg is True:
    print(input_A)
else:
    print('UNRESTORABLE')
Buggy code:
s = list(input())
t = list(input())

l = []

for i in range(len(s)-len(t) - 1):
    f = False
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')

Fixed code:
s = input()
t = input()

l = []

for i in range(len(s)-len(t) + 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')
Buggy code:
S_ = input()
T = input()
loop = len(S_) - len(T) + 1
stringlist = []

# check S_ in T
for n in range(loop):
    chance = True
    for i in range(len(T)):
        if S_[n+i] == T[i] or S_[n+i] == "?":
            pass
        else:
            chance = False
            break

    if chance:
        tmp = S_[:n] + T + S_[n+len(T):]
        stringlist.append(tmp)

if len(stringlist) == 0:
    print(UNRESTORABLE)
else:
    stringlist.sort()
    String = stringlist[0]
    S = ""
    for i in range(len(S_)):
        if String[i] == "?":
            S += "a"
        else:
            S += String[i]

print(S)





Fixed code:
S_ = input()
T = input()
loop = len(S_) - len(T) + 1
stringlist = []

# check S_ in T
for n in range(loop):
    chance = True
    for i in range(len(T)):
        if S_[n+i] == T[i] or S_[n+i] == "?":
            pass
        else:
            chance = False
            break

    if chance:
        tmp = S_[:n] + T + S_[n+len(T):]
        stringlist.append(tmp)

if len(stringlist) == 0:
    print("UNRESTORABLE")
else:
    stringlist.sort()
    String = stringlist[0]
    S = ""
    for i in range(len(S_)):
        if String[i] == "?":
            S += "a"
        else:
            S += String[i]
    print(S)
Buggy code:
S_dash  =   list(input())
len_s   =   len(S_dash)
T       =   list(input())
len_t   =   len(T)

if len_s < len_t:
    print('UNRESTORABLE')
else:
    flag_i = 0
    # if flag_i = 1, it means restorable. if not, unrestorable
    for i in range( len_s - len_t + 1 ):
        flag_j = 0
        # if flag_j = 1 , it means unrestorable
        check_s = S_dash[ len_s - len_t - i : len_s - i ]
        for j in range( len_t ):
            if ( check_s[j] != '?' and check_s[j] != T[j] ):
                flag_j = 1
                break
        if flag_j == 0:
            flag_i = 1
            break
    if flag_i == 0:
        print('UNRESTORABLE')
    else:
        S_dash[ len_s - len_t - i : len_s - i ] = T
        for i in range( len_s ):
            if S_dash[i] == '?':
                S_dash[i] = 'a'
        print(S_dash)

Fixed code:
S_dash  =   list(input())
len_s   =   len(S_dash)
T       =   list(input())
len_t   =   len(T)

if len_s < len_t:
    print('UNRESTORABLE')
else:
    flag_i = 0
    # if flag_i = 1, it means restorable. if not, unrestorable
    for i in range( len_s - len_t + 1 ):
        flag_j = 0
        # if flag_j = 1 , it means unrestorable
        check_s = S_dash[ len_s - len_t - i : len_s - i ]
        for j in range( len_t ):
            if ( check_s[j] != '?' and check_s[j] != T[j] ):
                flag_j = 1
                break
        if flag_j == 0:
            flag_i = 1
            break
    if flag_i == 0:
        print('UNRESTORABLE')
    else:
        S_dash[ len_s - len_t - i : len_s - i ] = T
        for i in range( len_s ):
            if S_dash[i] == '?':
                S_dash[i] = 'a'
        print( ''.join(S_dash) )
Buggy code:
s = input()
t = input()
def check(a, b):
  if a == '?':
    return True
  else:
    if a == b:
      return True
    else:
      return True
cand = []
for i in range(len(s)-len(t)):
  flag = True
  c = list(s)
  for j in range(len(t)):
    if not check(s[i+j], t[j]):
      flag = False
      break
    c[i+j] = t[j]
  if flag:
    s = ''.join(c)
    s.replace('?', 'a')
    cand.append(s)
if len(cand):
  cand.sort()
  print(cand[0])
else:
  print("UNRESTORABLE")
    

Fixed code:
s = input()
t = input()
def check(a, b):
  if a == '?':
    return True
  else:
    return a == b
  
cand = []
for i in range(len(s)-len(t)+1):
  flag = True
  c = list(s)
  for j in range(len(t)):
    if not check(s[i+j], t[j]):
      flag = False
      break
    c[i+j] = t[j]
  if flag:
    cs = ''.join(c)
    cand.append(cs.replace('?', 'a'))
if len(cand):
  cand.sort()
  print(cand[0])
else:
  print("UNRESTORABLE")
Buggy code:
s = list(str(input()))
t = list(str(input()))
ans = []
an = 0
if len(s) < len(t):
    print("UNRESTORABLE")
    exit()
for i in range(len(s)-len(t)+1):
    cou = s[i:i+len(t)]
    for k in range(len(t)):
        if s[i+k] != t[k] and s[i+k] != "?" and t[k] != "?":
            break
        if k == len(t)-1:
            ans.append(s[:i]+t+s[i+len(t):])
for h in range(len(ans)):
    for f in range(len(s)):
        if ans[h][f] == "?":ans[h][f] = "a"
    ans[h] = "".join(ans[h])
ans.sort()
print(ans[0])

Fixed code:
s = list(str(input()))
t = list(str(input()))
ans = []
an = 0
if len(s) < len(t):
    print("UNRESTORABLE")
    exit()
for i in range(len(s)-len(t)+1):
    cou = s[i:i+len(t)]
    for k in range(len(t)):
        if s[i+k] != t[k] and s[i+k] != "?" and t[k] != "?":
            break
        if k == len(t)-1:
            ans.append(s[:i]+t+s[i+len(t):])
for h in range(len(ans)):
    for f in range(len(s)):
        if ans[h][f] == "?":ans[h][f] = "a"
    ans[h] = "".join(ans[h])
if ans == []:
    print("UNRESTORABLE")
    exit()
ans.sort()
print(ans[0])
Buggy code:
s = input()
t = input()

def match(s1, s2):
    if len(s1) < len(s2):
        return False
    for i, j in zip(s1, s2):
        if i != j and i != "?":
            return False
    return True

result = []
for i in range(50):
    if match(s[i:], t):
        result.append((s[:i] + t + s[i + len(t):]).replace("?", "a"))
result.sort()
print(result[0])


Fixed code:
s = input()
t = input()

def match(s1, s2):
    if len(s1) < len(s2):
        return False
    for i, j in zip(s1, s2):
        if i != j and i != "?":
            return False
    return True

result = []
for i in range(50):
    if match(s[i:], t):
        result.append((s[:i] + t + s[i + len(t):]).replace("?", "a"))
result.sort()
if not result:
    print("UNRESTORABLE")
else:
    print(result[0])
Buggy code:
s=input()
flag=False
for i in range(len(s)-1):
  print(s[i:i+2])
  if s[i:i+1]=='AC':
    flag=True
if flag:
  print('Yes')
else:
  print('No')

Fixed code:
s = input()
p = False
for i in range(len(s)-1):
  if s[i:i+2] == 'AC': p = True
if p: print('Yes')
else: print('No')
Buggy code:
s = input()
flag = 0
for i in range(len(s)):
    if s[i] == "A":
        if s[i + 1] == "C":
            flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

Fixed code:
s = input()
flag = 0
for i in range(len(s) - 1):
    if s[i] == "A":
        if s[i + 1] == "C":
            flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")
Buggy code:
s=input()
print "Yes" if s.count("AC") else "No"


Fixed code:
s = input()

if s.count('AC'):
    print('Yes')
else:
    print('No')
Buggy code:
s = list(input())

for i in range(len(s) - 1):
    if 'A' == s[i]:
        if 'C' == s[i]:
            print('Yes')
            exit(0)

print('No')

Fixed code:
s = list(input())

for i in range(len(s) - 1):
    if 'A' == s[i]:
        if 'C' == s[i + 1]:
            print('Yes')
            exit(0)

print('No')
Buggy code:
s=input()
yn=0
for i in range(len(s)-1):
    if s[i:i+1]=="AC":
        yn=1
        break
if yn==1:
    print("Yes")
else:
    print("No")


Fixed code:
s=input()
yn=0
for i in range(len(s)-1):
    if s[i:i+2]=="AC":
        yn=1
        break
if yn==1:
    print("Yes")
else:
    print("No")
Buggy code:
l = input()
for i in range(len(l)-1):
  if l[i:i+1] == "AC":
    print("Yes")
    break
else:
  print("No")
  

Fixed code:
l = input()
for i in range(len(l)-1):
  if l[i:i+2] == "AC":
    print("Yes")
    break
else:
  print("No")
Buggy code:
l = list(input())

if "AC" in l:
  print("Yes")
else:
  print("No")

Fixed code:
l = input()

if "AC" in l:
  print("Yes")
else:
  print("No")
Buggy code:
S = input().split()
flag = 0
for i in range(len(S)-2+1):
    if S[i:i+2]=="AC":
        flag = 1
        break
if flag==1:
    print("Yes")
else:
    print("No")

Fixed code:
S = input().strip()
flag = 0
for i in range(len(S)-2+1):
    if S[i:i+2]=="AC":
        flag = 1
        break
if flag==1:
    print("Yes")
else:
    print("No")
Buggy code:
S = input()
for _ in range(S - 1):
    if S[_:_ + 2] == "AC":
        print("Yes")
        break
else:
    print("No")


Fixed code:
S = input()
for _ in range(len(S) - 1):
    if S[_:_ + 2] == "AC":
        print("Yes")
        break
else:
    print("No")