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):
def main():
    n, m = map(int, input().split())
    students = [tuple(map(int, input().split())) for i in range(n)]
    check_points = [tuple(map(int, input().split())) for i in range(m)]

    for a, b in students:
        dist = [abs(a - c) + abs(b - d) for c, d in check_points]
        print(min(dist) + 1)

    # for st in students:
    
    #     for pt in check_points:
    #         if abs(pt[0] - st[0]) + abs(pt[1] - st[1]) < \
    #            abs(min_pt[0] - st[0]) + abs(min_pt[1] - st[1]):
    #             min_pt = pt
    #     print(check_points.index(min_pt) + 1)


if __name__ == "__main__":

    main()


def main():
    n, m = map(int, input().split())
    students = [tuple(map(int, input().split())) for i in range(n)]
    check_points = [tuple(map(int, input().split())) for i in range(m)]

    for a, b in students:
        dist = [abs(a - c) + abs(b - d) for c, d in check_points]
        print(check_points.index(min(dist) + 1))
        
    # for st in students:
    
    #     for pt in check_points:
    #         if abs(pt[0] - st[0]) + abs(pt[1] - st[1]) < \
    #            abs(min_pt[0] - st[0]) + abs(min_pt[1] - st[1]):
    #             min_pt = pt
    #     print(check_points.index(min_pt) + 1)


if __name__ == "__main__":

    main()


def main():
    n, m = map(int, input().split())
    students = [tuple(map(int, input().split())) for i in range(n)]
    check_points = [tuple(map(int, input().split())) for i in range(m)]

    for a, b in students:
        dist = [abs(a - c) + abs(b - d) for c, d in check_points]
        print(dist.index(min(dist)) + 1)

    # for st in students:
    
    #     for pt in check_points:
    #         if abs(pt[0] - st[0]) + abs(pt[1] - st[1]) < \
    #            abs(min_pt[0] - st[0]) + abs(min_pt[1] - st[1]):
    #             min_pt = pt
    #     print(check_points.index(min_pt) + 1)


if __name__ == "__main__":

    main()


Verdicts: Wrong Answer

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=[list(map(int,input().split()) for _ in range(n)]
c_d=sorted([list(map(int,input().split()) for _ in range(m)])
for i in range(n):
  res=1
  d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])
  for j in range(m):
    t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])
    if t<d:
      d=t
      res=j+1
  print(res)
    
  

n,m=map(int,input().split())
a_b=[list(map(int,input().split())) for _ in range(n)]
c_d=[list(map(int,input().split())) for _ in range(m)]
for i in range(n):
  res=1
  d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])
  for j in range(1,m):
    t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])
    if t<d:
      d=t
      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())
ab = list(list(map(int, input().split())) for _ in range(n))
cd = list(list(map(int, input().split())) for _ in range(m))

for i in range(n):
    for j in range(m):
        num = []
        num.append(abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]))
    else:
        mini = min(num)
        print(num.index(mini)+1)
        num = []

n, m = map(int,input().split())
ab = list(list(map(int, input().split())) for _ in range(n))
cd = list(list(map(int, input().split())) for _ in range(m))

for i in range(n):
    num = []
    for j in range(m):
        num.append(abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]))
    else:
        mini = min(num)
        print(num.index(mini)+1)
        num = []

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




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)

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()))
 
s = [list(map(int,input().split())) for i in range(n)]
c = [list(map(int,input().split())) for j in range(n)]
 
for t1 in s:
    l = list(map(lambda x: abs(t1[0] - x[0]) + abs(t1[1] - x[1]), c))
    print(l.index(min(l)) + 1)

N,M = list(map(int, input().split()))
 
s = [list(map(int,input().split())) for i in range(N)]
c = [list(map(int,input().split())) for j in range(M)]
 
