qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S=input()
T=input()
i=0
j=0
match = 0
for i in range(Len(S)-Len(T)):
  count = 0
  for j in range(Len(T)):
    if S[i+j]==T[j]:
      count=count+1
  
  if match<count:
    match=count

print(Len(T)-match)
      

Fixed code:
S=input()
T=input()
match=0
for i in range(len(S)-len(T)+1):
    count=0
    for j in range(len(T)):
        if S[i+j]==T[j]:
            count=count+1
    if match<count:
        match=count
print(len(T)-match)
Buggy code:
S = str(input())
T = str(input())

lS = len(S)
lT = len(T)
q = 0

print(S,lS,T,lT)

for i in range(0,lS-lT+1):
    p = 0
    for j in range(0, lT):
        if S[i+j] == T[j]:
            p += 1
    print("p", p, "q", q)
    q = max(q, p)
ans = lT-q
print(ans)

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

lS = len(S)
lT = len(T)
q = 0

for i in range(0,lS-lT+1):
    p = 0
    for j in range(0, lT):
        if S[i+j] == T[j]:
            p += 1
    q = max(q, p)
ans = lT-q
print(ans)
Buggy code:
s = input()
t = input()
list1 = list()
y = list()
for i in range(len(s)):
    if i < (len(s)-len(t)+1):
        list1.append(s[i:(i+len(t))])
print(list1)
for j in range(len(list1)):
    count = 0
    for k in range(len(t)):
        if list1[j][k] != t[k]:
            count = count + 1
    y.append(count)
print(min(y))


Fixed code:
s = input()
t = input()
list1 = list()
y = list()
for i in range(len(s)):
    if i < (len(s)-len(t)+1):
        list1.append(s[i:(i+len(t))])
for j in range(len(list1)):
    count = 0
    for k in range(len(t)):
        if list1[j][k] != t[k]:
            count = count + 1
    y.append(count)
print(min(y))
Buggy code:

def input_from_console():
    s = input()
    t = input()
    return s, t


def solve(s, t):
    min_count = len(t)
    for i in range(len(s)-len(t)):
        temp_count = 0
        for j in range(len(t)):
            if s[j+i] != t[j]:
                temp_count += 1
        min_count = min(min_count, temp_count)
    return min_count


def main():
    s, t = input_from_console()
    print(s,t)
    print(solve(s, t))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Fixed code:
def input_from_console():
    s = input()
    t = input()
    return s, t


def solve(s, t):
    min_count = len(t)
    for i in range(len(s)-len(t) + 1):
        temp_count = 0
        for j in range(len(t)):
            if s[j+i] != t[j]:
                temp_count += 1
        min_count = min(min_count, temp_count)
    return min_count


def main():
    s, t = input_from_console()
    print(solve(s, t))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()
Buggy code:
S = str(input().split())
T = str(input().split())
import numpy as numpy
len_S = len(S)
len_T = len(T)
count = numpy.zeros(len_S-len_T+1)
for i in range(len_S-len_T+1):
  for j in range(len_T):
    if not S[i+j] == T[j]:
      count[i] +=1
print(int(min(count)))

Fixed code:
S = str(input())
T = str(input())
import numpy as numpy
len_S = len(S)
len_T = len(T)
count = numpy.zeros(len_S-len_T+1)
for i in range(len_S-len_T+1):
  for j in range(len_T):
    if not S[i+j] == T[j]:
      count[i] +=1
print(int(min(count)))
Buggy code:
s = input()
t = input()
ss = len(s)
tt = len(t)
min = tt

for i in range(ss - tt + 1):
  count = 0
  for j in range(tt):
    if s[j] != t[j]:
      count += 1
  if min > count:
    min = count

print(min) 


Fixed code:
s = input()
t = input()
ss = len(s)
tt = len(t)
min = tt


for i in range(ss - tt + 1):
  count = 0
  for j in range(tt):
    if s[i+j] != t[j]:
      count += 1
  if min > count:
    min = count

print(min)
Buggy code:
S = input()
T = input()

ans = 0
for i in range(len(S)):
  tmp = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      tmp += 1
    ans = max(ans, tmp)

print(len(T) - ans)
  

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

