TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t, a = map(int,input().split())
h = list(map(int,input().split()))
tem = [ans(a - ( t - i * 0.006)) for i in h]
print(tem.index(min(tem)) + 1)

n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tmp = 1000000
ans = 0
h.sort(reverse = True)

for i in range(n):
  c = t - h[i] * 0.006
  d = a - c
  if d < 0:
    d = -d
  if d < tmp:
    tmp = d
    ans = i + 1
print(ans)

n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tmp = 1000000
ans = 0
h.sort(reverse = True)

for i in range(n):
  c = t - h[i] * 0.006
  d = a - c
  if d < 0:
    d = -d
  if d < tmp:
    tmp = d
    ans = i + 1
print(ans)

n = int(input())
t, a = map(int,input().split())
h = list(map(int,input().split()))
tem = [abs(a - ( t - i * 0.006)) for i in h]
print(tem.index(min(tem)) + 1)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):

n = int(input())
t, a = list(map(int, input().split(' ')))
hs = list(map(int, input().split(' ')))

diff_a = list(map(lambda h: int(abs(a - t + h * 0.006)), hs))
print(diff_a)
ans = 100_000
result = -1
for i in range(n):
    if diff_a[i] <= ans:
        result = i + 1
        ans = diff_a[i]

print(result)


n = int(input())
t, a = list(map(int, input().split(' ')))
hn = list(map(int, input().split(' ')))

def get_dif(h):
    temp = t - h * 0.006
    dif = abs(temp - a)
    return dif

result = hn.index(min(hn, key=get_dif)) + 1
print(result)


Verdicts: Runtime Error

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
N=int(input())
T,A=map(int,input().split())
S=list(map(int,input().split()))
ans=0
t=0
temp=[]
for i in range(N):
	t = T-0.006*S[i] - A
	t = t*t
	temp.append(t)
print(temp)
print(temp.index(min(temp))+1)

N=int(input())
T,A=map(int,input().split())
S=list(map(int,input().split()))
ans=0
t=0
temp=[]
for i in range(N):
	t = T-0.006*S[i] - A
	t = t*t
	temp.append(t)
print(temp.index(min(temp))+1)		

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
a=int(input())
ave,risou= map(int, input().split())
h=[0]*a
h=list(map(int, input().split()))
for i in range(a):
    h[i]=abs(ave-(h[i]*0.006))
print(h.index(min(h))+1)

a=int(input())
b,c= map(int, input().split())
p=[0]*a
risou=[0]*a
p=list(map(int, input().split()))
for i in range(a):
    p[i]=b-(p[i]*0.006)
    if p[i]>=0:
        risou[i]=p[i]
    else:
        risou[i]=p[i]*-1
if 0 in risou:
    print(print(risou.index(0)+1))
else:
    print(risou.index(min(risou))+1)

a=int(input())
ave,risou= map(int, input().split())
h=[0]*a
h=list(map(int, input().split()))
for i in range(a):
    h[i]=risou-abs(ave-(h[i]*0.006))
print(h.index(max(h))+1)

a=int(input())
ave,risou= map(int, input().split())
h=[0]*a
h=list(map(int, input().split()))
for i in range(a):
    h[i]=abs(risou-(ave-(h[i]*0.006)))
print(h.index(min(h))+1)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t, a = map(int, input().split())
h = list(map(float, input().split()))

dt = 10000000
ans = 0
for i in range(len(h)):
    print(i)
    tmp = float(t) - 0.006 * h[i]
    print(i, h[i], tmp, dt, abs( a - tmp ))
    if dt > abs( a - tmp ):
        dt = abs( a - tmp )
        ans = i + 1

print(ans)


n = int(input())
t, a = map(int, input().split())
h = list(map(float, input().split()))

dt = 10000000
ans = 0
for i in range(len(h)):
    print(i)
    tmp = float(t) - 0.006 * h[i]
    if dt > abs( a - tmp ):
        dt = abs( a - tmp )
        ans = i + 1

print(ans)


n = int(input())
t, a = map(int, input().split())
h = list(map(float, input().split()))

dt = 1000
ans = 0
for i in range(len(h)):
    tmp = float(t) - 0.006 * h[i]
    if dt > abs( a - tmp ):
        dt = abs( a - tmp )
        ans = i + 1

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
N = int(input())
T, A = map(float, input().split())
H = list(map(float, input().split()))
ans = [0] * N
for i in range(N):
  ans[i] = abs(T - i * 0.006 - A)

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


