TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a, b = map(int, input())
ans = (a+b)%24
print(ans)

a, b = map(int, input().split())
ans = (a+b)%24
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a,b = map(int,input().splilt())
print((a+b)//24)

a,b = map(int,input().split())
print((a+b)%24)


Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
import sys
a, b = sys.stdin.readline().split()

print((a+b)%24)

import sys
a, b = map(int, sys.stdin.readline().split())

print((a+b)%24)


Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
A, B = map(int, input().split())
print((A + B) // 24)

A, B = map(int, input().split())
print((A + B) % 24)

Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a,b=map(int,input().split())
if (a>b):
    s=a+b
    s=s%24
if (b>=a):
    s=a-b
if (s<=0):
    s=s*-1

print(s)



a, b=input().split(" ")
a=float(a)
b=float(b)
s=a-b
if( s> 0 and s<=24 ):
    t=b-a
if(s <=0 ):
    tm=s%24
    t=24+tm
    
if (s<24 ):
    tm=s%24
    t=24-tm
print('%d'%t)




a, b = list(map(lambda x: int(x), input().split(" ")))

print((a+b)%24)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
print((int(input())+int(input()))%24)

print(sum(map(int,input().split()))%24)

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a, b = map(int, input().split())
print(a + b) if a + b > 24 else print(a + b - 24)

a, b = map(int, input().split())
print(a + b) if a + b < 24 else print(a + b - 24)

Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a, b = map(int, input().split())
print((a+b)//24)

a, b = map(int, input().split())
print((a+b)%24)

Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a,b = map(int,input().split())

if a+b>24
    print(a+b-24)
else:
    print(a+b)


a,b = map(int,input().split())

if a+b>=24:
    print(a+b-24)
else:
    print(a+b)




Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
A
 
B


A,B = map(int, input().split())

ans = None

if A+B > 23:
  ans = A+B-24
else:
  ans = A+B
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a,b=int(input().split())
print((a+b)%24)

a,b=map(int,input().split())
print((a+b)%24)

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
def r_t(n):
    return sum(map(int, n.split()))%24
r_t(input())

def r_t(n):
    return sum(map(int, n.split()))%24
print(r_t(input()))

Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a, b =map(in, input().split())
print((a+b)%24)

a, b = map(int, input().split())
print((a + b)%24)

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
print((lambda a,b : (a+b)//24)(list(map(int,input().split())) ))

print((lambda a : (a[0]+a[1])%24)(list(map(int,input().split())) ))


Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a,b = map(int,input().split())

print(a+b-24)

a,b = map(int,input().split())

if (a+b>=24):
  print(a+b-24)
else:
  print(a+b)


Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a.b=map(int,input().split())
print((a+b)%24)

n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort()
v.reverse()
ave=0
for i in range(a):
  ave+=v[i]
  
print(ave/a)

l=0
for j in range(a,b):
  if v[a-1]==v[j]:
    l+=1
    
p=v.count(v[a-1])

from math import factorial
a=factorial(p) / factorial(p-l) / factorial(l)
print(a)
  

a,b=map(int,input().split())
print((a+b)%24)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
AB = input()
ABL= AB.replace("\n", " ").split(" ")

print(ABL)
A = ABL[0]
if len(ABL) == 1:
    C = A
B = ABL[1]
C = int(A) + int(B )
if C >= 24:
    C -= 24
print(C)


AB =input()
if len(AB) <= 2:
    ABL = [AB]
else:
    ABL= AB.replace("\n", " ").split(" ")

print(ABL)
A = int(ABL[0])
if len(ABL) <= 2:
    C = A
else:
    B = ABL[1]
    C = int(A) + int(B )
if C >= 24:
    C -= 24
print(C)


AB =input()
if len(AB) <= 2:
    ABL = [AB]
else:
    ABL= AB.replace("\n", " ").split(" ")


A = int(ABL[0])
if len(ABL) <= 2:
    C = A
else:
    B = ABL[1]
    C = int(A) + int(B )
if C >= 24:
    C -= 24
print(C)


A = int(input())
B = int(input())
C = A + B 
if C >= 24:
    C -= 24
print(C)


AB = input()
if len(AB) <= 2:
    ABL = [AB]
else:
    ABL= AB.replace("\n", " ").split(" ")



A = int(ABL[0])
if len(AB) <= 2:
    C = A
else:
    B = ABL[1]
    C = int(A) + int(B )
    
if C >= 24:
    C -= 24
print(C)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
A,B = map(int,input().split())
print((A+B)//24)

A,B = map(int,input().split())
print((A+B)%24)

Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a, b = map(int, input().split())
print(a+b//24)

a, b = map(int, input().split())
print((a+b)%24)

Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a,b = list(map(int, input().split()))
print(mod(a+b))

a,b = list(map(int, input().split()))
print((a+b)%24)

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
a, b = map(int,input().split())
print((a+b)%12)

a, b = map(int,input().split())
print((a+b)%24)


Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
import sys

sys.setrecursionlimit(10000)


def memoize(f):
    cache = {}

    def func(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]

    return func


@memoize



def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))

b = input().split()
a = [int(b[i]) for i in range(len(b))]

if(a[0] + a[1] >= 24 ):
  print(a[0] + a[1] - 24)
else:
  print(a[0] + a[1])

  

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
num=input().split(" ")
a=num[0]
b=num[1]
if a+b>=24:
	print(a+b-24)
else:
	print(a+b)

num=input().split(" ")
a=int(num[0])
b=int(num[1])
if a+b>=24:
	print(a+b-24)
else:
	print(a+b)

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
N, A, B = map(int, input().split())
L = list(map(int, input().split()))

num = [0 for x in range(N)]
total = [0 for x in range(N)]

for i, v in enumerate(L):
    for j in reversed(range(1, i + 1)):
        new_v = total[j - 1] + v
        if(new_v > total[j]):
            total[j] = new_v
            num[j] = num[j - 1]
        elif(new_v == total[j]):
            num[j] = num[j] + num[j - 1]

    if(v > total[0]):
        total[0] = v
        num[0] = 1
    elif(v == total[0]):
        num[0] = num[0] + 1

print(total)
total = [x / (i + 1) for i, x in enumerate(total)]
total = total[(A - 1):B]
num = num[(A - 1):B]

maxV = max(total)
maxNum = sum([j for i, j in zip(total, num) if i == maxV])
print(maxV)
print(maxNum)

if __name__ == '__main__':
    h1 = input()
    a, b = h1.split()
    print((int(a) + int(b)) % 24)

Verdicts: Runtime Error

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
A,B=map(int,input().split())
ans=(A+B)//24
print(ans)


A,B=map(int,input().split())
ans=(A+B)%24
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.   In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".   The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.

Submission attempts (in order):
A,B=map(str,input().split())
#print(sorted(B)[0])
print((A+B)%24)

A,B=map(int,input().split())
#print(sorted(B)[0])
print((A+B)%24)

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())
student=[]
man=[]
for i in range(n):
  x,y=map(int,input().split())
  student.append([x,y])
for i in range(m):
  x,y=map(int,input().split())
  man.append([x,y])
for i in student:
  ans=[]
  for j in man:
    ans.append(abs(i[0]-j[0])+abs(i[1]-j[1]))
  print(ans.index(max(ans))+1)

n,m=map(int,input().split())
student=[]
man=[]
for i in range(n):
  x,y=map(int,input().split())
  student.append([x,y])
for i in range(m):
  x,y=map(int,input().split())
  man.append([x,y])
for i in student:
  ans=[]
  for j in man:
    ans.append(abs(i[0]-j[0])+abs(i[1]-j[1]))
  print(ans.index(max(ans)))

n,m=map(int,input().split())
student=[]
man=[]
for i in range(n):
  x,y=map(int,input().split())
  student.append([x,y])
for i in range(m):
  x,y=map(int,input().split())
  man.append([x,y])
for i in student:
  ans=[]
  for j in man:
    ans.append(abs(i[0]-j[0])+abs(i[1]-j[1]))
  print(ans.index(min(ans))+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):
students = []
for _ in range(N):
    l = list(map(int,input().split()))
    students.append(l)

check_points = []

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

minimum_points = 0

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


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

check_points = []

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

minimum_points = 0

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

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=[]
for i in range(n):
  A.append(list(map(int,input().split())))
for i in range(m):
  B.append(list(map(int,input().split())))

for i in A:
  man=1000000000
  for j in B:
    man=min(man,abs(i[0]-j[0])+abs(i[1]-j[1]))
  print(man)

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

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

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

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


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 = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(N)]
C = [[int(i) for i in input().split()] for j in range(M)]

ls1 = []
for i in range(N):
    ls2 = []
    for j in range(M):
        ls2.append(abs(A[i][0] - C[j][0]) + abs(A[i][1] - C[j][1]))
    a = min(ls2)
    ls1.append(ls2.index(a))
for i in ls1:
    print(i)

N, M = [int(i) for i in input().split().strip()]
A = [[int(i) for i in input().split().strip()] for j in range(N)]
C = [[int(i) for i in input().split().strip()] for j in range(M)]

ls1 = []
for i in range(N):
    ls2 = []
    for j in range(M):
        ls2.append(abs(A[i][0] - C[j][0]) + abs(A[i][1] - C[j][1]))
    a = min(ls2)
    ls1.append(ls2.index(a))
for i in ls1:
    print(i)

N, M = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(N)]
C = [[int(i) for i in input().split()] for j in range(M)]

ls1 = []
for i in range(N):
    ls2 = []
    for j in range(M):
        ls2.append(abs(A[i][0] - C[j][0]) + abs(A[i][1] - C[j][1]))
    a = min(ls2)
    ls1.append(ls2.index(a))
for i in ls1:
    print(i+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):
3 4
10 10
-10 -10
3 3
1 2
2 3
3 5
3 5

n,m=[int(_)for _ in input().split()]

ab=[[int(_) for _ in input().split()]for i in range(n)]
cd=[[int(_) for _ in input().split()]for i in range(m)]


def dist(p1,p2):
  return abs(p1[0]-p2[0])+abs(p1[1]-p2[1])

for i in range(n):
  d=1000000000
  ans=0
  for j in range(m):
    if d>dist(ab[i],cd[j]):
      ans=j+1
      d=dist(ab[i],cd[j])
  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())
ab = [input().split() for a in range(M)]
cd = [input().split() for a in range(M)]


for y in range(M):
    min_p = 999
    point = 1
    for x in range(M):
        distance = abs(int(ab[y][0]) - int(cd[x][0])) + abs(int(ab[y][1]) - int(cd[x][1]))
        if min_p == distance:
            continue
        elif min_p > distance:
            min_p = distance
            point += 1
    print(point)

N, M = map(int, input().split())
ab = [[int(a) for a in input().split()] for _ in range(N)]
cd = [[int(a) for a in input().split()] for _ in range(M)]
for i in range(N):
    min_distance = float('inf')
    check_point = 0
    for j in range(M):
        manhattan_distance = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if min_distance > manhattan_distance:
            min_distance = manhattan_distance
            check_point = j+1
    print(check_point)


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=[]
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 a:
  ans=10**18
  t=0
  for j in b:
    if abs(i[0]-j[0])+abs(i[1]-j[1])<ans:
      t=j+1
      ans=abs(i[0]-j[0])+abs(i[1]-j[1])
  print(t)

n,m=map(int,input().split())
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 a:
  ans=10**18
  t=0
  for j in range(m):
    if abs(i[0]-b[j][0])+abs(i[1]-b[j][1])<ans:
      t=j+1
      ans=abs(i[0]-b[j][0])+abs(i[1]-b[j][1])
  print(t)


n,m=map(int,input().split())
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 a:
  ans=10**18
  t=0
  for j in range(m):
    if abs(i[0]-b[j][0])+abs(i[1]-b[j][1])<ans:
      t=j+1
      ans=abs(i[0]-b[j][0])+abs(i[1]-b[j][1])
  print(t)


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()))
students = list()
checkpoints = list()