ans = 0
for i in range(len(S) - len(T) + 1):
  tmp = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      tmp += 1
  ans = max(ans, tmp)

print(len(T) - ans)
Buggy code:
s=str(input())
t=str(input())
l=0
for i in range(len(s)-len(t)+1):
    print(s[i:i+len(t)])
    p=0
    for j in range(len(t)):
        if t[j] == s[i:i+len(t)][j]:
            p+=1
    l=max(l,p)
print(len(t)-l)

Fixed code:
s=str(input())
t=str(input())
l=0
for i in range(len(s)-len(t)+1):
    p=0
    for j in range(len(t)):
        if t[j] == s[i:i+len(t)][j]:
            p+=1
    l=max(l,p)
print(len(t)-l)
Buggy code:
ans = []

for i in range(M-N+1):

    num = 0

    substring = input_list[0][i:i+N]

    for j in range(len(substring)):

        if substring[j] != input_list[1][j]:

            num += 1

    ans.append(num)

print(min(ans))


Fixed code:
input_list = [input() for i in range(2)]
M = input_list[0]
N = input_list[1]

ans = []

for i in range(len(M)-len(N)+1):

    num = 0

    substring = input_list[0][i:i+len(N)]

    for j in range(len(N)):

        if substring[j] != N[j]:

            num += 1

    ans.append(num)

print(min(ans))
Buggy code:
s=input()
l=input()
len_s=len(s)
len_l=len(l)
a=len_s-len_l
ans=1001
for i in range(len_s-a):
    cnt=0
    for j in range(len_s):
        if l[j]==s[i+j]:
            cnt+=1
    ans=min(ans,len_l-cnt)

print(ans)

Fixed code:
s=input()
l=input()
len_s=len(s)
len_l=len(l)
a=len_s-len_l
ans=1001
for i in range(len_s-len_l+1):
    cnt=0
    for j in range(len_l):
        if l[j]!=s[i+j]:
            cnt+=1
    ans=min(ans,cnt)

print(ans)
Buggy code:
S = input()
T = input()

Min = 100000

for i in range(len(S)):
    if i + len(T) > len(S) - 1:
        break
    count = 0
    for n in range(len(T)):
        if S[i + n] != T[n]:
            count += 1
    if count < Min:
        Min = count

print(count)

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

Min = 100000

for i in range(len(S) - len(T) + 1):
    count = 0
    for n in range(len(T)):
        if S[i + n] != T[n]:
            count += 1
    if count < Min:
        Min = count

print(Min)
Buggy code:
from sys import stdin

def check_str(s,t):
    com = 0
    print(s)
    for a,b in zip(s,t):
        if a == b:
            com += 1
    return com

def main():
    s = input()
    t = input()

    common = 0
    for i in range(len(s)):
        common = max(common, check_str(s[i:],t))

    print(len(t)-common)

    
if __name__ == "__main__":
    main()

Fixed code:
from sys import stdin

def check_str(s,t):
    com = 0
    if len(t) > len(s):
        return 0
    for a,b in zip(s,t):
        if a == b:
            com += 1
    return com

def main():
    s = input()
    t = input()

    common = 0
    for i in range(len(s)):
        common = max(common, check_str(s[i:],t))

    print(len(t)-common)

    
if __name__ == "__main__":
    main()
Buggy code:
#!/usr/bin/env python3
import sys


def solve(S: str, T: str):
    length = len(T)
    s_list =[]
    for i in range(len(S)-length+1):

        s = S[i:i+length]
        s_list.append(s)

    ans = length

    for s in s_list:
        counter = 0
        for i in range(ans):
            print(T)
            if s[i] != T[i]:
                counter+=1

    ans = min(ans, counter)


    return print(ans)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Fixed code:
#!/usr/bin/env python3
import sys


def solve(S: str, T: str):
    length = len(T)
    s_list =[]
    counter = length
    ans = 0

    for i in range(len(S)-length+1):
        s = S[i:i+length]
        for i in range(length):
            #print(s[i], T[i])
            if s[i] != T[i]:
                ans+=1

        counter = min(ans, counter)

        ans = 0

    return print(counter)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()