N = float(input())
T, A = map(float, input().split())
H = list(map(float, input().split()))
l = [i for i in H abs(T - i * 0.006)]

print(min(l))

N = int(input())
T, A = map(float, input().split())
H = list(map(float, input().split()))
ans = [0] * N
for i in range(N):
  ans[i] = abs(T - H[i] * 0.006 - A)

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


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
N = int(input())
T, A = map(int,input().split(" "))
H =  list(map(int,input().split(" ")))

out = None
num = None

for i in range(N):
    avg = T - H[i]*0.006
    if num == None:
        out = i
        num = abs(avg)
        continue

    if num > abs(avg):
        out = i
        num = abs(avg)

print(out+1)

N = int(input())
T, A = map(int,input().split(" "))
H =  list(map(int,input().split(" ")))

out = None
num = None

for i in range(N):
    avg = T - H[i]*0.006
    if num == None:
        out = i
        num = abs(A - avg)
        continue

    if num > abs(A - avg):
        out = i
        num = abs(A - avg)

print(out+1)

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
import sys
N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ans = None
for x in range(H):
    _ans = T - x * 0.006
    if _ans == ans:
        print(ans)
        sys.exit()
    if not ans or abs(A - _ans) < abs(A - ans):
        ans = _ans
print(ans)

N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ans = None
for x in range(H):
    _ans = T - x * 0.006
    if _ans == ans:
        print(ans)
        return
    if not ans or abs(A - _ans) < abs(A - ans):
        ans = _ans
print(ans)

import sys
N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ansnum = None
ans = 0
def getdiff(A, ans):
    return abs(max(ans, A) - min(ans, A))
def chk(A, _ans, ans):
    new_d, old_d = getdiff(A, _ans), getdiff(A, ans)
    if new_d < old_d:
        return True
    return False
def showans(ans):
    print(ans)
    sys.exit()
for i, x in enumerate(H):
    _ans = int(T) - int(x) * 0.006
    if _ans == A:
        showans(i+1)
    if not ansnum or chk(int(A), _ans, ansnum):
        ans = i+1
        ansnum = _ans
showans(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
N=int(input())
T,A=map(int,input().split())
H_list=list(map(int,input().split()))
a=list(map(lambda x:abs(A-(T-x*0.006)), H_list))
#print(a)
print(min(a))

N=int(input())
T,A=map(int,input().split())
H_list=list(map(int,input().split()))
a=list(map(lambda x:abs((T-x*0.006)-A), H_list))
#print(a)
#print(min(a))
print(a.index(min(a))+1)

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
import math
N = int(input())
T,A = map(int,input().split(" "))
H = list(map(int,input().split(" ")))

def average_temperature(x):
    global T
    return T - x*0.006

r = list(map(average_temperature,H))
print(r)
a = []
for i in range(len(H)):
    c = A - r[i]
    a.append((i,abs(c),))

b = sorted(a,key=lambda x:x[1])
print(b[0][0]+1)


N = int(input())
T,A = list(map(int,input().split(" ")))
H = list(map(int,input().split(" ")))
res = 1000000
c = 1
for i in range(N):
    tmp = T-(H[i]*0.006)
    d = abs(tmp-A)
    if d < res:
        res = d
        c = i+1
print(c)





Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
N = int(input())
T,A = list(map(int, input().split()))
H = list(map(int, input().split()))
ansx=100000000000
for i in range(N):
    subans=T-H[i]*0.006
    print(subans)
    if abs(A-subans)<=abs(ansx):
        ansx=subans
        ans=i+1
print(ans)


N = int(input())
T,A = list(map(int, input().split()))
H = list(map(int, input().split()))
ansx=T-H[0]*0.006
ans=1
for i in range(N):
    subans=T-H[i]*0.006
    if abs(A-subans)<abs(A-ansx):
        ansx=subans
        ans=i+1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t,a = map(int,input().split())
h = list(int(input()) for i in range(n))

mi = 1234567890
for i in range(n):
    ti = t - h[i] * 0.006
    if abs(mi - a) > abs(ti - a):
        mi = ti
        ans = i + 1
        
print(ans)

n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))