for t1 in s:
    l = list(map(lambda x: abs(t1[0] - x[0]) + abs(t1[1] - x[1]), 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):
[n,m]=list(map(int,input().split()))
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))
cd=[]
for i in range(m):
    cd.append(list(map(int,input().split())))
ans=[]
for i in range(n):
    kyorimin=10**9
    for j in range(m):
        kyori=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if kyorimin>kyori:
            goal=j+1
    ans.append(goal)
for i in range(len(ans)):
    print(ans[i])

[n,m]=list(map(int,input().split()))
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))
cd=[]
for i in range(m):
    cd.append(list(map(int,input().split())))
ans=[]
for i in range(n):
    kyorimin=10**9
    for j in range(m):
        kyori=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if kyorimin>kyori:
            goal=j+1
            kyorimin=kyori
    ans.append(goal)
for i in range(len(ans)):
    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())
man = [[int(x) for x in input().split()] for _ in range(N)]
check = [[int(x) for x in input().split()] for _ in range(M)]

for a, b in man:
    tmp = 1000000000
    ans = 1
    for i, (c, d) in enumerate(check):
        if tmp > (abs(a-c) + abs(b-d)):
            tmp = min(tmp, abs(a-c) + abs(b-d))
    print(ans)

N, M = map(int, input().split())
man = [[int(x) for x in input().split()] for _ in range(N)]
check = [[int(x) for x in input().split()] for _ in range(M)]

for a, b in man:
    tmp = 1000000000
    ans = 1
    for i, (c, d) in enumerate(check):
        if tmp > (abs(a-c) + abs(b-d)):
            tmp = min(tmp, abs(a-c) + abs(b-d))
            ans = i+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):
import os
import sys


def manhatten(tupleA,tupleB):
	return abs(tupleA[0]-tupleB[0]) + abs(tupleA[1]-tupleB[1])

header = input().split()
N,M = int(header[0]),int(header[1])
students = []
checkpoints = []

for i in range(N):
	student = input().split()
	student = [int(x) for x in student]
	students.append(tuple(student))

for i in range(M):
	checkpoint =input().split()
	checkpoint = [int(x) for x in checkpoint]
	checkpoints.append(tuple(checkpoint))

for student in students:
	distance = []
	for checkpoint in checkpoints:
		d = manhatten(student,checkpoint)
		distance.append(d)
	print(distance)
	print(distance.index(min(distance))+ 1)

import os
import sys


def manhatten(tupleA,tupleB):
	return abs(tupleA[0]-tupleB[0]) + abs(tupleA[1]-tupleB[1])

header = input().split()
N,M = int(header[0]),int(header[1])
students = []
checkpoints = []

for i in range(N):
	student = input().split()
	student = [int(x) for x in student]
	students.append(tuple(student))

for i in range(M):
	checkpoint =input().split()
	checkpoint = [int(x) for x in checkpoint]
	checkpoints.append(tuple(checkpoint))

for student in students:
	distance = []
	for checkpoint in checkpoints:
		d = manhatten(student,checkpoint)
		distance.append(d)
	print(distance.index(min(distance))+ 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())
p = [list(map(int, input().split())) for i in range(n + m)]
for a, b in p[:n]:
  x = [abs(a - c) + abs(b - d) for c, d in p[n:]]
print(x.index(min(x)) + 1)

n, m = map(int, input().split())
a = [input().split() for i in range(n)]
c = []
for i in range(n):
  for j in range(m):
    b = input().split()
    c.append(abs(a[i][0] - b[0]) + abs(a[i][1] - b[1]))
  print(c.index(min(c)))
 
    
  

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

Verdicts: Wrong Answer

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

nodes, checks = [], []
for i in range(N):
    nodes.append(map(int, input().split()))
for j in range(M):
    checks.append(map(int, input().split()))

for i in range(N):
    argMin, distMin = None, float('inf')
    for j in range(M):
        dist = abs(nodes[i][0] - checks[j][0]) + abs(nodes[i][1] - checks[j][1])
        if dist < distMin: argMin, distMin = j, dist
    print(j)