Buggy code:
S=list(map(str,input()))
T=list(map(str,input()))
X=[]
Z=0
for I in range(len(S)-len(T)):
    Y=S[I:I+len(T)]
    Z=0
    for J in range(len(T)):
        if Y[J]==T[J]:
            Z=Z+1
    X.append(Z)
if X ==True:
    print(len(T)-max(X))
elif S==T:
    print(0)
else:
    print(len(T))

Fixed code:
S=list(map(str,input()))
T=list(map(str,input()))
X=[]
Z=0
for I in range(len(S)-len(T)+1):
    Y=S[I:I+len(T)]
    Z=0
    for J in range(len(T)):
        if Y[J]==T[J]:
            Z=Z+1
    X.append(Z)
if not X==[]:
    print(len(T)-max(X))
elif S==T:
    print(0)
else:
    print(len(T))
Buggy code:
vs = input()
t = input()

stri = []
mincount = -1
for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if(s[i+j] == t[j]):
            count+= 1
    mincount = max(mincount,count) 
print(len(t) - mincount)

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

stri = []
mincount = -1
for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if(s[i+j] == t[j]):
            count+= 1
    mincount = max(mincount,count) 
print(len(t) - mincount)
Buggy code:
s = input()
t = input()

cnt = 0

for i in range(1, len(t) + 1):
    for j in range(len(t) - i + 1):
        if t[j:j+i] in s:
            cnt = max(cnt, i)

print(len(s) - cnt)

Fixed code:
s = input()
t = input()
 
ans = 0
 
for i in range(len(s) - len(t) + 1):
  cnt = 0
  for j in range(len(t)):
    if s[i+j] == t[j]:
      cnt += 1
  ans = max(cnt, ans)
  
print(len(t)-ans)
Buggy code:
s = input()
t = input()
ans = len(s)
for i in range(ans):
    if i + len(t) -1 >= ans:
        break
    for j in range(len(t)):
        dif = 0
        if s[i+j] != t[j]:
            dif += 1
    ans = min(ans, dif)
print(ans)
        


Fixed code:
s = input()
t = input()
ans = len(s)
for i in range(len(s)):
    if i + len(t) -1 >= len(s):
        break
    dif = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            dif += 1
    ans = min(ans, dif)
print(ans)
Buggy code:
S = input()
T = input()

if len(S) == 1:
    if S == T:
        print(0)
    else:
        print(1)

else:
    l = []
    for i in range(len(S) - len(T) + 1):
        A = S[i:i + (len(T))]
        print(A)
        count = 0
        for j in range(len(A)):
            if A[j] == T[j]:
                count += 1
                print(count)
        l.append(count)

    print(l)
    if len(l) > 0:
        a = len(T) - max(l)
        print(a)
    else:
        a = 1
        print(a)


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

if len(S) == 1:
    if S == T:
        print(0)
    else:
        print(1)

else:
    l = []
    for i in range(len(S) - len(T) + 1):
        A = S[i:i + (len(T))]
        # print(A)
        count = 0
        for j in range(len(A)):
            if A[j] == T[j]:
                count += 1
                # print(count)
        l.append(count)

    # print(l)
    if len(l) > 0:
        a = len(T) - max(l)
        print(a)
    else:
        a = 1
        print(a)
Buggy code:
S = list(input())
T = list(input())
lt = len(T)

result = 10**5
for i in range(len(S) - len(T) + 1):
    cnt = 0
    for s, t in zip(S[i: (i + lt)], T):
        if s != t:
            cnt += 1
    result = max(cnt, result)
print(result)

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

result = 10**5
for i in range(len(S) - len(T) + 1):
    cnt = 0
    for s, t in zip(S[i: (i + lt)], T):
        if s != t:
            cnt += 1
    result = min(cnt, result)
print(result)
Buggy code:
S = input()
T = input()

num = 10**10

for i in range(len(S)-len(T)+1):
    U = S[i:(i+len(T))]
    for j in range(len(T)):
        if(T[j] != S[j]):
            tmp += 1
    num = min(num, tmp)
    
print(num)

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

num = 10**10

