qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N, M = map(int, input().split())
S = [list(input().split()) for _ in range(N)]
C = [list(input().split()) for _ in range(M)]
for a, b in S:
    dist = [abs(a-c) + abs(b-d) for c, d in C]
    print(dist[dist.index(min(dist))])


Fixed code:
N, M = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]
C = [list(map(int, input().split())) for _ in range(M)]
for a, b in S:
    dist = [abs(a-c) + abs(b-d) for c, d in C]
    print(dist.index(min(dist))+1)
Buggy code:
N, M =map(int, input().split())
a, b = [0]*N, [0]*N
c, d = [0]*N, [0]*N
ans = []
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(M):
    c[i], d[i] = map(int, input().split())
    

for i in range(N):
    length = 10**9
    ind = 0
    for j in range(M):
        man =  abs(a[i] - c[j])+abs(b[i] - d[j])
        if length > man:
            length = man
            ind = j+1
    ans.append(ind)

for i in ans:
    print(i)

Fixed code:
N, M =map(int, input().split())
a, b = [0]*N, [0]*N
c, d = [0]*M, [0]*M
ans = []
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(M):
    c[i], d[i] = map(int, input().split())
    

for i in range(N):
    length = 10**9
    ind = 0
    for j in range(M):
        man =  abs(a[i] - c[j])+abs(b[i] - d[j])
        if length > man:
            length = man
            ind = j+1
    ans.append(ind)

for i in ans:
    print(i)
Buggy code:
N, M = map(int, input().split())
stu = []
for _ in range(N):
  stu.append(tuple(map(int, input().split())))
che = []
for _ in range(M):
  che.append(tuple(map(int, input().split())))

for i in range(N):
  ans = 0
  min_l = pow(10, 10)
  for j in range(M):
    l = abs(stu[i][0] - che[i][0]) + abs(stu[i][1] - che[i][1])
    if l < min_l:
      min_l = l
      ans = j+1
  print(ans)

Fixed code:
N, M = map(int, input().split())
stu = []
for _ in range(N):
  stu.append(tuple(map(int, input().split())))
che = []
for _ in range(M):
  che.append(tuple(map(int, input().split())))

for i in range(N):
  ans = 0
  min_l = pow(10, 10)
  for j in range(M):
    l = abs(stu[i][0] - che[j][0]) + abs(stu[i][1] - che[j][1])
    if l < min_l:
      min_l = l
      ans = j+1
  print(ans)
Buggy code:
N,M = map(int,input().split())
Ls = []
Lp = []
for i in range(N):
    a,b = map(int,input().split())
    Ls.append(a)
    Ls.append(b)
for m in range(M):
    c,d = map(int,input().split())
    Lp.append(c)
    Lp.append(d)

for i in range(N):
    for m in range(M):
        dis = list(abs(Ls[i][0]-Lp[m][0])+abs(Ls[i][1]-Lp[m][1]))
    print(dis.index(min(dis))+1)

Fixed code:
N,M = map(int,input().split())
Ls = []
Lp = []
for i in range(N):
    a,b = map(int,input().split())
    Ls.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    Lp.append([c,d])
for i in range(N):
    dis = []
    for m in range(M):
        dis.append(abs(Ls[i][0]-Lp[m][0])+abs(Ls[i][1]-Lp[m][1]))
    print(dis.index(min(dis))+1)
Buggy code:
#ABC057.B
N,M = int(input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

L3 = []
for j in range(N):
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0])+abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3[j])+1))

Fixed code:
#ABC057.B
N,M = map(int,input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)
Buggy code:
n, m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
cd = [list(map(int,input().split())) for _ in range(m)]

result = []
for a, b in ab:
    tmp = []
    for c, d in cd:
        tmp.append(abs(a-c) + abs(c-d))
    result.append(tmp.index(min(tmp)) +1)
for ans in result:
    print(ans)


Fixed code:
n, m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
cd = [list(map(int,input().split())) for _ in range(m)]

result = []
for a, b in ab:
    tmp = []
    for c, d in cd:
        tmp.append(abs(a-c) + abs(b-d))
    result.append(tmp.index(min(tmp)) +1)
for ans in result:
    print(ans)
Buggy code:
N, M = map(int, input().split())

