qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n,m map(int,input().split())
st=[]
for i in range(n):
  s_d=list(input())
  st.append(s_d)
cp=[]
for i in range(m):
  c_d=list(input())
  cp.append(c_d)
sc=[]
for i in range(n):
  scd=[]
  for j in range(m):
    scd_d=abs(st[i][0]-cp[j][0])+abs(st[i][1]-cp[j][1])
    scd.append(scd_d)
  sc.append(min(scd))
  
for i in range(n):
  print(sc[i])

Fixed code:
n,m=map(int,input().split())
st=[]
for i in range(n):
  s_d=list(map(int,input().split()))
  st.append(s_d)
cp=[]
for i in range(m):
  c_d=list(map(int,input().split()))
  cp.append(c_d)
sc=[]
for i in range(n):
  scd=[]
  for j in range(m):
    scd_d=abs(st[i][0]-cp[j][0])+abs(st[i][1]-cp[j][1])
    scd.append(scd_d)
  sc.append(scd.index(min(scd))+1)
  
for i in range(n):
  print(sc[i])
Buggy code:
def distance(a,b,c,d):
  return abs(a-c)+abs(b-d)

N,M=map(int, input().split())
Alist = []
Blist = []
for i in range(N):
  a,b=map(int, input().split())
  Alist.append(a)
  Blist.append(b)
Clist = []
Dlist = []
for i in range(M):
  c,d=map(int, input().split())
  Clist.append(c)
  Dlist.append(d)

for i in range(N):
  min_d = 10*10
  a = Alist[i]
  for k in range(M):
    b = Blist[k]
    if min_d > distance(a[0],a[1],b[0],b[1]):
      min_d = distance(a[0],a[1],b[0],b[1])
      kiroku = k
  print(k)


Fixed code:
def distance(a,b,c,d):
  return abs(a-c)+abs(b-d)

N,M=map(int, input().split())
Alist = []
Blist = []
for i in range(N):
  a,b=map(int, input().split())
  Alist.append(a)
  Blist.append(b)
Clist = []
Dlist = []
for i in range(M):
  c,d=map(int, input().split())
  Clist.append(c)
  Dlist.append(d)

for i in range(N):
  min_d = 10**10
  a = Alist[i]
  b = Blist[i]
  for k in range(M):
    c = Clist[k]
    d = Dlist[k]
    if min_d > distance(a,b,c,d):
      min_d = distance(a,b,c,d)
      kiroku = k
#    print(a,b,c,d,distance(a,b,c,d),min_d)
  print(kiroku+1)
Buggy code:
N, M = map(int, input().split())
stu = []
che = []
for i in range(N):
  stu.append(list(map(int, input().split())))
for i in range(M):
  che.append(list(map(int, input().split())))
  
for i in stu:
  x, y = i[0], i[1]
  ans = 0
  tmp = 99999999999999
  for j in che:
    if abs(x-j[0])+abs(y-j[1]) < tmp:
      tmp = abs(x-j[0])+abs(y-j[1])
      ans = j + 1
  print(ans)

Fixed code:
N, M = map(int, input().split())
stu = []
che = []
for i in range(N):
  stu.append(list(map(int, input().split())))
for i in range(M):
  che.append(list(map(int, input().split())))
  
for i in stu:
  x, y = i[0], i[1]
  ans = 0
  tmp = 99999999999999
  for num, j in enumerate(che):
    if abs(x-j[0])+abs(y-j[1]) < tmp:
      tmp = abs(x-j[0])+abs(y-j[1])
      ans = num + 1
  print(ans)
Buggy code:
n,m=map(int,input().split())
o,p,q,r=[],[],[],[]
def kyori(a,b,c,d):return abs(a-b)+abs(c-d)
for i in range(n):
  a,b=map(int,input().split())
  o.append(a)
  p.append(b)
for i in range(m):
  a,b=map(int,input().split())
  q.append(a)
  r.append(b)
for i in range(n):
  mind=kyori(a[i],b[i],c[0],d[0])
  minn=1
  for j in range(m-1):
    a=kyori(a[i],b[i],c[j+1],d[j+1])
    if a<mind:
      mind=a
      minn=j+2
  print(minn)