minimum = 1234567890
for i in range(n):
    ti = t - h[i] * 0.006
    if abs(minimum - a) > abs(ti - a):
        minimum = ti
        ans = i + 1
        
print(ans)

Verdicts: Runtime Error

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
p=0
q=100
x=0
for i in range(n):
  p=abs(a-t+h[i]*0.006)
  if p<q:
    x=i
    q=p
print(i+1)

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
dt=1000000
ans=-1
th=0
for i in range(n):
  th=abs(a-t+h[i]*0.006)
  if th<dt:
    ans=i+1
    dt=th
  print(th)
print(ans)

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=100
ans=-1
for i in range(n):
  h[i]=abs(a-t+h[i]*0.006)
  print(h[i])
  if i<m:
    ans=i+1
    m=h[i]
print(ans)

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
p=0
q=100
x=0
for i in range(n):
  p=abs(a-t-h[i]*0.006)
  if p<q:
    x=i
    q=p
print(i+1)

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
dt=1000000
ans=-1
th=0
for i in range(n):
  th=abs(a-t+h[i]*0.006)
  if th<dt:
    ans=i+1
    dt=th
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t, a = map(int,input().split())
h = list(map(int,input().split()))
h = [abs((t - x * 0.006) - a) for x in h]
print(h.index(min(h)))

n = int(input())
t, a = map(int,input().split())
h = list(map(int,input().split()))
h = [abs((t - x * 0.006) - a) for x in h]
print(h.index(min(h))+1)

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
import numpy; input(); t,a=map(int,input().split())
h=list(map(lambda x: abs(a-(t-int(x)*0.006)),input().split()))
print(numpy.argmin(h))

import numpy; input(); t,a=map(int,input().split())
h=list(map(lambda x: abs(a-(t-int(x)*0.006)),input().split()))
print(numpy.argmin(h)+1)

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
m = h[0]
ans = 0

for i in range(1, n):
    num = abs(a-(t-h[i]*0.006))
    if num < m:
        ans = i
        m = num

print(ans+1)

n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
m = abs(a-(t-h[0]*0.006))
ans = 0

for i in range(1, n):
    num = abs(a-(t-h[i]*0.006))
    if num < m:
        ans = i
        m = num

print(ans+1)

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
#coding:UTF-8
num = int(input())
s = input()
ss = s.split(" ")
t = int(ss[0])
a = int(ss[1])
high = input()
high_list = high.split(" ")
calc_list = list()
for i in range(num):
  high_work = int(high_list[i])
  work = t-high_work*0.006
  calc_list.append(abs(a-work))
print(calc_list)
print(calc_list.index(min(calc_list))+1)

#coding:UTF-8
num = int(input())
s = input()
ss = s.split(" ")
t = int(ss[0])
a = int(ss[1])
high = input()
high_list = high.split(" ")
calc_list = list()
for i in range(num):
  high_work = int(high_list[i])
  work = t-high_work*0.006
  calc_list.append(abs(a-work))
print(calc_list.index(min(calc_list))+1)

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

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

for i in range(N)
    H[i] = abs(A - (T - H[i] * 0.006))
print(H.index(min(H)) + 1)

N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

for i in range(N):
    H[i] = abs(A - (T - H[i] * 0.006))
print(H.index(min(H)) + 1)


Verdicts: Runtime Error

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
input_str = input().split("\n")
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [(temp - (Hn * 0.006)) / goal for Hn in Hn]

if goal >= 0:
    print(int((avg_temp.index(max(avg_temp))) + 1))
else:
    print(int((avg_temp.index(min(avg_temp))) + 1))

input_str = input().split("\n")
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [int(temp - (Hn * 0.006)) for Hn in Hn]

print(int((avg_temp.index(max(avg_temp)))+1))




input_str = input().split("\n")
# a = [int(x) for x in a]
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [(temp - (Hn * 0.006)) for Hn in Hn]

print(int((avg_temp.index(max(avg_temp))) + 1))


input_str = input().split("\n")
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [int(temp - (Hn * 0.006)) for Hn in Hn]

print(int((avg_temp.index(max(avg_temp)))+1))




input_str = input().split("\n")
# a = [int(x) for x in a]
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [(temp - (Hn * 0.006)) / goal for Hn in Hn]

if goal >= 0:
    print(int((avg_temp.index(max(avg_temp))) + 1))
else:
    print(int((avg_temp.index(min(avg_temp))) + 1))

def main(n, t, a, h):
    def formula(t, x): return t - x * 0.006
    res = []

    for _h in h:
        res.append(abs(a - formula(t, _h)))

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


if __name__ == "__main__":
    n = int(input())
    t, a = map(int, input().split(' '))
    h = list(map(int, input().split(' ')))

    main(n, t, a, h)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
N = int(input())
t , x = map(int,input().split())
h_list = list(map(int,input().split()))
tmp = []
for h in h_list:
    tmp1 = abs(x - (t - h * 0.006))
    tmp.append(tmp1)
print(tmp)
print(tmp.index(min(tmp)) + 1)

N = int(input())
t , x = map(int,input().split())
h_list = list(map(int,input().split()))
tmp = []
for h in h_list:
    tmp1 = abs(x - (t - h * 0.006))
    tmp.append(tmp1)
print(tmp.index(min(tmp)) + 1)

Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t, a = map(int, input().split())
y = 0
z = 0

h = list(map(int, input().split()))
for i in range(1,n+1):
  x = t - (h[i-1] * 0.006)
  print(x)
  if y ==0:
    y=x
    z=i
  else:
    if abs(x-a) <= abs(y-a):
      y = x
      z = i
print(z)

n = int(input())
t, a = map(int, input().split())
y = 0

h = list(map(int, input().split()))
def comp(a,b,c):
  if abs(a-c) >= abs(b-c):
    return a
  else:
    return b
for i in range(n):
  x = t - (h[i] * 0.006)
  #print(x)
  if y ==0:
    y=x
  else:
    y=comp(x,y,a)
    z=i+1
print(z)

n = int(input())
t, a = map(int, input().split())
y = 0
z = 0

h = list(map(int, input().split()))
for i in range(1,n+1):
  x = t - (h[i-1] * 0.006)
#  print(x)
  if y ==0:
    y=x
    z=i
  else:
    if abs(x-a) <= abs(y-a):
      y = x
      z = i
print(z)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
def calc_height(t, h):
    return (t - h) * 0.006

n = int(input())
t, a = map(int, input().split())
hs = input().split()

ans = 1
diff = abs(calc_height(t, int(hs[0])))
for i, h in enumerate(hs):
    if calc_height(t, int(h)) < diff:
        ans = i + 1

print (ans)


# input
n = int(input())
t, a = map(int, input().split())
hs = list(map(int, input().split()))

# 1st point set
ans = 0
ans_diff = float("inf")

# check all point
for i in range(n):
    i_diff = abs(t - hs[i] * 0.006 - a)
    if i_diff < ans_diff:
        ans = i + 1
        ans_diff = i_diff
print (ans)


Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

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

mini = 0
min = float('inf')

for i in range(len(H)):
    if min > abs(A - (T - 0.006 * H[i])):
        mini = i + 1

print(mini)


N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

mini = 0
min = float('inf')

for i in range(len(H)):
    if min > abs(A - (T - 0.006 * H[i])):
        min = abs(A - (T - 0.006 * H[i]))
        mini = i + 1

print(mini)


Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
minval=10**5
ans=0
for i in range(N):
    val=abs(A-(T-H[i]*0.006))
    if val<minval:
        val=minval
        ans=i
print(ans+1)

N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
minval=10**5
ans=0
for i in range(N):
    val=abs(T-(12-H[i]*0.006))
    if val<minval:
        val=minval
        ans=i
print(ans+1)

N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))

