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):
n, m = map(int, input().split())
name = []
city = []
prefecture = [1] * n
for i in range(m):
    a = list(map(int, input().split())) + [i+1]
    city.append(a)
    name.append("{}{}".format("0" * (6 - len(str(a[0]))), a[0]))
city_1 = sorted(city, key=lambda x: x[0])
city_sorted = sorted(city, key=lambda x: x[1])

x = 1
for i in range(m):
    p, y, num = city_sorted[i]
    x = prefecture[p-1]
    name[num-1] += "{}{}".format("0" * (6 - len(str(x))), x)
    x += 1
for i in name:
    print(i)


n, m = map(int, input().split())
name = []
city = []
prefecture = [1] * n
for i in range(m):
    a = list(map(int, input().split())) + [i+1]
    city.append(a)
    name.append("{}{}".format("0" * (6 - len(str(a[0]))), a[0]))


for i in range(m):
    p, y, num = city[i]
    x = prefecture[p-1]
    name[num-1] += "{}{}".format("0" * (6 - len(str(x))), x)
    prefecture[p-1] += 1
for i in name:
    print(i)


n, m = map(int, input().split())
name = []
city = []
prefecture = [1] * n
for i in range(m):
    a = list(map(int, input().split())) + [i+1]
    city.append(a)
    name.append("{}{}".format("0" * (6 - len(str(a[0]))), a[0]))
city_1 = sorted(city, key=lambda x: x[0])
city_sorted = sorted(city, key=lambda x: x[1])

x = 1
for i in range(m):
    p, y, num = city_sorted[i]
    x = prefecture[p-1]
    name[num-1] += "{}{}".format("0" * (6 - len(str(x))), x)
    prefecture[p-1] += 1
for i in name:
    print(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):
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

N,M = [int(x) for x in stdin.readline().rstrip().split()]
counter = 0
country = 1

ID = []

for i in range(M):
    p,y = [int(x) for x in stdin.readline().rstrip().split()]
    ID.append([p,y,i,"no"])
ID.sort(key=itemgetter(0,1))

for i in range(M):
    if ID[i][0] != country:
        counter = 0
    country = ID[i][0]
    counter += 1
    ID_m = format(ID[i][0],"04") + format(counter,"04")
    ID[i][3] = ID_m
    
ID.sort(key=itemgetter(2))

for i in range(M):
    print(ID[i][3])

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

N,M = [int(x) for x in stdin.readline().rstrip().split()]
counter = 0
country = 1

ID = []

for i in range(M):
    p,y = [int(x) for x in stdin.readline().rstrip().split()]
    ID.append([p,y,i,"no"])
ID.sort(key=itemgetter(0,1))

for i in range(M):
    if ID[i][0] != country:
        counter = 0
    country = ID[i][0]
    counter += 1
    ID_m = format(ID[i][0],"06") + format(counter,"06")
    ID[i][3] = ID_m
    
ID.sort(key=itemgetter(2))