for i in range(len(S)-len(T)+1):
    U = S[i:(i+len(T))]
    tmp = 0
    for j in range(len(T)):
        if(T[j] != U[j]):
            tmp += 1
    num = min(num, tmp)
    
print(num)
Buggy code:
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
s_sub = np.array(list((s[i:i+len(t)] for i in range(len(s)-len(t)+1))))
print(s_sub)
ans = [0]*len(s_sub)
for i in range(len(s_sub)):
    ans[i] = np.count_nonzero(s_sub[i] == t)
print(len(t)-max(ans))

Fixed code:
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
s_sub = np.array(list((s[i:i+len(t)] for i in range(len(s)-len(t)+1))))
ans = [0]*len(s_sub)
for i in range(len(s_sub)):
    ans[i] = np.count_nonzero(s_sub[i] == t)
print(len(t)-max(ans))
Buggy code:
S = input()
T = input()

if S>=(T+2):
    countbox=[]
    for n in range(len(S)-2-len(T)+1):
        count =0
        for i in range(len(T)):
            if T[i] != S[i+n+1]:
                count+=1
        countbox.append(count)
    print(min(countbox))
else:
    print(0)

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

if len(S)==len(T):
    count=0
    for i in range(len(T)):
        if T[i] != S[i]:
            count+=1
    print(count)

else:
    countbox=[]
    for n in range(len(S)-len(T)+1):
        count =0
        for i in range(len(T)):
            if T[i] != S[i+n]:
                count+=1
        countbox.append(count)
    print(min(countbox))
Buggy code:
def minimumChar(S,T): 
    n, m = len(S), len(T) 
    ans = sys.maxsize 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (S[j] != T[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
      
S=input()
T=input()

print(minimumChar(S, T)) 

Fixed code:
import sys
def minimumChar(T,S): 
    n, m = len(T), len(S) 
    ans = sys.maxsize 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (T[j] != S[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
      
S=input()
T=input()

print(minimumChar(T,S))
Buggy code:
s=list(input())
t=list(input())
S=[0 for i in range(len(s)-len(t)+1)]
for i in range(len(s)-len(t)+1):
  for j in range(len(t)):
    if t[j]==s[j+i]:
      S[i]+=1

S_max=max(S)
print(t-S_max)

Fixed code:
s=list(input())
t=list(input())
S=[0 for i in range(len(s)-len(t)+1)]
for i in range(len(s)-len(t)+1):
  for j in range(len(t)):
    if t[j]==s[j+i]:
      S[i]+=1
      
S_0=max(S)
print(len(t)-S_0)
Buggy code:
S = input()
T = input()
cnt_list = []

for j in range(len(S)-len(T)):
  sub_S  =  S[j:(j+len(S))]
  for k in range(len(T)-1):
    cnt = 0
    if T[k] != sub_S[k]:
      cnt += 1
    cnt_list.append(cnt)

print(min(cnt_list))
  

Fixed code:
S = input()
T = input()
cnt_list = []

for i in range(len(S)-len(T)+1):
  sub_S = S[i:i+len(T)]
  cnt = 0
  for j in range(len(T)):
    if sub_S[j] != T[j]:
      cnt += 1
  cnt_list.append(cnt)
print(min(cnt_list))
Buggy code:
S = input()
T = input()

res = 0
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        if S[j+i] == T[j]:
            cnt += 1     
print(len(T) - res)

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

res = 0
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        if S[j+i] == T[j]:
            cnt += 1
    res = max(res, cnt)
print(len(T) - res)
Buggy code:
S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(s-t + 1):
      count = 0
      U = S[i: i+t]
      for i in range(t):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))

Fixed code:
S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(lens-lent + 1):
      count = 0
      U = S[i: i+lent]
      for j in range(lent):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))
Buggy code:
S,T = input().split()
mm = 0
for i in range(len(S)-len(T)):
    a = S[i:i+len(T)]
    mm_now = sum([x == y for x,y in [*zip(a,T)]])
    mm = max(mm_now, mm)
print(len(T) - mm)


Fixed code:
S = input()
T = input()
mm = 0
for i in range(len(S)-len(T)+1):
    a = S[i:i+len(T)]
    mm_now = sum([x == y for x,y in [*zip(a,T)]])
    mm = max(mm_now, mm)