for i in range(N):
	students.append(list(map(int, input().split())))

for i in range(M):
	checkpoints.append(list(map(int, input().split())))

ans = [0] * N

for i in range(N):
	mindif = 4 * 10**8 + 1
	for j in range(M):
		dif = abs(students[i][0] - checkpoints[j][0]) + abs(students[i][1] - checkpoints[j][1])
		if dif < mindif:
			mindif = dif
			ans[i] = j

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


N, M = list(map(int, input().split()))
students = list()
checkpoints = list()

for i in range(N):
	students.append(list(map(int, input().split())))

for i in range(M):
	checkpoints.append(list(map(int, input().split())))

ans = [0] * N

for i in range(N):
	mindif = 4 * 10**8 + 1
	for j in range(M):
		dif = abs(students[i][0] - checkpoints[j][0]) + abs(students[i][1] - checkpoints[j][1])
		if dif < mindif:
			mindif = dif
			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())

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

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

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

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

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


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):
yandy
n, m = map(int, input().split())

student = []

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

point = []

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

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


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

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

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

n,m=map(int,input().split())
a,b,c,d=[],[],[],[]
for i in range(n):
    o = list(map(int, input().split()))
    a.append(o[0])
    b.append(o[1])
for i in range(m):
    o = list(map(int, input().split()))
    c.append(o[0])
    d.append(o[1])