N, M = map(int, input().split())

nodes, checks = [], []
for i in range(N):
    nodes.append(list(map(int, input().split())))

for j in range(M):
    checks.append(list(map(int, input().split())))

for i in range(N):
    argMin, distMin = None, float('inf')
    for j in range(M):
        dist = abs(nodes[i][0] - checks[j][0]) + abs(nodes[i][1] - checks[j][1])
        if dist < distMin: argMin, distMin = j, dist
    print(argMin + 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())
lab=[]
for i in range(N):
    lab.append(list(map(int,input().split())))
lcd=[]
for i in range(N):
    lcd.append(list(map(int,input().split())))
for i in range(N):
    dmin=10**9
    for j in range(M):

        if abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])<dmin:
            dmin=abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])
    print(dmin)


N,M=map(int,input().split())
lab=[]
for i in range(N):
    lab.append(list(map(int,input().split())))
lcd=[]

for i in range(M):
    lcd.append(list(map(int,input().split())))
for i in range(N):
    dmin=10**9
    ans=1
    for j in range(M):

        if abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])<dmin:
            #print(abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1]))
            dmin=abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])
            ans=j+1
    #print(dmin)
    
    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):
# -*- coding: utf-8 -*-


def solve(s_pp, p_pp):
    p_nums = []
    for x, y in s_pp:
        distance = []
        for xx, yy in p_pp:
            n = abs(x, xx) + abs(y, yy)
            distance.append(n)
        p_nums.append(min(distance))
    return p_nums


def main():
    students, points = [int(e) for e in input().split()]
    students_ps = []
    points_ps = []

    for _ in range(students):
        x, y = [int(e) for e in input().split()]
        students_ps.append([x, y])
    for _ in range(points):
        x, y = [int(e) for e in input().split()]
        points_ps.append([x, y])
    
    for answer in solve(students_ps, points_ps):
        print(answer)


main()


# -*- coding: utf-8 -*-


def solve(s_pp, p_pp):
    p_nums = []
    for x, y in s_pp:
        distance = []
        for xx, yy in p_pp:
            n = abs(x - xx) + abs(y - yy)
            distance.append(n)
        min_distance_idx = distance.index(min(distance))
        p_nums.append(min_distance_idx + 1)
    return p_nums


def main():
    students, points = [int(e) for e in input().split()]
    students_ps = []
    points_ps = []

    for _ in range(students):
        x, y = [int(e) for e in input().split()]
        students_ps.append([x, y])
    for _ in range(points):
        x, y = [int(e) for e in input().split()]
        points_ps.append([x, y])
    
    for answer in solve(students_ps, points_ps):
        print(answer)


m

# -*- coding: utf-8 -*-


def solve(s_pp, p_pp):
    p_nums = []
    for x, y in s_pp:
        distance = []
        for xx, yy in p_pp:
            n = abs(x - xx) + abs(y - yy)
            distance.append(n)
        min_distance_idx = distance.index(min(distance))
        p_nums.append(min_distance_idx + 1)
    return p_nums


def main():
    students, points = [int(e) for e in input().split()]
    students_ps = []
    points_ps = []

    for _ in range(students):
        x, y = [int(e) for e in input().split()]
        students_ps.append([x, y])
    for _ in range(points):
        x, y = [int(e) for e in input().split()]
        points_ps.append([x, y])
    
    for answer in solve(students_ps, points_ps):
        print(answer)


main()


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 = list(map(int, input().split()))
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = list(map(int, input().split()))
c = [0] * m
d = [0] * m
for j in range(m):
    c[j], d[j] = list(map(int, input().split()))

for i in range(n):
    distance = []
    minDistance = 10 ** 8 + 1
    checkPoint = 1
    for j in range(m):
        if j == 0:
            checkPoint = 1
        else:
            distance.append(abs(a[i] - c[j]) + abs(b[i] - d[j]))
            if minDistance > distance[j]:
                minDistance = distance[j]
                checkPoint = j + 1
    print(checkPoint)

