TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n, m = map(int,input().split())
student_list = [list(map(int,input().split())) for _ in range(n)]
print(student_list)
check_list = [list(map(int,input().split())) for _ in range(m)]
print(check_list)
for s in student_list:
    tmp = []
    for c in check_list:
        tmp.append(abs(s[0]-c[0]) + abs(s[1]-c[1]))
    print(tmp.index(min(tmp))+1)

n, m = map(int,input().split())
student_list = [list(map(int,input().split())) for _ in range(n)]

check_list = [list(map(int,input().split())) for _ in range(m)]

for s in student_list:
    tmp = []
    for c in check_list:
        tmp.append(abs(s[0]-c[0]) + abs(s[1]-c[1]))
    print(tmp.index(min(tmp))+1)

Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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[i][0])+abs(pos[i][1]-che[i][1]))
    print(dis.index(min(dis))+1)

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)

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)




Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)

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)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)

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)


Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
N,M = map(int,input().split())
student = [list(map(int,input().split())) for _ in range(N)]
cpoint = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
    mannmn = 10**8
    for j in range(M):
        mann = abs(student[i][0] - cpoint[j][0])+abs(student[i][1] - cpoint[j][1])
        if mann <= mannmn:
            mannmn = mann
            ref = j
    print(ref+1)

N,M = map(int,input().split())
student = [list(map(int,input().split())) for _ in range(N)]
cpoint = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
    mannmn = 10**10
    mann = 10**10
    for j in range(M):
        mann = abs(student[i][0] - cpoint[j][0])+abs(student[i][1] - cpoint[j][1])
        if mann < mannmn:
            mannmn = mann
            ref = j
    print(ref+1)
        

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
# B - Checkpoints
N, M = list(map(int, input().split()))
P = [list(map(int, input().split())) for i in range(N)]
C = [list(map(int, input().split())) for i in range(M)]

ans = [1]*N
for i in range(N): 
    D = [10 ** 10] * M
    for j in range(M): 
        D[j] = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])
        if D[j] <= min(D):
            if ans[i] >= j+1:
                pass
            else:
                ans[i] = j+1
        else:
            pass

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

# B - Checkpoints
N, M = list(map(int, input().split()))
P = [list(map(int, input().split())) for i in range(N)]
C = [list(map(int, input().split())) for i in range(M)]

ans = [0] * N
for i in range(N): 
    D = [10 ** 10] * M
    D_hikaku = 10 ** 10
    for j in range(M): 

        D = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])
        if D < D_hikaku:
            D_hikaku = D
            ans[i] = j + 1
        else:
            pass

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

Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n,m=map(int,input().split())
pos1=[list(map(int,input().split())) for _ in range(n)]
pos2=[list(map(int,input().split())) for _ in range(m)]
ans=[0]*n
for i in range(n):
  lim=10**9
  for j in range(m):
    tmp=abs(pos1[i][0]-pos2[i][0])+abs(pos1[i][1]-pos2[i][1])
    if tmp<lim:
      tmp=lim
      ans[i]=j
for i in range(n):
  print(ans[i])

n,m=map(int,input().split())
pos1=[list(map(int,input().split())) for _ in range(n)]
pos2=[list(map(int,input().split())) for _ in range(m)]
ans=[0]*n
for i in range(n):
  lim=10**9
  for j in range(m):
    tmp=abs(pos1[i][0]-pos2[j][0])+abs(pos1[i][1]-pos2[j][1])
    if tmp<lim:
      lim=tmp
      ans[i]=j+1
for i in range(n):
  print(ans[i])

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n, m = map(int, input().split())
A = [(a, b) for a, b in map(int, input().split())]
C = [(c, d) for c, d in map(int, input().split())]
for i in range(n):
  res = 0
  ans = 1 << 20
  for j in range(m):
    tmp = abs(A[i][0] - C[j][0]) + abs(A[i][1] - C[j][1]) )
    if tmp < ans:
	  ans = tmp
      res = j
  print(j)


n, m = map(int, input().split())
A = [tuple(map(int, input().split())) for i in range(n)]
C = [tuple(map(int, input().split())) for j in range(m)]
for i in range(n):
  res = 1 
  ans = abs(A[i][0] - C[0][0]) + abs(A[i][1] - C[0][1])
  for j in range(m):
    tmp = abs(A[i][0] - C[j][0]) + abs(A[i][1] - C[j][1])
    if tmp < ans:
      ans = tmp
      res = j+1
  print(res)


Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n,m=map(int,input().split())
st=[]
ch=[]
def mht(ax,ay,bx,by):
  return abs(ax-bx)+abs(ay-by)

for i in range(n):
  st.append(list(map(int,input().split())))
