TnT/Multi_CodeNet4Repair huggingface dataset:
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):
from sys import stdin

N, M = map(int, stdin.readline().split())
py = [list(map(int, stdin.readline().split())) for _ in range(M)]

py.sort()

px = []

ptmp = 0
xtmp = 1

for p, y in py:
    if p == ptmp:
        xtmp += 1
        px.append([p, xtmp])
    else:
        ptmp = p
        xtmp = 1
        px.append([p, xtmp])

for p, x in px:
    print("{0:06d}".format(p), "{0:06d}".format(x), sep="")


from sys import stdin

N, M = map(int, stdin.readline().split())
py = [list(map(int, stdin.readline().split())) for _ in range(M)]

for i in range(M):
    py[i].append(i)

py.sort()

px = []

ptmp = 0
xtmp = 1

for p, y, i in py:
    if p == ptmp:
        xtmp += 1
    else:
        ptmp = p
        xtmp = 1
    px.append([str(p).zfill(6) + str(xtmp).zfill(6), i])


px.sort(key=lambda x: x[1])

for out, i in px:
    print(out)


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())
arr = [0 for _ in range(M)]
for i in range(M):
    p, y = map(int, input().split())
    arr[i] = [p, y, i]
print(arr)
arr.sort(key=lambda x:x[1])
print(arr)
arr[0][1] = 1
ans_list = [0] * M
for i in range(0, M):
    if i == 0:
        ans_list[i] = [str(arr[0][0]).zfill(6) + str(arr[0][1]).zfill(6), arr[i][2]]
        continue
    if arr[i][0] == arr[i - 1][0]:
        arr[i][1] = arr[i - 1][1] + 1
    else:
        arr[i][1] = 1
    ans_list[i] = [str(arr[i][0]).zfill(6) + str(arr[i][1]).zfill(6), arr[i][2]]
print(ans_list)
ans_list.sort(key=lambda x:x[1])
for i in range(M):
    print(ans_list[i][0])

N, M = map(int, input().split())
arr = [0 for _ in range(M)]
for i in range(M):
    arr[i] = list(map(int, input().split()))
arr_sort = sorted(arr)

arr_sort[0][1] = 1
for i in range(0, M):
    if i == 0:
        print(str(arr_sort[0][0]).zfill(6) + str(arr_sort[0][1]).zfill(6))
        continue
    if arr_sort[i][0] == arr_sort[i - 1][0]:
        arr_sort[i][1] = arr_sort[i - 1][1] + 1
    else:
        arr_sort[i][1] = 1
    print(str(arr_sort[i][0]).zfill(6) + str(arr_sort[i][1]).zfill(6))

N, M = map(int, input().split())
arr = [0 for _ in range(M)]
for i in range(M):
    p, y = map(int, input().split())
    arr[i] = [p, y, i]

arr.sort(key=lambda x: x[1])

arr[0][1] = 1
P_cnt = [1 for _ in range(10 ** 6)]
ans_list = [0] * M
for p, y, i in arr:
    ans_list[i] = [str(p).zfill(6) + str(P_cnt[p]).zfill(6), i]
    P_cnt[p] += 1

ans_list.sort(key=lambda x: x[1])
for i in range(M):
    print(ans_list[i][0])

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())
P = [list(map(int,input().split()))+[0] for i in range(m)]
X = sorted(P,key = lambda x:x[1])
city = {}
for p,y,z in X:
    if p in city:
        city[p] += 1
    else:
        city[p] = 1
    z = city[p]
for p,y,z in P:
    print(str(p).zfill(6)+str(z).zfill(6))


N,M = map(int,input().split())
A = []
for i in range(M):
    p,y = map(int,input().split())
    A.append([p,y,i,0])
A.sort(key = lambda x:x[1])
D = dict()
for a in A:
    if a[0] not in D:
        D[a[0]] = 1
    else:
        D[a[0]] += 1
    a[3] = D[a[0]]
A.sort(key=lambda x:x[2])
for a in A:
    print(str(a[0]).zfill(6)+str(a[3]).zfill(6))


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 = [int(x) for x in input().split(' ')]