s = []
for i in range(n):
    g = float('inf')
    h = 0
    for j in range(m):
        if g > abs(a[i]-c[j])+abs(b[i]-d[j]):
            g = abs(a[i]-c[j])+abs(b[i]-d[j])
            h = j+1
    s.append(h)
for i in s:
    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 = [None]*n
points = [None]*m
for i in range(n):
  students[i] = tuple(map(int,input().split()))
for i in range(m):
  points[i] = tuple(map(int,input().split()))

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


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

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

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())
student = [tuple(map(int, input().split())) for _ in range(N)]
checkpoint = [tuple(map(int, input().split())) for _ in range(M)]

closest = {}
for s in student:
    min_dist = 'INF'
    ans = 1
    for c in checkpoint:
        dist = abs(s[0]-c[0]) + abs(s[1]-c[1])
        if min_dist == 'INF' or dist < min_dist:
            min_dist = dist
            closest[s] = ans
        ans += 1

print(closest[s] for s in student)
            

N, M = map(int, input().split())
Std = [tuple(map(int, input().split())) for _ in range(N)]
Chp = [tuple(map(int, input().split())) for _ in range(M)]
INF = 10e9
Arrv = []
Mdist = lambda x,y,u,v:abs(x-u)+abs(y-v)
for s in Std:
    close = INF
    for i in range(M):
        dist = Mdist(*s,*Chp[i])
        if dist < close:
            close = dist
            arrv = i+1
    Arrv.append(arrv)