Fixed code:
n,m=map(int,input().split())
o,p,q,r=[],[],[],[]
def kyori(a,b,c,d):return abs(a-c)+abs(b-d)
for i in range(n):
  a,b=map(int,input().split())
  o.append(a)
  p.append(b)
for i in range(m):
  a,b=map(int,input().split())
  q.append(a)
  r.append(b)
for i in range(n):
  mind=kyori(o[i],p[i],q[0],r[0])
  minn=1
  for j in range(m-1):
    a=kyori(o[i],p[i],q[j+1],r[j+1])
    if a<mind:
      mind=a
      minn=j+2
  print(minn)
Buggy code:

C = []
D = []
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):
    v_min = float('inf')
    for j in range(m):
        v = abs(A[i] - C[j]) + abs(B[i] - D[j])
        if v_min > v:
            v_min = v
            ans = j + 1
    print(ans)

Fixed code:
n, m = map(int, input().split())
A = []
B = []
C = []
D = []
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):
    v_min = float('inf')
    for j in range(m):
        v = abs(A[i] - C[j]) + abs(B[i] - D[j])
        if v_min > v:
            v_min = v
            ans = j + 1
    print(ans)
Buggy code:
from sys import stdin

n,m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
lc = [list(map(int,stdin.readline().rstrip().split())) for _ in range(m)]

for i in range(n):
    kyo = []
    for j in range(m):
        kyo.append(abs(li[i][0]-lc[j][0])+abs(li[i][0]-lc[j][1]))
    print(kyo.index(min(kyo))+1)

Fixed code:
from sys import stdin

n,m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
lc = [list(map(int,stdin.readline().rstrip().split())) for _ in range(m)]

for i in range(n):
    kyo = []
    for j in range(m):
        kyo.append(abs(li[i][0]-lc[j][0])+abs(li[i][1]-lc[j][1]))
    print(kyo.index(min(kyo))+1)
Buggy code:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
cd = [list(map(int, input().split())) for i in range(M)]

ans = []
for i, (a, b) in enumerate(ab):
  min_dist = 10**20
  idx = -1
  for j, (c, d) in enumerate(cd):
    dij = abs(a - c) + abs(b - d)
    if dij < min_dist:
      min_dist = dij
      idx = j
  ans.append(idx)

print(*ans, sep='\n')

Fixed code:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
cd = [list(map(int, input().split())) for i in range(M)]

ans = []
for i, (a, b) in enumerate(ab):
  min_dist = 10**20
  idx = -1
  for j, (c, d) in enumerate(cd):
    dij = abs(a - c) + abs(b - d)
    if dij < min_dist:
      min_dist = dij
      idx = j
  ans.append(idx+1)

print(*ans, sep='\n')
Buggy code:
n,m = map(int,input().split())
ab = [[int(x) for x in input().split()] for _ in range(n)]
cd = [[int(x) for x in input().split()] for _ in range(m)]
ls = []

for i in range(n):
    cnt = 10*9
    num = 0
    for j in range(m):
        c = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])
        if c<cnt:
            cnt = c
            num = j+1
    print(cnt)


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


for i in range(n):
    cnt = 10**9
    num = 0
    for j in range(m):
        c = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])
        if c<cnt:
            cnt = c
            num = j+1
    print(num)
Buggy code:
n,m=map(int,input().split())

li=[list(map(int,input().split())) for i in range(n)]
lj=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
    li_distance=[abs(lj[j][0]-li[i][0])+abs(lj[j][1]-li[i][1]) for j in range(m)]
    print(li_distance.index(min(li_distance)+1))
    

Fixed code:
n,m=map(int,input().split())

li=[list(map(int,input().split())) for i in range(n)]
lj=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
    li_distance=[abs(lj[j][0]-li[i][0])+abs(lj[j][1]-li[i][1]) for j in range(m)]
    print(li_distance.index(min(li_distance))+1)
Buggy code:
n,m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(n)]

ans = []

for i in a:
  count = 10**10
  check = 0
  for j in range(m):
    if count > abs(i[0]-b[j][0])+abs(i[1]-b[j][1]):
      check = j+1
      count = abs(i[0]-b[j][0])+abs(i[1]-b[j][1])
    
  ans.append(check)
