qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S = input()
ans = 753
for i in range(len(S)-3):
  ans = min(ans, abs(int(S[i:i+3])-753))

print(ans)

Fixed code:
S = input()
ans = 753
for i in range(len(S)-2):
  ans = min(ans, abs(int(S[i:i+3])-753))

print(ans)
Buggy code:
s = input()
Min = 1000
for i in range(len(s)-2):
    x = s[i:i+3]
    print(x, i)
    if abs(753-int(x)) < Min:
        Min = abs(753-int(x))
print(Min)     

Fixed code:
s = input()
Min = 1000
for i in range(len(s)-2):
    x = s[i:i+3]
    if abs(753-int(x)) < Min:
        Min = abs(753-int(x))
print(Min)
Buggy code:
s=input()
S=[]
for i in range(s):
    S.append(s[i])
d=[]
for i in range(len(S)-2):
    N=int(S[i:i+3])
    d.append(abs(N-753))
print(min(d))

Fixed code:
S=input()
d=[]
for i in range(len(S)-2):
    N=int(S[i:i+3])
    d.append(abs(N-753))
print(min(d))
Buggy code:
def resolve():
    S = list(input())
    mindiff = float("inf")
    for i in range(len(S)-2):
        val = int(S[i]+S[i+1]+S[i+2])
        print(val)
        mindiff = min(mindiff, abs(753-val))
    print(mindiff)

if '__main__' == __name__:
    resolve()

Fixed code:
def resolve():
    S = list(input())
    mindiff = float("inf")
    for i in range(len(S)-2):
        val = int(S[i]+S[i+1]+S[i+2])
        mindiff = min(mindiff, abs(753-val))
    print(mindiff)

if '__main__' == __name__:
    resolve()
Buggy code:
s=int(input())
z=753
for i in range(s-2):
  x=int(s[i:i+3])
  y=abs(753-x)
  z=min(z,y)
print(z)

Fixed code:
s=input()
z=753
for i in range(len(s)-2):
  x=int(s[i:i+3])
  y=abs(753-x)
  z=min(z,y)
print(z)
Buggy code:
s = list(input())

ans = []
for i in range(0,len(s)-2):
  d = int("".join(s[i]+s[i+1]+s[i+2]))
  ans.append(abs(b-753))
  
print(min(ans))

Fixed code:
s = list(input())

ans = []
for i in range(0,len(s)-2):
  d = int("".join(s[i]+s[i+1]+s[i+2]))
  ans.append(abs(d-753))
  
print(min(ans))
Buggy code:
s=input()
l=len(s)
ans=float('inf')
for i in range(l-2):
  x=int(s[i:i+3])
  ans=min(ans, x)
print(ans)

Fixed code:
s=input()
l=len(s)
ans=float('inf')
for i in range(l-2):
  x=int(s[i:i+3])
  ans=min(abs(x-753), ans)
print(ans)
Buggy code:
S = int(input())
L = []
for i in range(len(S)-2):
  x = int(S[i:i+3])
  y = abs(753-x)
  L.append(y)
print(min(L))

Fixed code:
S = input()
L = []
for i in range(len(S)-2):
  x = int(S[i:i+3])
  y = abs(753-x)
  L.append(y)
print(min(L))
Buggy code:
a = input()
ans = abs(int(a[0:3]) - 753)
for i in range(1, len(a) - 3):
    num = int(a[i:i+3])
    data = abs(num-753)
    if data < ans:
        ans = data
print(ans)

Fixed code:
a = input()
ans = abs(int(a[0:3]) - 753)
for i in range(1, len(a) - 2):
    num = int(a[i:i+3])
    data = abs(num - 753)
    if data < ans:
        ans = data
print(ans)
Buggy code:
S = input()
ans = 1000
for i in range(len(S)-2):
  ans = min(ans, int(S[i:i+3]))
print(ans)

Fixed code:
S = input()
ans = 1000
for i in range(len(S)-2):
  ans = min(ans, abs(753-int(S[i:i+3])))