for ar in Arrv:
    print(ar)    

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):
# B-Checkpoints


N, M = map(int, input().split()) 
ABs = [] 
CDs = [] 


for i in range(N):
    ABs.append([int(x) for x in input().split()])


for i in range(N):
    CDs.append([int(x) for x in input().split()])

for a,b in ABs:
    
    distance = [abs(a-c) + abs(b-d) for c,d in CDs]
    print(distance)
    
    
    
    print(distance.index(min(distance)) + 1)


# B-Checkpoints


N, M = map(int, input().split()) 
ABs = [] 
CDs = [] 


for i in range(N):
    ABs.append([int(x) for x in input().split()])


for i in range(M):
    CDs.append([int(x) for x in input().split()])

for a,b in ABs:
    
    distance = [abs(a-c) + abs(b-d) for c,d in CDs]
    
    
    
    print(distance.index(min(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())
ab=[list(map(int, input().split())) for i in range(n)]
cd=[list(map(int, input().split())) for j in range(m)]

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

n,m=map(int,input().split())
ab=[list(map(int, input().split())) for i in range(n)]
cd=[list(map(int, input().split())) for j in range(m)]

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

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=[]
b_list=[]
for i in range(n):
  a,b=map(int, input().split())
  a_list.append(a)
  b_list.append(b)
c_list=[]
d_list=[]
for i in range(m):
  c,d=map(int, input().split())
  c_list.append(c)
  d_list.append(d)
for i in range(n):
  min=0
  min_number=0
  for j in range(m):
    d=abs(a[i]-c[j])+abs(b[i]-d[j])
    if d<min:
      min=d
      min_number=j
  print(min_number)

n,m=map(int, input().split())
a_list=[]
b_list=[]
for i in range(n):
  a,b=map(int, input().split())
  a_list.append(a)
  b_list.append(b)
c_list=[]
d_list=[]
for i in range(m):
  c,d=map(int, input().split())
  c_list.append(c)
  d_list.append(d)
for i in range(n):
  min=2*(10**8)
  min_number=0
  for j in range(m):
    d=abs(a_list[i]-c_list[j])+abs(b_list[i]-d_list[j])
    if d<min:
      min=d
      min_number=j
  print(min_number+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 i in range(N)]
T=[list(map(int,input().split())) for i in range(M)]
for i in range(N):
    x1=S[i][0]
    y1=S[i][1]
    x2=T[0][0]
    y2=T[0][1]
    min=abs(x1-x2)+abs(y1-y2)
    x1=S[i][0]
    y1=S[i][1]
    for j in range(M-1,-1,-1):
        x2=T[j][0]
        y2=T[j][1]
        if min>=abs(x1-x2)+abs(y1-y2):
            min=abs(x1-x2)+abs(y1-y2)
            R[i]=j+1
for i in range(len(R)):
    print(R[i])

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 range(N):
    dmin=abs(a[i][0]-b[0][0])+abs(a[i][1]-b[0][1])
    num=1
    for j in range(M):
        dist=abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])
        if dmin>dist:
            dmin=dist
            num=j+1
    print(num)  

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=[]
p=[]
md=[[None,float('INF')] for i in range(n)]
for i in range(n):
    t1,t2=map(int,input().split())
    s.append([t1,t2])