for i in ans:
  print(i)

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

ans = []

for i in a:
  count = 10**10
  check = 0
  for j in range(m):
    if count > abs(i[0]-b[j][0])+abs(i[1]-b[j][1]):
      check = j+1
      count = abs(i[0]-b[j][0])+abs(i[1]-b[j][1])
    
  ans.append(check)
for i in ans:
  print(i)
Buggy code:
n, m = map(int, input().split())
students = [list(map(int, input().split())) for i in range(n)]

targets = [list(map(int, input().split())) for i in range(m)]
x = 0
snumber = [(0, x)] * n
  
def md(s, t):
  d = abs(s[0] - t[0]) + abs(s[1] - t[1])
  return d

for i in range(n):
  x = 2 * 10 ** 8
  for j in range(m):    
    if x >= md(students[i], targets[j]):
      x = md(students[i], targets[j])
      snumber[i] = (j+1, md(students[i], targets[j]))
      
for i in range(n):      
  print(snumber[i][0])

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

targets = [list(map(int, input().split())) for i in range(m)]
x = 0
snumber = [(0, x)] * n
  
def md(s, t):
  d = abs(s[0] - t[0]) + abs(s[1] - t[1])
  return d

for i in range(n):
  x = 4 * 10 ** 8
  for j in range(m):    
    if x > md(students[i], targets[j]):
      x = md(students[i], targets[j])
      snumber[i] = (j+1, md(students[i], targets[j]))
      
for i in range(n):      
  print(snumber[i][0])
Buggy code:
N, M = map(int, input().split())

a = [0 for i in range(N)]
b = [0 for i in range(N)]
c = [0 for i in range(N)]
d = [0 for i in range(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):
    closest_ind = -1
    closest_dist = 10000000000
    for j in range(M):
        if closest_dist > abs(a[i] - c[j]) + abs(b[i] - d[j]):
            closest_ind = j
            closest_dist = abs(a[i] - c[j]) + abs(b[i] - d[j])
    print(closest_ind + 1)

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

a = [0 for i in range(N)]
b = [0 for i in range(N)]
c = [0 for i in range(M)]
d = [0 for i in range(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):
    closest_ind = -1
    closest_dist = 10000000000
    for j in range(M):
        if closest_dist > abs(a[i] - c[j]) + abs(b[i] - d[j]):
            closest_ind = j
            closest_dist = abs(a[i] - c[j]) + abs(b[i] - d[j])
    print(closest_ind + 1)
Buggy code:
N,M=map(int,input().split(' '))
S = [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):
  l = [abs(S[i][0]-C[i][0])+abs(S[i][1]-C[i][1]) for i in range(M)]
  print(l.index(min(l))+1)

Fixed code:
N,M=map(int,input().split(' '))
S = [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):
  l = [abs(S[i][0]-C[j][0])+abs(S[i][1]-C[j][1]) for j in range(M)]
  print(l.index(min(l))+1)
Buggy code:
n, m = map(int, input().split())
print(n,m)
pos = []
che = []
for i in range(n):
    a,b=map(int,input().split())
    pos.append([a,b])
for i in range(m):
    a,b=map(int,input().split())
    che.append([a,b])

for i in range(n):
    dis = []
    for j in range(m):
        dis.append(abs(pos[i][0]-che[i][0])+abs(pos[i][1]-che[i][1]))
    print(dis.index(min(dis))+1)

Fixed code:
n, m = map(int, input().split())
pos = []
che = []
for i in range(n):
    a, b = map(int,input().split())
    pos.append([a,b])
for i in range(m):
    a, b = map(int,input().split())
    che.append([a,b])
 
for i in range(n):
    dis = []
    for j in range(m):
        dis.append(abs(pos[i][0]-che[j][0])+abs(pos[i][1]-che[j][1]))
    print(dis.index(min(dis))+1)
Buggy code:
n,m = map(int,input().split())
stds = [tuple(map(int,input().split())) for _ in range(n)]
points = [tuple(map(int,input().split())) for _ in range(m)]

def d(s,p):
  return abs(s[0]-p[0]) + abs(s[1] + p[1])

for std in stds:
  ans = (float('inf'), -1)
  for i, pnt in enumerate(points):
    if d(std,pnt) < ans[1]:
      ans = (i, pnt)
  print(i+1)

Fixed code:
n,m = map(int,input().split())
stds = [tuple(map(int,input().split())) for _ in range(n)]
points = [tuple(map(int,input().split())) for _ in range(m)]

def d(s,p):
  return abs(s[0]-p[0]) + abs(s[1] - p[1])

for std in stds:
  ans = (-1, float('inf'))
  for i, pnt in enumerate(points):
    dst = d(std,pnt)
    if dst < ans[1]:
      ans = (i, dst)
  print(ans[0]+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)]
print(ab)
print(cd)
for i in range(n):
    seq_min = 1e9
    ans = -1
    for j in range(m):
        seq = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if seq_min > seq:
            seq_min = seq
            ans = j
    print(ans + 1)

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)]
for i in range(n):
    seq_min = 1e9
    ans = -1
    for j in range(m):
        seq = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if seq_min > seq:
            seq_min = seq
            ans = j
    print(ans + 1)