for i in range(M):
    print(ID[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):
from collections import defaultdict

n, m = map(int, input().split())
PY = [tuple(map(int, input().split())) for _ in range(m)]
ypi = sorted((y, p) for i, (p, y) in enumerate(PY))
d = defaultdict(lambda: 0)

ans = [None]*m

for y, p in ypi:
    d[p] += 1
    ans[i] = str(p).zfill(6) + str(d[p]).zfill(6)

print(*ans, sep='\n')

from collections import defaultdict

n, m = map(int, input().split())
PY = [tuple(map(int, input().split())) for _ in range(m)]
ypi = sorted((y, p, i) for i, (p, y) in enumerate(PY))
d = defaultdict(lambda: 0)

ans = [None]*m

for y, p, i in ypi:
    d[p] += 1
    ans[i] = str(p).zfill(6) + str(d[p]).zfill(6)

print(*ans, 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):
import collections,bisect
N,M=map(int,input().split())
PY=[list(map(int,input().split())) for i in range(M)]
x=collections.defaultdict(list)
for city,year in PY:
    x[city]+=[year]
for city,year in PY:
    num=bisect.bisect(x[city],year)
    print("%06d%06d"%(city,num))

n,m=map(int,input().split())
cnt=[0]*(n+1)
a=[]
for i in range(m):
    p,y=map(int,input().split())
    a.append((y,p,i))
a.sort()
b=[]
for y,p,i in a:
    cnt[p]+=1
    b.append((i,"{0:06}{0:06}".format(p,cnt[p])))
b.sort()
for i,r in b:
    print(r)

n,m=map(int,input().split())
cnt=[0]*(n+1)
a=[]
for i in range(m):
    p,y=map(int,input().split())
    a.append((y,p,i))
a.sort()
print(a)
b=[]
for y,p,i in a:
    cnt[p]+=1
    b.append((i,"{0:06}{0:06}".format(p,cnt[p])))
b.sort()
print(b)
for i,r in b:
    print(r)

N,M=map(int,input().split())
PY=[list(map(int,input().split())) for i in range(M)]
x=collections.defaultdict(list)
for city,year in PY:
    x[city]+=[year]
for city,year in PY:
    num=bisect.bisect(x[city],year)
    print("%06d%06d"%(city,num))

import collections,bisect
N,M=map(int,input().split())
PY=[list(map(int,input().split())) for i in range(M)]
x=collections.defaultdict(list)
for city,year in sorted(PY):
    x[city]+=[year]
for city,year in PY:
    num=bisect.bisect(x[city],year)
    print("%06d%06d"%(city,num))

Verdicts: Wrong Answer

Wrong Answer

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):
from itertools import groupby

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

py = [py_i + [i] for i, py_i in enumerate(py)]
py_ = []
for key, group in groupby(py, lambda x: x[0]):
	for i, city in enumerate(group):
		py_.append(city + [i+1])
py = sorted(py_, key=lambda x: x[3])

for py_i in py:
	print(str(py_i[0]).zfill(6) + str(py_i[3]).zfill(6))

from itertools import groupby

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

py = [py_i + [i] for i, py_i in enumerate(py)]
py_ = []
for key, group in groupby(sorted(py, key=lambda x: x[0]), lambda x: x[0]):
	for i, city in enumerate(sorted(group, key=lambda x: x[1])):
		py_.append(city + [i+1])

py = sorted(py_, key=lambda x: x[2])