for i in range(m):
    t1,t2=map(int,input().split())
    p.append([t1,t2])
for i in range(n):
    for j in range(m):
        if md[i][1]>abs(s[i][0]-p[j][0])+abs(s[i][1]-p[j][1]):
            md[i][0]=j+1
for i in range(n):
    print(md[i][0])

n,m=map(int,input().split())
s=[]
p=[]
md=[[None,float('INF')] for i in range(n)]
for i in range(n):
    t1,t2=map(int,input().split())
    s.append([t1,t2])
for i in range(m):
    t1,t2=map(int,input().split())
    p.append([t1,t2])
for i in range(n):
    for j in range(m):
        if md[i][1]>abs(s[i][0]-p[j][0])+abs(s[i][1]-p[j][1]):
            md[i][0]=j+1
            md[i][1]=abs(s[i][0]-p[j][0])+abs(s[i][1]-p[j][1])
for i in range(n):
    print(md[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())
s = []
d = []
for i in range(n):
    x, y = map(int, input().split())
    s.append([x, y])
for i in range(m):
    x, y = map(int, input().split())
    d.append([x, y])
for i in s:
    a = m
    c = abs(i[0] - x) + abs(i[1] - y)
    for j in range(m):
        c_t = abs(i[0] - d[j][0]) + abs(i[1] - d[j][1])
        if c_t < c:
            c = min(c, c_t)
            a = j
    print(a)

n, m = map(int, input().split())
s = []
d = []
for i in range(n):
    x, y = map(int, input().split())
    s.append([x, y])
for i in range(m):
    x, y = map(int, input().split())
    d.append([x, y])
for i in s:
    a = m
    c = abs(i[0] - d[0][0]) + abs(i[1] - d[0][1])
    for j in range(1, m):
        c_t = abs(i[0] - d[j][0]) + abs(i[1] - d[j][1])
        if c_t < c:
            c = min(c, c_t)
            a = j
    print(a)


n, m = map(int, input().split())
s = []
d = []
for i in range(n):
    x, y = map(int, input().split())
    s.append([x, y])
for i in range(m):
    x, y = map(int, input().split())
    d.append([x, y])
for i in s:
    a = m
    c = abs(i[0] - x) + abs(i[1] - y)
    for j in range(m):
        c_t = abs(i[0] - d[j][0]) + abs(i[1] - d[j][1])
        if c_t < c:
            c = min(c, c_t)
            a = j
    print(a)

n, m = map(int, input().split())
s = []
d = []
for i in range(n):
    x, y = map(int, input().split())
    s.append([x, y])
for i in range(m):
    x, y = map(int, input().split())
    d.append([x, y])
for i in s:
    a = 1
    c = abs(i[0] - d[0][0]) + abs(i[1] - d[0][1])
    for j in range(1, m):
        c_t = abs(i[0] - d[j][0]) + abs(i[1] - d[j][1])
        if c_t < c:
            c = min(c, c_t)
            a = j + 1
    print(a)


Verdicts: Wrong Answer

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())
stds = [tuple(map(int,input().split())) for _ in range(n)]
points = [tuple(map(int,input().split())) for _ in range(m)]

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

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

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

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

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



Verdicts: Wrong Answer

Accepted