cities = list()
for i in range(m):
    pi, pm = [int(x) for x in input().split(' ')]
    cities.append((pi, pm))

p = [0] * (n+1)
for city in sorted(cities, key=lambda city: city[1]): # sort by year
    p[city[0]] += 1 # city birth order
    print('{:06d}{:06d}'.format(city[0], p[city[0]]))


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

cities = list()
for i in range(m):
    pi, pm = [int(x) for x in input().split(' ')]
    cities.append([pi, pm, i])

p = [0] * (n+1)
for c in sorted(cities, key=lambda city: city[1]): # sort by year
    p[c[0]] += 1 # city birth order
    c.append(p[c[0]])

for c in cities:
    print('{:06d}{:06d}'.format(c[0], c[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):
# input
N, M = map(int, input().split())

citys = []
c_append = citys.append
prefs = []
p_append = prefs.append
pref_in_citys = {}
for i in range(M):
    P, Y = map(int, input().split())
    if P not in prefs:
        p_append(P)
        pref_in_citys[P] = []
    city_dict = {
        "birth": Y,
        "pref": P,
        "number": ""
    }
    c_append(city_dict)
    pref_in_citys[P].append(citys[-1])


for p in pref_in_citys.keys():
    target_citys = pref_in_citys[p]
    if len(target_citys) == 1:
        target_citys[0]["number"] += "000001"
    else:
        target_citys.sort(key=lambda x: x["birth"])
        lot_num = 1
        for c in target_citys:
            c["number"] += "0" * (6 - len(str(p))) + str(p) + "0" * (6 - len(str(lot_num))) + str(lot_num)
            lot_num += 1

for c in citys:
    print(c["number"])

N, M = map(int, input().split())
piys = [[] for _ in range(N)]
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y, i))

ans = [None]*M
for p, iys in enumerate(piys):
    iys.sort()
    for k, (y, i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1, k+1)

for i in ans:
    print(i)

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):
# -*- coding: utf-8 -*-
from operator import itemgetter

N, M = list(map(int, input().split()))
A = [[0] * 4 for i in range(M)]
for i in range(M):
    A[i][0], A[i][1] = list(map(int, input().split()))
    A[i][2] = i

sorted_A = sorted(A, key=itemgetter(1))
print(sorted_A)

P_num = [1]*N
for a in sorted_A:
    y = a[0]
    a[3] = P_num[y-1]
    P_num[y-1] += 1

print(sorted_A)
B = sorted(sorted_A, key=itemgetter(2))
for b in B:
    print("%06d%06d" % (b[0], b[3]))


# -*- coding: utf-8 -*-
from operator import itemgetter

N, M = list(map(int, input().split()))
A = [[0] * 4 for i in range(M)]
P = []
for i, a in enumerate(A):
    a[0], a[1] = list(map(int, input().split()))
    a[2] = i
    if not a[0] in P:
        P.append(a[0])

P_counts = [0]*len(P)
sorted_A = sorted(A, key=itemgetter(1))

for a in sorted_A:
    idx = P.index(a[0])
    P_counts[idx] += 1
    print(str(a[0]).zfill(6) + str(P_counts[idx]).zfill(6))


# -*- coding: utf-8 -*-
from operator import itemgetter

N, M = list(map(int, input().split()))
A = [[0] * 4 for i in range(M)]
for i in range(M):
    A[i][0], A[i][1] = list(map(int, input().split()))
    A[i][2] = i

sorted_A = sorted(A, key=itemgetter(1))

P_num = [1]*N
for a in sorted_A:
    y = a[0]
    a[3] = P_num[y-1]
    P_num[y-1] += 1

B = sorted(sorted_A, key=itemgetter(2))
for b in B:
    print("%06d%06d" % (b[0], b[3]))


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())
P=[map(int,input().split()) for _ in range(M)]
d = {}
for p,y in P:
  if p not in d:
    d[p]=[]
  d[p].append(y)
sd = {k:dict(zip(sorted(v),range(1,1+len(v))))
      for k,v in d.items()}
for p,y in P:
  print('%06d%06d' % (p, sd[p][y]))

N,M = map(int,input().split())
P=[]
for _ in range(M):
  p,y = map(int,input().split())
  P.append((p,y))
d = {}
for p,y in P:
  if p not in d:
    d[p]=[]
  d[p].append(y)
sd = {k:dict(zip(sorted(v),range(1,1+len(v))))
      for k,v in d.items()}
for p,y in P:
  print('%06d%06d' % (p, sd[p][y]))


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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
pl =[1]*(n+1)

a=[]
for i in range(0,m):
  p,l = map(int, input().split())
  s='{:06}{:06}'.format(p,pl[p])
  pl[p]=pl[p]+1
  a.append(s)
a.sort()
for i in range(0,m):
  print(a[i])


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
pp =[1]*(n+1)

pl =[1]*(m)
mm={}

for i in range(0,m):
  p,l = map(int, input().split())
  pl[i]=p
  mm[i]=p*100000+l
a=[""]*(m+1)
for k, v in sorted(mm.items(), key=lambda x: x[1]):
  pre=pl[k]
  a[k]="{:06}{:06}".format(pl[k],pp[pre])
  pp[pre]=pp[pre]+1
for i in range(0,m):
  print(a[i])


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):
from heapq import heappush
N,M = map(int, input().split())
A = {}
prefs = []
years = []
for i in range(M):
    p,y = input().split()
    prefs.append(p)
    years.append(y)
    if p not in A:
        A[p] = [y]
    else:
        heappush(A[p], y)
res = {}
for k,v in A.items():
    for i in range(len(v)):
        res[k+v[i]] = str(i+1)
for p,y in zip(prefs, years):
    print(p.zfill(6) + res[k+y].zfill(6))


n,m = map(int, input().split())
pre = {}
city = []
for i in range(m):
    p,y = map(int, input().split())
    if p not in pre:
        pre[p] = []
    pre[p].append(y)
    city.append((p,y))

d = {}
for k in pre.keys():
    pre[k].sort()
    for i in range(len(pre[k])):
        d[(k, pre[k][i])] = i+1

for p,y in city:
    print(str(p).zfill(6) + str(d[(p, y)]).zfill(6))
    

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())
inl = [[i] + list(map(int,input().split())) for i in range(m)]
inl = sorted(inl,key=lambda x:x[1])
inl = sorted(inl,key=lambda x:x[2])
cnt = 1
print(inl)
for i in range(m):
    a = str(inl[i][1]).rjust(6,"0")
    b = str(cnt).rjust(6,"0")
    cnt +=1
    if i !=m-1 and inl[i][1] != inl[i+1][1]:
        cnt = 1
    inl[i][1] = a
    inl[i][2] = b
inl = sorted(inl,key=lambda x:x[0])
for i in range(m):
    print(str(inl[i][1])+str(inl[i][2]))

n,m = map(int,input().split())
inl = [[i] + list(map(int,input().split())) for i in range(m)]
inl = sorted(inl,key=lambda x:x[1])
inl = sorted(inl,key=lambda x:x[2])
cnt = 1
for i in range(m):
    inl[i][1] = str(inl[i][1]).rjust(6,"0")
    inl[i][2] = str(cnt).rjust(6,"0")
    cnt +=1
    if  i!=m-1 and inl[i][1] != inl[i+1][1]:
        cnt = 1

inl = sorted(inl,key=lambda x:x[0])
for i in range(m):
    print(str(inl[i][1])+str(inl[i][2]))

n,m = map(int,input().split())
inl = [[i] + list(map(int,input().split())) for i in range(m)]
inl = sorted(inl,key=lambda x:x[1])
inl = sorted(inl,key=lambda x:x[2])
shi = 1
cnt = 1
for i in range(m):
    if inl[i][1] == shi:
        inl[i][1] = str(shi).rjust(6,"0")
        inl[i][2] = str(cnt).rjust(6,"0")
        cnt +=1
    else:
        shi +=1
        cnt = 1
        inl[i][1] = str(shi).rjust(6,"0")
        inl[i][2] = str(cnt).rjust(6,"0")
        cnt +=1
inl = sorted(inl,key=lambda x:x[0])
print(inl)
for i in range(m):
    print(str(inl[i][1])+str(inl[i][2]))

n,m = map(int,input().split())
inl = [[i] + list(map(int,input().split())) for i in range(m)]
inl = sorted(inl,key=lambda x:x[2])
inl = sorted(inl,key=lambda x:x[1])
cnt = 1
for i in range(m):
    a = str(inl[i][1]).rjust(6,"0")
    b = str(cnt).rjust(6,"0")
    cnt +=1
    if i !=m-1 and inl[i][1] != inl[i+1][1]:
        cnt = 1
    inl[i][1] = a
    inl[i][2] = b
inl = sorted(inl,key=lambda x:x[0])
for i in range(m):
    print(str(inl[i][1])+str(inl[i][2]))

Verdicts: Wrong Answer

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())
  input_list = [[] for i in range(n)]

for i in range(m):
  p,y = map(int, input().split())
  input_list[p-1].append((y,i))
  
for i in input_list :
  i.sort()

result = [None]*m

for p,i in enumerate(input_list) :
  for n, (a,b) in enumerate(i):
    result[b] = str(p+1).zfill(6)+str(n+1).zfill(6)
    
print(*result, sep = '\n')

n,m = map( int, input().split())
  
result= {}
input_list = [[] for i in range(n)]


for i in range(m):
  p,y = map(int, input().split())
  input_list[p-1].append((y,i))
  
for i in input_list :
  i.sort()

result = [None]*m

for p,i in enumerate(input_list) :
  for n, (a,b) in enumerate(i):
    result[b] = str(p+1).zfill(6)+str(n+1).zfill(6)
    
print(*result, sep = '\n')


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

m_list = [[] for j in range(N)]

for inputs in input_list:
    m_list[inputs[0]-1].append(inputs[1])

print(m_list)
for arr in m_list:
    arr.sort()

print(m_list)

for inputs in input_list:
    num = m_list[inputs[0]-1].index(inputs[1]) + 1
    print(str(inputs[0]).zfill(6) + str(num).zfill(6))

import sys
input = sys.stdin.readline
 
N, M = (int(i) for i in input().split())
input_list = [[int(i) for i in input().split()] for i in range(M)] 
 
m_list = [[] for j in range(N+1)]
 
for inputs in input_list:
    m_list[inputs[0]].append(inputs[1])
 
for arr in m_list:
    arr.sort()
    arr.insert(-10000)
 
for inputs in input_list:
    num = m_list[inputs[0]].index(inputs[1])
    print(str(inputs[0]).zfill(6) + str(num).zfill(6))

import sys
input = sys.stdin.readline
 
N, M = (int(i) for i in input().split())
py_list = [[int(i) for i in input().split()] + [0] for i in range(M)] 
m_list = [[] for j in range(N+1)]
 
sorted_py_list = sorted(py_list, key=lambda x:x[1])

city_list = {}
for py in sorted_py_list:
    city_list[py[0]] = city_list[py[0]]+1 if py[0] in city_list else 1
    py[2] = city_list[py[0]]
 
for py in py_list:
    print(str(py[0]).zfill(6) + str(py[2]).zfill(6))

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):
import bisect
n, m = map(int, input().split())
p = []
y = []
py = []
categorized = [[] for i in range(n+1)]
for i in range(m):
    tmpp, tmpy = map(int, input().split())
    p.append(tmpp)
    y.append(tmpy)
    categorized[tmpp].append(tmpy)

for c in categorized:
    c.sort()
print(categorized)
for i in range(m):
    order = bisect.bisect(categorized[p[i]], y[i])
    print('%06d%06d' % (p[i], order))


import bisect
n, m = map(int, input().split())
p = []
y = []
py = []
categorized = [[] for i in range(n+1)]
for i in range(m):
    tmpp, tmpy = map(int, input().split())
    p.append(tmpp)
    y.append(tmpy)
    categorized[tmpp].append(tmpy)

for c in categorized:
    c.sort()
for i in range(m):
    order = bisect.bisect(categorized[p[i]], y[i])
    print('%06d%06d' % (p[i], order))


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())
PY = [list(map(int, input().split())) + [i] for i in range(M)]
PY.sort(key=lambda x: [x[0], x[1]])
ans = []
P = [0] * (N + 1)
for p, y, i in PY:
    P[p] += 1
    tmp = str(p).zfill(8) + str(P[p]).zfill(8)
    ans.append([i, tmp])
ans.sort()
for i, a in ans:
    print(a)

N, M = map(int, input().split())
PY = [list(map(int, input().split())) + [i] for i in range(M)]
PY.sort(key=lambda x: [x[0], x[1]])
ans = []
P = [0] * (N + 1)
for p, y, i in PY:
    P[p] += 1
    tmp = str(p).zfill(6) + str(P[p]).zfill(6)
    ans.append([i, tmp])
ans.sort()
for i, a in ans:
    print(a)

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())
pLst = [list(map(int, input().split())) for i in range(M)]

for i in range(len(pLst)):
    pLst[i].append(i)
nLst = [''] * N

for i in range(N):
    nLst[i] = str(i + 1).zfill(6)
tLst = sorted(pLst, key=lambda x: (x[0], x[1]))
ansLst = [''] * M
tmp = nLst[tLst[i][0] - 1]
index = 1

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

for i in range(len(pLst)):
    pLst[i].append(i)
nLst = [''] * N

for i in range(N):
    nLst[i] = str(i + 1).zfill(6)
tLst = sorted(pLst, key=lambda x: (x[0], x[1]))
ansLst = [''] * M
tmp = nLst[tLst[0][0] - 1]
index = 1
for i in range(M):
    if tmp == nLst[tLst[i][0] - 1]:
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)
        index += 1
    else:
        index = 1
        tmp = nLst[tLst[i][0] - 1]
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)
        index += 1

for i in ansLst:
    print(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):
def con(var):
    var=str(var)
    while(len(var)<6):
        var="0"+var
    return var


def run():
    N,M=map(int,input().split())
    P=[-1]*M
    Y=[-1]*M
    arr=[]
    for i in range(M):
        P[i],Y[i]=input().split()
        P[i]=int(P[i])-1
        Y[i]=int(Y[i])
        arr.append([P[i],Y[i],i])
    arr=sorted(arr,key=lambda x:x[1])
    print(arr)
    ans=[0]*M
    cnt=[0]*N
    for i in range(M):
        cnt[arr[i][0]]=cnt[arr[i][0]]+1
        ans[arr[i][2]]=con(arr[i][0]+1)+con(cnt[arr[i][0]])
    for i in range(M):
        print(ans[i])
run()


def con(var):
    var=str(var)
    while(len(var)<6):
        var="0"+var
    return var



def run():
    N,M=input().split()
    N=int(N)
    M=int(M)
    P=[-1]*M
    Y=[-1]*M
    arr=[]
    for i in range(M):
        P[i],Y[i]=input().split()
        P[i]=int(P[i])-1
        Y[i]=int(Y[i])
        arr.append([P[i],Y[i],i])
    arr=sorted(arr,key=lambda x:x[1])
    print(arr)
    ans=[0]*M
    cnt=[0]*N
    for i in range(M):
        cnt[arr[i][0]]=cnt[arr[i][0]]+1
        ans[arr[i][2]]=con(arr[i][0]+1)+con(cnt[arr[i][0]])
    for i in range(M):
        print(ans[i])
run()

def con(var):
    var=str(var)
    while(len(var)<6):
        var="0"+var
    return var


def run():
    N,M=map(int,input().split())
    P=[-1]*M
    Y=[-1]*M
    arr=[]
    for i in range(M):
        P[i],Y[i]=map(int,input().split())
        P[i]=P[i]-1
        arr.append([P[i],Y[i],i])
    arr=sorted(arr,key=lambda x:x[1])
    ans=[0]*M
    cnt=[0]*N
    for i in range(M):
        cnt[arr[i][0]]=cnt[arr[i][0]]+1
        ans[arr[i][2]]=con(arr[i][0]+1)+con(cnt[arr[i][0]])
    for i in range(M):
        print(ans[i])
run()

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 = list(map(int, input().split()))
li = []
yli = []
for _ in range(m):
    p, y = list(map(int, input().split()))
    li.append((y, p))
    yli.append(y)

import numpy as np
idx = np.argsort(yli)
srt = sorted(li)
ans = []
from collections import Counter
pcnt = Counter()
for p, y in srt:
    pcnt[p] += 1    
    ans.append('{:06}{:06}'.format(p, pcnt[p]))

for i in idx:
    print(ans[i])


n, m = list(map(int, input().split()))
li = []
yli = []
for _ in range(m):
    p, y = list(map(int, input().split()))
    li.append((y, p))
    yli.append(y)

import numpy as np
idx = np.argsort(yli).argsort()
srt = sorted(li)
ans = []
from collections import Counter
pcnt = Counter()
for p, y in srt:
    pcnt[p] += 1    
    ans.append('{:06}{:06}'.format(p, pcnt[p]))

for i in idx:
    print(ans[i])


n, m = list(map(int, input().split()))
li = []
yli = []
for _ in range(m):
    p, y = list(map(int, input().split()))
    li.append((y, p))
    yli.append(y)

import numpy as np
idx = np.argsort(yli).argsort()
srt = sorted(li)
ans = []
from collections import Counter
pcnt = Counter()
for y, p in srt:
    pcnt[p] += 1
    ans.append('{:06}{:06}'.format(p, pcnt[p]))

for i in idx:
    print(ans[i])


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())
pref_dict = {}

for i in range(M):
    P, Y = map(int, input().split())
    pref_dict[i] = [P, Y]

sorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))
print(sorted_dict)

ans_dict = {}
buf = ""
count = 1

for tup in sorted_dict:

    row = tup[0]
    pref_name = f"00000{tup[1][0]}"[-6:]

    if pref_name == buf:
        count += 1
    else:
        count = 1

    pref_id = f"00000{count}"[-6:]
    ans_dict[row] = [pref_name, pref_id]
    buf = pref_name

for key, value in sorted(ans_dict.items(), key=lambda x: x[0]):
    print(*value, sep="")

N, M = map(int, input().split())
pref_dict = {}

for i in range(M):
    P, Y = map(int, input().split())
    pref_dict[i] = [P, Y]

sorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))
ans_dict = {}
buf = ""
count = 1

for tup in sorted_dict:

    row = tup[0]
    pref_name = "00000{}".format(tup[1][0])
    pref_name = pref_name[-6:]

    if pref_name == buf:
        count += 1
    else:
        count = 1

    pref_id = "00000{}".format(count)
    pref_id = pref_id[-6:]
    ans_dict[row] = [pref_name, pref_id]
    buf = pref_name

for key, value in sorted(ans_dict.items(), key=lambda x: x[0]):
    print(*value, sep="")

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):
#!/usr/bin/env python3

import numpy as np

# line1 = "2 3"
# line2 = ['1 32', '2  63', '1 12']

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

PY = np.array(PY)
cn = np.array([np.arange(np.shape(PY)[0])])
cc = np.array([np.zeros(np.shape(PY)[0], dtype=int)])

city_list = np.hstack([cn.T, PY, cc.T])
cl_ysort = city_list[np.argsort(city_list[:, 2])]
city_count = np.zeros(N+1, dtype=int)
for i, cinfo in enumerate(cl_ysort):
    pref = cinfo[1]
    city_count[pref] += 1
    cl_ysort[i, 3] = city_count[pref]

cl_idsort = cl_ysort[np.argsort(cl_ysort[:, 0])]

[print('{:06d}{:06d}'.format(cl[1], cl[3])) for cl in cl_idsort]


#!/usr/bin/env python3

import numpy as np

# line1 = "2 3"
# line2 = ['1 32', '2  63', '1 12']

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

PY = np.array(PY)
cn = np.array([np.arange(np.shape(PY)[0])])
cc = np.array([np.zeros(np.shape(PY)[0], dtype=int)])

city_list = np.hstack([cn.T, PY, cc.T])
cl_ysort = city_list[np.argsort(city_list[:, 2])]
city_count = np.zeros(N+1, dtype=int)
for i, cinfo in enumerate(cl_ysort):
    pref = cinfo[1]
    city_count[pref] += 1
    cl_ysort[i, 3] = city_count[pref]

cl_idsort = cl_ysort[np.argsort(cl_ysort[:, 0])]

[print('{:06d}{:06d}'.format(cl[1], cl[3])) for cl in cl_idsort]


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):
def identify(N: int, M: int, PY: list) -> list:
    _PY = [(i, p, y) for i, (p, y) in enumerate(PY)]
    _PY.sort(key=lambda x: x[2])
    _PY.sort(key=lambda x: x[1])

    now_p = 0
    now_o = 1
    ids = []
    for i, p, _ in _PY:
        if p != now_p:
            now_p = p
            now_o = 1
        ids.append((i, '{p:08}{o:08}'.format(p=p, o=now_o)))
        now_o += 1

    return [i for _, i in sorted(ids, key=lambda x: x[0])]


if __name__ == "__main__":
    N, M = map(int, input().split())
    PY = [tuple(int(s) for s in input().split()) for _ in range(M)]
    for ans in identify(N, M, PY):
        print(ans)


def identify(N: int, M: int, PY: list) -> list:
    _PY = [(i, p, y) for i, (p, y) in enumerate(PY)]
    _PY.sort(key=lambda x: x[2])
    _PY.sort(key=lambda x: x[1])

    now_p = 0
    now_o = 1
    ids = []
    for i, p, _ in _PY:
        if p != now_p:
            now_p = p
            now_o = 1
        ids.append((i, '{p:06}{o:06}'.format(p=p, o=now_o)))
        now_o += 1

    return [i for _, i in sorted(ids, key=lambda x: x[0])]


if __name__ == "__main__":
    N, M = map(int, input().split())
    PY = [tuple(int(s) for s in input().split()) for _ in range(M)]
    for ans in identify(N, M, PY):
        print(ans)


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):
2 3
2 55
2 77
2 99

ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,M=rl()
P=[0]*M
Y=[0]*M
dic = [[] for _ in range(N+1)]
for i in range(M):
    P[i],Y[i] = rl()
    dic[P[i]] += [Y[i]]

for i in range(N+1):
    dic[i].sort()

import bisect
for i in range(M):
    print("{:0>6}{:0>6}".format(P[i], bisect.bisect_left(dic[P[i]],Y[i])+1))


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())
py = [list(map(int, input().split())) for i in range(m)]
py.sort(key=lambda x: x[1])
now = py[0][0]
count = 0
for i in range(m):
    if now == py[i][0]:
        count += 1
    else:
        now = py[i][0]
        count = 1
    print("{:06}".format(py[i][0]) + "{:06}".format(count))

n, m = map(int, input().split())
py = [list(map(int, input().split())) for i in range(m)]
py.sort(key=lambda x: x[1])
now = py[0][0]
count = 0
for i in range(m):
    if now == py[i][0]:
        count += 1
    else:
        now = py[i][0]
        count = 1
    print("{:04}".format(py[i][0]) + "{:04}".format(count))

import numpy as np
n, m = map(int, input().split())
py = [list(map(int, input().split())) for i in range(m)]
py2 = [py[i].append(i) for i in range(m)]
py.sort(key=lambda x: x[1])
now = py[0][0]
count = 0
anslist = np.empty((m, 2))
print(py)
for i in range(m):
    if now == py[i][0]:
        count += 1
    else:
        now = py[i][0]
        count = 1
    anslist[py[i][2], 0] = py[i][0]
    anslist[py[i][2], 1] = count

for x, y in anslist:
    print("{:06}".format(int(x)) + "{:06}".format(int(y)))

n, m = map(int, input().split())
p_y_num_list = sorted([list(map(int, input().split())) + [i] for i in range(m)])
now = p_y_num_list[0][0]
num = 1
for pyn in p_y_num_list:
    if pyn[0] != now:
        num = 1
        now = pyn[0]
        pyn.append(num)
    else:
        pyn.append(num)
    num += 1
p_y_num_list.sort(key=lambda x: x[2])
for p, y, i, n in p_y_num_list:
    print("{:06}{:06}".format(p, n))

Verdicts: Wrong Answer

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_d = {}
ans_l = ["" for _ in range(M)]
for i in range(M):
    P,Y = map(int,input().split())
    city_d.setdefault(P,[])
    city_d[P].append([Y,i])

for p,y_orgnum in city_d.items():
    for j,sorted_y_orgnum in enumerate(sorted(y_orgnum,key=lambda x:x[0])):
        ans_l[sorted_y_orgnum[1]] = str(p).zfill(8) + str(j+1).zfill(8)

for ans in ans_l:
    print(ans)




N,M = map(int,input().split())
city_d = {}
ans_l = ["" for _ in range(M)]
for i in range(M):
    P,Y = map(int,input().split())
    city_d.setdefault(P,[])
    city_d[P].append([Y,i])

for p,y_orgnum in city_d.items():
    for j,sorted_y_orgnum in enumerate(sorted(y_orgnum,key=lambda x:x[0])):
        ans_l[sorted_y_orgnum[1]] = str(p).zfill(6) + str(j+1).zfill(6)

for ans in ans_l:
    print(ans)




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

info_list = []

for i in range(m):
    pi, yi = map(int, input().split())
    info_list.append([i, pi, yi])
print(info_list)

from operator import itemgetter
info_list.sort(key = itemgetter(1))
info_list.sort(key = itemgetter(2))
print(info_list)

p = info_list[0][1]
j = 1
for ele in info_list:
    if ele[1] == p:
        ele.append(str(ele[1]).zfill(6) + str(j).zfill(6))
        j+=1
    else:
        p+=1
        j=1
        ele.append(str(ele[1]).zfill(6) + str(j).zfill(6))

info_list.sort(key = itemgetter(0))

for ele in info_list:
    print(ele[3])

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

info_list = []

for i in range(m):
    pi, yi = map(int, input().split())
    info_list.append([i+1, pi, yi])
print(info_list)

from operator import itemgetter
info_list.sort(key = itemgetter(2))
print(info_list)


xth = [1 for i in range(1, n+1)]
print(xth)

for info in info_list:
    info.append(str(info[1]).zfill((6)) + str(xth[info[1]-1]).zfill(6))
    xth[info[1]-1]+=1


info_list.sort(key = itemgetter(0))

for ele in info_list:
    print(ele[3])

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

info_list = []

for i in range(m):
    pi, yi = map(int, input().split())
    info_list.append([i+1, pi, yi])
# print(info_list)

from operator import itemgetter
info_list.sort(key = itemgetter(2))
# print(info_list)


xth = [1 for i in range(1, n+1)]
# print(xth)

for info in info_list:
    info.append(str(info[1]).zfill((6)) + str(xth[info[1]-1]).zfill(6))
    xth[info[1]-1]+=1


info_list.sort(key = itemgetter(0))

for ele in info_list:
    print(ele[3])

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):
import numpy as np
from operator import itemgetter

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

for i, c in enumerate(C):
  C[i] = [int(c[0]), int(c[1])]
  C[i].append(i)

C_sorted = sorted(C, key = lambda x: (x[0], x[1]))

counter = 1
current = 1

for c in C_sorted:
  if current < c[0]:
    counter = 1
  pref = str(c[0])
  num = str(counter)
  number = ''
  for i in range(6 - len(pref)):
    number += '0'
  number += pref
  for i in range(6 - len(num)):
    number += '0'
  number += num

  c.append(number)
  counter += 1
  current = c[0]

print(C_sorted)

C_reversed = sorted(C_sorted, key = lambda x: x[2])

for c in C_reversed:
  print(c[3])

import numpy as np
from operator import itemgetter

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

for i, c in enumerate(C):
  C[i] = [int(c[0]), int(c[1])]
  C[i].append(i)

C_sorted = sorted(C, key = lambda x: (x[0], x[1]))

counter = 1
current = 1

for c in C_sorted:
  if current < c[0]:
    counter = 1
  pref = str(c[0])
  num = str(counter)
  number = ''
  for i in range(6 - len(pref)):
    number += '0'
  number += pref
  for i in range(6 - len(num)):
    number += '0'
  number += num

  c.append(number)
  counter += 1
  current = c[0]

C_reversed = sorted(C_sorted, key = lambda x: x[2])

for c in C_reversed:
  print(c[3])

Verdicts: Wrong Answer

Accepted