print(len(T) - mm)
Buggy code:
s = input() # all
t = input() # substring

def calc_length(str1, str2):
    print(str1)
    print(str2)
    length = 0
    for i in range(len(str1)):
        if str1[i] != str2[i]:
            length += 1
    return length

min_length = len(t)
for i in range(len(s)- len(t) + 1):
    l = calc_length(s[i:i+len(t)], t)
    if l < min_length:
        min_length = l

print(min_length)

Fixed code:
s = input() # all
t = input() # substring

def calc_length(str1, str2):
    length = 0
    for i in range(len(str1)):
        if str1[i] != str2[i]:
            length += 1
    return length

min_length = len(t)
for i in range(len(s)- len(t) + 1):
    l = calc_length(s[i:i+len(t)], t)
    if l < min_length:
        min_length = l

print(min_length)
Buggy code:
s = input()
t = input()
ans = len(t)

for i in range(len(s)):
  if (i + len(t) - 1 >= len(s)): break
  dif = 0
  for j in range(len(t)):
    print(s[i + j])
    if (s[i + j] != t[j]):
      dif += 1
  ans = min(ans, dif)
print(ans)

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

for i in range(len(s)):
  if (i + len(t) - 1 >= len(s)): break
  dif = 0
  for j in range(len(t)):
    if (s[i + j] != t[j]):
      dif += 1
  ans = min(ans, dif)
print(ans)
Buggy code:
S = input()
T = input()
ans = float("INF")
for i in range(len(S)):
    cnt = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            cnt += 1
    ans = min(ans,cnt)
print(cnt)

Fixed code:
S = input()
T = input()
ans = float("INF")
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)
Buggy code:
S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] for k in range(x))
  ans = min(ans, cost)
print(ans)

Fixed code:
S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x + 1):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] else 0 for k in range(x))
  ans = min(ans, cost)
print(ans)
Buggy code:
s = input()
t = input()
ans = len(t)
for i in range(0, (len(s)-len(t))):
    diff = 0
    for j in range(i, len(t)):
        if t[j] == s[i+j]:
            diff += 1
    ans = min(ans, len(t)-diff)
print(ans)


Fixed code:
s = input()
t = input()
ans = len(t)
for i in range(0, (len(s)-len(t)+1)):
    diff = 0
    for j in range(0, len(t)):
        if t[j] == s[i+j]:
            diff += 1
    ans = min(ans, len(t)-diff)
print(ans)
Buggy code:
S=input()
T=input()
k = len(T)
ans=k
lim=0
for i in range(len(S)-len(T)+1):
  for j in range(k):
    print( S[i+j],T[j])
    if S[i+j]==T[j]:
      lim+=1
  if lim<=ans:
    ans=len(T)-lim
  lim=0
print(ans)

Fixed code:
S=input()
T=input()
k = len(T)
ans=k
lim=0
for i in range(len(S)-len(T)+1):
  for j in range(k):
    #print(i, j, S[i+j],T[j])
    if S[i+j]!=T[j]:
      lim+=1
  if lim<=ans:
    ans=lim
  lim=0
print(ans)
Buggy code:
S =input()
T =input()
mint=10000

for i in range(len(S)-len(T)+1):
    con = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            con += 1
            
    mint =min(con,mint)
    
    if min_count == 0:
        break


print(mint)

Fixed code:
S =input()
T =input()
mint=10000

for i in range(len(S)-len(T)+1):
    con = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            con += 1
            
    mint =min(con,mint)
    
    if mint == 0:
        break


print(mint)
Buggy code:
s = input()
t = input()

ans = 10000

for i in range(len(s) - len(t) + 1):
    score = 0
    U = [i:i + len(t)]
    for j in range(len(t)):
        if U[j] != t[j]:
            score += 1
    ans = min(ans, score)

print(ans)

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

ans = 10000

for i in range(len(s) - len(t) + 1):
    score = 0
    U = s[i:i + len(t)]
    for j in range(len(t)):
        if U[j] != t[j]:
            score += 1
    ans = min(ans, score)

print(ans)
Buggy code:
S=input()
T=input()