minval=[abs(A-(T-item*0.006)) for item in H]
print(minval.index(min(minval))+1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

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

h = list(map(int, (input().split())))
min = abs(a - (t - h[i]*0.006))

for i in range(1, n):
    if(min > abs(a - (t - h[i]*0.006))):
        min = a - (t - h[i]*0.006)
        ans = i+1

print(ans)

n = int(input())
t, a = map(int,input().split())
min = 10000

h = list(map(int, (input().split())))

for i in range(n):
    print(a-(t-h[i]*0.006))
    if(min > a - (t - h[i]*0.006)):
        min = a - (t - h[i]*0.006)
        ans = i+1

print(ans)     

n = int(input())
t, a = map(int,input().split())

h = list(map(int, (input().split())))
min = abs(a - (t - h[0]*0.006))
ans = 1

for i in range(1, n):
    if (min > abs(a - (t - h[i]*0.006))):
        min = abs(a - (t - h[i]*0.006))
        ans = i+1

print(ans)   

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t, a = [int(i) for i in input().split(' ')]
h = [int(i) for i in input().split(' ')]

temp = []
for i in h:
    temp.append(t - i * 0.006)

near = 10001
ans = 0
for i, v in enumerate(temp):
    sub = a - v
    print(sub)
    if abs(near) > abs(sub):
        near = sub
        ans = i+1

print(ans)


n = int(input())
t, a = [int(i) for i in input().split(' ')]
h = [int(i) for i in input().split(' ')]

temp = []
for i in h:
    temp.append(t - i * 0.006)

near = 10001
ans = 0
for i, v in enumerate(temp):
    sub = a - v
    if abs(near) > abs(sub):
        near = sub
        ans = i+1

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: A country decides to build a palace.  In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.  There are N places proposed for the place. The elevation of Place i is H_i meters.  Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.  Print the index of the place where the palace should be built.  It is guaranteed that the solution is unique.

Submission attempts (in order):
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
gap = float("inf")
for i in range(n):
    print(gap)
    if abs(t - h[i] * 0.006 - a) < gap:
        ans = i + 1
        gap = abs(t - h[i] * 0.006 - a)
print(ans)

n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
gap = float("")
for i in range(n):
    print(gap)
    if abs(t - h[i] * 0.006 - a) < gap:
        ans = i + 1
        gap = abs(t - h[i] * 0.006 - a)
print(ans)

n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
gap = float("inf")
for i in range(n):
    if abs(t - h[i] * 0.006 - a) < gap:
        ans = i + 1
        gap = abs(t - h[i] * 0.006 - a)
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

Submission attempts (in order):
n, m = map(int, input().split())
list_PY = [ list(map(int,input().split(" "))) for i in range(m)]

list_PY.sort(key=lambda x:(x[0], x[1]))
cnt = 0
k = 0

for i in range(m):
    list_P = ["0" for _ in range(6)]
    list_X = ["0" for _ in range(6)]
    l = list_PY[i]
    if l[0] == k:
        cnt += 1
        a = list(str(l[0]))
        b = list(str(cnt))
        for j in range(1, len(a)+1):
            list_P[-j] = a[-j]
        for j in range(1, len(b)+1):
            list_X[-j] = b[-j]
    else:
        k = l[0]
        cnt = 1
        a = list(str(l[0]))
        b = list(str(cnt))
        for j in range(1, len(a)+1):
            list_P[-j] = a[-j]
        for j in range(1, len(b)+1):
            list_X[-j] = b[-j]

    c = list_P + list_X
    ans = "".join(c)
    print(ans)

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

for i in range(m):
    l = list_PY[i]
    l.append(i)
list_PY.sort(key=lambda x:(x[0], x[1]))

cnt = 0
k = 0
for i in range(m):
    l = list_PY[i]
    if l[0] == k:
        cnt += 1
        a = len(list(str(l[0])))
        b = "0"*(6 - a) + str(l[0])
        c = len(list(str(cnt)))
        d = "0"*(6 - c) + str(cnt)
    else:
        k = l[0]
        cnt = 1
        a = len(list(str(l[0])))
        b = "0" * (6 - a) + str(l[0])
        c = len(list(str(cnt)))
        d = "0" * (6 - c) + str(cnt)
    l.append(b+d)


list_PY.sort(key=lambda x:x[2])

for i in range(m):
    print(list_PY[i][3])

Verdicts: Wrong Answer

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

Submission attempts (in order):
import sys
import bisect
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0] for i in range(10**5+1)]
for i in l:
  s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:06}{:06}'.format(i[0],bisect.bisect_left(s[i[0]],i[1]))

import sys
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0]*(10**5+1)]
for i in l:
  if s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:0>6}{:0>6}'.format(str(i[0]),str(s[i[0]].index(i[1]))))

import sys
import bisect
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0] for i in range(10**5+1)]
for i in l:
  s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:06}{:06}'.format(i[0],bisect.bisect_left(s[i[0]],i[1])))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