Buggy code:
a, b, c, d = [0] * n, [0] * n, [0] * m, [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):
    min_dist, min_c = abs(a[0]-c[0]) + abs(b[0]-d[0]), 0
    for j in range(m):
        dist = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if dist < min_dist:
            min_dist = dist
            min_c = j
    print(min_c+1)

Fixed code:
n, m = map(int, input().split())
a, b, c, d = [0] * n, [0] * n, [0] * m, [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):
    min_dist, min_c = 10**9, -1
    for j in range(m):
        dist = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if dist < min_dist:
            min_dist = dist
            min_c = j
    print(min_c+1)
Buggy code:
N, M = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(N)]
y = [list(map(int, input().split())) for _ in range(M)]
for a,b in ab:
    z = [abs(a-c) + abs(b-d) for c,d in cd]
    print(z.index(min(z))+1)

Fixed code:
N, M = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(N)]
y = [list(map(int, input().split())) for _ in range(M)]
for a,b in x:
    z = [abs(a-c) + abs(b-d) for c,d in y]
    print(z.index(min(z))+1)
Buggy code:
N, M = map(int, input().split())
AB = []
for _ in range(N):
  a, b = map(int, input().split())
  AB.append((a, b))

CD = []
for _ in range(M):
  c, d = map(int, input().split())
  CD.append((c, d))

check_index = []
for i, ab in enumerate(AB):
  min_index = 0
  for j, cd in enumerate(CD):
    check_dis = distance(ab, cd)
    min_dis = distance(ab, CD[min_index])
    if(min_dis > check_dis):
      min_index = j
  
  check_index.append(min_index)

for ci in check_index:
  print(ci + 1)


Fixed code:
def distance(ab, cd):
  return abs(ab[0] - cd[0]) + abs(ab[1] - cd[1])

N, M = map(int, input().split())
AB = []
for _ in range(N):
  a, b = map(int, input().split())
  AB.append((a, b))

CD = []
for _ in range(M):
  c, d = map(int, input().split())
  CD.append((c, d))

check_index = []
for i, ab in enumerate(AB):
  min_index = 0
  for j, cd in enumerate(CD):
    check_dis = distance(ab, cd)
    min_dis = distance(ab, CD[min_index])
    if(min_dis > check_dis):
      min_index = j
  
  check_index.append(min_index)

for ci in check_index:
  print(ci + 1)
Buggy code:
n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(m)]
for i in range(n):
    mindis = 10 ** 9
    for j in range(m):
        dis = abs(s[i][0] - p[j][0]) + abs(s[i][1] - p[j][1])
        if mindis > dis:
            p = j+1
            mindis = dis
    print(p)

Fixed code:
n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(m)]
for i in range(n):
    mindis = 10 ** 9
    for j in range(m):
        dis = abs(s[i][0] - p[j][0]) + abs(s[i][1] - p[j][1])
        if mindis > dis:
            point = j+1
            mindis = dis
    print(point)
Buggy code:
yandy
n, m = map(int, input().split())

student = []

for i in range(n):
    a, b = map(int, input().split())
    student.append((a, b))

point = []

for j in range(m):
    c, d = map(int, input().split())
    point.append((c, d))

for a, b in student:
    length = 10 ** 10
    pn = 0
    for j in range(m):
        c, d = point[j]
        if abs(a-c) + abs(b-d) < length:
            length = abs(a-c) + abs(b-d)
            pn = j + 1
    print(pn)


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

for a,b in student:
  length=10**10
  pn=0
  for j in range(m):
    c,d=point[j]
    if abs(a-c)+abs(b-d)<length:
      length=abs(a-c)+abs(b-d)
      pn=1+j
  print(pn)
Buggy code:
n, m = list(map(int, input().split()))

a = []
b = []

for i in range(n):
    tmp1, tmp2 = list(map(int, input().split()))
    a.append(tmp1)
    b.append(tmp2)

c = []
d = []

for i in range(m):
    tmp1, tmp2 = list(map(int, input().split()))
    c.append(tmp1)
    d.append(tmp2)

for i in range(n):
    tmp = abs(a[n] - c[0]) + abs(b[n] - d[0])
    s = 1
    for j in range(m):
        tmp3 = abs(a[i] - c[j]) + abs(b[i] - d[j])
        if tmp3 < tmp:
            tmp = tmp3
            s = j + 1
    print(s)

Fixed code:
n, m = list(map(int, input().split()))

a = []
b = []

for i in range(n):
    tmp1, tmp2 = list(map(int, input().split()))
    a.append(tmp1)
    b.append(tmp2)

c = []
d = []

for i in range(m):
    tmp1, tmp2 = list(map(int, input().split()))
    c.append(tmp1)
    d.append(tmp2)

for i in range(n):
    tmp = abs(a[i] - c[0]) + abs(b[i] - d[0])
    s = 1
    for j in range(m):
        tmp3 = abs(a[i] - c[j]) + abs(b[i] - d[j])
        if tmp3 < tmp:
            tmp = tmp3
            s = j + 1
    print(s)
Buggy code:
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
b=[list(map(int,input().split())) for i in range(m)]
for i in a:
  cnt=2*(10**16)
  ans=0
  for j in range(len(b)):
    if abs(i[0]*b[j][0])+ abs(i[1]*b[j][1])<cnt:
      cnt=abs(i[0]*b[j][0])+ abs(i[1]*b[j][1])
      ans=j+1
  print(ans)

Fixed code:
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
b=[list(map(int,input().split())) for i in range(m)]
for i in a:
  cnt=2*(10**16)
  ans=0
  for j in range(len(b)):
    if abs(i[0]-b[j][0])+ abs(i[1]-b[j][1])<cnt:
      cnt=abs(i[0]-b[j][0])+ abs(i[1]-b[j][1])
      ans=j+1
  print(ans)
Buggy code:
n, m = map(int,input().split())
students = [None]*n
points = [None]*m
for i in range(n):
  students[i] = tuple(map(int,input().split()))
for i in range(m):
  points[i] = tuple(map(int,input().split()))

ans = [None]*n
for s in students:
  tmp = [None]*m
  for p in points:
    tmp[p] = abs(students[s][0] - points[p][0]) + abs(students[s][1] - points[p][1])
  ans[s] = tmp.index(min(tmp))
for i in range(n):
  print(ans[i])


Fixed code:
n, m = map(int,input().split())
students = [None]*n
points = [None]*m
for i in range(n):
  students[i] = tuple(map(int,input().split()))
for i in range(m):
  points[i] = tuple(map(int,input().split()))

ans = []
for s in students:
  tmp = []
  for p in points:
    tmp.append(abs(s[0] - p[0]) + abs(s[1] - p[1]))
  ans.append(tmp.index(min(tmp)) + 1)
for i in range(n):
  print(ans[i])
Buggy code:
n,m=map(int,input().split())
A=[[0,0]for i in range(n)]
B=[[0,0] for i in range(m)]
E=[1]*n
for i in range(n):
    A[i][0],A[i][1]=map(int,input().split())
for i in range(m):
    B[i][0],B[i][1]=map(int,input().split())
for i in range(n):
    c=abs(A[i][0]-B[0][0])+abs(A[i][1]-B[0][1])
    for j in range(1,m):
        if abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])<c:
            E[i]=j+1
for i in range(n):
    print(E[i])

Fixed code:
n,m=map(int,input().split())
A=[[0,0]for i in range(n)]
B=[[0,0] for i in range(m)]
E=[1]*n
for i in range(n):
    A[i][0],A[i][1]=map(int,input().split())
for i in range(m):
    B[i][0],B[i][1]=map(int,input().split())
for i in range(n):
    c=abs(A[i][0]-B[0][0])+abs(A[i][1]-B[0][1])
    for j in range(1,m):
        if abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])<c:
            c=abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])
            E[i]=j+1
for i in range(n):
    print(E[i])
Buggy code:
N, M = map(int, input().split())
student = [list(map(int, input().split())) for _ in range(N)]
cp = [list(map(int, input().split())) for _ in range(M)]

idou = []
for a, b in student:
  idousaki = -1
  nearest = 1000000000
  for i, x, y in enumerate(cp):
    d = abs(x-a) + abs(y-b)
    if d < nearest:
      nearest = d
      idousaki = i+1
      
  idou.append(idousaki)
  
for i in idou:
  print(i)


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

idou = []
for a, b in student:
  idousaki = -1
  nearest = 1000000000
  for i, xy in enumerate(cp):
    d = abs(xy[0]-a) + abs(xy[1]-b)
    if d < nearest:
      nearest = d
      idousaki = i+1
      
  idou.append(idousaki)
  
for i in idou:
  print(i)
Buggy code:
n, m = map(int,input().split())

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

ca = []
for i in la:
    a, b = map(int, input().split())
    ca.append((a,b))

for i in ca:
    mi = 1000000001
    ans = 0
    for j in range(len(ca)):
        if abs(i[0]-ca[j][0]) + abs(i[1]-ca[j][1]) < mi:
            mi = abs(i[0]-ca[j][0]) + abs(i[1]-ca[j][1])
            ans = j+1
    print(ans)



Fixed code:
n, m = map(int,input().split())

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

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

for i in range(len(la)):
    mi = 1000000001
    ans = 0
    for j in range(len(ca)):
        p = abs(la[i][0]-ca[j][0]) + abs(la[i][1]-ca[j][1])
        if  p < mi:
            mi = p
            ans = j+1
    print(ans)
Buggy code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7



def main():
  n,m = map(int,input().split())
  
  AB = [map(int,input().split()) for _ in range(n)]
  #print(AB)
  CD = [map(int,input().split()) for _ in range(m)]
  idx = 1
  man = float("inf")
  for i in range(n):
    a,b = AB[i]
    for j in range(m-1,-1,-1):
      c,d = CD[j]
      if abs(a-c) + abs(b-d) <= man:
        man = abs(a-c) + abs(b-d)
        idx = j
      print(j+1)
      
  
if __name__ == '__main__':
  main()

Fixed code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7



def main():
  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)]
  idx = 1

  for i in range(n):
    a,b = AB[i]
    man = float("inf")
    for j in range(m-1,-1,-1):
      c,d = CD[j]
      if abs(a-c) + abs(b-d) <= man:
        man = abs(a-c) + abs(b-d)
        idx = j
    print(idx+1)
      
  
if __name__ == '__main__':
  main()
Buggy code:
import numpy as np

N, M = map(int, input().split())
A = [map(int, input().split()) for _ in range(N)]
B = [map(int, input().split()) for _ in range(M)]

for (x, y) in A:
    d = np.array([])
    for q in B:
        print("q = ", q)
        print("*q=", *q,)
        a, b = q
        d = np.append(d, abs(x-a) + abs(y-b))
    print(np.argmin(d) + 1)

Fixed code:
import numpy as np

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

for (x, y) in A:
    d = np.array([])
    for (a, b) in B:
        d = np.append(d, abs(x-a) + abs(y-b))
    print(np.argmin(d) + 1)