n, m = list(map(int, input().split()))
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = list(map(int, input().split()))
c = [0] * m
d = [0] * m
for j in range(m):
    c[j], d[j] = list(map(int, input().split()))

for i in range(n):
    distance = []
    minDistance = 10 ** 16
    checkPoint = 1
    for j in range(m):
        distance.append(abs(a[i] - c[j]) + abs(b[i] - d[j]))
        if minDistance > distance[j]:
            minDistance = distance[j]
            checkPoint = j + 1
    print(checkPoint)

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=[]
ans=0
ans1=0
tmp=0
for i in range(n):
    x,y=map(int,input().split())
    a.append(x)
    b.append(y)
for i in range(m):
    x,y=map(int,input().split())
    c.append(x)
    d.append(y)
for i in range(n):
    for j in range(m):
        tmp=abs(a[i]-c[j])+abs(b[i]-d[j])
        if j==0:
            ans=tmp
        if ans>tmp:
            ans1=j+1
            ans=tmp
    print(ans1)


n,m=map(int,input().split())
ans=10**9
tmp_ans=10**9
prin=0
a=[]
b=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append([x,y])
for i in range(m):
    x,y=map(int,input().split())
    b.append([x,y])
for i in range(n):
    tmp_x=a[i][0]
    tmp_y=a[i][1]
    for j in range(m):
        ans=min((abs(tmp_x-b[j][0])+abs(tmp_y-b[j][1])),ans)
        if tmp_ans!=ans:
            prin=j+1
            tmp_ans=ans
    print(prin)
    ans=10**9
    tmp_ans=10**9


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())
l1=[]
l2=[]
for i in range(n):
  l1.append(list(map(int,input().split())))
for i in range(m):
  l2.append(list(map(int,input().split())))
for i in range(n):
  l=abs(l1[i][0]-l2[0][0])+abs(l1[i][1]-l2[0][1])
  for j in range(1,m):
    if l>abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1]):
      l=abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1])
    else:
      pass
  print(l)
  

n,m=map(int,input().split())
l1=[]
l2=[]
for i in range(n):
  l1.append(list(map(int,input().split())))
for i in range(m):
  l2.append(list(map(int,input().split())))
for i in range(n):
  l=abs(l1[i][0]-l2[0][0])+abs(l1[i][1]-l2[0][1])
  n=0
  for j in range(1,m):
    if l>abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1]):
      l=abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1])
      n=j
    else:
      pass
  print(n)

n,m=map(int,input().split())
l1=[]
l2=[]
for i in range(n):
  l1.append(list(map(int,input().split())))
for i in range(m):
  l2.append(list(map(int,input().split())))
for i in range(n):
  l=abs(l1[i][0]-l2[0][0])+abs(l1[i][1]-l2[0][1])
  n=0
  for j in range(1,m):
    if l>abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1]):
      l=abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1])
      n=j
    else:
      pass
  print(n+1)


Verdicts: Wrong Answer

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())
h=[]
p=[]
def man(a,c,b,d):
    s=abs(a-b)+abs(c-d)
    return s
for i in range(n):
    h.append(list(map(int,input().split())))
for j in range(m):
    p.append(list(map(int,input().split())))
for k in range(n):
    l=float("inf")
    for v in range(m):
        x=man(h[k][0],p[v][0],h[k][1],p[v][1])
        if x<l:
            l=x
    print(l)

    



n,m=map(int,input().split())
h=[]
p=[]
def man(a,c,b,d):
    s=abs(a-b)+abs(c-d)
    return s
for i in range(n):
    h.append(list(map(int,input().split())))
for j in range(m):
    p.append(list(map(int,input().split())))
