qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

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

Fixed code:
# import sys
# from sys import stdin
# input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = 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()
T = input()

ss = len(S)
tt = len(T)

count = 0
res = []


for i in range(ss-tt+1):
    for j in range(tt):
        if S[i+j] != T[j]:
            count += 1
    res.append(count)
    count = 0

print(res)
print(min(res))

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

ss = len(S)
tt = len(T)

count = 0
res = []


for i in range(ss-tt+1):
    for j in range(tt):
        if S[i+j] != T[j]:
            count += 1
    res.append(count)
    count = 0

print(min(res))
Buggy code:
s = input()
t - input()

ans = len(s)

for s_start 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)

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()

c = 0
u = []
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]!=s[j+i]:
            c+=1
    u.append(c)
print(min(u))

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

c = 0
u = []
for i in range(len(s)-len(t)+1):
    c = 0
    for j in range(len(t)):
        if t[j]!=s[j+i]:
            c+=1
    u.append(c)
print(min(u))
Buggy code:
s = input()
t = input()

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

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

ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans_tmp = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            ans_tmp += 1
    ans = min(ans, ans_tmp)
print(ans)
Buggy code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


S=list(ns())
T=list(ns())

INF=10**9
ans=INF
for i in range(len(S)-len(T)):
    tmp=0
    for j in range(len(T)):
        if(S[i+j]!=T[j]):
            tmp+=1
    ans=min(ans,tmp)

print(tmp)
            




Fixed code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


S=list(ns())
T=list(ns())

INF=10**9
ans=INF
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 = 10 ** 8
for i in range(len(s)-len(t)+1):
  check = 0
  for j in range(len(t)):
    print(s[i+j], t[j])
    if s[i+j] != t[j]:
      check = check + 1
  if ans > check:
    ans = check
print(ans)

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

ans = 10 ** 8
for i in range(len(s)-len(t)+1):
  check = 0
  for j in range(len(t)):
    if s[i+j] != t[j]:
      check = check + 1
  if ans > check:
    ans = check
print(ans)
Buggy code:
s = list(input())
t = list(input())

ln = len(s)
lt = len(t)
n = ls - lt + 1
l = []

cnt = 0
for i in range(n):
    for j in range(lt):
        if t[j] != s[i + j]:
            cnt += 1
    l.append(cnt)
    cnt = 0
    
print(min(l))
        

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

ls = len(s)
lt = len(t)
n = ls - lt + 1
l = []

cnt = 0
for i in range(n):
    for j in range(lt):
        if t[j] != s[i + j]:
            cnt += 1
    l.append(cnt)
    cnt = 0
    
print(min(l))
Buggy code:
s1 = input()
s2 = input()
a = len(s2)
m = 10**18
for x in range(len(s1)-a+1):
  s3 = s1[x:x+a]
  print(s3)
  s = 0
  for y in range(a):
    if s3[y]!=s2[y]:
      s+=1
  m = min(m,s)
print(m)


Fixed code:
s1 = input()
s2 = input()
a = len(s2)
m = 10**18
for x in range(len(s1)-a+1):
  s3 = s1[x:x+a]
  s = 0
  for y in range(a):
    if s3[y]!=s2[y]:
      s+=1
  m = min(m,s)
print(m)
Buggy code:
S = input()
T = input()
A = len(T)  
ls = []
for i in range(len(S)-len(T)+1):
    ls.append(S[i:i+len(T)])
    
same = 0
for i in range(len(ls)):
    for j in range(len(T)):
        if T[j] == ls[i][j]:
            same += 1;
        if len(T)-same < A:
            A = len(T)-same
print(A)

Fixed code:
S = input()
T = input()
A = len(T)  
ls = []
for i in range(len(S)-len(T)+1):
    ls.append(S[i:i+len(T)])
for i in range(len(ls)):
    same = 0
    for j in range(len(T)):
        if T[j] == ls[i][j]:
            same += 1;
        if len(T)-same < A:
            A = len(T)-same
print(A)
Buggy code:
s = input()
t = input()
ls = len(s)
lt = len(t)

ans = 0
for i in range(ls-lt+1):
  same = 0
  for j in range(lt):
    ind = i+lt
    if s[ind]==t[j]:
      same += 1
  ans = min(ans,min)