for py_i in py:
	print(str(py_i[0]).zfill(6) + str(py_i[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):
import bisect
import collections

N, M = map(int, input().split())
PM = [[int(j) for j in input().split()] for i in range(M)]
A = collections.defaultdict(list)
for x, y in sorted(PM):
    A[x] += [y]
for x, y in PM:
    z = bisect.bisect(A[x], y)
    print('%06d%06d'%(x,y))

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
cur = [1] * (N+1)  # 1-indexed
PY = [lr() + [i] for i in range(M)]
PY.sort(key=lambda x: x[1])
answer = [None] * M  # 0-indexed
for p, y, i in PY:
    x = str(p).zfill(6) + str(cur[p]).zfill(6)
    answer[i] = x
    cur[p] += 1

for a in answer:
    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):
import bisect
N, M = map(int, input().split())
P, Y = [], []
pref = [[] for _ in range(N+1)] # non-0-indexed
for m in range(M):
    p,y = map(int, input().split())
    P.append(p)
    Y.append(y)
bisect.insort(pref[p], y)

    
for p,y in zip(P,Y):
    ans = "{:0>6}".format(p)
    i = bisect.bisect(pref[p], y)
    ans += "{:0>6}".format(i)
    print(ans)


import bisect
N, M = map(int, input().split())
P, Y = [], []
pref = [[] for _ in range(N+1)] # non-0-indexed
for m in range(M):
    p,y = map(int, input().split())
    P.append(p)
    Y.append(y)
for i in len(pref):
	pref[i].sort()
    
for p,y in zip(P,Y):
    ans = "{:0>6}".format(p)
    i = bisect.bisect(pref[p], y)
    ans += "{:0>6}".format(i)
    print(ans)


import bisect
N, M = map(int, input().split())
P, Y = [], []
pref = [[] for _ in range(N+1)] # non-0-indexed
for m in range(M):
    p,y = map(int, input().split())
    P.append(p)
    Y.append(y)
for p in pref:
	p = p.sort()
    
for p,y in zip(P,Y):
    ans = "{:0>6}".format(p)
    i = bisect.bisect(pref[p], y)
    ans += "{:0>6}".format(i)
    print(ans)


import bisect
N, M = map(int, input().split())
P, Y = [], []
pref = [[] for _ in range(N+1)] # non-0-indexed
for m in range(M):
    p,y = map(int, input().split())
    P.append(p)
    Y.append(y)
    pref[p].append(y)
for i, p in enumerate(pref):
    pref[i] = sorted(p)
    
for p,y in zip(P,Y):
    ans = "{:0>6}".format(p)
    i = bisect.bisect(pref[p], y)
    ans += "{:0>6}".format(i)
    print(ans)




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

city = []
PY = []
for i in range(M):
    ll = [i] + list(map(int, input().split(" ")))
    # print(ll)
    PY.append(ll)

PY = sorted(PY, key=lambda x: x[2])
print(PY)

ken = [1]*N
answer = []
for i in range(M):
    ue6 = "{0:06d}".format(PY[i][1])
    sita6 = "{0:06d}".format(ken[PY[i][1]-1])
    ken[PY[i][1]-1] += 1
    answer.append([PY[i][0], ue6+sita6])

answer = sorted(answer, key=lambda x: x[0])
for i in range(M):
    print(answer[i][1])


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

city = []
PY = []
for i in range(M):
    ll = [i] + list(map(int, input().split(" ")))
    # print(ll)
    PY.append(ll)

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


ken = [1]*N
answer = []
for i in range(M):
    ue6 = "{0:06d}".format(PY[i][1])
    sita6 = "{0:06d}".format(ken[PY[i][1]-1])
    ken[PY[i][1]-1] += 1
    answer.append([PY[i][0], ue6+sita6])

answer = sorted(answer, key=lambda x: x[0])
for i in range(M):
    print(answer[i][1])

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 math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, m = MAP()
p = [[i]+LIST() for i in range(m)]
q = [0]*(n+1)

p.sort(key=itemgetter(2))
for x in p:
    q[x[1]] += 1
    x.append(q[x[1]])

p.sort(key=itemgetter(0))
for x in p:
    print(str(x[1]).zfill(6), str(x[3]).zfill(6))

from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, m = MAP()
p = [[i]+LIST() for i in range(m)]
q = [0]*(n+1)

p.sort(key=itemgetter(2))
for x in p:
    q[x[1]] += 1
    x.append(q[x[1]])

p.sort(key=itemgetter(0))
for x in p:
    print(str(x[1]).zfill(6)+str(x[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):
import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)


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

ans = []

Ps = {}

for i in range(M):
	P,Y = list(map(int, input().split(' ')))

	if P in Ps:
		last = True
		jb = 1
		tp = 0
		for j  in range (len(Ps[P])):
			if Y < Ps[P][j][0]:
				Ps[P].insert(j, [Y, i])
				ans.append([P,jb])
				last = False
				tp = j
				continue
			else:
				jb += 1
				

		if last:
			Ps[P].append([Y, i])
			ans.append([P,jb])
		else:
			for k in range(tp+1,len(Ps[P])):
				ans[Ps[P][k][1]][1] += 1

	else:
		Ps[P] = [[Y,i]]
		ans.append([P,1])


# {1: [[12, 2], [32, 0]], 2: [[63, 1]]}
print(Ps)

for elem in ans:
	print(str(elem[0]).zfill(6)+str(elem[1]).zfill(6))

import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)


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

# Y,P,i
Cities = []

for i in range(M):
	P, Y = list(map(int, input().split(' ')))
	Cities.append([Y,P,i])

Cities.sort()
PsCount = {}


ans = []

for c in Cities:
	if c[1] in PsCount:
		PsCount[c[1]] += 1
		ans.append([c[2], c[1], PsCount[c[1]]])
	else:
		PsCount[c[1]] = 1
		ans.append([c[2], c[1], 1])

ans.sort()


for elem in ans:
	print(str(elem[1]).zfill(6)+str(elem[2]).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=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
s=sorted(a,key=lambda x:(x[0],x[1]))
f=s[0][0]
d=1
for i in range(m):
    if s[i][0]==f:
        s[i][1]==d
        d+=1
    else:
        f=s[i][0]
        d=1
        s[i][1]=d
        d+=1

for i in range(m):
    z=str(a[i][0])
    x=str(a[i][1])
    n="0"*(6-len(z)) + z + "0"*(6-len(x)) + x 
    print(n)

import bisect
n,m=(int(i) for i in input().split())
a=[[] for _ in range(n)]
s=[]

for _ in range(m):
    x,c=(int(i) for i in input().split())
    a[x-1].append(c)
    s.append((x,c))
print(a)
print(s)
[a[i].sort() for i in range(n)]
print(a)
for x,c in s:
    print("{:06}{:06}".format(x, bisect.bisect_left(a[x-1],c)+1))

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

s = sorted(a,key=lambda x:(x[0],x[1]))
f=s[0][0]
d=1
for i in range(m):
    if s[i][0] == f:
        s[i][1]=d
        d+=1
    else:
        f=s[i][0]
        d=1
        s[i][1]=d
        d+=1
for i in range(m):
    print("{:06}".format(a[i][0]) +"{:06}".format(a[i][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())
a = []
b = []
for i in range(n):
    P,Y = map(int,input().split())
    a.append(P)
    b.append(Y)





count = 0
ans = 0
i = 0
A = sorted(a)
while True:
    if m-b[a.index(A[i])] > 0:
        m -= b[a.index(A[i])]
        ans += A[i] * b[a.index(A[i])]
    else:
        ans += A[i]* m
        break
    i+=1
print(ans)

n,m = map(int,input().split())
s = []
for i in range(m):
    a =list(map(int,input().split()))
    a.append(i)
    s.append(a)
s.sort()
print(s)
ans = [0 for i in range(m)]
num = 0
ans_ = ""
for i in range(m):
    if num != s[i][0]:
        num = s[i][0]
        count = 1
    ans_ = str(s[i][0])
    ans__ = str(count)
    for j in range(5):
        if len(ans_) < 6:
            ans_ = "0"+ans_
        if len(ans__) < 6:
            ans__ = "0" + ans__
    ans[s[i][2]] = ans_+ans__
    count += 1
for i in range(m):
    print(ans[i])

n,m = map(int,input().split())
s = []
for i in range(m):
    a =list(map(int,input().split()))
    a.append(i)
    s.append(a)
s.sort()
ans = [0 for i in range(m)]
num = 0
ans_ = ""
for i in range(m):
    if num != s[i][0]:
        num = s[i][0]
        count = 1
    ans_ = str(s[i][0])
    ans__ = str(count)
    for j in range(5):
        if len(ans_) < 6:
            ans_ = "0"+ans_
        if len(ans__) < 6:
            ans__ = "0" + ans__
    ans[s[i][2]] = ans_+ans__
    count += 1
for i in range(m):
    print(ans[i])

Verdicts: 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):
import sys
import collections
import itertools
import math
import re
from collections import Counter
from collections import deque
import bisect


MOD = 10 ** 9 + 7

N, M = [int(x) for x in input().split()]


KenList = [[] for _ in range(N)]


PYlist = [None] * M
for i in range(M):
    P, Y = [int(x) for x in input().split()]
    P = P - 1
    PYlist[i] = (P, Y)
    KenList[P].append((i, Y))



    

for i in range(M):
    ken = PYlist[i][0]
    idx = 0
    kl = KenList[ken]
    for j in range(len(kl)):
        if kl[j][0] == i:
            idx = j
            break
    print("{0:06d}{1:06d}".format(ken+1, idx+1))


sys.exit(0)


import sys
import collections
import itertools
import math
import re
from collections import Counter
from collections import deque

MOD = 10 ** 9 + 7

N, M = [int(x) for x in input().split()]

PYC = []
for i in range(M):
    p, y = [int(x) for x in input().split()]
    PYC.append((p, y, i))

PYC = sorted(PYC)

city = {}

pCount = 1
preP = -1
for p, y, c in PYC:
    if preP != p:
        pCount = 1
    city[c] = (p, pCount)
    pCount += 1
    preP = p

for i in range(M):
    print("{:06d}{:06d}".format(city[i][0], city[i][1]))


sys.exit(0)


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())
PList = [[] for _ in range(N+1)]

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

#print(PList)

ans = [0] * M

for P, l in enumerate(PList):
    if not l:
        continue
    l.sort()
    for j, (i, Y) in enumerate(l):
        ans[i] = "{:06d}{:06d}".format(P, j+1)

#print(ans)

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

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

PiYList = []

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

PiYList = sorted(PiYList, key = lambda x: x[0])

tmp = 1
x = 1
for j in range(M):
    if PiYList[j][0] != tmp:
        tmp = PiYList[j][0]
        x = 1
    ans = PiYList[j][0] * 1000000 + x
    ans = str(ans)
    ans = ans.zfill(12)
    PiYList[j][1] = ans
    x += 1

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

for i in range(M):
    print(PiYList[i][1])

N, M = map(int, input().split())
PList = [[] for _ in range(N+1)]

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

#print(PList)

ans = [0] * M

for P, l in enumerate(PList):
    if not l:
        continue
    l.sort()
    for j, (i, Y) in enumerate(l):
        ans[i] = "{:06d}{:06d}".format(P, j+1)

#print(ans)

print("\n".join(ans))

N, M = map(int, input().split())
PList = [[] for _ in range(N+1)]

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

#print(PList)

ans = [0] * M

for P, l in enumerate(PList):
    if not l:
        continue
    l.sort()
    for j, (Y, i) in enumerate(l):
        ans[i] = "{:06d}{:06d}".format(P, j+1)

#print(ans)

print("\n".join(ans))

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 = dict()
for i in range(N):
    City[i+1] = []
for i in range(M):
    Ken,Year = map(int,input().split())
    City[Ken].append(Year)
for i in range(N):
    City[i+1].sort()
for i in range(1,N+1):
    for el in City[i]:
        el = City[i].index(el)
def Zip_code(Ken,rank):
    Ken = str(Ken)
    rank = str(rank)
    Add = (6-len(Ken)) * '0'
    Ken = Add + Ken
    Add = (6-len(rank)) * '0'
    rank = Add + rank
    return Ken+rank
for i in range(1,N+1):
    if City[i] != []:
        for el in City[i]:
            print(Zip_code(i,City[i].index(el)+1))

def mips():
  return map(int,input().split())
def rev(data):
    a = data[0]
    data[0] = data[1]
    data[1] = a
    return None
N,M = mips()
data = dict()
for i in range(M):
    pref,year = mips()
    if pref not in data:
        data[pref] = [[year,i+1,pref]]
    else:
        data[pref].append([year,i+1,pref])
ans = []
for pref in data:
    data[pref].sort()
    for i in range(len(data[pref])):
        data[pref][i][0] = i+1
        rev(data[pref][i])
        ans.append(data[pref][i])
ans.sort()
for i in range(M):
    ken = str(ans[i][2])
    when = str(ans[i][1])
    ken,when = format(ken,'0>6'),format(when,'0>6')
    print(ken+when)

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 collections
import bisect
n,m=map(int,input().split())
p = [list(map(int,input().splilt())) for i in range(m)]
a=collections.defaultdict(list)
for x,y in sorted(p):
    a[x]+=[y]
for x,y in p:
    z=bisect.bisect(a[x],y)
    print("%06d%06d"%(x,z))

import collections
import bisect
n,m = map(int,input().split())
p = [list(map(int,input().splilt())) for i in range(m)]
a = collections.deefaultdict(list)
for x,y in sorted(p):
  a[x]+=[y]
for x,y in p:
  z = bisect.bisect(a[x],y)
  print("%06d%06d"%(x,z))

import collections
import bisect
n,m=map(int,input().split())
p = [map(int,input().splilt()) for i in range(m)]
a=collections.defaultdict(list)
for x,y in sorted(p):
    a[x]+=[y]
for x,y in p:
    z=bisect.bisect(a[x],y)
    print("%06d%06d"%(x,z))

import collections
import bisect
n,m = map(int,input().split())
p = [list(map(int,input().splilt())) for i in range(m)]
a = collections.defaultdict(list)
for x,y in sorted(p):
  a[x]+=[y]
for x,y in p:
  z = bisect.bisect(a[x],y)
  print("%06d%06d"%(x,z))

import collections
import bisect
n,m=map(int,input().split())
p=[[int(j) for j in input().split()] for i in range(m)]
a=collections.defaultdict(list)
for x,y in sorted(p):
    a[x]+=[y]
for x,y in p:
    z=bisect.bisect(a[x],y)
    print("%06d%06d"%(x,z))

Verdicts: Runtime Error

Runtime Error

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):
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
d = {}
for i in range(1,m+1):
    p,y = map(int, input().split())
    if p not in d:
        d[p] = []
    d[p].append([y,i])

for k in d.keys():
    d[k] = sorted(d[k])

ret = []
for k in d.keys():
    for i in range(len(d[k])):
        idx = i+1
        ret.append("{:06x}{:06x}".format(k,idx))

for s in sorted(ret):
    print(s)


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

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

ret = {}
for k in d.keys():
    d[k] = sorted(d[k])
    ret[k] = {}
    for i in range(len(d[k])):
        ret[k][d[k][i][0]] = i+1

for p,y in py:
    print("{:06}{:06}".format(p,ret[p][y]))


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())
cities=[[] for i in range(n)]
for i in range(1,m+1):
  p,y=map(int,input().split())
  cities[p-1].append(y)
  print(format(str(p),"0>6")+format(str(len(cities[p-1])),"0>6"))