for k in range(n):
    l=float(inf)
    for v in range(m):
        x=man(h[k][0],p[v][0],h[k][1],p[v][1])
        if x<l:
            l=x
    print(l)

    

n,m=map(int,input().split())
h=[]
p=[]
def man(a,c,b,d):
    s=abs(a-c)+abs(b-d)
    return s
for i in range(n):
    h.append(list(map(int,input().split())))
for j in range(m):
    p.append(list(map(int,input().split())))
for k in range(n):
    l=float("inf")
    for v in range(m):
        x=man(h[k][0],p[v][0],h[k][1],p[v][1])
        if x<l:
            l=x
            y=v+1
    print(y)

    



Verdicts: Wrong Answer

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

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)

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=[list(map(int,input().split())) for a in range(n)]
c=[list(map(int,input().split())) for b in range(m)]
print(a)
print(c)
dist=0
minnum=0
for indi,i in enumerate(a):
    dist=0
    min=10*14
    for indj,j in enumerate(c):
        dist+=abs(i[0]-j[0])
        dist+=abs(i[1]-j[1])
        if min>dist:
            min=dist
            minnum=indj
            print(dist)
        dist=0 
    print(minnum+1)

n,m=map(int,input().split())
a=[list(map(int,input().split())) for a in range(n)]
c=[list(map(int,input().split())) for b in range(m)]
dist=0
minnum=0
for indi,i in enumerate(a):
    min=10**10
    minnum=0
    for indj,j in enumerate(c):
        dist=0 
        dist+=abs(i[0]-j[0])
        dist+=abs(i[1]-j[1])
        #print("dist={}".format(dist))
        if min>dist:
            min=dist
            minnum=indj
    print(minnum+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())
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:
  k=[]
  for c,d in c:
    k.append(abs(a-c)+abs(b-d))
  print(k.index(min(k))+1)

n,m=map(int, input().split())
s=[list(map(int, input().split())) for _ in range(n)]
o=[list(map(int, input().split())) for _ in range(m)]
for a,b in s:
  k=[]
  for c,d in o:
    k.append(abs(a-c)+abs(b-d))
  print(k.index(min(k))+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())
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

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


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

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

Verdicts: Wrong Answer

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())
gakusei = []
for i in range(N):
    a,b = map(int,input().split())
    gakusei.append((a,b))
check = []
for i in range(1,M+1):
    c,d = map(int,input().split())
    check.append((c,d))
for i in range(N):
    a,b = gakusei[i]
    z = 10**9
    m = 0
    for j in range(1,M+1):
        c,d = check[j-1]
        x = max(a-c,c-a) + max(b-d,d-b)
        if x < z:
            m = j
            z = x
    print(z)
        

N,M = map(int,input().split())
gakusei = []
for i in range(N):
    a,b = map(int,input().split())
    gakusei.append((a,b))
check = []
for i in range(1,M+1):
    c,d = map(int,input().split())
    check.append((c,d))
for i in range(N):
    a,b = gakusei[i]
    z = 10**9
    m = 0
    for j in range(1,M+1):
        c,d = check[j-1]
        x = max(a-c,c-a) + max(b-d,d-b)
        if x < z:
            m = j
            z = x
    print(m)

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()))
St = [input().split() for _ in range(N)]
Ch = [input().split() for _ in range(M)]

print(St)
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)


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


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)


Verdicts: Wrong Answer

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


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)


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

N, M = map(int, input().split())

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

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

ans_lis = []


for i in range(len(studentlis)):
    ans = int(10**100)

    tmpstudentlis = studentlis[i]

    x1 = tmpstudentlis[0]
    y1 = tmpstudentlis[1]
    
    for j in range(len(checkpointlis)):
        tmpcheckpointlis = checkpointlis[j]

        x2 = tmpcheckpointlis[0]
        y2 = tmpcheckpointlis[1]
        
        distance = (abs(x1-x2) + abs(y1-y2))

        if distance < ans:
            ans = distance
            num = j

        if j == len(checkpointlis)-1:
            ans_lis.append(num+1)