print(ans)

Fixed code:
s = input()
t = input()
ls = len(s)
lt = len(t)

ans = 0
for i in range(ls-lt+1):
  same = 0
  for j in range(lt):
    ind = i+j
    if s[ind]==t[j]:
      same += 1
  ans = max(ans,same)
print(lt-ans)
Buggy code:
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT):
        d = 0
        for lt in range(LT):
            if S[ls + lt:ls + LT] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

Fixed code:
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT + 1):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))
Buggy code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []
    for i in range(a - b):
        cnt = 0
        S_1 = S_[i:i + b + 1]
        for i in range(b):
            if S_1[i] == T[i]:
                cnt += 1
        cnt_list.append(cnt)

    ans = b - max(cnt_list)
    print(ans)



Fixed code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S_ = S()
    T = S()
    a = len(S_)
    b = len(T)
    cnt_list = []

    for i in range(a - b + 1):
        cnt = 0
        S_1 = S_[i:i + b]
        for j in range(b):
            if S_1[j] == T[j]:
                cnt += 1
        cnt_list.append(cnt)

    ans = b - max(cnt_list)
    print(ans)



if __name__ == "__main__":
    main()
Buggy code:
s = input()
t = input()
ans = 0
for i in range(len(s)-len(t)+1):
    m = 0
    for j, k in zip(s[i:],t):
        if j==k:
            m += 1
    if m > ans:
        ans = m
print(ans)

Fixed code:
s = input()
t = input()
ans = 0
for i in range(len(s)-len(t)+1):
    m = 0
    for j, k in zip(s[i:],t):
        if j==k:
            m += 1
    if m > ans:
        ans = m
print(len(t) - ans)
Buggy code:
import copy

s = input()
t = input()

sn = len(s)
tn = len(t)
answer = int(copy.deepcopy(tn))

for i in range(sn-tn+1):
    sk = s[i:i+tn]
    count = 0
    for j in range(tn):
        if sk[j] != t[j]:
            count += 1
    print(sk,count)
    if count < answer:
        answer = count

print(answer)

Fixed code:
import copy

s = input()
t = input()

sn = len(s)
tn = len(t)
answer = int(copy.deepcopy(tn))

for i in range(sn-tn+1):
    sk = s[i:i+tn]
    count = 0
    for j in range(tn):
        if sk[j] != t[j]:
            count += 1
    if count < answer:
        answer = count

print(answer)
Buggy code:
s = str(input())
t = str(input())
ans = 10000
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)


Fixed code:
s = str(input())
t = str(input())
ans = 10000
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:
import numpy as np
s = input()
t = input()
strs = []
t_size = len(t)
for i in np.arange(len(s)-len(t)+1):
    strs.append(s[i:i+t_size])
n = 0
max_n = 0
for ss in strs:
    for i in np.arange(len(t)):
        print(t[i], ss[i])
        if t[i]==ss[i]:
            n += 1
        if max_n < n:
            max_n = n
    n = 0
print(len(t)-max_n)

Fixed code:
import numpy as np
s = input()
t = input()
strs = []
t_size = len(t)
for i in np.arange(len(s)-len(t)+1):
    strs.append(s[i:i+t_size])
n = 0
max_n = 0
for ss in strs:
    for i in np.arange(len(t)):
        if t[i]==ss[i]:
            n += 1
        if max_n < n:
            max_n = n
    n = 0
print(len(t)-max_n)
Buggy code:
s=input()
t=input()

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

print(ans)


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

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

print(ans)
Buggy code:
S = input()
T = input()
ans = len(T)
for i in range(len(S)):
    for s,t in zip(S[i:i+len(T)],T):
        tmp = len(T)
        if t == s:
            tmp -= 1
    ans = min(ans,tmp)
else:
    print(ans)

Fixed code:
S = input()
T = input()
ans = len(T)
for i in range(len(S)):
    tmp = len(T)
    if len(S)-i >= len(T):
        for s,t in zip(S[i:i+len(T)],T):
            if t == s:
                tmp -= 1
        ans = min(ans,tmp)
else:
    print(ans)
Buggy code:
#!/usr/bin/env python3

s = input()
t = input()