n,m=map(int,input().split())
cities=[[] for i in range(n)]
for i in range(1,m+1):
  p,y=map(int,input().split())
  cities[p-1].append(y)
  print(format(str(p),"0>6")+format(str(len(cities[p-1],"0>6"))))
  

import sys
n,m=map(int,input().split())
if m==1:
  a,b=map(int,input().split())
  print(str(a).zfill(6)+str(m).zfill(6));sys.exit()
cities=[None]*m
for i in range(m):
  p,y=map(int,input().split())
  cities[i]=[p,y,i]
cities.sort(key=lambda x:x[1]);cities.sort(key=lambda x:x[0])
i=0
c=1
while True:
  cities[i].append(c)
  c+=1
  if i!=m-1 and cities[i][0]!=cities[i+1][0]:c=1
  elif i==m-1:break
  i+=1
cities.sort(key=lambda x:x[2])
for i in cities:
  print(str(i[0]).zfill(6)+str(i[3]).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):
n = list(map(int, input().split()))
N, M = n[0], n[1]

import numpy as np

def main():
    M_list = []
    y_array = np.array([[10000000000]*M]*N)
    for i in range(M):
        tmp = list(map(int, input().split()))
        M_list.append(tmp[0])
        y_array[tmp[0]-1,i] = tmp[1]

    num_array = np.zeros([N,M])
    ynum_array = np.ones([N,M])
    for k in range(N):
        #print(np.argsort(y_array[k]))
        num_array[k,:] = np.argsort(y_array[k])
        y_sorted = np.sort(y_array)
        tmp = 1
        for l in np.argsort(y_array[k]):
            if int(ynum_array[k][l]) == 10000000000:
                break
            ynum_array[k][l] = tmp
            tmp += 1

    for j in range(M):
        ac = (str(M_list[j]).zfill(5)) + (str(int(ynum_array[M_list[j]-1][j])).zfill(5))
        print(ac)
        
    #print(y_array)