for i in range(m):
  ch.append(list(map(int,input().split())))
  
for i in st:
  ax=i[0]
  ay=i[1]
  mn=100000000
  for (j,k) in zip(ch,range(len(ch))):
    bx=j[0]
    by=j[1]
    mh=mht(ax,ay,bx,by)
    if mh<mn:
      mn=mh
      nm=k
  print(nm)


n,m=map(int,input().split())
st=[]
ch=[]
def mht(ax,ay,bx,by):
  return abs(ax-bx)+abs(ay-by)

for i in range(n):
  st.append(list(map(int,input().split())))
for i in range(m):
  ch.append(list(map(int,input().split())))
  
for i in st:
  ax=i[0]
  ay=i[1]
  mn=100000000
  for (j,k) in zip(ch,len(ch)):
    bx=j[0]
    by=j[1]
    mh=mht(ax,ay,bx,by)
    if mh<mn:
      mn=mh
      nm=k
  print(nm)


n,m=map(int,input().split())
st=[]
ch=[]
def mht(ax,ay,bx,by):
  return abs(ax-bx)+abs(ay-by)

for i in range(n):
  st.append(list(map(int,input().split())))
for i in range(m):
  ch.append(list(map(int,input().split())))
  
for i in st:
  ax=i[0]
  ay=i[1]
  mn=1000000000
  for (j,k) in zip(ch,range(len(ch))):
    bx=j[0]
    by=j[1]
    mh=mht(ax,ay,bx,by)
    if mh<mn:
      mn=mh
      nm=k
  print(nm+1)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]

for i in g:
    a,b=i[0],i[1]
    dis=10**10
    ind=1
    for j in range(m):
        x,y=c[j][0],c[j][1]
        now=abs(a-x)+abs(b-y)
        if now<dis:
            dis=now
            ind=j+1
    print(ind)import sys
input=sys.stdin.readline

n,m=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]

for i in g:
    a,b=i[0],i[1]
    dis=10**10
    ind=1
    for j in range(m):
        x,y=c[j][0],c[j][1]
        now=abs(a-x)+abs(b-y)
        if now<dis:
            dis=now
            ind=j+1
    print(ind)

import sys
input=sys.stdin.readline

n,m=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]

for i in g:
    a,b=i[0],i[1]
    dis=10**10
    ind=1
    for j in range(m):
        x,y=c[j][0],c[j][1]
        now=abs(a-x)+abs(b-y)
        if now<dis:
            dis=now
            ind=j+1
    print(ind)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
a,b = map(int,input().split())
S = [list(map(int,input().split())) for i in range(a)]
CP = [list(map(int,input().split())) for i in range(b)]
for s in S:
  count = 0
  ab = 10**8
  p = 10**8
  for cp in CP:
    total = abs(s[0]-cp[0]) + abs(s[1]-cp[1])
    count +=1
    print(cp)
    if ab > total:
      ab = total
      p = count
      
  print(p)

a,b = map(int,input().split())
S = [list(map(int,input().split())) for i in range(a)]
CP = [list(map(int,input().split())) for i in range(b)]
for s in S:
  count = 0
  ab = 10**9
  p = 10**9
  for i,cp in zip(range(b),CP):
    total = abs(s[0]-cp[0]) + abs(s[1]-cp[1])
    count +=1
    if ab > total:
      ab = total
      p = i+1
      
  print(p)

Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)

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)



Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n,m=map(int,input().split())
p=[tuple(map(int,input().split())) for i in range(n)]
for i in range(m):
  c,d=map(int,input().split())
  ans=10**10
  for j,k in p:
    ans=min(ans,abs(c-j)+abs(d-k))
  print(ans)

n,m=map(int,input().split())
now=[tuple(map(int,input().split())) for i in range(n)]
p=[tuple(map(int,input().split())) for i in range(m)]
for a in now:
  ans=10**10
  for c in p:
    ans=min(ans,abs(c[0]-a[0])+abs(c[1]-a[1]))
  print(ans)


n,m=map(int,input().split())
now=[tuple(map(int,input().split())) for i in range(n)]
p=[tuple(map(int,input().split())) for i in range(n)]
for a in now:
  ans=10**10
  for c in p:
    ans=min(ans,abs(c[0]-a[0])+abs(c[1]-a[1]))
  print(ans)