for i in range(0,len(S)-len(T)+1):
  score=0
  for j in range(0,len(T)):
    if(S[i] != T[i+j]):
      score += 1
  score = min(score, len(T))
print(score)

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

N_max = len(T)
for i in range(len(S)-len(T)+1):
  score=0
  for j in range(len(T)):
    if(S[i+j] != T[j]):
      score += 1
      
  N_max = min(score, N_max)
  
print(N_max)
Buggy code:
s=input()
t=input()

count = []

for i in range(len(s)-len(t)):
    c=0
    for j in range(i,i+len(t)):
        if s[j] == t[j]:
            c+=1
    
    count.append(c)

print(len(t)-max(count))


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

count = []

for i in range(len(s)-len(t)+1):
    c=0
    for j in range(i,i+len(t)):
        if s[j] == t[j-i]:
            c+=1
    count.append(c)

# print(count)
print(len(t)-max(count))
Buggy code:
s = input("")
t = input("")
cnt = 0

ans = 10000

for i in range(len(s)-len(t)+1):
    S = s[i:i+len(t)]
    for j in range(len(t)):
        if S[j] != t[j]:
            cnt += 1
    
    ans = min(ans,cnt)
    
print(ans)

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

ans = 10000

for i in range(len(s)-len(t)+1):
    cnt = 0
    S = s[i:i+len(t)]
    for j in range(len(t)):
        if S[j] != t[j]:
            cnt += 1
    ans = min(ans,cnt)
    
print(ans)
Buggy code:
S = input()
T = input()

max_cnt = 0
for i in range(len(S)-len(T)+1):
  print(i)
  cnt = 0
  for j in range(len(T)):
    if S[i+j] == T[j]:
      cnt += 1
    max_cnt = max(max_cnt, cnt)
print(len(T) - max_cnt)

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

max_cnt = 0
for i in range(len(S)-len(T)+1):
  cnt = 0
  for j in range(len(T)):
    if S[i+j] == T[j]:
      cnt += 1
    max_cnt = max(max_cnt, cnt)
print(len(T) - max_cnt)
Buggy code:
s=list(input())
t=list(input())
ans=[]
for i in range(len(s)-len(t)):
  cnt=0
  for j in range(i,len(t)+i):
    if s[j]!=t[j]:
      cnt+=1
  ans.append(cnt)
print(min(ans))

Fixed code:
s=list(input())
t=list(input())
ans=[]
for i in range(len(s)-len(t)+1):
  cnt=0
  for j in range(i,len(t)+i):
    if s[j]!=t[j-i]:
      cnt+=1
  ans.append(cnt)
print(min(ans))
Buggy code:
s = input()
t = input()

ans = 10000
for i in range(len(s) - len(t) + 1):
  tmp = 0
  for i in range(len(t)):
    if s[i + j] != s[j]:
      tmp+=1
    ans = min(ans, tmp)
print(ans)

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

ans = 10000
for i in range(len(s) - len(t) + 1):
    tmp = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            tmp += 1
    ans = min(ans, tmp)

print(ans)
Buggy code:
S=input()
T=input()
ans=1000000
for i in range(len(S)-len(T)+1):
  print(i)
  cnt=len(T)
  for j in range(len(T)):
    if S[i+j]==T[j]:
      cnt-=1
  ans=min(cnt,ans)
print(ans)


Fixed code:
S=input()
T=input()
ans=1000000
for i in range(len(S)-len(T)+1):
  cnt=len(T)
  for j in range(len(T)):
    if S[i+j]==T[j]:
      cnt-=1
  ans=min(cnt,ans)
print(ans)
Buggy code:
def solve(s, t):
    n = len(s)
    m = len(t)
    best = m
    for i in range(m-n+1):
        num = 0
        for j in range(n):
            if s[j] == t[i+j]:
                num += 1
        best = min(best, num)
    return best
    
s = input()
t = input()
print(solve(s, t))

Fixed code:
def solve(s, t):
    n = len(s)
    m = len(t)
    best = m
    for i in range(n-m+1):
        num = 0
        for j in range(m):
            if s[i+j] != t[j]:
                num += 1
        best = min(best, num)
    return best

s = input()
t = input()
print(solve(s, t))