Submission attempts (in order):
n,m=map(int,input().split())
d=[]
for i in range(m):
  d.append(list(map(int,input().split())))
  d[i].append(1)
s=sorted(d)
k=0
if m>1:
  for i in range(m-1):
    if s[i][0]==s[i+1][0]:
      s[i][2]=k
      s[i+1][2]=k+1
      k=k+1
    else:
      k=1
      s[i+1][2]=k
      
  for i in range(m):
    ans=1000000000000+d[i][0]*1000000+d[i][2]
    print(str(ans)[1:])
else:
  print("000001000001")



n,m=map(int,input().split())
d=[]
for i in range(m):
  d.append(list(map(int,input().split())))
  d[i].append(0)
s=sorted(d)
k=1
if m>1:
  for i in range(m-1):
    if s[i][0]==s[i+1][0]:
      s[i][2]=k
      s[i+1][2]=k+1
      k=k+1
    else:
      k=1
      s[i+1][2]=k
      s[i][2]=k
      
  for i in range(m):
    ans=1000000000000+d[i][0]*1000000+d[i][2]
    print(str(ans)[1:])

else:
  print("000001000001")



n,m=map(int,input().split())
d=[]
for i in range(m):
  d.append(list(map(int,input().split())))
  d[i].append(1)
s=sorted(d)
k=1
if m>1:
  for i in range(m-1):
    if s[i][0]==s[i+1][0]:
      s[i][2]=k
      s[i+1][2]=k+1
      k=k+1
    else:
      k=1
      s[i+1][2]=k
      
for i in range(m):
  ans=1000000000000+d[i][0]*1000000+d[i][2]
  print(str(ans)[1:])



Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

Submission attempts (in order):
n,m=map(int,input().split())
city_list = [[] for _ in range(n)]

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

for ppyy in py:
  city_list[ppyy[0]-1].append(ppyy[1])

for index, ppyy in enumerate(city_list):
  ppyy.sort()
  for index2, pppyyy in enumerate(ppyy):
    print(str(index+1).zfill(6)+str(index2+1).zfill(6))

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, P: "List[int]", Y: "List[int]"):
    hashTable = {}

    for i in range(M):
        if hashTable.get(P[i]) == None:
            hashTable[P[i]] = [Y[i]]
        else:
            hashTable[P[i]].append(Y[i])
    
    # Year: idnumber
    answerTable = {}

    for key,value in hashTable.items():
        value.sort()
        
        for i,v in enumerate(value):
            answerTable[v] = str(key).zfill(6) + str(i+1).zfill(6)
    
    for i in range(M):
        print(answerTable[Y[i]])

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    P = [int()] * (M)  # type: "List[int]"
    Y = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        P[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, M, P, Y)

if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

Submission attempts (in order):
N,M = map(int,input().split())
L = []
for i in range(M):
    l = list(map(int,input().split()))+[i]
    L.append(l)
cnt = 0
tmp = []
M = sorted(L,key = lambda x: (x[0],x[1]))
for x in M:
    if tmp == x[0]:
        x.append(cnt+1)
        cnt += 1
    else:
        tmp = x[0]
        cnt = 0
        x.append(cnt)
M = sorted(L,key = lambda x:x[2])
print(M)
for x in M:
    st = str(x[0]).zfill(5)
    st += str(x[3]+1).zfill(5)
    print(st)


import sys
input = sys.stdin.readline
N,M=map(int, input().split())
L=[ [] for _ in range(N)]

X=[]
for _ in range(M):
    a,b = input().split()
    a=int(a)
    b=int(b)
    L[a-1].append(b)
    X.append({a:b})
Y=[ (sorted(L[_])) for _ in range(N) ]
for i in range(M) :
    for k,v in X[i].items():
        z='%06d' % 
        Z='%06d' % k
        print('%06d%06d' % (k,(Y[k-1].index(v)+1)))


N,M = map(int,input().split())
L = []
for i in range(M):
    l = list(map(int,input().split()))+[i]
    L.append(l)
cnt = 0
tmp = []
M = sorted(L,key = lambda x: (x[0],x[1]))
for x in M:
    if tmp == x[0]:
        x.append(cnt+1)
        cnt += 1
    else:
        tmp = x[0]
        cnt = 0
        x.append(cnt)