print(ans)
Buggy code:
import sys
s = list(map(int, input().split(' ')))
result = 753
a = 0
for i in range(len(s)-2):
    a = 100*s[i]+10*s[i+1]+s[i+2]
    if a < 753:
        a = 753 - a
    elif a > 753:
        a = a - 753
    else:
        print(0)
        sys.exit()
    if result > a:
        result = a
print(a)

Fixed code:
import sys
s = list(map(int, list(input())))
result = []
a = 0
for i in range(len(s)-2):
    a = 100*s[i]+10*s[i+1]+s[i+2]
    if a < 753:
        a = 753 - a
    elif a > 753:
        a = a - 753
    else:
        print(0)
        sys.exit()
    result.append(a)
print(min(result))
Buggy code:
s = [int(x) for in list(input())]
cand = []
for c1, c2, c3 in zip(s, s[1:], s[2:]):
  res = abs(c1 * 100 + c2 * 10 + c3 - 754)
  cand.append(res)
print(min(cand))
  

Fixed code:
s = [int(x) for x in list(input())]
cand = []
for c1, c2, c3 in zip(s, s[1:], s[2:]):
  res = abs(c1 * 100 + c2 * 10 + c3 - 753)
  cand.append(res)
print(min(cand))
Buggy code:
s=input()
print(min([abs(753-int(s[i:i+3])) for i in range(len(s)-3)]))


Fixed code:
s = input()
print(min([abs(int(s[i:i+3]) - 753) for i in range(len(s)-2)]))
Buggy code:
s= input()
n = len(s)
for i in range(n-2):
    k = 100*int(s[i])+10*int(s[i+1])+int(s[i+2])
    if min > abs(753-k):
        min = abs(753-k)
    
print(min)

Fixed code:
s= input()
n = len(s)
min = 1000
for i in range(n-2):
    k = 100*int(s[i])+10*int(s[i+1])+int(s[i+2])
    if min > abs(753-k):
        min = abs(753-k)
    
print(min)
Buggy code:
S = input()
ans = 10 ** 9
for i in range(len(S) - 3):
    s = int(S[i:i + 3])
    ans = min(ans, abs(s - 753))
print(ans)

Fixed code:
S = input()
ans = 10 ** 9
for i in range(len(S) - 2):
    s = int(S[i:i + 3])
    ans = min(ans, abs(s - 753))
print(ans)
Buggy code:
a=input()
c=1000
for b in range(len(a)):
  if (int(a[b:b+3])-753)<c:
    c = int(a[b:b+3])-753
print(c)   

Fixed code:
a=input()
c=1000
for b in range(len(a)):
  if abs(int(a[b:b+3])-753)<c:
    c = abs(int(a[b:b+3])-753)
print(c)
Buggy code:
s=input();print(min(abs(int(s[i:i+3])-753)for i in range(len(s)-3)))

Fixed code:
s=input()
print(min(abs(int(s[i:i+3])-753) for i in range(len(s)-2)))
Buggy code:
s=input()
ans=10000
i=0
while i+3<=len(s):
  x = int(s[i:i+3])
  if ans>abs(753-x):
    ans=abs(753-x)
print(ans)

Fixed code:
s=input()
ans=10000
i=0
while i+3<=len(s):
  x = int(s[i:i+3])
  if ans>abs(753-x):
    ans=abs(753-x)
  i+=1
print(ans)
Buggy code:
s = input()
 
ans = 100000
for i in range(len(s)-2):
  if (abs(int(s[i:i+2]) - 753) < ans):
    ans = abs(int(s[i:i+2]) - 753)
 
print(ans)
           

Fixed code:
s = input()
 
ans = 100000
for i in range(len(s)-2):
  if (abs(int(s[i:i+3]) - 753) < ans):
    ans = abs(int(s[i:i+3]) - 753)
 
print(ans)
Buggy code:
S = input()
diff = 1000
for i in range(len(S)-2):
    diff2 = abs(int(S[i:i+3])-753)
    if diff2 < diff:
        diff = diff2