if __name__ == '__main__':
    main()




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

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

city_list.sort(key=lambda x: (x[0], x[1]))

#print(city_list)

tmp_list = [0]*m
tmp_num = 1
for num,j in enumerate(city_list):
    if num == 0:
        tmp_list[j[2]] = str(j[0]).zfill(6)+str(tmp_num).zfill(6)
        j_tmp = j[0]
        tmp_num += 1
    else:
        if j[0] != j_tmp:
            j_tmp = j[0]
            tmp_num = 1
            tmp_list[j[2]] = str(j[0]).zfill(6)+str(tmp_num).zfill(6)
            tmp_num += 1
        else:
            tmp_list[j[2]] = str(j[0]).zfill(6)+str(tmp_num).zfill(6)
            tmp_num += 1

for k in tmp_list:
    print(k)

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 numpy as np
N, M = [int(a) for a in input().split()]
P = []
Y = []

for _ in range(M):
    p, y =  [int(a) for a in input().split()]
    P.append(p)
    Y.append(y)

index = {}
id = ["" for _ in range(len(P))]

for i in np.argsort(Y):
    index[P[i]] = index.get(P[i], 0)
    id[i] = "{0:06d}".format(P[i])+"{0:06d}".format(index[P[i]])
    index[P[i]] += 1