M = sorted(L,key = lambda x:x[2])
#print(M)
for x in M:
    st = str(x[0]).zfill(5)
    st += str(x[3]+1).zfill(5)
    print(st)


N,M = map(int,input().split())
L = []
for i in range(M):
    l = list(map(int,input().split()))+[i]
    L.append(l)
cnt = 0
tmp = []
M = sorted(L,key = lambda x: (x[0],x[1]))
for x in M:
    if tmp == x[0]:
        x.append(cnt+1)
        cnt += 1
    else:
        tmp = x[0]
        cnt = 0
        x.append(cnt)
M = sorted(L,key = lambda x:x[2])
#print(M)
for x in M:
    st = str(x[0]).zfill(6)
    st += str(x[3]+1).zfill(6)
    print(st)


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

Submission attempts (in order):
n,m = map(int,input().split())
C = [[i, list(map(int,input().split()))] for i in range(m)]
C.sort(key=lambda x:(x[1][0],x[1][1]))
D = {}
rank=1
for i in range(m):
    name=C[i][0]
    if i>1 and C[i][1][0] != C[i-1][1][0]:
        rank = 1
    D[name] = str(C[i][1][0]).zfill(6)+str(rank).zfill(6)
    rank+=1
    print(D[name])

n,m = map(int,input().split())
C = [[i, list(map(int,input().split()))] for i in range(m)]
C.sort(key=lambda x:(x[1][0],x[1][1]))
D = {}
print(C)
rank=1
for i in range(m):
    name=C[i][0]
    if i>1 and C[i][1][0] != C[i-1][1][0]:
        rank = 1
    D[name] = str(C[i][1][0]).zfill(6)+str(rank).zfill(6)
    rank+=1
for i in range(m):
    print(D[i])

N, M = map(int, input().split())
ss = [[] for _ in range(N)]
for i in range(M):
    p, y = map(int, input().split())
    ss[p-1].append((i, y))
ls = [''] * M
for p in range(N):
    s = ss[p]
    s.sort(key=lambda g: g[1])
    for d, (i, y) in enumerate(s):
        ps = str(p+1).zfill(6)
        ds = str(d+1).zfill(6)
        ls[i] = ps+ds
for l in ls:
    print(l)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

Submission attempts (in order):
N,M=map(int,input().split())
PY=[list(map(int,input().split()))+[i] for i in range(M)] 

PY.sort(key= lambda x:x[1])
num=[0]*N
w=[""]*M

for p,y,i in PY:
	num[p-1]+=1
	w[i]=str(p).zfill(6)+str(num[p-1]).zfill(6)

for a in range(M):
	print(w)

N,M=map(int,input().split())
PY=[list(map(int,input().split()))+[i] for i in range(M)] 

PY.sort(key= lambda x:x[1])
num=[0]*N
w=[""]*M

for p,y,i in PY:
	num[p-1]+=1
	w[i]=str(p).zfill(6)+str(num[p-1]).zfill(6)

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


Verdicts: Runtime Error

Accepted
Problem: In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.  City i is established in year Y_i and belongs to Prefecture P_i.  You can assume that there are no multiple cities that are established in the same year.  It is decided to allocate a 12-digit ID number to each city.  If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.  Here, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.  Find the ID numbers for all the cities.  Note that there can be a prefecture with no cities.

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

cities = {}

def to_id(x):
  return '0' * (6 - len(str(x))) + str(x)

for i in range(m):
  p, y = map(int, input().split())
  if p in cities.keys():
    cities[p] += 1
  else:
    cities[p] = 1
  
for p in range(1, n+1):
  if p in cities.keys():
    p_id = to_id(p)
    for i in range(cities[p]):
      print(p_id + to_id(i+1))

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

cities = []
ps = {}

def to_id(x):
  return '0' * (6 - len(str(x))) + str(x)

for i in range(m):
  p, y = map(int, input().split())
  cities.append([p, y, ''])
  if p in ps.keys():
    ps[p].append([y, i])
  else:
    ps[p] = [[y, i]]
  
years = {}
ids = {}
for p in ps.keys():
  years[p] = sorted(ps[p], key=lambda x: x[0])
  for i, year in enumerate(years[p]):
    cities[year[1]][2] += to_id(p) + to_id(i+1)

for i in range(m):
  print(cities[i][2])

Verdicts: Wrong Answer

Accepted