for i in ans_lis:
    print(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())
students=[]
checks=[]
def mdistance([a,b],[c,d]):
  return abs(a-c)+abs(b-d)
for i in range(n):
  a=list(map(int,input().split()))
  students.append(a)
for i in range(m):
  checks.append(list(map(int,input().split())))
for i in range(n):
  anspoint=0
  for j in range(m):
    if mdistance(students[i],checks[j])<mdistance(students[i],checks[anspoint]):
      anspoint=j
  print(j)

n,m=map(int,input().split())
s=[]
c=[]
def mdistance(a,b,c,d):
  return abs(a-c)+abs(b-d)
for i in range(n):
  a=list(map(int,input().split()))
  s.append(a)
for i in range(m):
  c.append(list(map(int,input().split())))
for i in range(n):
  anspoint=0
  for j in range(m):
    if mdistance(s[i][0],s[i][1],c[j][0],c[j][1])<mdistance(s[i][0],s[i][1],c[anspoint][0],c[anspoint][1]):
      anspoint=j
  print(anspoint+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())
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)

N = int(input())

y = []

for i in range(1, N//2):
    if N % i == 0:
        y.append( max( len(str(i)),  len(str(int(N/i))) ) )
print(min(y))

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)

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):
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :


import math


def calc_distance(student_post, checkpoint_post):
    return int(math.fabs(student_post[0] - checkpoint_post[0]) + math.fabs(student_post[1] - checkpoint_post[1]))


if __name__ == '__main__':
    import doctest
    doctest.testmod()

    first = input()
    first = first.split(" ")
    data = [int(line) for line in first]

    student_num = data[0]
    checkpoint_num = data[1]

    student_pos_data = [[int(i) for i in input().split(" ")] for i in range(student_num)]
    checkpoint_data = [[int(i) for i in input().split(" ")] for i in range(checkpoint_num)]
    print(student_pos_data)
    print(checkpoint_data)

    for each_student in student_pos_data:
        dis_list = [calc_distance(each_student, i) for i in checkpoint_data]
        print(dis_list)
        print(dis_list.index(min(dis_list)) + 1)


# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :


import math


def calc_distance(student_post, checkpoint_post):
    return int(math.fabs(student_post[0] - checkpoint_post[0]) + math.fabs(student_post[1] - checkpoint_post[1]))


if __name__ == '__main__':
    import doctest
    doctest.testmod()

    first = input()
    first = first.split(" ")
    data = [int(line) for line in first]

    student_num = data[0]
    checkpoint_num = data[1]

    student_pos_data = [[int(i) for i in input().split(" ")] for i in range(student_num)]
    checkpoint_data = [[int(i) for i in input().split(" ")] for i in range(checkpoint_num)]

    for each_student in student_pos_data:
        dis_list = [calc_distance(each_student, i) for i in checkpoint_data]
        print(dis_list.index(min(dis_list)) + 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())
s = [tuple(map(int,input().split())) for _ in range(n)]
c = [tuple(map(int,input().split())) for _ in range(m)]
for i in range(n):
  mini = 0
  m_i = 0
  for j in range(m):
    dis = abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1])
    print(mini, dis)
    if j==0:
      mini, m_i = dis, j+1
      continue
    elif mini > dis:
      mini, m_i = dis, j+1
  print(m_i)

n,m = map(int, input().split())
s = [tuple(map(int,input().split())) for _ in range(n)]
c = [tuple(map(int,input().split())) for _ in range(m)]
for i in range(n):
  mini = 0
  m_i = 0
  for j in range(m):
    dis = abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1])
    if j==0:
      mini, m_i = dis, j+1
      continue
    elif mini > dis:
      mini, m_i = dis, j+1
  print(m_i)

Verdicts: Wrong Answer

Accepted