ab = [map(int, input().split()) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for n in range(N):
    ans = []
    a, b = ab[n]
    for m in range(M):
        c, d = cd[m]
        distance = abs(a - c) + abs(b - d)
        ans.append(distance)
    print(ans.index(min(ans)))

Fixed code:
N, M = map(int, input().split())

ab = [map(int, input().split()) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for n in range(N):
    ans = []
    a, b = ab[n]
    for m in range(M):
        c, d = cd[m]
        distance = abs(a - c) + abs(b - d)
        ans.append(distance)
    print(ans.index(min(ans)) + 1)
Buggy code:
n,m=map(int,input().split())
A=[]
B=[]
for i in range(n):
  A.append(list(map(int,input().split())))
for i in range(m):
  B.append(list(map(int,input().split())))

for i in range(n):
  man=1000000000
  ans=0
  for j in range(m):
    if abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])<man:
      man=abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])
      ans=j
  print(ans)

Fixed code:
n,m=map(int,input().split())
A=[]
B=[]
for i in range(n):
  A.append(list(map(int,input().split())))
for i in range(m):
  B.append(list(map(int,input().split())))

for i in range(n):
  man=1000000000
  ans=0
  for j in range(m):
    if abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])<man:
      man=abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])
      ans=j+1
  print(ans)
Buggy code:
N, M = map(int, input().split())
a, b, c, d = [],[],[],[]

for i in range(N):
  ai, bi = map(int, input().split())
  a.append(ai)
  b.append(bi)
#  print(a, b)
for j in range(M):
  cj, dj = map(int, input().split())
  c.append(cj)
  d.append(dj)
  
#print(a,b,c,d)
  
for i in range(N):
  dist, min_dist = 0, INF
  ans = 1
  for j in range(M):
    dist = abs(c[j] - a[i]) + abs(d[j] - b[i])
    if dist < min_dist:
      ans = j+1
      min_dist = dist
#    print("ai:{}, bi:{}, cj:{}, dj:{}, dist:{}, ans:{}".format(a[i], b[i], c[j], d[j], dist, ans))
#    print("i:{}, j:{}, dist:{}, min_dist:{}, ans:{}".format(i, j, dist, min_dist, ans))
#    min_dist = min(dist, min_dist)
  print(ans)

Fixed code:
N, M = map(int, input().split())
a, b, c, d = [],[],[],[]

for i in range(N):
  ai, bi = map(int, input().split())
  a.append(ai)
  b.append(bi)
#  print(a, b)
for j in range(M):
  cj, dj = map(int, input().split())
  c.append(cj)
  d.append(dj)
  
#print(a,b,c,d)
  
for i in range(N):
  dist, min_dist = 0, 10**9
  ans = 1
  for j in range(M):
    dist = abs(c[j] - a[i]) + abs(d[j] - b[i])
    if dist < min_dist:
      ans = j+1
      min_dist = dist
#    print("ai:{}, bi:{}, cj:{}, dj:{}, dist:{}, ans:{}".format(a[i], b[i], c[j], d[j], dist, ans))
#    print("i:{}, j:{}, dist:{}, min_dist:{}, ans:{}".format(i, j, dist, min_dist, ans))
#    min_dist = min(dist, min_dist)
  print(ans)
Buggy code:
N, M = map(int, input().split())

student = [  tuple( map(int, input().split()) ) for x in range(N)]
point = [ tuple( map(int, input().split()) ) for x in range(M)]


for (x1, y1) in point :
    data =  [ abs(x1 - x2) + abs(y1 - y2) for (x2, y2) in student ]
    ans = data.index(min(data))
    print(ans + 1)

Fixed code:
N, M = map(int, input().split())

student = [  tuple( map(int, input().split()) ) for x in range(N)]
point = [ tuple( map(int, input().split()) ) for x in range(M)]


for (x1, y1) in student :
    data =  [ abs(x1 - x2) + abs(y1 - y2) for (x2, y2) in point ]
    ans = data.index(min(data))
    print(ans + 1)
Buggy code:
n,m=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
x=[]
y=[]
l=[]
p=[]
for i in range(n):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
for j in range(m):
    ci,di=map(int,input().split())
    c.append(ci)
    d.append(di)
    
for i in range(n):
    for j in range(m):
        x.append(abs(a[i]-c[j]))
        y.append(abs(b[i]-d[j]))
        l.append(x[i]+y[i])
        p.append(l.index(min(l)))
        l=[]
        
for i in range(n):
    print(p[i])

Fixed code:
n,m=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
x=[]
y=[]
l=[]
p=[]

for i in range(n):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
    
for j in range(m):
    ci,di=map(int,input().split())
    c.append(ci)
    d.append(di)
    
for i in range(n):
    for j in range(m):
        x.append(abs(a[i]-c[j]))
        y.append(abs(b[i]-d[j]))
        l.append(x[j+i*m]+y[j+i*m])
    
    p.append(l.index(min(l))+1)   
    l=[]
    #x=[]
    #y=[]
    
for i in range(n):
    print(p[i])
Buggy code:
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
c=[0]*m
d=[0]*m
ans=[0]*n

for i in range(n):
    a[i],b[i]=map(int,input().split())
for i in range(m):
    c[i],d[i]=map(int,input().split())
    
for i in range(n):
    dis=[-1]*2
    for j in range(m):
        dis[1]=abs(a[i]-c[j])+abs(b[i]-d[j])
        if (dis[0]<0):
            ans[i]=j+1
        else:
            if (dis[0]>dis[1]):
                ans[i]=j+1
        dis[0]=dis[1]
for i in range(n):
    print(ans[i])

Fixed code:
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
c=[0]*m
d=[0]*m
ans=[0]*n

for i in range(n):
    a[i],b[i]=map(int,input().split())
for i in range(m):
    c[i],d[i]=map(int,input().split())
    
for i in range(n):
    dis=[-1]*3
    for j in range(m):
        dis[1]=abs(a[i]-c[j])+abs(b[i]-d[j])
        if (dis[0]<0):
            ans[i]=j+1
            dis[2]=dis[1]
        else:
            if (dis[2]>dis[1]):
                ans[i]=j+1
                dis[2]=dis[1]
        dis[0]=dis[1]
for i in range(n):
    print(ans[i])
Buggy code:
students = []
for _ in range(N):
    l = list(map(int,input().split()))
    students.append(l)

check_points = []

for _ in range(M):
    l = list(map(int,input().split()))
    check_points.append(l)

minimum_points = 0

for person in students:
    minimum = 10**10
    for i in range(len(check_points)):
        d=abs(person[0]-check_points[i][0])+abs(person[1]-check_points[i][1])
        if minimum > d:
            minimum = d
            minimum_points = i
    print(minimum_points+1)


Fixed code:
N, M = map(int,input().split())
students = []
for _ in range(N):
    l = list(map(int,input().split()))
    students.append(l)

check_points = []

for _ in range(M):
    l = list(map(int,input().split()))
    check_points.append(l)

minimum_points = 0

for person in students:
    minimum = 10**10
    for i in range(len(check_points)):
        d=abs(person[0]-check_points[i][0])+abs(person[1]-check_points[i][1])
        if minimum > d:
            minimum = d
            minimum_points = i
    print(minimum_points+1)
Buggy code:

if __name__ == '__main__':
    a, b = map(int, input().split())
    lista=[]
    for i in range(a):
        c = [int(i) for i in input().split()]
        lista.append(c)

    listb=[]
    for i in range(b):
        c = [int(i) for i in input().split()]
        listb.append(c)

    listc =[]

    for i in lista:
        min = 51*51
        minroot=-1
        for j in range(len(listb)):
            root = (i[0] - listb[j][0])  + (i[1] - listb[j][1])
            if root <min:
                min =root
                minroot=j+1
        listc.append(minroot)
    for i in listc:
        print(i)


Fixed code:

if __name__ == '__main__':
    a, b = map(int, input().split())
    lista=[]
    for i in range(a):
        c = [int(i) for i in input().split()]
        lista.append(c)

    listb=[]
    for i in range(b):
        c = [int(i) for i in input().split()]
        listb.append(c)

    listc =[]

    for i in lista:
        min = 10**9
        minroot=-1
        for j in range(len(listb)):
            root = abs(i[0] - listb[j][0])  + abs(i[1] - listb[j][1])
            if root <min:
                min =root
                minroot=j+1
        listc.append(minroot)
    for i in listc:
        print(i)
Buggy code:
N,M = map(int,input().split())
A = []
B = []
C = []
D = []
ans = []

for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

for j in range(M):
    c,d = map(int,input().split())
    C.append(c)
    D.append(d)