Fixed code:
S = input()
diff = 1000
for i in range(len(S)-2):
    diff2 = abs(int(S[i:i+3])-753)
    if diff2 < diff:
        diff = diff2
print(diff)
Buggy code:
s = input()
s = str(s)
min=1000000
for i in range(0,len(s)-3):
	val = int(s[i:i+3])
	ans = abs(val-753)
	if(ans<min):
		min=ans
print(min)

Fixed code:
s = input()
s = str(s)
min=1000000
for i in range(0,len(s)-2):
	val = int(s[i:i+3])
	ans = abs(val-753)
	if(ans<min):
		min=ans
print(min)
Buggy code:
s = input()
mi = min(abs(int(s[i:i+3])-753) for i in range(len(s)-3))
print(mi)

Fixed code:
s = input()
mi = min(abs(int(s[i:i+3])-753) for i in range(len(s)-2))
print(mi)
Buggy code:
S = str(input())

list_aaa =[]

for i in range(len(S)-2):
    list_aaa.append(int(S[i]+S[i+1]+S[i+2]))

print(min(list_aaa,key = lambda x: abs(753-x))-753)



Fixed code:
S = str(input())

list_aaa =[]

for i in range(len(S)-2):
    list_aaa.append(int(S[i]+S[i+1]+S[i+2]))

print(abs(min(list_aaa,key = lambda x: abs(753-x))-753))
Buggy code:
S = str(input())
s = []
for i in range(len(S)):
    s.append(int(S[i]))

x = 753
l = len(s)
ans = 100000
for i in range(l-2):
    for j in range(i+1,l-1):
        for k in range(j+1,l):
            n = s[i] * 100 + s[j] * 10 + s[k]
            ans = min(abs(n-x),ans)
print(ans)

Fixed code:
S = str(input())
s = []
for i in range(len(S)):
    s.append(int(S[i]))

x = 753
l = len(s)
ans = 100000
for i in range(l-2):
    n = s[i] * 100 + s[i+1] * 10 + s[i+2]
    ans = min(abs(n-x),ans)
print(ans)
Buggy code:
S=int(input().strip())

m =None
for i in range(len(S)-2):
  e=int(S[i:i+3])
  if m is None:
    m=abs(753-e)
  elif abs(753-e) <m:
    m=abs(753-e)
print(m)

Fixed code:
S=input().strip()

m =None
for i in range(len(S)-2):
  e=int(S[i:i+3])
  if m is None:
    m=abs(753-e)
  elif abs(753-e) <m:
    m=abs(753-e)
print(m)
Buggy code:
s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(s[i]*100+s[i+1]*10+s[i+2]-753))
print(min(a))

Fixed code:
s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(int(s[i])*100+int(s[i+1])*10+int(s[i+2])-753))
print(min(a))
Buggy code:
s=input()
a=753
ans=999
for i in range(len(s)-3):
  n=int(s[i:i+2])
  tmp=abs(a-n)
  if tmp<ans:
    ans=tmp
print(ans)

Fixed code:
s=input()
a=753
ans=999
for i in range(len(s)-2):
  n=int(s[i:i+3])
  tmp=abs(a-n)
  if tmp<ans:
    ans=tmp
print(ans)
Buggy code:
S = list(input())
lst = []
for i in range(len(S)-3):
    a = int(''.join(S[i:i+3]))
    lst.append(a)
min = 1000
for j in lst:
    if abs(j-753) < min:
        min = abs(j-753)
print(min)

Fixed code:
S = list(input())
lst = []
for i in range(len(S)-2):
    a = int(''.join(S[i:i+3]))
    lst.append(a)
mini = 1000
for j in lst:
    if abs(j-753) < mini:
        mini = abs(j-753)
print(mini)
Buggy code:
s = input()
ans = float("inf")
for i in range(len(s) - 3):
    x = int(s[i:i+3])
    ans = min(ans, abs(x - 753))
print(ans)

Fixed code:
s = input()
ans = float("inf")
for i in range(len(s) - 2):
    x = int(s[i:i+3])
    ans = min(ans, abs(x - 753))
print(ans)
Buggy code:
S = input()


ans = 753

for i in range(len(S) - 2) :
    N = int(S[i:3])
    M = abs(753 - N)
    if ans > M :
        ans = M

print(ans)

Fixed code:
S = input()


ans = 753

for i in range(len(S) - 2) :
    N = int(S[i:i+3])
    M = abs(753 - N)
    if ans > M :
        ans = M

print(ans)
Buggy code:
ans=0
dif=1000
s=input()
n=len(s)
for i in range(n-2):
  tmp=int(s[i:i+3])
  if abs(753-tmp)<dif:
    ans=tmp
    dif=abs(753-ans)
print(ans)

Fixed code:
ans=0
dif=1000
s=input()
n=len(s)
for i in range(n-2):
  tmp=int(s[i:i+3])
  if abs(753-tmp)<dif:
    ans=tmp
    dif=abs(753-ans)
print(dif)
Buggy code:
S = input()

min = 753
tmp = 753
for i in range(0,len(S)-2):
  tmp = int(S[i])*100 + int(S[i+1])*10 + int(S[i+2])
  print(tmp)
  if min > abs(753-tmp): min = abs(753-tmp)

print(min)
  

Fixed code:
S = input()

min = 753
tmp = 753
for i in range(0,len(S)-2):
  tmp = int(S[i])*100 + int(S[i+1])*10 + int(S[i+2])
  if min > abs(753-tmp): min = abs(753-tmp)

print(min)
Buggy code:
1 S = input()
2 print(min(abs(int(S[i:i+3]) - 753) for i in range(len(S) - 2)))

Fixed code:
S = input()
print(min(abs(753-int(S[i:i+3])) for i in range(len(S)-2)))
Buggy code:
S=input()
a=[]
for i in range(len(S)):
    #print(int(S[i:i+2]))
    a.append(abs(int(S[i:i+3])-753))
#print(min(a))
print(a)

Fixed code:
S=input()
a=[]
for i in range(len(S)):
    #print(int(S[i:i+2]))
    a.append(abs(int(S[i:i+3])-753))
print(min(a))
#print(a)
Buggy code:
s=str(input())
ans=10**9
for i in range(len(s)-3):
    ans=min(ans,abs(753-int(s[i:i+3])))
print(ans)

Fixed code:
s=str(input())
ans=10**9
for i in range(len(s)-2):
    ans=min(ans,abs(753-int(s[i:i+3])))
print(ans)
Buggy code:
S = input().strip()
print(min(int([S[i:i+3]) for i in range(0,len(S)-2,3)))

Fixed code:
S = input().strip()
print(min(abs(753 - int(S[i:i+3])) for i in range(0,len(S)-2)))
Buggy code:
s=input()
imin=753
for i in range(len(s)-2):
	if abs(int(s[i]+s[i+2]+s[i+2])-753)<imin:
		imin=abs(int(s[i]+s[i+2]+s[i+2])-753)
print(imin)

Fixed code:
s=input()
imin=753
for i in range(len(s)-2):
	if abs(int(s[i]+s[i+1]+s[i+2])-753)<imin:
		imin=abs(int(s[i]+s[i+1]+s[i+2])-753)
print(imin)
Buggy code:

import sys

target = 753
num = input()

diff = sys.maxsize

for pos in range(0, len(num)-3):
    diff = min(abs(753 - int(num[pos:pos+3])), diff)

print(diff)

Fixed code:

import sys

target = 753
num = input()

diff = sys.maxsize

for pos in range(0, len(num)-2):
    diff = min(abs(753 - int(num[pos:pos+3])), diff)

print(diff)
Buggy code:
s = input()
for i in range(len(s)-2):
    a = [abs(753-int(s[i:i+3]))]

print(min(a))

Fixed code:
s = input()
a = []
for i in range(len(s)-2):
    a.append(abs(753-int(s[i:i+3])))

print(min(a))
Buggy code:
def main():
    S = input()
    mind = 1000
    for i in range(len(S) - 3 + 1):
        d = abs(753 - int(S[i:i+3]))
        if d < mind:
            mind = d
    print(d)
main()

Fixed code:
def main():
    S = input()
    mind = 1000
    for i in range(len(S) - 3 + 1):
        d = abs(753 - int(S[i:i+3]))
        if d < mind:
            mind = d
    print(mind)
main()
Buggy code:
S = input()
res = int(S[0:3])
for i in range(len(S)-3):
  if abs(res - 753) > abs(int(S[i:i+3])-753):
    res = S[i:i+3]
print(res)
  

Fixed code:
S = input()
res = int(S[0:3])
for i in range(len(S)-2):
    if abs(res - 753) > abs(int(S[i:i+3])-753):
        res = int(S[i:i+3])
print(abs(res-753))
Buggy code:
import numpy as np
S = input()
l = []
for i in range(len(S)-2):
    l.append(int(S[i:i+3]))
l_new = abs(np.array([l])-753)
min(l_new[0])

Fixed code:
import numpy as np
S = input()
l = []
for i in range(len(S)-2):
    l.append(int(S[i:i+3]))
l_new = abs(np.array([l])-753)
print(min(l_new[0]))
Buggy code:
data = [int(i) for i in input()]
ans = 999

for i in range(len(data) - 3):
  x = (data[i] * 100) + (data[i + 1] * 10) + (data[i + 2])
  ans = min(ans, abs(753 - x))
  
print(ans)

Fixed code:
data = [int(i) for i in input()]
ans = 999
 
for i in range(len(data) - 2):
  x = (data[i] * 100) + (data[i + 1] * 10) + (data[i + 2])
  ans = min(ans, abs(753 - x))
  
print(ans)
Buggy code:
S = input()
N = len(S)
m = 999
for i in range(N-2):
  M = abs(int(S[i:i+3]) - 754)
  m = min(m, M)
print(m)

Fixed code:
S = input()
N = len(S)
m = 999
for i in range(N-2):
  M = abs(int(S[i:i+3]) - 753)
  m = min(m, M)
print(m)
Buggy code:
a=input()
b=len(a)
c=[a[0+i:3+i] for i in range(b-2)]
d=[abs(int(j)-754) for j in c ]
print(min(d))



Fixed code:
a=input()
b=len(a)
c=[a[0+i:3+i] for i in range(b-2)]
d=[abs(int(j)-753) for j in c ]
print(min(d))
Buggy code:
A = input()
N=len(str(A))
for i in range(N-2):
  if i ==0:
    B=A[i:i+3]
    V=int(B)
  else:
    B=int(A[i:i+3])
    if abs(753-B)<=abs(753-V):
      V=B
print(V)
    
    

Fixed code:
A = input()
N=len(str(A))
for i in range(N-2):
  if i ==0:
    B=A[i:i+3]
    V=int(B)
  else:
    B=int(A[i:i+3])
    if abs(753-B)<=abs(753-V):
      V=B
print(abs(V-753))
Buggy code:
s=input()
ans=1000
for i in range(len(s)-2):
    a=abs(int(s[i:i+3])-753)
    if ans>a:
        ans=a
print(a) 

Fixed code:
s=input()
ans=1000
for i in range(len(s)-2):
    a=abs(int(s[i:i+3])-753)
    if ans>a:
        ans=a
print(ans)
Buggy code:
s=input()
ans=[]
for i in range(len(s)-2):
    ans = min(ans , abs(753-int(s[i:i+3])))
print(min(ans))

Fixed code:
s=input()
ans = 1000000000000000000
for i in range(len(s)-2):
    ans = min(ans, abs(int(s[i:i+3])-753))
print(ans)
Buggy code:
S = input()
Smin = 753
for i in range(len(S)-2):
  if Smin > 753-int(S[i:i+3]):
    Smin = 753-int(S[i:i+3])
print(Smin)

Fixed code:
S = input()
Smin = 753
for i in range(len(S)-2):
  if Smin > abs(753-int(S[i:i+3])):
    Smin = abs(753-int(S[i:i+3]))
print(Smin)
Buggy code:
s = input()
ans_set = []

for i in range(len(s)):
    x = abs(int(s[i:i+3])-753)
    ans_set[i] = x
ans = min(ans_set)
print(ans)

Fixed code:
s = input()
ans_set = [0] * len(s)

for i in range(len(s)):
    x = abs(int(s[i:i+3])-753)
    ans_set[i] = x
ans = min(ans_set)
print(ans)
Buggy code:
s=input()
i=2
l=[]
while i+1<len(s):
    l.append(abs(753-int(s[i-2]+s[i-1]+s[i])))
    i+=1
print(min(l))

Fixed code:
s=input()
i=2
l=[]
while i<len(s):
    l.append(abs(753-int(s[i-2]+s[i-1]+s[i])))
    i+=1
print(min(l))
Buggy code:
trget_num = 753
x = list(input())
list_len = len(x)
uv = list(map(int, x))
print(uv)

list_len = len(uv)
min_heigt = 1000
for x in range(list_len-2):
    nagasa = abs(trget_num - (uv[x] * 100 + uv[x+1] * 10 + uv[x + 2]))
    if min_heigt > nagasa:
        min_heigt = nagasa

print(min_heigt)

Fixed code:
trget_num = 753
x = list(input())
list_len = len(x)
uv = list(map(int, x))

list_len = len(uv)
min_heigt = 1000
for x in range(list_len-2):
    nagasa = abs(trget_num - (uv[x] * 100 + uv[x+1] * 10 + uv[x + 2]))
    if min_heigt > nagasa:
        min_heigt = nagasa

print(min_heigt)
Buggy code:
s = input()
d = 999
for i in range (len(s)-3):
  if abs(int(s[i:i+3]) - 753) < d:
    d = abs(int(s[i:i+3]) - 753)
print(d)

Fixed code:
s = input()
d = 999
for i in range (len(s)-2):
  if abs(int(s[i:i+3]) - 753) < d:
    d = abs(int(s[i:i+3]) - 753)
print(d)
Buggy code:
s = string(input())
m = 753
a = 999

for i in range(len(s)-2):
  #print(s[i:i+3])
  if abs(m - int(s[i:i+3])) < a:
    a = abs(m - int(s[i:i+3]))
print(a)

Fixed code:
s = input()
m = 753
a = 999

for i in range(len(s)-2):
  #print(s[i:i+3])
  if abs(m - int(s[i:i+3])) < a:
    a = abs(m - int(s[i:i+3]))
print(a)
Buggy code:
S = str(input())

L = []
K = []

for i in range(len(S)-2):
    L.append(int(S[0+i]+S[1+i]+S[2+i]))

for i in range(len(L)):

    K.append(753-abs(L[i]))
print(min(K))


Fixed code:
S = str(input())

L = []
K = []

for i in range(len(S)-2):
    L.append(int(S[0+i]+S[1+i]+S[2+i]))

for i in range(len(L)):

    K.append(abs(753-(L[i])))
print(min(K))
Buggy code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
min_ = inf
for i in range(len(s)-3):
  min_ = min(min_, abs(int(s[i:i+3])-753))
print(min_)
  
  
    










Fixed code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
min_ = inf
for i in range(len(s)-2):
  min_ = min(min_, abs(int(s[i:i+3])-753))
print(min_)
Buggy code:
S = input()
ans = 10000
for i in range(3,len(S)):
    ans = min(ans,abs(753 - int(S[i-3:i])))
print(ans)

Fixed code:
S = input()
ans = 10000
for i in range(3,len(S)+1):
    ans = min(ans,abs(753 - int(S[i-3:i])))
print(ans)
Buggy code:
S = input()
a = 100000
for i in range(len(S) - 2):
    s = int(S[i:i + 3])
    print(s)
    a = min(a, abs(753 - s))
print(a)


Fixed code:
S = input()
a = 100000
for i in range(len(S) - 2):
    s = int(S[i:i + 3])
    a = min(a, abs(753 - s))
print(a)
Buggy code:
S = input()
ans = 1e9
for i in range(len(S)-3):
  x = int(S[i:i+3])
  ans = min(ans, abs(753-x))
print(ans)

Fixed code:
S = input()
ans = 1e9
for i in range(len(S)-2):
  ans = min(ans, abs(753-int(S[i:i+3])))
print(ans)
Buggy code:
s = input()
g = float('inf')
for i in range(len(s)-2):
  if g > abs(int(s[i:i+3])-753):
  g = abs(int(s[i:i+3])-753)
print(g)

Fixed code:
s = input()
g = float('inf')
for i in range(len(s)-2):
  if g > abs(int(s[i:i+3])-753):
  	g = abs(int(s[i:i+3])-753)
print(g)
Buggy code:
s = input()
m = 1000
for i in range(len(s)-3):
  _s = int(s[i:i+3])
  d = abs(_s - 753)
  m = min(m, d)
print(m)

Fixed code:
s = input()
m = 1000
for i in range(len(s)-2):
  _s = int(s[i:i+3])
  d = abs(_s - 753)
  m = min(m, d)
print(m)
Buggy code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
S = list(input())

sublist = []
for i in range(len(s)-2):
    num =  int("".join(S[i:i+3]))
    sublist.append(num)

print(min(sublist))

Fixed code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
S = list(input())

sublist = []
for i in range(len(S)-2):
    num =  int("".join(S[i:i+3]))
    sublist.append(abs(num-753))

print(min(sublist))
Buggy code:
s = input()
err = []
for i in range(len(s) - 3):
  err.append(abs(int(s[i:i+3]), 753))
print(min(err))

Fixed code:
s = input()
err = []
for i in range(len(s) - 2):
  err.append(abs(int(s[i:i+3]) - 753))
print(min(err))
Buggy code:
s=input()
n=len(s)
k=1000
l=int(s)
for i in range(n-2):
    x=(l-(l//10**(n-i))*10**(n-i))//10**(n-3-i)
    print(x)
    if abs(x-753)<k:
        k=abs(x-753)
print(int(k))

Fixed code:
s=input()
n=len(s)
k=1000
l=int(s)
for i in range(n-2):
    x=(l-(l//10**(n-i))*10**(n-i))//10**(n-3-i)
    if abs(x-753)<k:
        k=abs(x-753)
print(int(k))
Buggy code:
l, ans = len(s), []
for i in range(0,l-2):
    n = s[i:i+3]
    ans.append(abs(753-int(n)))
print(min(ans))

Fixed code:
s = input()
l, ans = len(s), []
for i in range(0,l-2):
    n = s[i:i+3]
    ans.append(abs(753-int(n)))
print(min(ans))
Buggy code:
n = int(input())
sn = str(n)
minx = 0
temp = 754
sav = 0
for i in range(len(str(n//100))):
    minx = abs(753-int(sn[i:i+3]))
    if temp > minx:
        temp = minx
        sav = n3

print(sav)


Fixed code:
n = int(input())
sn = str(n)
n3 = 0
minx = 0
temp = 754
for i in range(len(str(n // 100))):
    n3 = int(sn[i : i + 3])
    minx = abs(753 - n3)
    if temp > minx:
        temp = minx

print(temp)
Buggy code:
s = input()
x = 753
res = 1000
for i in range(len(s)-3):
    e_s = s[i:i+3]
    res = min(res, abs(x - int(e_s)))
print(res)

Fixed code:
s = input()
x = 753
res = 1000
for i in range(len(s)-2):
    e_s = s[i:i+3]
    res = min(res, abs(x - int(e_s)))
print(res)
Buggy code:
S = input()
dis = 1e9
min = ""
for i in range(len(S) - 2):
  text = S[i:i+3]
  if abs(753 - int(text)) < dis:
    dis = abs(753 - int(text))
    min = text
print(text)

Fixed code:
S = input()
dis = 1e9
min = ""
for i in range(len(S) - 2):
  text = S[i:i+3]
  if abs(753 - int(text)) < dis:
    dis = abs(753 - int(text))
    min = dis
print(min)
Buggy code:
S = input()
l = len(S)
distance = 999
for i in range(l)
    num = int(S[i:i+3])
    if abs(num - 753) < distance:
        distance = abs(num - 753)
print(str(distance))

Fixed code:
S = input()
l = len(S)
distance = 999
for i in range(l):
    num = int(S[i:i+3])
    if abs(num - 753) < distance:
        distance = abs(num - 753)
print(str(distance))
Buggy code:
S = input()
num = ""
l = len(S)
dis = float("inf") 

for i in range(l-2):
    num = S[i:i+3]
    if abs(787-int(num)) < dis:
        dis = abs(753-int(num))
        
for i in range(l-3):
    num = S[i:i+4]
    if abs(787-int(num)) < dis:
        dis = abs(753-int(num))

print(dis)

Fixed code:
S = input()
num = ""
l = len(S)
dis = float("inf") 

for i in range(l-2):
    num = S[i:i+3]
    if abs(753-int(num)) < dis:
        dis = abs(753-int(num))
        
print(dis)
Buggy code:
w = list(input())
ans = float("inf")
for i in range(len(w)-2):
  c = abs(int("".join(w[i:i+3])))
  if c < ans:
    ans = c
print(ans)

Fixed code:
w = list(input())
ans = float("inf")
for i in range(len(w)-2):
  c = abs(int("".join(w[i:i+3]))-753)
  if c < ans:
    ans = c
print(ans)
Buggy code:
s = input()
res = 1000
for i in range(3, len(s)):
    res = min(res, abs(753-int(s[i-3:i])))
print(res)

Fixed code:
s = input()
res = 1000
for i in range(3, len(s)+1):
    res = min(res, abs(753-int(s[i-3:i])))
print(res)
Buggy code:
def B():
    S = (input())
    minA = 1000000000000000
    for i in range(3, len(S)):
        if abs(int(S[i - 3:i]) - 753) < minA:
            minA = abs(int(S[i - 3:i]) - 753)
    print(minA)
B()

Fixed code:

def B():
    S = input()
    minA = 1000000000000000
    for i in range(3, len(S) + 1):
        if abs(int(S[i - 3:i]) - 753) < minA:
            minA = abs(int(S[i - 3:i]) - 753)
    print(minA)
B()
Buggy code:
import math
s=list(input())
a=[]
for i in range(len(s)-2):
  p=100*int(s[i])+10*int(s[i+1])+int(s[i])
  a.append(abs(p-753))
print(min(a))

Fixed code:
import math
s=list(input())
a=[]
for i in range(len(s)-2):
  p=100*int(s[i])+10*int(s[i+1])+int(s[i+2])
  a.append(abs(p-753))
print(min(a))
Buggy code:
# input
S = input()
best = 753

# check
make_min_num = min(
    [
        abs(int("".join(S[i:i + 3])) - best)
        for i in range(0, len(S) - 3)
    ]
)

print(make_min_num)

Fixed code:
# input
S = input()
best = 753

# check
make_min_num = min(
    [
        abs(int("".join(S[i:i + 3])) - best)
        for i in range(0, len(S) - 2)
    ]
)

print(make_min_num)
Buggy code:
s = input()
list = []

for i in range(len(s)-3):
    list.append(abs(int(s[i:i+3]) - 753))
print(min(list))


Fixed code:
s = input()
list = []

for i in range(len(s)-2):
    list.append(abs(int(s[i:i+3]) - 753))
print(min(list))
Buggy code:
s = input()
mindif = int(s[0:3])
for i in range(0, len(s)-2):
    dif = abs(753-int(s[i:i+3]))
    if dif < mindif:
        mindif = dif
print(mindif)

Fixed code:
s = input()
mindif = abs(753 - int(s[0:3]))
for i in range(0, len(s)-2):
    dif = abs(753-int(s[i:i+3]))
    if dif < mindif:
        mindif = dif
print(mindif)