for i in id:
    print(i)

import numpy as np
N, M = [int(a) for a in input().split()]
P = []
Y = []

for _ in range(M):
    p, y =  [int(a) for a in input().split()]
    P.append(p)
    Y.append(y)

index = {}
id = ["" for _ in range(len(P))]

for i in np.argsort(Y):
    index[P[i]] = index.get(P[i], 0)
    id[i] = "{0:06d}".format(P[i])+"{0:06d}".format(index[P[i]])
    index[P[i]] += 1

for i in id:
    print(i)

import numpy as np
N, M = [int(a) for a in input().split()]
P = []
Y = []

for _ in range(M):
    p, y =  [int(a) for a in input().split()]
    P.append(p)
    Y.append(y)

index = {}
id = ["" for _ in range(len(P))]

for i in np.argsort(Y):
    index[P[i]] = index.get(P[i], 1)
    id[i] = "{0:06d}".format(P[i])+"{0:06d}".format(index[P[i]])
    index[P[i]] += 1

for i in id:
    print(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())
PY = [[i,0] + list(map(int, input().split())) for i in range(M)]
# [index, nth city, pref num, birth year]

PY.sort(key=lambda x:(x[2],x[3]))

p = -1
for i,py in enumerate(PY):
  if p != py[3]:
    p = py[3]
    num = 1
    PY[i][1] = num
  else:
    num += 1
    PY[i][1] = num

