qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s = input()

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


Fixed code:
s = input()

ans = 999
for i in range(len(s)-2):
    temp = abs(int(s[i:i+3])-753)
    ans = min(ans, temp)
print(ans)
Buggy code:
s = input()
n = len(s)
lists = []
for i in range(n-3):
    lists.append(abs(int(s[i:i+3])-753))
print(min(lists))


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

print(min(lists))
Buggy code:
S=input()
m=999
for i in range(len(S)-2):
  d=753-int(S[i:i+3])
  if d<m:
    m=d
    
print(m)

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

ans = []

for i in range(2, len(S)):
    ans.append(abs(753 - int(S[i-2:i+1])))

print(min(ans), ans)
    


Fixed code:
S = input()

ans = []

for i in range(2, len(S)):
    ans.append(abs(753 - int(S[i-2:i+1])))

print(min(ans))
Buggy code:
s=input()
s=s[::-1]
print(s)
ans=10000
l=len(s)
for x in range(l-2):
    c=abs(753-(int(s[x])*100+int(s[x+1])*10+int(s[x+2])))
    if(x==0):
        ans=c
    elif(ans>c):
        ans=c


        
print(ans)

Fixed code:
s=input()


ans=10000
l=len(s)
for x in range(l-2):
    c=abs(753-(int(s[x])*100+int(s[x+1])*10+int(s[x+2])))
    if(x==0):
        ans=c
    elif(ans>c):
        ans=c


        
print(ans)
Buggy code:
num = input()
ans = []
for n in range(len(num)-3):
	tmp = int(num[n:n+3])
	i = 753 - tmp
	if i < 0:
		i *= -1
	ans.append(i)
print(min(ans))

Fixed code:
num = input()
ans = []
for n in range(len(num)-2):
	tmp = int(num[n:n+3])
	i = 753 - tmp
	if i < 0:
		i *= -1
	ans.append(i)
print(min(ans))
Buggy code:
S=str(input())
min_dif = 1000
for i in range(len(S)-2):
  dif = int(S[i:i+3])
  if min_dif > dif:
    min_dif = dif
print(dif)

Fixed code:
S=str(input())
min_dif = 1000
for i in range(len(S)-2):
  dif = abs( int(S[i:i+3]) - 753)
  if min_dif > dif:
    min_dif = dif
print(min_dif)
Buggy code:
S = input()
print(min((abs(765 - int(S[i:i+3])) 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:
Sstr = list(input())
S = [int(i) for i in Sstr]

bit=[]
for i in range(0,len(S)-1):
    bit.append([abs(7-S[i]),i])


bit.sort(key=lambda x : x[0])

j=0
start=[]
while bit[0][0] == bit[j][0]:
    start.append(bit[j][1])
    j+=1

test=0
ans=1000
for st in start:
    if len(S)-st >= 3:
        test=abs(753-(S[st]*100+S[st+1]*10+S[st+2]))
        if ans > test:
            ans=test
print(ans)

Fixed code:
Sstr = list(input())
S = [int(i) for i in Sstr]

bit=[]
for i in range(0,len(S)-2):
    bit.append([abs(7-S[i]),i])


bit.sort(key=lambda x : x[0])

j=0
start=[]

for j in range(len(bit)):
    if bit[0][0] == bit[j][0]:
        start.append(bit[j][1])
        j+=1
    else:
        break

test=0
ans=1000
for st in start:
    if len(S)-st >= 3:
        test=abs(753-(S[st]*100+S[st+1]*10+S[st+2]))
        if ans > test:
            ans=test
print(ans)
Buggy code:
n=input()
a=0
b=753
ans=100000000
for i in renge(len(n)-2):
	a=int(n[i])*100+int(n[i+1])*10+int(n[i+2])
    ans=min(abs(a-b),ans)
print(ans)

Fixed code:
n=input()
a=0
b=753
ans=100000000
for i in range(len(n)-2):
	a=int(n[i])*100+int(n[i+1])*10+int(n[i+2])
	ans=min(abs(a-b),ans)
print(ans)
Buggy code:
S = input()
l  = len(S)
NUM = 753
ans = 999999
for i in range(l-3):
  temp = int(S[i] + S[i+1]+S[i+2])
  if abs(NUM - temp) < ans:
    ans = abs(NUM - temp)
print(ans)

Fixed code:
S = input()
l  = len(S)
NUM = 753
ans = 999999
for i in range(l-2):
  temp = int(S[i] + S[i+1]+S[i+2])
  if abs(NUM - temp) < ans:
    ans = abs(NUM - temp)
print(ans)
Buggy code:
s=input()
n=len(s)
ans=[]
for i in range(n-3):
    temp=s[i:i+3]
    temp=int(temp)
    ans.append(abs(temp-753))
print(min(ans))


Fixed code:
s=input()
n=len(s)
ans=[]
for i in range(n-2):
    temp=int(s[i:i+3])
    ans.append(abs(temp-753))
print(min(ans))
Buggy code:
# -*- coding: utf-8 -*-
s = input()

diff = []
for i in range(len(s) - 3):
    diff.append(abs(753 - int(s[i:i+3])))

print(min(diff))

Fixed code:
# -*- coding: utf-8 -*-
s = input()

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

print(min(diff))
Buggy code:
x=input()
min_output=999

for i in range(len(x)-3):
    str_answer=x[i:i+3]
    int_answer=int(str_answer)
    output=abs(int_answer-753)
    min_output=min(min_output,output)

print(min_output)

Fixed code:
x=input()
min_output=999

for i in range(len(x)-2):
    str_answer=x[i:i+3]
    int_answer=int(str_answer)
    output=abs(int_answer-753)
    min_output=min(min_output,output)

print(min_output)
Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

S = int(input())

diff = 9999
for i in range(N-2):
    s = int(S[i:i+3])
    if abs(s - 753) < diff:
        diff = s - 753
print(diff)


Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

S = input()

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

arr = []

for i in range(0, len(s) - 2):
    arr.append(753 - int(str(s[i]) + str(s[i + 1]) + str(s[i + 2])))

print(min(arr))

Fixed code:
s = input()

arr = []

for i in range(0, len(s) - 2):
    arr.append(abs(753 - int(str(s[i]) + str(s[i + 1]) + str(s[i + 2]))))

print(min(arr))
Buggy code:
S = input()
min = 1000
for i in range(len(S)-2):
    X = S[i:i+3]
    print(X)
    X = int(X)
    d = abs(753 - X)
    if d < min:
        min = d
    
print(d)

Fixed code:
S = input()
min = 1000
for i in range(len(S)-2):
    X = S[i:i+3]
    X = int(X)
    d = abs(753 - X)
    if d < min:
        min = d
    
print(min)
Buggy code:
s=input()
l=len(s)
T=753
c=[None]*(l-2)
for s in range(l-2):
	c[s]=abs(int(s[s:(s+3)])-T)
print(min(c))


Fixed code:
s=input()
l=len(s)
T=753
c=[None]*(l-2)
for sp in range(l-2):
	c[sp]=abs(int(s[sp:(sp+3)])-T)
print(min(c))
Buggy code:
s = input()
t = 753
ans = 1000000
for i in range(len(s)-2):
  ans = min(abs(s[i:i+3]-t))
print(ans)

Fixed code:
s = input()
t = 753
ans = 1000000
for i in range(len(s)-2):
  ans = min(abs(int(s[i:i+3])-t), ans)
print(ans)
Buggy code:
s = list(input())
ans = 753 - int(s[0] + s[1] + s[2])
for i in range (8):
  num = s[i] + s[i+1] + s[i+2]
  if ans > abs(int(num)-753):
    ans = abs(int(num)-753)
print(ans)

Fixed code:
s = list(input())
ans = abs(753 - int(s[0] + s[1] + s[2]))
for i in range (len(s) - 2):
  num = s[i] + s[i+1] + s[i+2]
  if ans > abs(int(num)-753):
    ans = abs(int(num)-753)
print(ans)
Buggy code:
S=input()
d=999999999
for i in range(0,len(S)-3):
  temp=int(S[i:i+3])
  dd=abs(753-temp)
  if dd<=d:
    d=dd
print(d)

Fixed code:
S=input()
d=999999999
for i in range(0,len(S)-2):
  temp=int(S[i:i+3])
  dd=abs(753-temp)
  if dd<=d:
    d=dd
print(d)
Buggy code:
s = input()
lst = []
for i in range(len(s)-2):
    lst.append(abs(int(s[i:i+3]) -753))
for i in range(len(s)-3):
    lst.append(abs(int(s[i:i+4]) -753))
print(min(lst))

Fixed code:
s = input()
lst = []
for i in range(len(s)-2):
    lst.append(abs(int(s[i:i+3]) -753))
print(min(lst))
Buggy code:
num = input()
li = []

for i in range(len(num) - 2):
  li.append(abs(int(num[i]) * 100 + int(num[i+1] * 10) + int(num[i+2]) - 753))

print(min(li))

Fixed code:

num = input()
li = []

for i in range(len(num) - 2):
  li.append(abs(int(num[i]) * 100 + int(num[i+1]) * 10 + int(num[i+2]) - 753))

print(min(li))
Buggy code:
S=list(input())
ans=10**10
for i in range(8):
    if abs(753-int(''.join(S[i:i+3])))<ans:
        ans=abs(753-int(''.join(S[i:i+3])))
print(ans)

Fixed code:
S=list(input())
ans=10**10
for i in range(len(S)-2):
    if abs(753-int(''.join(S[i:i+3])))<ans:
        ans=abs(753-int(''.join(S[i:i+3])))
print(ans)
Buggy code:
S = input()
S_sub = []
for i in range(len(S)-2):
    S_sub.append(S[i: i +3])
print(S_sub)
for i in range(len(S_sub)):
    S_sub[i] = int(S_sub[i])
S_sub_mi = [0]*len(S_sub)
for i in range(len(S_sub)):
    S_sub_mi[i] = 753 - S_sub[i]
print(S_sub[S_sub_mi.index(min(S_sub_mi))])

Fixed code:
S = input()
S_sub = []
for i in range(len(S)-2):
    S_sub.append(int(S[i: i +3]))
S_sub_mi = [0]*len(S_sub)
for i in range(len(S_sub)):
    S_sub_mi[i] = abs(753 - S_sub[i])
print(min(S_sub_mi))
Buggy code:
num_str = input()

min_num = 753
for i in range(len(num_str) - 3):
  cur_num = int(num_str[i:i+3])
  sub_num = abs(753 - cur_num)
  min_num = min(sub_num, min_num)
  if min_num == 0:
    break
    
print(min_num)

Fixed code:
num_str = input()
 
min_num = 753
for i in range(len(num_str) - 2):
  cur_num = int(num_str[i:i+3])
  sub_num = abs(753 - cur_num)
  min_num = min(sub_num, min_num)
  if min_num == 0:
    break
    
print(min_num)
Buggy code:
if __name__ == '__main__':
    s = list(input())
    l = [int(s[i]) for i in range(len(s))] 
    ans = 999
    n=753
    for i in range(len(l)-3):
        num = int(l[i]*100 + l[i+1]*10 + l[i+2])
        res = abs(n-num)
        if ans > res:
            ans = res
    print(int(ans))

Fixed code:
if __name__ == '__main__':
    s = list(input())
    l = [int(s[i]) for i in range(len(s))] 
    ans = 999
    n=753
    for i in range(len(l)-2):
        num = int(l[i]*100 + l[i+1]*10 + l[i+2])
        res = abs(n-num)
        if ans > res:
            ans = res
    print(int(ans))
Buggy code:
s=input()
n=len(s)
minnum=100000
for i in range(n-2):
    check=s[i:i+3]
    print(check)
    check=abs(753-int(check))
    minnum=min(minnum,check)
print(minnum)

Fixed code:
s=input()
n=len(s)
minnum=100000
for i in range(n-2):
    check=s[i:i+3]
    check=abs(753-int(check))
    minnum=min(minnum,check)
print(minnum)
Buggy code:
S = list(input())

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

Fixed code:
S = list(input())

ans = 10 ** 10
for i in range(len(S) - 2):
    tmp = 100 * int(S[i])  + 10 * int(S[i+1]) + int(S[i+2])
    
    ans = min(abs(753 - tmp), ans)
    
print(ans)
Buggy code:
a=input()
ans=999

for i in range(len(a)-2):
  ans=min(ans,abs(753-int(a[i:i+2])))
  
print(ans)

Fixed code:
a=input()
ans=999

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

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

print(min([abs(int(s[i]+s[i+1]+s[i+2]))-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()
mi = 9999999
for i in range(len(S) - 2):
  mi = min(mi, int(S[i]+S[i+1]+S[i+2]))
print(mi)

Fixed code:
S = input()
mi = 9999999
for i in range(len(S) - 2):
  mi = min(mi, abs(753 - int(S[i]+S[i+1]+S[i+2])))
print(mi)
Buggy code:
S = input()
l = []
for i in range(len(S)-2):
  l.append(abs(int(S[i:i+2])-753))

print(min(l))

Fixed code:
S = input()
l = []
for i in range(len(S)-2):
  l.append(abs(int(S[i:i+3])-753))
     
print(min(l))
Buggy code:
s=int(input())
ans=753
while ans>99:
  ans=min(ans,abs(s%1000-753))
  ans=ans//10
print(ans)

Fixed code:
s=int(input())
ans=753
while s>99:
  ans=min(ans,abs(s%1000-753))
  s=s//10
print(ans)
Buggy code:
S = list(input())
l = []
for i in range(int(len(S))):
    l.append(753 - int(''.join(S[i:i+3])))
print(min(l))

Fixed code:
S = list(input())
l = []
for i in range(int(len(S))):
    if (int(len(S[i:i+3]))) == 3:
        l.append(abs(753 - int(''.join(S[i:i+3]))))
print(min(l))
Buggy code:
s = input()
check = float('inf')
for i in range(len(s)-3):
  check = min(check, abs(753-int(s[i:i+3])))
print(check)

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

listS = list(s)

listA = []
listB = []


for i in range(len(listS)-2):
	for j in range(3):
		n = int(listS[j+i])
		listA.append(n)
	Sm =listA[0]*100+listA[1]*10+list{2}
	sa= abs(int(753) - Sm)
	listB.append(sa)

	listA.clear()

print(min(listB))


Fixed code:
s = input()
listS = list(s)
listA = []
listB = []
for i in range(len(listS)-2):
	for j in range(3):
		n = int(listS[j+i])
		listA.append(n)
	Sm =listA[0]*100+listA[1]*10+listA[2]
	sa= abs(int(753) - Sm)
	listB.append(sa)
	listA.clear()
print(min(listB))
Buggy code:
s = input()
Min = (min(abs(753-int(s[i:i+3]))) for i in range(len(s)-2))
print(Min)

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

best = 99999999999
for i in range (0,length-2):
    num = int(s[i:i+3])
    print(num)
    if abs(753-num)<best:
        best = abs(753-num)

print (best)
    
    


Fixed code:
s=""
s = input()
length = len(s)

best = 99999999999
for i in range (0,length-2):
    num = int(s[i:i+3])
    if abs(753-num)<best:
        best = abs(753-num)

print (best)
Buggy code:
s = list(map(int, input()))
print(min(abs(s[i+2]*100+s[i+1]*10+s[i]-753)) for i in range(len(s)-2)

Fixed code:
s = list(map(int, input()))
print(min(abs(s[i+2]+s[i+1]*10+s[i]*100-753) for i in range(len(s)-2)))
Buggy code:
list = input()

list_int = [int(ele) for ele in list]

print(list)
print(list_int)
min = 10000

for i in range(0, len(list)-2):
    x = abs( list_int[i] * 100 + list_int[i+1] * 10 + list_int[i+2] - 753)
    if x < min:
        min = x

print(min)

Fixed code:
list = input()

list_int = [int(ele) for ele in list]

min = 10000

for i in range(0, len(list)-2):
    x = abs( list_int[i] * 100 + list_int[i+1] * 10 + list_int[i+2] - 753)
    if x < min:
        min = x

print(min)
Buggy code:
s = input()

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

Fixed code:
s = input()

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

print(abs(max(ans)-753))

Fixed code:
S = input()
list = []
for i in S:
    list.append(int(i))
n = len(S)
ans =[]
Ans =[]
for i in range(n-2):
    ans.append(100*list[i]+10*list[i+1]+list[i+2])
for i in range(n-2):
     Ans.append(abs(ans[i]-753))
print(min(Ans))
Buggy code:
def main42():
    data = input()
    nagasa = len(data)
    result = 10000
    for i in range(0,nagasa-2,1):
        kari = data[i:i+3]
        num = int(kari)
        if result > abs(num - 753)

if __name__ == "__main__":
    main42()

Fixed code:
def main42():
    data = input()
    nagasa = len(data)
    result = 10000
    for i in range(0,nagasa-2,1):
        kari = data[i:i+3]
        num = int(kari)
        if result > abs(num - 753):
            result = abs(num - 753)
    print(result)

if __name__ == "__main__":
    main42()
Buggy code:
import math
s = list(input())

total = 753
for i in range(len(s) - 3):
    a = int(s[i]) * 100 + int(s[i+1]) * 10 + int(s[i+2])
    if total > abs(a - 753):
        total = abs(a - 753)
print(total)


Fixed code:
import math
s = list(input())

total = 753
for i in range(len(s) - 2):
    a = int(s[i]) * 100 + int(s[i+1]) * 10 + int(s[i+2])
    if total >= abs(a - 753):
        total = abs(a - 753)

print(total)
Buggy code:
s=input()
lenlen=len(s)
sa=100000
for i in range(0,lenlen-2):
  sasa=abs(753-int(s[i:i+3]))
  if sasa<=sa:
    sa=sasa
print(sasa)
  

Fixed code:
s=input()
lenlen=len(s)
sa=100000
for i in range(0,lenlen-2):
  sasa=abs(753-int(s[i:i+3]))
  if sasa<=sa:
    sa=sasa
print(sa)
Buggy code:
a=input()
x=abs(int(a[0])*100+int(a[1])*10+int(a[2])-753)
for i in range(i-2)
if abs(int(a[i])*100+int(a[i+1])*10+int(a[i+2])-753)<=x:
    x=abs(int(a[i])*100+int(a[i+1])*10+int(a[i+2])-753)

Fixed code:
a=input()
x=abs(int(a[0])*100+int(a[1])*10+int(a[2])-753)
for i in range(len(a)-2):
    if abs(int(a[i])*100+int(a[i+1])*10+int(a[i+2])-753)<=x:
        x=abs(int(a[i])*100+int(a[i+1])*10+int(a[i+2])-753)
print(x)
Buggy code:
s = input()

ans =[]

for i in range(:len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans()):
  num.append(abs(754-ans[i]))
               
num.sort()
               
print(num[0]

Fixed code:
s = input()

ans =[]

for i in range(len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans)):
  num.append(abs(753-int(ans[i])))
               
num.sort()
               
print(num[0])
Buggy code:
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

Fixed code:
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
ans = 753
for i in range(len(s) - 2):
    num = int(s[i:i+3])
    ans = min(ans, abs(num-753))
print(ans)
Buggy code:
S = input()
diff = 1000
for i in range(len(S)-2):
    S_int = int(S[i:i+3])
    diff = min(diff, abs(753-S_int)
print(diff)


Fixed code:
S = input()
diff = 1000
for i in range(len(S)-2):
    S_int = int(S[i:i+3])
    diff = min(diff, abs(753-S_int))
print(diff)
Buggy code:
S=input()
d=10**4
for i in range(len(S)-3):
  dd=abs(753-int(S[i:i+3]))
  d=min(d,dd)
print(d)


Fixed code:
S=input()
d=10**4
for i in range(len(S)-2):
  dd=abs(753-int(S[i:i+3]))
  d=min(d,dd)
print(d)
Buggy code:
s = input()
minvalue = 1000
for i in range(n-2):
  x = int(s[i:i+3])
  minvalue = min(minvalue,abs(x-753))
print(minvalue)

Fixed code:
s = input()
minvalue = 1000
for i in range(len(s)-2):
  x = int(s[i:i+3])
  minvalue = min(minvalue,abs(x-753))
print(minvalue)
Buggy code:
s = input()
ans = 1000
n = 0
for i in range(0:len(s)-2):
  n = int(s[i] + s[i+1] + s[i+2])
  ans = min(ans,abs(n-753))
print(ans)

Fixed code:
s = input()
ans = 1000
n = 0
for i in range(0,len(s)-2):
  n = int(s[i] + s[i+1] + s[i+2])
  ans = min(ans,abs(n-753))
print(ans)
Buggy code:
s = input()
min_ = 10**18
for i in range(len(s)-3):
  min_ = min(min_, abs(753 - int(s[i:i+3])))

Fixed code:
s = input()
min_ = 10**18
for i in range(len(s)-2):
  min_ = min(min_, abs(753 - int(s[i:i+3])))

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

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

Fixed code:
s=input()
a=1000
for i in range(len(s)-2):
  x=int(s[i:i+3])
  a=min(a,abs(x-753))
print(a)
Buggy code:
from math import log10
a=int(input())
tmp=1000000

for i in range(1,int(log10(a))):
    c=(int(a/pow(10,i)%1000))
    b=abs(int(a/pow(10,i)%1000)-753)
    if tmp>b:tmp=b

print(tmp)

Fixed code:
from math import log10
a=int(input())
tmp=1000000

for i in range(int(log10(a))):
    c=(int(a/pow(10,i)%1000))
    b=abs(int(a/pow(10,i)%1000)-753)
    if tmp>b:tmp=b

print(tmp)
Buggy code:
S = input()

num_len = 999
for i in range(len(S)-2):
    X = int(S[i:i+3])
    print(X)
    num_len = min(num_len, abs(753-X))

print(num_len)

Fixed code:
S = input()

num_len = 999
for i in range(len(S)-2):
    X = int(S[i:i+3])
    num_len = min(num_len, abs(753-X))

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

Fixed code:
S = input()
ans = 1000000000;
for i in range(len(S) - 2):
    X = int(S[i] + S[i + 1] + S[i + 2])
    ans = min(ans, abs(X - 753))
print(ans)
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()
n = len(s)
ans = 999
for i in range(n-3):
    kar = int(s[i:i+3])

    ans = min(ans,abs(kar-753)) 
print(ans)

Fixed code:
s = input()
n = len(s)
ans = 999
for i in range(n-2):
    kar = int(s[i:i+3])

    ans = min(ans,abs(kar-753)) 
print(ans)
Buggy code:
x = input()
min = 999 - 753
for i in range(0, len(x) - 2):
    a = x[i] + x[i + 1] + x[i + 2]
    b = abs(753 - int(a))
    if b < min:
        min = b
print(min)

Fixed code:
x = input()
min = 0
for i in range(0, len(x) - 2):
    a = x[i] + x[i + 1] + x[i + 2]
    b = abs(753 - int(a))
    if i == 0:
        min = b
    elif b < min:
        min = b
print(min)
Buggy code:
list = int(input().split())
num = []
ans = 753
for i in range(len(list)-2):
  num.append((list[i] * 100) + (list[i+1] * 10) + list[i+2])
  if(num[i] >= 753):
    if(ans >= (num[i] - 753)):
      ans = num[i] - 753
  else:
    if(ans > (753 - ans[i])):
      ans = 753 - ans[i]
print(ans)

Fixed code:
s = input()
list = [int(c) for c in s]
num = []
ans = 753
for i in range(len(list)-2):
	num.append((list[i] * 100) + (list[i+1] * 10) + list[i+2])
	if(num[i] >= 753):
		if(ans >= (num[i] - 753)):
			ans = num[i] - 753
	else:
		if(ans > (753 - num[i])):
			ans = 753 - num[i]
print(ans)
Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8-*-
if __name__ == '__main__':
    s = input()
    r = 1000
    for i in range(len(s)-3):
        t = int(s[i:i+3])
        t -= 753
        if t < 0:
            t = t * -1
        if t < r:
            r = t
    print(r)


Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8-*-
if __name__ == '__main__':
    s = input()
    r = 1000
    for i in range(len(s)-2):
        t = int(s[i:i+3])
        t -= 753
        if t < 0:
            t = t * -1
        if t < r:
            r = t
    print(r)
Buggy code:
x = 753
s = int(input())
ans=100
for i in range(len(s)-2):
	if(abs(x-int(s[i:i+3]))<ans):
		ans=abs(x-int(s[i:i+3))
print(ans)

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

Fixed code:
x = 753
s = input()
ans=10**10
for i in range(len(s)-2):
	if(abs(x-int(s[i:i+3]))<ans):
		ans=abs(x-int(s[i:i+3]))
print(ans)
Buggy code:
s=input()
d=999
import re
l=[[7],[6,8],[5,9]]+[[x] for x in range(4,0,-1)]
for n in l:
  for j in n:
    for i in re.findall('(?=('+str(j)+'..))',s):
      print(i)
      d=min(d,abs(753-int(i)))
  if d<800:break
print(d)

Fixed code:
s=input()
d=999
import re
l=[[7],[6,8],[5,9]]+[[x] for x in range(4,0,-1)]
for n in l:
  for j in n:
    for i in re.findall('(?=('+str(j)+'..))',s):
      d=min(d,abs(753-int(i)))
  if d<800:break
print(d)
Buggy code:
s = input()

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


Fixed code:
s = input()

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

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