n,m=map(int,input().split())
now=[tuple(map(int,input().split())) for i in range(n)]
p=[tuple(map(int,input().split())) for i in range(n)]
for a,b in now:
  ans=10**10
  for c,d in p:
    ans=min(ans,abs(c-a)+abs(d-b))
  print(ans)


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)]
def d(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
for i in a:
    ans=10101001010
    ch=0
    for j in range(m):
        if d(i,c[j])<ans:
            ch=j
            ans=d(i,c[j])
    print(ch+1)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n, m = map(int, input().split())

a = [[0, 0] for i in range(n)]

c = [[0, 0] for i in range(m)]

for i in range(n):
    a[i][0], a[i][1] = map(int, input().split())

for i in range(m):
    c[i][0], c[i][1] = map(int, input().split())

index = 0

print(a,c)

for i in range(n):
    for j in range(m):
        if j == 0 :
            k = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1]) +1

        di = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])
        if di < k:
            index = j + 1
            k = di
    print(index)

n, m = map(int, input().split())

a = [[0, 0] for i in range(n)]

c = [[0, 0] for i in range(m)]

for i in range(n):
    a[i][0], a[i][1] = map(int, input().split())

for i in range(m):
    c[i][0], c[i][1] = map(int, input().split())

index = 0


for i in range(n):
    for j in range(m):
        if j == 0 :
            k = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1]) +1

        di = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])
        if di < k:
            index = j + 1
            k = di
    print(index)


Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
3 4
10 10
-10 -10
3 3
1 2
2 3
3 5
3 5

n,m=map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
C = [list(map(int,input().split())) for _ in range(m)]
for a,b in A:
  l=[abs(a-c)+abs(b-d) for c,d in C]
  print(l.index(min(l))+1)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)


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)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)

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)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):

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)

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)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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))

  print(ans)

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

  print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n,m = map(int,input().split())
l_n =list(list(map(int,input().split())) for i in range(n))
l_m =list(list(map(int,input().split())) for i in range(m))
q = 1000000
for i in range(n):
  for t in range(m):
    a,b = l_n[i]
    c,d = l_m[t]
    v= abs(a-c)+abs(b-d)
    if v<=q:
      q = v
      z = t
  print(z+1)
  q = 100000
    

n,m = map(int,input().split())
l_n =list(list(map(int,input().split())) for i in range(n))
l_m =list(list(map(int,input().split())) for i in range(m))
for i in range(n):
  q = 10**9
  for t in range(m):
    a,b = l_n[i]
    c,d = l_m[t]
    v= abs(a-c)+abs(b-d)
    if v<q:
      q = v
      z = t
  print(z+1)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):

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)



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)



Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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])

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

Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n,m = map(int,input().split())
x = [0]*n
y = [0]*n
mx = [0]*m
my = [0]*m
for i in range(n):
    x[i],y[i] = map(int,input().split())
for j in range(m):
    mx[j],my[j] = map(int,input().split())
ans = [0]*n
for k in range(n):
    dis = 0
    cnt = 1
    for l in range(n):
        if abs(x[k]-xs[l])+abs(y[k]-ys[l]) > dis:
            dis = abs(x[k]-xs[l])+abs(y[k]-ys[l])
            cnt = l+1
    ans[k] = cnt
for h in ans:
    print(h)

n,m = map(int,input().split())
student = []
Coodinate = []
for i in range(n):
    student.append(list(map(int,input().split())))
for j in range(m):
    Coodinate.append(list(map(int,input().split())))
ans = []
#print(student)
#print(Coodinate)
for k in student:
    manhattan = 100000000000
    number = 0
    for u in range(m):
        manhattann = abs(k[0]-Coodinate[u][0])+abs(k[1]-Coodinate[u][1])
        if manhattann < manhattan:
            manhattan = manhattann
            number = u+1
    ans.append(number)
for y in ans:
    print(y)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
n, m = map(int, input().split(" "))

def abs(n):
    return n if n>0 else -n


for i in range(1, n+1):
    ab = list(map(int, input().split(" ")))
for j in range(1, m+1):
    cd = list(map(int, input().split(" ")))

for i in range(0, n):
    delta = 999999999999
    ans=0
    for j in range(0, m):
        newdelta = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])
        if delta>newdelta:
            delta=newdelta
            ans=j+1
    print(ans)



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




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


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)

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)


Verdicts: Wrong Answer

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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):
    for j in range(M):
        dist = []
        tmp = abs(a[i]-c[i]) + abs(b[i]-d[i])
        dist.append(tmp)

    print(dist.index(min(dist)))

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):
    dist = []

    for j in range(M):
        tmp = abs(a[i]-c[j]) + abs(b[i]-d[j])
        dist.append(tmp)

    print(dist.index(min(dist)) + 1)

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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))
    

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)
    

Verdicts: Runtime Error

Accepted
Problem: There are N students and M checkpoints on the xy-plane.   The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).   When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_.   The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.   Here, |x| denotes the absolute value of x.   If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.   Which checkpoint will each student go to?

Submission attempts (in order):
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)

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)

Verdicts: Runtime Error

Accepted