for i in range(N):
    item = abs(A[i]-C[0])-abs(B[i]-D[0])
    index = 1
    for j in range(M):
        if item > abs(A[i]-C[j])-abs(B[i]-D[j]):
            item = abs(A[i]-C[j])-abs(B[i]-D[j])
            index = j+1
            print(index)

for i in range(len(ans)):
    print(ans[i])

Fixed code:
N,M = map(int,input().split())
A = []
B = []
C = []
D = []
ans = []

for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

for j in range(M):
    c,d = map(int,input().split())
    C.append(c)
    D.append(d)

for i in range(N):
    item = abs(A[i]-C[0])+abs(B[i]-D[0])
    index = 1
    for j in range(M):
        if item > abs(A[i]-C[j])+abs(B[i]-D[j]):
            item = abs(A[i]-C[j])+abs(B[i]-D[j])
            index = j+1
    ans.append(index)

for i in range(len(ans)):
    print(ans[i])
Buggy code:
N,M=map(int, input().split())
S=[]
for i in range(N):
    a,b=map(int, input().split())
    S.append((a,b))

C=[]
for i in range(M):
    c,d=map(int, input().split())
    C.append((c,d,i+1))
print(C)
for s in S:
    a,b=s
    now=0
    dis=10**9

    for t in C:
        c,d,n=t
        D=abs(c-a)+abs(d-b)
        
        if D<dis:
            dis=D
            now=n
    print(now)

Fixed code:
N,M=map(int, input().split())
S=[]
for i in range(N):
    a,b=map(int, input().split())
    S.append((a,b))

C=[]
for i in range(M):
    c,d=map(int, input().split())
    C.append((c,d,i+1))
#print(C)
for s in S:
    a,b=s
    now=0
    dis=10**9

    for t in C:
        c,d,n=t
        D=abs(c-a)+abs(d-b)
        
        if D<dis:
            dis=D
            now=n
    print(now)
Buggy code:
a = list(map(int,input().split(" ")))
b = list()
c = list()
ans = list()

for i in range(a[0]):
    b.append(list(map(int,input().split(" "))))

for i in range(a[1]):
    c.append(list(map(int,input().split(" "))))

for i in range(a[0]):
    d = 0
    e = 99999999
    for ii in range(a[1]):
        if e > abs(b[i][0] - c[ii][0]) + abs(b[i][1] - c[ii][1]):
            d = ii
    ans.append(d)
    
for i in range(a[0]):
    print(ans[i])


Fixed code:
a = list(map(int,input().split(" ")))
b = list()
c = list()
ans = list()

for i in range(a[0]):
    b.append(list(map(int,input().split(" "))))

for i in range(a[1]):
    c.append(list(map(int,input().split(" "))))

for i in range(a[0]):
    d = 0
    e = 9999999999
    for ii in range(a[1]):
        if e > abs(b[i][0] - c[ii][0]) + abs(b[i][1] - c[ii][1]):
            e = abs(b[i][0] - c[ii][0]) + abs(b[i][1] - c[ii][1])
            d = ii
    ans.append(d+1)
    
for i in range(a[0]):
    print(ans[i])
Buggy code:
N,M = map(int,input().split())

a = [0]*N
b=[0]*N
c = [0]*M
d =[0]*M

for i in range(N):
    a[i],b[i] = map(int,input().split())
    
    
for i in range(M):
    c[i],d[i] = map(int,input().split())
    
    
for i in range(N):
    x = a[i]
    y = b[i]
    result =0
    Min = 10**20
    
    for j in range(M):
        
        cx = c[j]
        cy = d[j]
        
        temp = abs((cx-x)+(cy-y))
        
        if Min > temp:
            result = j+1
            Min = temp
            
            
    print(result)

Fixed code:
N,M = map(int,input().split())

a=[0]*N
b=[0]*N
c=[0]*M
d=[0]*M


for i in range(N):
    a[i],b[i] = map(int,input().split())
    
    
for i in range(M):
    c[i],d[i] = map(int,input().split())
    
    
for i in range(N):
    x = a[i]
    y = b[i]
    
    for j in range(M):
        
        cx = c[j]
        cy = d[j]
        
        temp = abs(cx-x) + abs(cy-y)
        
        if j==0:
            Min = temp
            result =1
        elif Min > temp:
            result = j+1
            Min = temp
            
            
    print(result)
Buggy code:
N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
C=[list(map(int,input().split())) for i in range(M)]
for i in range(N):
    z=10**10
    ans=0
    for t in range(M):
        if abs(A[i][0]-C[t][0])+abs(A[i][0]-C[t][1])<z:
            z=abs(A[i][0]-C[t][0])+abs(A[i][0]-C[t][1])
            ans=t+1
        else:
            continue
    print(ans)

Fixed code:
N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
C=[list(map(int,input().split())) for i in range(M)]
for i in range(N):
    z=10**10
    ans=0
    for t in range(M):
        if (abs(A[i][0]-C[t][0])+abs(A[i][1]-C[t][1]))<z:
            z=(abs(A[i][0]-C[t][0])+abs(A[i][1]-C[t][1]))
            ans=t+1
        else:
            continue
    print(ans)
Buggy code:
import math;

n, m = map(int, input().split(" "));
ab = [];
for i in range(0, n):
    ab.append(input().split(" "));

cd = [];
for i in range(0, m):
    cd.append(input().split(" "));

for i in range(0, n):
    dist=9999999999999
    nearm=0;
    for j in range(0, m):
         dist2 = math.fabs(int(ab[i][0]) - int(cd[j][0])) + math.fabs(int(ab[i][1]) - int(cd[j][1]));
         if dist2 < dist:
            dist = dist2;
            nearm=j;
    print(nearm);




Fixed code:
import math;

n, m = map(int, input().split(" "));
ab = [];
for i in range(0, n):
    ab.append(input().split(" "));

cd = [];
for i in range(0, m):
    cd.append(input().split(" "));

for i in range(0, n):
    dist=9999999999999
    nearm=0;
    for j in range(0, m):
         dist2 = math.fabs(int(ab[i][0]) - int(cd[j][0])) + math.fabs(int(ab[i][1]) - int(cd[j][1]));
         if dist2 < dist:
            dist = dist2;
            nearm=j;
    print(nearm+1);
Buggy code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
std_li = [list(map(int, input().split())) for i in range(N)]
chk_li = [list(map(int, input().split())) for j in range(M)]
dist = 0

for i in range(N):
    ctr = 0
    min_dist = pow(10,8) * 4 + 1
    for j in range(M):
        dist = abs(std_li[i][0] - chk_li[j][0]) + abs(std_li[i][1] - chk_li[j][1])
        print(dist, min_dist)
        if dist < min_dist:
            min_dist = dist
            ctr = j + 1
    print(ctr)

Fixed code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
std_li = [list(map(int, input().split())) for i in range(N)]
chk_li = [list(map(int, input().split())) for j in range(M)]
dist = 0

for i in range(N):
    ctr = 0
    min_dist = pow(10,8) * 4 + 1
    for j in range(M):
        dist = abs(std_li[i][0] - chk_li[j][0]) + abs(std_li[i][1] - chk_li[j][1])
        if dist < min_dist:
            min_dist = dist
            ctr = j + 1
    print(ctr)
Buggy code:
N, M = list(map(int, input().split()))
St = [input().split() for _ in range(N)]
Ch = [input().split() for _ in range(M)]

for i in range(N):
    memo = []
    for j in range(M):
        diff = abs(int(St[i][0]) - int(Ch[j][0])) + abs(int(St[i][1]) - int(Ch[j][1]))
        memo.append(diff)
    print(memo.index(min(memo)))


Fixed code:
N, M = list(map(int, input().split()))
St = [input().split() for _ in range(N)]
Ch = [input().split() for _ in range(M)]

for i in range(N):
    memo = []
    for j in range(M):
        diff = abs(int(St[i][0]) - int(Ch[j][0])) + abs(int(St[i][1]) - int(Ch[j][1]))
        memo.append(diff)
    print(memo.index(min(memo)) + 1)
Buggy code:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
import sys
n,m = ma()
ckp = []
st = []

for i in range(n):
    st.append(lma())
for i in range(m):
    ckp.append(lma())
for a,b in st:
    tmp=10**15
    ans=0
    for i  in range(m):
        if tmp<abs(a-c)+abs(b-d):
            tmp=abs(a-c)+abs(b-d)
            ans=i+1
    print(ans)


Fixed code:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
import sys
n,m = ma()
ckp = []
st = []

for i in range(n):
    st.append(lma())
for i in range(m):
    ckp.append(lma())
for a,b in st:
    tmp=10**15
    ans=0
    for i  in range(m):
        c,d=ckp[i]
        if tmp>abs(a-c)+abs(b-d):
            tmp=abs(a-c)+abs(b-d)
            ans=i+1
    print(ans)
Buggy code:
N, M = map(int,input().split())
st = [[] for _ in range(N)]
cp = [[] for _ in range(M)]
for i in range(N):
    a, b = map(int,input().split())
    st[i] = [a, b]
for j in range(M):
    c, d = map(int,input().split())
    cp[j] = [c, d]
for i in range(N):
    ne = 10**12
    p = 0
    for j in range(M):
        dis = abs(st[i][0]-cp[j][0])+abs(st[i][1]-cp[j][1])
        print(dis)
        if dis < ne:
            p = j
            ne = dis
        print(p)
    print(p+1)

Fixed code:
N, M = map(int,input().split())
st = [[] for _ in range(N)]
cp = [[] for _ in range(M)]
for i in range(N):
    a, b = map(int,input().split())
    st[i] = [a, b]
for j in range(M):
    c, d = map(int,input().split())
    cp[j] = [c, d]
for i in range(N):
    ne = 10**12
    p = 0
    for j in range(M):
        dis = abs(st[i][0]-cp[j][0])+abs(st[i][1]-cp[j][1])
        if dis < ne:
            p = j
            ne = dis
    print(p+1)
Buggy code:
N,M = map(int,input().split())

a = [0]*N
b = [0]*N

for i in range(N):
    a[i],b[i] = map(int,input().split())

x = [0]*M
y = [0]*M

for  i in range(M):
    x[i],y[i]= map(int,input().split())

for i in range(N):
    dis = 10000000000000000
    for j in range(M):
        dis = min(dis,(abs(a[i]-x[j])+abs(b[i]-y[j])))
        res = i

    print(res+1)


Fixed code:
N,M = map(int,input().split())

a = [0]*N
b = [0]*N

for i in range(N):
    a[i],b[i] = map(int,input().split())

x = [0]*M
y = [0]*M

for  i in range(M):
    x[i],y[i]= map(int,input().split())

for i in range(N):
    dis = 10000000000000000
    res = 0
    for j in range(M):
        if dis > (abs(a[i]-x[j])+abs(b[i]-y[j])):
            dis = min(dis,(abs(a[i]-x[j])+abs(b[i]-y[j])))
            res = j

    print(res+1)
Buggy code:
N, M = map(int, input().split())
s = []
for i in range(0, N):
  x, y = map(int, input().split())
  s.append([x, y])
c = []
for i in range(0, M):
  x, y = map(int, input().split())
  s.append([x, y])
  
for x,y in s:
  dist_min = 10000000000
  min_n = 0
  n = 0
  for c, d in c:
    n += 1
    dist = abs(x-c)+ abs(y-d)
    if dist_min > dist:
      dist_min = dist
      min_n = n
  print(min_n)

Fixed code:
N, M = map(int, input().split())
s = []
for i in range(0, N):
  x, y = map(int, input().split())
  s.append([x, y])
ch = []
for i in range(0, M):
  x, y = map(int, input().split())
  ch.append([x, y])
  
for x,y in s:
  dist_min = 10000000000
  min_n = 0
  n = 0
  for c, d in ch:
    n += 1
    dist = abs(x-c)+ abs(y-d)
    if dist_min > dist:
      dist_min = dist
      min_n = n
  print(min_n)
Buggy code:
n, m = map(int, input().split())
stu = []
check = []
for i in range(n):
    stu.append(list(map(int, input().split())))

for i in range(m):
    check.append(list(map(int, input().split())))


ans = []

for i in range(n):
    dist = []
    for j in range(m):
        tmp = abs(stu[i][0] - check[j][0]) + abs(stu[i][1] - check[j][1])
        dist.append(tmp)
    mi = dist.index(min(dist))
    ans.append(mi)


for i in range(len(ans)):
    print(ans[i])




Fixed code:
n, m = map(int, input().split())
stu = []
check = []
for i in range(n):
    stu.append(list(map(int, input().split())))

for i in range(m):
    check.append(list(map(int, input().split())))


ans = []

for i in range(n):
    dist = []
    for j in range(m):
        tmp = abs(stu[i][0] - check[j][0]) + abs(stu[i][1] - check[j][1])
        dist.append(tmp)
    mi = dist.index(min(dist))
    ans.append(mi)


for i in range(len(ans)):
    print(ans[i] + 1)