errors = []
for i in range(len(s)-len(t)+1):
    error = 0 
    for j in range(len(t)):
        if s[i+j] != t[j]:
            error += 1
    errors.append(error)
print(min(errors)

Fixed code:
#!/usr/bin/env python

s = input()
t = input()

errors = []
for i in range(len(s)-len(t)+1):
    error = 0 
    for j in range(len(t)):
        if s[i+j] != t[j]:
            error += 1
    errors.append(error)
print(min(errors))
Buggy code:
S = input()
T = input()

size = len(T)
n = len(S)
ans = size

for i in range(n-size+1):
    t = S[i:i+size]
    print(t)
    v = sum([k!=j for k, j in zip(T, t)])
    ans = min(v, ans)

print(ans)


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

size = len(T)
n = len(S)
ans = size

for i in range(n-size+1):
    t = S[i:i+size]
    v = sum([k!=j for k, j in zip(T, t)])
    ans = min(v, ans)

print(ans)
Buggy code:
def main():
    S = input()
    T = input()
    print(S)
    print(T)
    min = len(T)
    for i in range(len(S) - len(T) + 1):
        temp = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                temp += 1
        if temp < min:
            min = temp
    print(min)
main()

Fixed code:
def main():
    S = input()
    T = input()
    min = len(T)
    for i in range(len(S) - len(T) + 1):
        temp = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                temp += 1
        if temp < min:
            min = temp
    print(min)
main()
Buggy code:
def count(A,B):
    counter=0
    for i in range(len(A)):
        if A[i]==B[i]:
            counter+=1
    return len(A)-counter

S = input()
T = input()
t = len(T)
s = len(S)
_min = float('inf')
for i in range(s-t+1):
    print(S[i:i+t])
    _min = min(_min,count(S[i:i+t],T))
print(_min)

Fixed code:
def count(A,B):
    counter=0
    for i in range(len(A)):
        if A[i]==B[i]:
            counter+=1
    return len(A)-counter
 
S = input()
T = input()
t = len(T)
s = len(S)
_min = float('inf')
for i in range(s-t+1):
    _min = min(_min,count(S[i:i+t],T))
print(_min)
Buggy code:
s = input()
t = input()

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

print(len(t)-ans)


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(ans,cnt)

print(len(t)-ans)
Buggy code:
s = input()
t = input()
c = 0

for i in range(len(s) - len(t) + 1):
    c_1 = 0
    for j in range(len(t)):
        if s[i + j] == t[j]:
            c_1 += 0
    if c < c_1:
        c = c_1

print(len(t) - c)  

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

for i in range(len(s) - len(t) + 1):
    c_1 = 0
    for j in range(len(t)):
        if s[i + j] == t[j]:
            c_1 += 1
    if c < c_1:
        c = c_1

print(len(t) - c)
Buggy code:
S = input()
T = input()

min_count = len(T)
for s in range(len(S) - len(T) + 1):  # T cannot exceed the length of S
    matched = 0
    for i in range(len(T)):
        print(f'S[{s + i}] == T[{i}]')
        if S[s + i] == T[i]:
            matched += 1
    count = len(T) - matched
    if count < min_count:
        min_count = count
print(min_count)

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

min_count = len(T)
for s in range(len(S) - len(T) + 1):  # T cannot exceed the length of S
    matched = 0
    for i in range(len(T)):
        # print(f'S[{s + i}] == T[{i}]')
        if S[s + i] == T[i]:
            matched += 1
    count = len(T) - matched
    if count < min_count:
        min_count = count
print(min_count)
Buggy code:
s = input() #efabdd
t = input() #abcd
sl = len(s) #6
tl = input(t) #4
ans = tl #4
for i in range(sl-tl+1): #6-4+1 => 0, 1, 2
    c = 0
    for j in range(min(tl, sl): #min(4, 6) => 4
        if (s[i+j] != t[j]: #s[0] != t[0]..t[3]
            c += 1
    ans = min(c, ans) #min(0..4, 4)
print(ans)


Fixed code:
s = input() #efabdd
t = input() #abcd
sl = len(s) #6
tl = len(t) #4
ans = tl #4
for i in range(sl-tl+1): #6-4+1 => 0, 1, 2
    c = 0
    for j in range(min(tl, sl)): #min(4, 6) => 4
        if (s[i+j] != t[j]): #s[0] != t[0]..t[3]
            c += 1
    ans = min(c, ans) #min(0..4, 4)
print(ans)
Buggy code:
S = input()
T = input()

cand = []
for start in range(len(S) - len(T) + 1):
    print(S[start:start+len(T)])
    cnt = sum([not T[i] == S[start:start+len(T)][i] for i in range(len(T))])
    cand.append(cnt)

print(min(cand))


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

cand = []
for start in range(len(S) - len(T) + 1):
    cnt = sum([not T[i] == S[start:start+len(T)][i] for i in range(len(T))])
    cand.append(cnt)

print(min(cand))
Buggy code:
a = input()
b = input()

l = []
for i in range(len(a) - len(b) + 1):
    cnt = 0
    for j in range(len(b)):
        if b[j] == a[i + j]:
            cnt += 1
    l.append(cnt)

print(l)
print(len(b) - max(l))

Fixed code:
a = input()
b = input()

l = []
for i in range(len(a) - len(b) + 1):
    cnt = 0
    for j in range(len(b)):
        if b[j] == a[i + j]:
            cnt += 1
    l.append(cnt)

#print(l)
print(len(b) - max(l))
Buggy code:
def main():
    s = input()
    t = input()
    n = len(t)
    ans = 0

    for i in range(len(s) - n + 1):
        cnt = 0
        for a, b in zip(s[i:i + n], t):
            if a == b: cnt += 1
        ans = max(ans, cnt)
        print(s[i:i + n])
    print(n - ans)

if __name__ == '__main__':
    main()



Fixed code:
def main():
    s = input()
    t = input()
    n = len(t)
    ans = 0

    for i in range(len(s) - n + 1):
        cnt = 0
        for a, b in zip(s[i:i + n], t):
            if a == b: cnt += 1
        ans = max(ans, cnt)
    print(n - ans)

if __name__ == '__main__':
    main()
Buggy code:
S = input()
T = input()

len_T = len(T)
len_S = len(S)
output = len_T

for i in range(len_S-len_T):
    diff = 0
    for j in range(len_T):
        if T[j] != S[i+j]:
            diff += 1
    output = min(output, diff)

print('output',output)
                

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

len_T = len(T)
len_S = len(S)
output = len_T

for i in range(len_S-len_T+1):
    diff = 0
    for j in range(len_T):
        if T[j] != S[i+j]:
            diff += 1
    output = min(output, diff)

print(output)
Buggy code:
s = input()
t = input()
ls = len(s)
lt = len(t)

a = []
sum_ = 0
for i in range(ls-lt+1):
    ss = s[i:i+lt]
    sum_ = 0
    for i, alb in enumerate(lt):
        if alb == ss[i]:
            sum_+= 1
    a.append(sum_)

print(lt - max(a))

Fixed code:
s = input()
t = input()
ls = len(s)
lt = len(t)

a = []
sum_ = 0
for i in range(ls-lt+1):
    ss = s[i:i+lt]
    sum_ = 0
    for i, alb in enumerate(t):
        if alb == ss[i]:
            sum_+= 1
    a.append(sum_)

print(lt - max(a))
Buggy code:
S = input().rstrip()
T = input().rstrip()
count = 0
lens = len(S)
lent = len(T)
for i in range(lens-lent+1):
    tempcount=0
    for j in range(lent):
        if S[i+j]==T[j]:
            tempcount += 1
    print(tempcount)
    count = max(count,tempcount)

print(lent-count)

Fixed code:
S = input().rstrip()
T = input().rstrip()
count = 0
lens = len(S)
lent = len(T)
for i in range(lens-lent+1):
    tempcount=0
    for j in range(lent):
        if S[i+j]==T[j]:
            tempcount += 1
    #print(tempcount)
    count = max(count,tempcount)

print(lent-count)
Buggy code:
s = list(input())
t = list(input())
ans = len(t)

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

    ans = min(ans, tmp)

print(ans)


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

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

    ans = min(ans, tmp)

print(ans)
Buggy code:
a=str(input())
b=str(input())
ans=0
c=[]
l=0
for x in range(len(a)-len(b)+1):
    ans=0
    for i in range(len(b)):
       if a[i+l]!=b[i]:
           ans+=1
    l+=1
    c.append(ans)
print(c)
print(min(c))

Fixed code:
a=str(input())
b=str(input())
ans=0
c=[]
l=0
for x in range(len(a)-len(b)+1):
    ans=0
    for i in range(len(b)):
       if a[i+l]!=b[i]:
           ans+=1
    l+=1
    c.append(ans)
print(min(c))
Buggy code:
S = input()
T = input()
t_len = len(T)
count = len(S) - len(T) + 1
max_correct = []
for i in range(count):
  s_tmp = S[i:t_len]
  for n, s in enumerate(s_tmp):
    correct = 0
    if s == T[n]:
      correct += 1
    max_correct.append(correct)
  i = i + 1
  t_len = t_len + 1

print(max(max_correct))

Fixed code:
S = input()
T = input()
t_len = len(T)
count = len(S) - len(T) + 1
max_correct = []
for i in range(count):
  s_tmp = S[i:t_len]
  correct = 0
  for n, s in enumerate(s_tmp):
    if s == T[n]:
      correct += 1
  max_correct.append(correct)
  
  i = i + 1
  t_len = t_len + 1

max_correct = len(T) - max(max_correct)
print(max_correct)
Buggy code:
strS = input()
strT = input()

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m <= (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)





Fixed code:
strS = input()
strT = input()

strS = list(strS)
strT = list(strT)

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1

print(len(strT)-maxRange)
Buggy code:
S = input()
T = input()

ans = 1000
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(i, ans)

print(ans)


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

ans = 1000
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()
length=len(T)
for i in range(0,len(S)-len(T)+1):
	diff=0
	for i in range(0,len(T)):
		if T[i]!=S[s+i]:
			diff+=1
	result=min(ans,diff)

print(result)


Fixed code:
S=input()
T=input()
result=len(T)
for s in range(0,len(S)-len(T)+1):
	diff=0
	for i in range(0,len(T)):
		if T[i]!=S[s+i]:
			diff+=1
	result=min(result,diff)

print(result)
Buggy code:
# coding: utf-8
# Your code here!
S = input()
T = input()

print(len(S))

a = 0
ans = len(T)

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


Fixed code:
# coding: utf-8
# Your code here!
S = input()
T = input()

a = 0
ans = len(T)

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

print(ans)
Buggy code:
S = input()
T = input()
i = 0
min = len(S)
#print(S[2])
if(T in S):
    print("0")
while(i < len(S)-len(T)):
    count = 0
    for j in range(len(T)):
        if(T[j] == S[j + i]):
            count+=1
    if(count <= min and count != 0):
        min = count
    i+=1
print(min)

Fixed code:
S = input()
T = input()
i = 0
min = len(T)
#print(S[2])
if(T in S):
    print("0")
else:
    while(i <= len(S)-len(T)):
        count = 0
        #print("count min")
        #print(count)
        #print(min)
        for j in range(len(T)):
            #print("T S")
            #print(T[j])
            #print(S[j + i])
            if(T[j] != S[j + i]):
                count+=1
        #print("now count")
        #print(count)
        if(count <= min and count != 0):
            min = count
            #print("Change!!!!!")
        i+=1
    print(min)
Buggy code:
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
        ans = min(defolt,ans)
print(ans)

Fixed code:
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)+1):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
    defolt = min(defolt,ans)
print(defolt)
Buggy code:
a = input()
b = input()

T=1000
ans = 0
for i in range(len(a)-len(b)+1):
  for j in range(len(b)):
    if a[i+j]=!b[j]:
      ans +=1
      ans = min(T, ans)
print(ans)
        
  

Fixed code:
a = input()
b = input()

T=1000

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

for i in range(s-t+1):
  count=0
  for j in range(t):
    if T[i]==S[j+i]:
      count += 1
  max_count=max(max_count,count)
    
print(t-max_count)

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

ans = 0
l = len(T)
for m in range (len(S)-l):
    diff = 0
    for i in range (l):
        if S[m+i] != T[i]:
            diff+=1
    ans = max(ans, diff)

print(ans)

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

ans = len(T)
l = len(T)
for m in range (len(S)-l+1):
    diff = 0
    for i in range (l):
        if S[m+i] != T[i]:
            diff+=1
    ans = min(ans, diff)

print(ans)