PY.sort(key=lambda x:x[0])

for py in PY:
  print('{:0=6}{:0=6}'.format(py[2], py[1]))


#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, M = map(int, input().split())
# PY = [list(map(int, input().split())) for _ in range(M)]
PY = []
for i in range(M):
    P, Y = map(int, input().split())
    PY.append((i, P, Y))

PYs = sorted(PY, key=lambda x:(x[1], x[2]))
# print(PYs)

d = defaultdict(int)
ress = []
for py in PYs:
    i, p, y = py
    ress.append((i, p, d[p]+1))
    d[p] += 1

ress.sort(key=lambda x: x[0])
for res in ress:
    i, p, o = res
    print(str(p).zfill(6)+str(o).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 = map(int, input().split())
L = []
for i in range(M):
  P, Y = map(int, input().split())
  L.append((P, Y, i))
ans = ['']*(M)
print(L)
L.sort(key=lambda x:(x[0], x[1]))
before = L[0][0]
num = 0
for i in range(M):
  if L[i][0] == before:
    num += 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
  else:
    num = 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
    before = L[i][0]
for city in ans:
  print(city)


N, M = map(int, input().split())
L = []
for i in range(M):
  P, Y = map(int, input().split())
  L.append((P, Y, i))
ans = ['']*(M)
L.sort(key=lambda x:(x[0], x[1]))
before = L[0][0]
num = 1
for i in range(M):
  if L[i][0] == before:
    num += 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
  else:
    num = 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
    before = L[i][0]
for city in ans:
  print(city)
    
  
  



N, M = map(int, input().split())
L = []
for i in range(M):
  P, Y = map(int, input().split())
  L.append((P, Y, i))
ans = ['']*(N)

L.sort(key=lambda x:(x[0], x[1]))
before = L[0][0]
num = 1
for i in range(M):
  if L[i][0] == before:
    num += 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
  else:
    num = 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
    before = L[i][0]
for city in ans:
  print(city)
    
  
  

N, M = map(int, input().split())
L = []
for i in range(M):
  P, Y = map(int, input().split())
  L.append((P, Y, i))
ans = ['']*(M)
L.sort(key=lambda x:(x[0], x[1]))
before = L[0][0]
num = 0
for i in range(M):
  if L[i][0] == before:
    num += 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
  else:
    num = 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
    before = L[i][0]
for city in ans:
  print(city)


Verdicts: Wrong Answer

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())
p=[1]*(n+1)
c=[]
for i in range(m):
  pi,x =map(int, input().split())
  c.append([i+1, pi, x, 0])
  #p[pi].append(x)


x_order = sorted(c, key=lambda e: e[2])
for e in range(x_order):
  e[3] = p[pi]
  p[pi] += 1

i_order = sorted(x_order)
for e in i_order:
  id=e[1]*1000000+e[3]
  print(str(id).zfill(12))


n,m=map(int, input().split())
p=[1]*(n+1)
c=[]
for i in range(m):
  pi,x =map(int, input().split())
  c.append([i+1, pi, x, 0])
  #p[pi].append(x)


x_order = sorted(c, key=lambda e: e[2])
for e in x_order:
  e[3] = p[pi]
  p[pi] += 1

i_order = sorted(x_order)
for e in i_order:
  id=e[1]*1000000+e[3]
  print(str(id).zfill(12))


n,m=map(int, input().split())
p=[[] for i in range(n+1)]
c=[]
for i in range(m):
  pi,x =map(int, input().split())
  c.append((pi,x))
  p[pi].append(x)
for i in range(n):
  p[i]=sorted(p[i])
for e in c:
  id=e[0]*1000000+p[e[0]].index(e[1])+1
  proud(str(id).zfill(12))

n,m=map(int, input().split())
p=[1]*(n+1)
c=[]
for i in range(m):
  pi,x =map(int, input().split())
  c.append([i+1, pi, x, 0])
  #p[pi].append(x)


x_order = sorted(c, key=lambda e: e[2])
for e in x_order:
  e[3] = p[e[1]]
  p[e[1]] += 1

i_order = sorted(x_order)

for e in i_order:
  id=e[1]*1000000+e[3]
  print(str(id).zfill(12))


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted