problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03221
u036744414
2,000
1,048,576
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 ci...
['# coding:utf-8\n\ndef gen_id(n):\n id = ""\n hokan = 6 - len(str(n))\n for _ in range(hokan):\n id += "0"\n id += str(n)\n return id\n\nN, M = map(int, input().split())\n\nDIC = dict()\nNUM_DIC = dict()\nfor pi in range(1, N+1):\n DIC[pi] = []\n NUM_DIC[pi] = 0\n\nfor _ in range(M):\n p...
['Wrong Answer', 'Accepted']
['s358562804', 's127868398']
[33972.0, 73356.0]
[2105.0, 1283.0]
[703, 757]
p03221
u038408819
2,000
1,048,576
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 ci...
["N, M = map(int, input().split())\n\n \npy = [list(map(int, input().split())) for i in range(M)]\npy.sort()\ncnt = 1\npre = py[0][0]\nans = '0' * (6 - len(str(py[0][0]))) + str(py[0][0]) + '0' * 5 + '1'\ncnt += 1\nprint(ans)\nfor i in range(1, M):\n \n if py[i][0] != pre:\n cnt = 1\n pre = py[i][0]\...
['Wrong Answer', 'Accepted']
['s712318151', 's614280110']
[28824.0, 36636.0]
[756.0, 757.0]
[497, 441]
p03221
u044459372
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\nli=[[] for i in range(n+1)]\n\nfor i in range(m):\n\tj,k=map(int,input().split())\n\tli[j].append(k)\n\nfor i in range(1,m):\n\tli[i].sort()\n\tfor j in li[i]:\n\t\tprint(str(i).zfill(6)+str(j).zfill(6))', "def main():\n n, m = map(int, input().split())\n p, y = [0 for i in range(m...
['Runtime Error', 'Accepted']
['s150475765', 's224359695']
[19632.0, 64220.0]
[531.0, 607.0]
[217, 696]
p03221
u046187684
2,000
1,048,576
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 ci...
['import numpy as np\n\n\ndef solve(string):\n n, m, *py = map(int, string.split())\n p = [[] for _ in range(n)]\n for _p, _y in py:\n p[_p - 1].append(_y)\n for i in range(n):\n p[i] = np.argsort(np.argsort(p[i]))\n counter = [0 for _ in range(n)]\n for _p, _y in py:\n t = "{:06}...
['Runtime Error', 'Runtime Error', 'Accepted']
['s395707764', 's992437771', 's905634871']
[36240.0, 43796.0, 55336.0]
[340.0, 503.0, 1631.0]
[595, 413, 640]
p03221
u048004795
2,000
1,048,576
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 ci...
["# -*-coding: utf-8 -*-\n\nimport sys\n\ndef main():\n input = sys.stdin.readline\n n, m = map(int, input().split())\n y_dict = {}\n ken_dict = {}\n for i in range(m):\n p_i, y_i = map(int, input().split())\n y_dict[y_i] = []\n y_dict[y_i].append(p_i)\n\n if not p_i in ken_di...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s218458706', 's589131360', 's887890474']
[44584.0, 9092.0, 44372.0]
[331.0, 31.0, 290.0]
[792, 723, 753]
p03221
u054514819
2,000
1,048,576
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 ci...
["N, M = map(int, input().split())\nfrom bisect import bisect_right\ndic = [[] for i in range(N)]\n\nshi = {}\nfor i in range(M):\n p, y = map(int, input().split())\n dic[p-1].append(y)\n shi[i] = (p, y)\n\nfor j in range(M):\n p, y = shi[j]\n print('{:06}{:06}'.format(p, bisect_right(dic[p-1], y)))\n\n"...
['Wrong Answer', 'Accepted']
['s969599886', 's175265727']
[38188.0, 38212.0]
[638.0, 688.0]
[303, 341]
p03221
u057109575
2,000
1,048,576
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 ci...
["N, M = map(int, input().split())\nX = [list(map(int, input().split())) for _ in range(M)]\nX.sort()\n\ncity = X[0][0]\nnum = 0\nfor v in X:\n if city == v[0]:\n num += 1\n else:\n city = v[0]\n num = 1\n print('{:06}{:06}'.format(v[0], num))", "N, M = map(int, input().split())\nX = [list...
['Wrong Answer', 'Accepted']
['s273978939', 's634975269']
[30052.0, 47328.0]
[662.0, 624.0]
[259, 290]
p03221
u063052907
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\nlst = [list(map(int, input().split())) for _ in range(M)]\nlst_city = [[] for _ in range(N)]\n\nfor i, y in lst:\n i -= 1\n lst_city[i].append(y)\nelse:\n lst_city[i].sort()\nprint(lst_city)\n\n\nfor i, y in lst:\n id_u = str(i).zfill(6)\n id_l = str(lst_city[i-1].inde...
['Wrong Answer', 'Accepted']
['s031277547', 's862839211']
[40136.0, 55316.0]
[2106.0, 701.0]
[360, 384]
p03221
u065079240
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\ncity = [0]*M\nfor i in range(M):\n city[i] = [i] * 4\n prefecture, year = map(int, input().split())\n city[i][0], city[i][1] = year, prefecture\n\ncity = sorted(city)\nprint(city)\n\nprint(city)\nite = [1] * (N+1)\nfor k in range(M):\n city[k][3] = ite[city[k][1]]\n it...
['Wrong Answer', 'Accepted']
['s134909290', 's316476368']
[41260.0, 30632.0]
[963.0, 843.0]
[457, 433]
p03221
u067983636
2,000
1,048,576
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 ci...
['import heapq\n\nN, M = map(int, input().split())\nS = ["" for m in range(M)]\n\nD = {}\nfor m in range(M):\n P, Y = map(int, input().split())\n listP = D.setdefault(P, [])\n heapq.heappush(listP, (Y, m))\n\nprint(D)\n\nfor p, l in D.items():\n for i in range(len(l)):\n y, m = heapq.heappop(l)\n ...
['Wrong Answer', 'Accepted']
['s821654179', 's394644907']
[45196.0, 38288.0]
[779.0, 685.0]
[377, 367]
p03221
u074294821
2,000
1,048,576
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 ci...
["from collections import defaultdict\nimport bisect\n\npre = defaultdict(list)\nori = []\nn, m = map(int, input().split())\nfor _ in range(m):\n x, y = map(int, input().split())\n pre[x].append(y)\n ori.append([x, y])\n\nfor key, val in pre.items():\n val.sort()\n\nprint(pre)\nfor i in range(m):\n l = p...
['Wrong Answer', 'Accepted']
['s342345925', 's433206458']
[42604.0, 38708.0]
[431.0, 432.0]
[392, 381]
p03221
u077291787
2,000
1,048,576
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 ci...
['import sys\ninput = sys.stdin.readline\n\nn, m = list(map(int, input().rstrip().split()))\nans = [""] * m\narr = []\ncnt = 1\nfor i in range(m):\n p, y = map(int, input().split())\n arr += [(p, y, i)]\narr = sorted(arr)\n\nans[arr[0][2]] = "{:06}{:06}".format(arr[0][0], cnt)\nfor i in range(1, m):\n if arr[i...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s386809603', 's415307756', 's445281994', 's726432939', 's995833897', 's656547066']
[27640.0, 50208.0, 27644.0, 34548.0, 40460.0, 51420.0]
[428.0, 2106.0, 427.0, 485.0, 503.0, 460.0]
[476, 388, 454, 611, 635, 592]
p03221
u079022693
2,000
1,048,576
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 ci...
['from sys import stdin\ndef f(n,m):\n n,m=str(n),str(m)\n s1=["0"]*(6-len(n))\n s1.append(n)\n s2=["0"]*(6-len(m))\n s2.append(m)\n return "".join(s1)+"".join(s2)\n\ndef main():\n \n readline=stdin.readline\n N,M=map(int,readline().split())\n li=[0]*M\n for i in range(M):\n a=li...
['Wrong Answer', 'Accepted']
['s778138220', 's890387943']
[43236.0, 39264.0]
[783.0, 634.0]
[721, 707]
p03221
u083960235
2,000
1,048,576
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 ci...
['N,M=map(int,input().split())\nL=[list(map(int,input().split())) for i in range(M)]\nL.sort(key=lambda x:x[1])\nL.sort(key=lambda x:x[0])\ncity_num=1#\n#12 to 1\n#32 to 2\ninside_num=1\nfor i in range(M):\n if L[i][0]==city_num:\n L[i][1]=inside_num\n inside_num+=1\n else:\n city_num+=1\n ...
['Wrong Answer', 'Accepted']
['s683804912', 's669594953']
[29400.0, 32280.0]
[699.0, 822.0]
[447, 447]
p03221
u088553842
2,000
1,048,576
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 ci...
["def main():\n n, m = map(int, input().split())\n def zs(num):\n k = 6 - len(str(num))\n return '0' * k + str(num)\n lst = [[-1] for i in range(n + 1)]\n cities = []\n for i in range(m):\n temp = tuple(map(int, input().split()))\n lst[temp[0]].append(temp[1])\n cities.append(temp)\n for l in lst:\...
['Wrong Answer', 'Accepted']
['s703067908', 's929873971']
[38816.0, 36812.0]
[2207.0, 528.0]
[453, 375]
p03221
u089376182
2,000
1,048,576
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 ci...
['n,m = map(int, input().split())\ninfo = [[i] + list(map(int, input().split())) for i in range(1, m+1)]\ncity = sorted(set([info_i[0] for info_i in info]))\n\n', 'n,m = map(int, input().split())\ninfo = [[i] + list(map(int, input().split())) for i in range(1, m+1)]\ncity = sorted(set([info_i[0] for info_i in info]))\n...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s376622525', 's712572983', 's179502821']
[30284.0, 35592.0, 43328.0]
[389.0, 2105.0, 803.0]
[554, 559, 333]
p03221
u094191970
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\n\nans=[[] for i in range(m)]\np_list=[[] for i in range(n)]\n\nfor i in range(m):\n p,y=map(int,input().split())\n\n ans[i]=str(p).zfill(6)\n p_list[p].append([i,y])\n\nfor pp in p_list:\n pp=sorted(pp,key=lambda x:x[1])\n num=0\n for ppp in pp:\n num+=1\n ans[ppp[0]]+=str(num).zfill(6...
['Runtime Error', 'Accepted']
['s571741029', 's860221956']
[42536.0, 49984.0]
[804.0, 671.0]
[335, 484]
p03221
u099566485
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\np=[[] for i in range(n)]\ny=[]\nnl=[]\nfor i in range(m):\n t1,t2=map(int,input().split())\n p[t1-1].append(t2)\nfor i in range(n):\n tl=p[i].sort()\n for j in range(len(p[i])):\n u=str(i+1)\n w=tl.index(p[i][j])\n d=str(w+1)\n while len(u)<6:\n ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s304666226', 's324728161', 's777642196', 's914789146', 's937607543', 's975072100', 's229278166']
[17968.0, 19352.0, 26520.0, 26836.0, 26516.0, 26408.0, 42740.0]
[396.0, 2104.0, 656.0, 721.0, 2104.0, 2104.0, 934.0]
[435, 320, 388, 388, 418, 418, 316]
p03221
u102126195
2,000
1,048,576
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 ci...
['def ABC113C():\n \n N, M = map(int, input().split())\n PY = [list(map(int, input().split())) for i in range(M)]\n P = [[] for i in range(10 ** 5)]\n\n from operator import itemgetter\n PY.sort(key = itemgetter(1))\n for k in range(len(PY)):\n i = PY[k][0]\n j = PY[k][1]\n P[i...
['Wrong Answer', 'Accepted']
['s142512330', 's371910642']
[65696.0, 64836.0]
[998.0, 996.0]
[703, 751]
p03221
u102960641
2,000
1,048,576
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 ci...
['n,m = map(int, input().split())\na = [list(map(int, input().split())) for i in range(m)]\nc = [0]*n\nfor i in a:\n p,y = i[0],i[1]\n c[p-1] += 1\n num = c[p-1]\n print("0"*(6-len(p))+"0"*(6-len(num))+num)\n ', 'import math\nn,m = map(int, input().split())\na = []\nfor i in range(m):\n pk,yk = map(int,input().sp...
['Runtime Error', 'Accepted']
['s378293379', 's887356580']
[28172.0, 41748.0]
[339.0, 949.0]
[204, 525]
p03221
u106797249
2,000
1,048,576
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 ci...
['def resolve():\n (N, M) = list(map(int,input().split(" ")))\n cities = [list(map(int, input().split(" "))) + [i] for i in range(M)]\n sorted_cities = sorted(cities, key=lambda x: (x[0], x[1]))\n\n pref = 0\n cnt = 0\n for city in sorted_cities:\n if pref != city[0]:\n pref = city[0...
['Wrong Answer', 'Accepted']
['s417960879', 's873817263']
[35368.0, 35428.0]
[672.0, 661.0]
[563, 615]
p03221
u108990937
2,000
1,048,576
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 ci...
["N, M = (int(i) for i in input().split(' '))\npy=[]\np =[]\n\nfor i in range(M):\n p = [i]\n p.extend([int(j) for j in input().split(' ')])\n py.append(p)\n\nNpy = []\nfor i in range(1,N+1):\n \n pyi = [j for j in py if j[1] == i] \n pyi.sort(key=lambda x: x[2]) \n l = len(pyi)\n cnt = 0\n f...
['Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s094265504', 's308917960', 's475179523', 's950656618', 's778186729']
[30628.0, 27924.0, 27900.0, 27916.0, 28256.0]
[2105.0, 2105.0, 2108.0, 2105.0, 743.0]
[532, 629, 598, 599, 468]
p03221
u111365362
2,000
1,048,576
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 ci...
["n,m = map(int,input().split())\npref = [[] for _ in range(n)]\ncityrecord = []\nfor i in range(m):\n p,y = map(int,input().split())\n pref[p-1].append([y,i])\n cityrecord.append(p-1)\nfor ni in range(n):\n pref[ni].sort()\nprint(pref)\nfor i in range(m):\n now = cityrecord[i]\n for j in range(len(pref[now])):\n...
['Wrong Answer', 'Accepted']
['s925957242', 's124701548']
[40900.0, 50040.0]
[2105.0, 880.0]
[451, 513]
p03221
u113750443
2,000
1,048,576
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 ci...
['def nyu():\n N, M = map(int, input().split())\n S = [list(input().split()) for i in range(M)]\n return N,M,S\n\ndef kansu(N,M,S):\n\n S_tmp=[]\n for i in range(M):\n tmp = [int(S[i][0]),int(S[i][1]),0]\n S_tmp.append(tmp) \n S_tmp.sort()\n tmp = S_tmp[0][0]\n cnt = 1\n\n for i...
['Wrong Answer', 'Accepted']
['s838954800', 's524297763']
[54916.0, 53788.0]
[2106.0, 842.0]
[1108, 1012]
p03221
u116233709
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\nli=[]\nans=[]\ncnt=0\nfor i in range(m):\n p,y=map(int,input().split())\n li.append([p,y,i])\nli=sorted(li,key=lambda x:x[1])\nli=sorted(li,key=lambda x:x[0])\npre=li[0][0]\nprint(li)\nfor j in range(m):\n if li[j][0]==pre:\n cnt+=1\n ans.append([str(pre).zfill(6)+...
['Wrong Answer', 'Accepted']
['s810252834', 's120449965']
[48228.0, 43476.0]
[1076.0, 902.0]
[528, 518]
p03221
u118642796
2,000
1,048,576
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 ci...
['from bisect import bisect,bisect_left\n\n\nN,M = map(int,input().split())\n\nd1 = {}\nd2 = {}\nfor i in range(M):\n PY = list(map(int,input().split()))\n tmp = d1.get(PY[0],[])\n ins_pos = bisect(tmp,PY[1])\n tmp.insert(ins_pos,PY[1])\n d1[PY[0]] = tmp\n\nfor py in PY:\n s1 = str(py[0])\n s1 = ("...
['Runtime Error', 'Accepted']
['s046173309', 's179107869']
[32860.0, 32616.0]
[2104.0, 665.0]
[413, 265]
p03221
u123824541
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\nD = [[] for i in range(N)]\n\nfor i in range(M):\n p, y = map(int, input().split())\n D[p-1].append((y, i))\n\nans = [None]*M\n\nfor i, d in enumerate(D):\n print(d)\n d.sort()\n for k, (y, j) in enumerate(d):\n ans[j] = "%06d%06d" % (i+1, k+1)\n \nprint(*ans...
['Wrong Answer', 'Accepted']
['s445553696', 's501552702']
[39476.0, 37480.0]
[774.0, 596.0]
[314, 301]
p03221
u124735330
2,000
1,048,576
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 ci...
["pre_n, city_n = map(int, input().split())\ncities = [list(map(int, input().split())) for x in range(city_n)]\n\nhistory = {}\n\nA = {}\n\nprint(sorted(cities))\n\nfor x in sorted(cities):\n pref = str(x[0])\n if pref not in history:\n history[pref] = '1'\n\n A.setdefault(str(x), '0'*(6-len(pref)) + pr...
['Wrong Answer', 'Accepted']
['s943154584', 's769594581']
[73764.0, 66464.0]
[1233.0, 1001.0]
[441, 418]
p03221
u126232616
2,000
1,048,576
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 ci...
['n,m = map(int, input().split())\nY = [[] for _ in range(n)]\nL = []\nfor i in range(m):\n p,yi = map(int, input().split())\n Y[p-1].append(yi)\n L.append(yi)\nfor i in range(n):\n Y[i].sort()\n for k in range(len(Y[i])):\n print(0)', 'n,m = map(int, input().split())\nY = [[] for _ in range(n)]\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s052180568', 's787551992', 's893173721']
[19628.0, 18864.0, 35944.0]
[482.0, 2105.0, 675.0]
[243, 303, 340]
p03221
u129749062
2,000
1,048,576
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 ci...
["N, M = map(int,input().split())\npy = []\nfor i in range(M):\n py.append(list(map(int,input().split())))\n py[i].append(i)\nsorted_py = sorted(py, key=lambda x: x[1])\nP = [0]*N\np_num = 0\nnum = 0\noutput = ''\noutput2 = []\noutputs = []\nfor i in range(M):\n P[sorted_py[i][0]-1] += 1\n p_num = sorted_py[i][0]\n...
['Wrong Answer', 'Accepted']
['s481008563', 's107430159']
[49816.0, 49768.0]
[590.0, 611.0]
[546, 546]
p03221
u131405882
2,000
1,048,576
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 ci...
['from operator import itemgetter\nN, M = map(int, input().split())\nc=[]\nfor i in range(M):\n\tc.append(input().split())\nfor i in range(M):\n\tc[i].append(i)\nC = sorted(sorted(c,key=itemgetter(1)), key=itemgetter(0))\nx = 1\nfor i in range(M):\n\tif i > 0 and int(C[i][0]) - int(C[i-1][0]) > 0:\n\t\tx = 1\n\telse:\...
['Wrong Answer', 'Accepted']
['s095289245', 's117290590']
[43008.0, 37356.0]
[859.0, 867.0]
[434, 431]
p03221
u131411061
2,000
1,048,576
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 ci...
["N,M = map(int,input().split())\nd=[0]*M\nres = []\nfor i in range(M):\n P,Y = map(int,input().split())\n res.append((P,Y,i))\nc=1\nprint(res)\nfor i in sorted(res):\n x = str(i[0])\n y = str(i[1])\n tmp = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)\n if(tmp in d):\n c+=1\n d[i[2]] = (6...
['Wrong Answer', 'Accepted']
['s996078956', 's775245903']
[29516.0, 28956.0]
[2105.0, 651.0]
[457, 340]
p03221
u131881594
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\npre=[[] for _ in range(n)]\nfor _ in range(m):\n p,y=map(int,input().split())\n pre[p-1].append([y,_,p])\nfor p in range(n):\n pre[p].sort(key=lambda x:x[0])\n for i in range(len(pre[p])):\n pre[p][i].append(i)\nlis=[]\nfor i in pre:\n for j in i:\n lis.appen...
['Wrong Answer', 'Accepted']
['s774291403', 's847047990']
[46628.0, 46560.0]
[588.0, 627.0]
[392, 392]
p03221
u131944095
2,000
1,048,576
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 ci...
["N, M = map(int, input().split())\nD = [[] for i in range(N)]\n\nfor i in range(M):\n p, y = map(int, input().split())\n D[p-1].append((y, i)) \n\nans = [None]*M\n\nfor i, d in enumerate(D): \n d.sort()\n print(d)\n for k, (y, j) in enumerate(d): \n ans[j] = str(i+1).zfill(6) + str(k+1).zfill(6)\nprint(*ans, s...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s500383648', 's918134603', 's389413309']
[39508.0, 39624.0, 37480.0]
[802.0, 2106.0, 652.0]
[315, 444, 306]
p03221
u134181243
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\nnum=[1]*(n+1)\nansl=[]\nfor i in range(m):\n p,y=map(int,input().split())\n ans="%06d"%p+"%06d"%num[p]\n num[p]+=1\n ansl.append(ans)\nprint(*ansl,sep="\\n")\n', 'import bisect\nimport heapq\nn,m=map(int,input().split())\npy_i=[[int(x) for x in input().split()] for _ in range...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s410752967', 's744251614', 's405268086']
[13908.0, 35052.0, 34436.0]
[473.0, 768.0, 678.0]
[191, 297, 298]
p03221
u136090046
2,000
1,048,576
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 ci...
['n, m =map(int, input().split())\npy_array = [[int(x) for x in input().split()]+[y] for x, y in enumerate(range(m), 0)]\npy_array = sorted(py_array, key=lambda x:(x[0], x[1]))\n\nbase = 1\nbase2 = 0\nres_array = []\nfor i, j, k in py_array:\n if base == i:\n base2 += 1\n print(i)\n else:\n b...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s048485408', 's590175818', 's569485047']
[47612.0, 47612.0, 46940.0]
[1029.0, 1070.0, 1002.0]
[491, 490, 473]
p03221
u137228327
2,000
1,048,576
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 ci...
["N,M = map(int,input().split())\n\nD = [[] for i in range(N)]\n#print(P.sort())\nfor i in range(M):\n p,y = map(int,input().split())\n D[p-1].append((y,i))\n \n\n#D = [[(32,0),(12,2)],[(63,1)]]\n#print(D)\nsubmit = [0]*M\nfor i,d in enumerate(D):\n #print(d)\n d.sort()\n #print(i,d)\n for k, (y,j)...
['Wrong Answer', 'Accepted']
['s075459994', 's933324058']
[42124.0, 55580.0]
[441.0, 476.0]
[501, 439]
p03221
u143509139
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\np = [list(map(int, input().split())) + [i] for i in range(M)]\np.sort()\nprint(p)\ni = 0\nfor n in range(1, N + 1):\n count = 1\n print(i, p[2][0])\n while not(i > n or p[i][0] != n):\n p[i] += [str(n).zfill(6) + str(count).zfill(6)]\n i += 1\n count += ...
['Runtime Error', 'Accepted']
['s532690408', 's552486127']
[36840.0, 35008.0]
[910.0, 891.0]
[363, 333]
p03221
u156931988
2,000
1,048,576
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 ci...
['from collections import defaultdict\n\nN,M = map(int,input().split())\nquestion_dic = defaultdict(list)\nquestion_dics = defaultdict(list)\nfor _ in range(M):\n city,value = map(int,input().split())\n question_dic[city].append(value)\nfor key,value in question_dic.items():\n question_dics[key] = sorted(value...
['Wrong Answer', 'Accepted']
['s055628499', 's074348176']
[47688.0, 47320.0]
[2104.0, 637.0]
[433, 424]
p03221
u160244242
2,000
1,048,576
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 ci...
["nm_lst = list(map(int, input().split()))\ncity_lst = [list(map(int, (str(i)+' '+input()).split())) for i in range(nm_lst[1])]\n\ncity_lst = sorted(city_lst, key = lambda x: x[1]*10**7 + x[2])\n\nans_lst = []\nnum_num = 0\nfor n, city in enumerate(city_lst):\n prefec_num = city[1]\n prefec_str = '0' * (6-len(str...
['Runtime Error', 'Accepted']
['s641835147', 's760629221']
[3060.0, 53968.0]
[17.0, 1052.0]
[682, 655]
p03221
u163320134
2,000
1,048,576
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 ci...
["def mks(num):\n s=str(num)\n if len(s)<6:\n s='0'*(6-len(s))+s\n return s\n\nn,m=map(int,input().split())\narr=[]\nfor i in range(m):\n p,y=map(int,input().split)\n arr.append([p,y,i])\nans=[0]*m\narr=sorted(arr,key=lambda x:x[1])\narr=sorted(arr,key=lambda x:x[0])\ntmp=arr[0][0]\ncnt=1\nfor i in range(m):\n ...
['Runtime Error', 'Accepted']
['s822924220', 's724960923']
[3064.0, 31968.0]
[17.0, 847.0]
[508, 521]
p03221
u163449343
2,000
1,048,576
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 ci...
['n, m = map(int, input().split())\na = [0] * (n+1)\nb = [list(map(int, input().split())) + [i] + [0] for i in range(m)]\nb.sort(key= lambda x:x[1])\nfor i, (v, x, y, z) in enumerate(b):\n a[v-1] += 1\n b[i][3] = a[v-1]\nb.sort(key = lambda x:x[2])\nfor v,x,y,z in b:\n print("{0:06d}{0:06d}".format(v,z))', 'n,...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s455636652', 's535956049', 's739137922', 's629257523']
[35960.0, 35960.0, 5136.0, 35960.0]
[730.0, 712.0, 964.0, 729.0]
[303, 301, 257, 303]
p03221
u167523937
2,000
1,048,576
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 ci...
["n,m = map(int, input().split())\npy=[]\nfor i in range(m):\n p,y=map(int, input().split())\n py.append([i,p,y])\n\npy.sort(key=lambda x:(x[1],x[2]))\nsorted_py = py\nnum = 1\nprev_p = str(sorted_py[0][1])\nfor i in range(m):\n if prev_p != sorted_py[i][1]:\n num = 1\n p = str(sorted_py[i][1])\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s139395435', 's960795086', 's367200108']
[34520.0, 34968.0, 34460.0]
[890.0, 883.0, 899.0]
[621, 621, 611]
p03221
u167681750
2,000
1,048,576
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 ci...
['n, m= map(int, (input().split()))\npyi = [list(map(int, (input().split()))) + [i] for i in range(m)]\npyi.sort(key=itemgetter(1))\npyi.sort(key=itemgetter(0))\ncityflag = 0\nans = []\nfor rep in range(m):\n if pyi[rep][0] != pyi[rep - 1][0]:\n cityflag = 0\n\n cityflag += 1\n ans += [[pyi[rep][0] , ci...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s449314238', 's650904327', 's145559941']
[23184.0, 39160.0, 39416.0]
[356.0, 791.0, 840.0]
[421, 422, 454]
p03221
u172035535
2,000
1,048,576
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 ci...
['N,M = map(int,input().split())\nPY = [list(map(int,input().split())) for _ in range(M)]\nfor i in range(M):\n PY[i].append(i)\nPY.sort(key=lambda x:x[1])\nans = [0]*M\nnum = [0]*N\nfor p,y,i in PY:\n ans[i] = str(p).zfill(6) + str(num[p]+1).zfill(6)\n num[p] += 1\nfor s in ans:print(s)', 'N,M = map(int,input...
['Runtime Error', 'Accepted']
['s037264598', 's698278726']
[39876.0, 39884.0]
[644.0, 646.0]
[285, 289]
p03221
u174273188
2,000
1,048,576
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 ci...
['import itertools\n\n\ndef solve():\n n, m = map(int, input().split())\n py = list(list(map(int, input().split())) for _ in range(m))\n py_with_key = sorted([(idx, pyi) for idx, pyi in enumerate(py)], key=lambda x: x[1])\n pref_no = 1\n cnt = 0\n ids = []\n for idx, p_y in py_with_key:\n if...
['Wrong Answer', 'Accepted']
['s090574792', 's712324546']
[56452.0, 54160.0]
[775.0, 791.0]
[619, 600]
p03221
u175590965
2,000
1,048,576
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 ci...
['n,m = [int(i) for i in input().split()]\na = [[]for i in range(n)]\nb = []\n\nfor i in range(m):\n c,d = [int(i)for i in input().split()]\n a =[c-1].append((d,i))\nans = [None]*m\nfor j,b in enumerate(a):\n b.sort()\n for k,(d,i) in enumerate(b):\n ans[i] = str(j+1).zfill(6)+str(k+1).zfill(6)\nprin...
['Runtime Error', 'Runtime Error', 'Accepted']
['s149308502', 's938857692', 's872645747']
[10288.0, 10288.0, 37480.0]
[353.0, 353.0, 639.0]
[322, 305, 272]
p03221
u177411511
2,000
1,048,576
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 ci...
["import sys\nfrom collections import deque\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, m = na()\nbuf = [None] * m\ncnt = {k: [] for k in range(n + 1)}\nfor i in range(m):\n p, y = na()\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s040864741', 's820694135', 's996543458']
[56684.0, 59516.0, 53472.0]
[698.0, 767.0, 511.0]
[519, 530, 506]
p03221
u177756077
2,000
1,048,576
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 ci...
["N,M=map(int,input().split())\nPY=[]\nfor i in range(M):\n array=list(map(int,input().strip().split()))\n PY.append(array)\n\nPY.sort()\ncity=0\norder=0\nfor i in range(M):\n newcity=PY[i][0]\n if(newcity!=city):\n city=newcity\n order=1\n strcity=str(PY[i][0])\n strorder=str(order)\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s301391138', 's411297284', 's032618336']
[29584.0, 3064.0, 35484.0]
[725.0, 17.0, 795.0]
[420, 385, 429]
p03221
u185688520
2,000
1,048,576
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 ci...
["n, m = map(int, input().split())\ndata = [0] * m\nres = [0] * m\nfor i in range(m):\n d = list(map(int, input().split()))\n d.append(i)\n data[i] = tuple(d)\ndata.sort()\ncity_num = data[0][0]\nbirth_num = 1\nprint(data)\nfor item in data:\n # print(item, city_num)\n if item[0] != city_num:\n ci...
['Wrong Answer', 'Accepted']
['s238046424', 's305663915']
[31912.0, 29056.0]
[772.0, 678.0]
[456, 458]
p03221
u185896732
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\nt=[[] for _ in range(n)]\nfor i in range(m):\n p,y=map(int,input().split())\n t[p-1].append((y,i))\nans=[""]*m\nfor i,j in enumerate(t,1):\n j.sort()\n for k,(j,l) in enumerate(j,1):\n print(l)\n ans[l]=str(i).zfill(6)+str(k).zfill(6)\nprint("\\n".join(ans))', '...
['Wrong Answer', 'Accepted']
['s333046509', 's202743779']
[39268.0, 38376.0]
[722.0, 581.0]
[302, 285]
p03221
u187516587
2,000
1,048,576
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 ci...
['import sys\ndef input():\n return sys.stdin.readline()[:-1]\nN,M=map(int,input().split())\nl=[None]*M\nfor i in range(M):\n P,Y=map(int,input().split())\n l[i]=(P,Y,i)\nl.sort()\na=[None]*M\ns=0\nt=1\nfor i in l:\n if i[0]==s:\n t+=1\n else:\n t=1\n s=i[0]\n a[i[2]]="{:06d}".for...
['Wrong Answer', 'Accepted']
['s412149370', 's924467258']
[32592.0, 30564.0]
[448.0, 506.0]
[339, 349]
p03221
u191829404
2,000
1,048,576
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 ci...
['# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0\n# abcde\ts=input()\ts=\'abcde\'\n# abcde\ts=list(input())\ts=[\'a\', \'b\', \'c\', \'d\', \'e\']\n\n# 1 2\tx,y = map(int,input().split())\tx=1,y=2\n\n\n\n\n# 3\n# hoge\n# foo\n# bar\n# n=int(input())\n\n# N, M = map(int,input().split())\n\n# P, Y = [], []\n# f...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s055232399', 's827290891', 's648726596']
[58184.0, 28240.0, 44536.0]
[2105.0, 2104.0, 839.0]
[1014, 947, 1023]
p03221
u196697332
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\n\nP = [0] * M\nY = [0] * M\ndic = {}\nano_dic = {}\nfor m in range(M):\n line = list(map(int, input().split()))\n P[m] = line[0]\n Y[m] = line[1]\n \n dic[m] =[P[m], Y[m]]\n\n\nID = {}\ncount = 0\nsorted_list = sorted(dic.items(), key=lambda x: (x[1][0], x[0]))\n\n\nfo...
['Wrong Answer', 'Accepted']
['s664601186', 's700267615']
[59016.0, 58948.0]
[881.0, 921.0]
[639, 643]
p03221
u197545363
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\nl=[]\nfor i in range(n):l.append([])\nfor i in range(m):\n p,y=map(int,input().split())\n l[p-1].append((i,y))\nrl=[]\nfor i in range(n):\n ll=l[i]\n ll.sort(key=lambda x:x[1])\n hd="000000"+str(i+1)[-6:]\n rr=[(ll[j][0],hd+("000000"+str(j+1))[-6:]) for j in range(len(l...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s459801432', 's984066502', 's081220221']
[43676.0, 44160.0, 42336.0]
[930.0, 1479.0, 887.0]
[362, 375, 364]
p03221
u197955752
2,000
1,048,576
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 ci...
["N, M = [int(x) for x in input().split()]\n\nPREF = 0\nYEAR = 1\nPY = [tuple(int(x) for x in input().split()) for _ in range(M)]\n\nPY.sort()\n\nord = 1 \nfor i in range(M):\n if i > 0 and PY[i][PREF] == PY[i - 1][PREF]:\n ord += 1\n else:\n ord = 1\n print('{:0>6}{:0>6}'.format(str(PY[i][PREF])...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s543519021', 's612228430', 's820786267']
[17904.0, 33836.0, 31296.0]
[661.0, 909.0, 738.0]
[344, 471, 432]
p03221
u201234972
2,000
1,048,576
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 ci...
["N, M = map( int, input().split())\nX = [(0,0)]*M\nY = [1]*(N+1)\nfor i in range(M):\n p,y = map( int, input().split())\n X[i] = (y,p)\nX.sort()\nfor i in range(M):\n y, p = X[i]\n ans = '%06d'%p + '%06d'%Y[p]\n print(ans)\n Y[p] += 1", "N, M = map( int, input().split())\nX = [(0,0,0)]*M\nY = [1]*(N+...
['Wrong Answer', 'Accepted']
['s695754081', 's508042292']
[18700.0, 29796.0]
[569.0, 604.0]
[240, 299]
p03221
u210440747
2,000
1,048,576
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 ci...
["#!/usr/bin/env python3\n# -*- coding:utf-8 -*-\n\ndef main():\n n, m = map(int, input().split())\n ipy = [(i+1, )+(tuple(map(int, input().split()))) for i in range(m)]\n kens = set([p for i,p,y in ipy])\n di = {ken:0 for ken in kens}\n\n ans = []\n for i,p,y in ipy:\n di[p] += 1\n number = ('%06d%06d' % (...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s384390237', 's616131187', 's998110253']
[47636.0, 52340.0, 47728.0]
[519.0, 775.0, 731.0]
[456, 499, 486]
p03221
u215743476
2,000
1,048,576
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 ci...
["from operator import itemgetter\n\nn, m = map(int, input().split())\np, y = [], []\nfor i in range(m):\n p_, y_ = map(int, input().split())\n p.append(p_), y.append(y_)\n\nx = [0] * n\npn = [i for i in range(1, m+1)]\nidn = [''] * m\nyp = list(zip(y, p, pn, idn))\nyp.sort()\n\nfor i in range(m):\n p_ = p[i] ...
['Wrong Answer', 'Accepted']
['s352327664', 's566875137']
[33548.0, 41548.0]
[703.0, 809.0]
[442, 499]
p03221
u216752093
2,000
1,048,576
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 ci...
["from collections import defaultdict\nfrom bisect import bisect\nn,m=map(int,input().split())\nl=[list(map(int,input().split()) for _ in range(m))]\na=defaultdict(list)\nfor x,y in sorted(l):\n a[x]+=[y]\n\nfor x,y in l:\n z=bisect(a[x],y)\n print('%06d%06d'%(x,z))", "from collections import defaultdict\nfrom...
['Runtime Error', 'Accepted']
['s694353537', 's768658634']
[52936.0, 39992.0]
[337.0, 454.0]
[263, 264]
p03221
u217086212
2,000
1,048,576
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 ci...
['n, m = list(map(int, input().split()))\ncity_list = [[] for i in range(n)]\nnumbers = []\n\nfor i in range(m):\n pm, ym = list(map(int, input().split()))\n city_list[pm-1].append(ym)\n\nfor i in range(n):\n city_list[i].sort()\n for j in range(len(city_list[i])):\n print("{:0=6}{:0=6}".format(i+1, ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s134925583', 's511259111', 's604483260', 's645322335', 's945122876', 's459337343']
[25496.0, 24112.0, 24112.0, 45168.0, 47320.0, 47320.0]
[640.0, 403.0, 394.0, 2105.0, 731.0, 766.0]
[313, 375, 419, 442, 423, 423]
p03221
u220904910
2,000
1,048,576
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 ci...
['n,m=map(int, input().split())\nl = [[int(i) for i in input().split()] for i in range(m)]\n\nfor i in range(m):\n l[i].append(i)\nl = sorted(l,key=lambda x: (x[0],x[1]))\n\nl[0].append(1)\nfor i in range(1,m):\n if l[i][0]!=l[i-1][0]:\n l[i].append(1)\n else:\n l[i].append(l[i-1][3]+1)\n\nfor i ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s222437509', 's403733213', 's468250212']
[33164.0, 67536.0, 40672.0]
[544.0, 2107.0, 956.0]
[446, 493, 452]
p03221
u222207357
2,000
1,048,576
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 ci...
['# coding: utf-8\n# Your code here!\n\nN,M = map(int,input().split())\npy= []\n\nfor i in range(M):\n pp,yy = map(int,input().split())\n py.append((pp,yy,i))\n\npy.sort()\n\ncnt = 1\npp_prev = 0\ncode = [\'\' for _ in range(M)]\n\nfor pp,yy,i in py:\n if pp == pp_prev:\n cnt += 1 \n else:\n cn...
['Wrong Answer', 'Accepted']
['s476937143', 's317770593']
[30736.0, 37480.0]
[546.0, 579.0]
[362, 316]
p03221
u223904637
2,000
1,048,576
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 ci...
["import numpy as np\nn,m=map(int,input().split())\nd=[[] for i in range(n)]\nl=[]\nfor i in range(m):\n a,b=map(int,input().split())\n d[a-1].append(b)\n l.append(a)\nx=[[] for i in range(n)]\nfor i in range(n):\n d[i]=list(np.argsort(d[i]))\n tmp=[0]*len(d[i])\n for j in range(len(d[i]):\n tm...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s140072812', 's721214771', 's944359151', 's498844996']
[3064.0, 38488.0, 39528.0, 38764.0]
[18.0, 1281.0, 1286.0, 1233.0]
[580, 466, 587, 593]
p03221
u224050758
2,000
1,048,576
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 ci...
["N, M = [int(n) for n in input().split()]\n\ndef main():\n ps = [[] for _ in range(N)]\n print(ps)\n\n for m in range(M):\n p, y = [int(n) for n in input().split()]\n pref = ps[p - 1]\n pref.append([m, y])\n\n result = []\n\n for i, pref in enumerate(ps):\n pref.sort(key=lamb...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s603129289', 's756608297', 's539663741']
[49300.0, 51468.0, 51028.0]
[909.0, 1019.0, 890.0]
[608, 562, 548]
p03221
u225388820
2,000
1,048,576
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 ci...
['n,m= map(int, input().split())\nx=[[] for j in range(n)]\nfor i in range(m):\n p,ye= map(int, input().split())\n x[p-1].append([ye,i])\nfor i in range(n):\n x[i].sort()\ny=[0]*m\ncnt=1\nfor i in range(n):\n for a in range(len(x[i])):\n j=str(i+1)\n k=str(cnt)\n y[x[i][a][1]]="0"*(6-le...
['Wrong Answer', 'Accepted']
['s521233216', 's561671114']
[43964.0, 59052.0]
[841.0, 907.0]
[398, 412]
p03221
u227082700
2,000
1,048,576
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 ci...
['def pypri(p,y):print(str(p).zfill(6)+str(y).zfill(6))\nn,m=map(int,input().split())\na=[[]for _ in range(n)]\nb=[]\nfor i in range(m):\n p,y=map(int,input.split())\n b.append(p-1)\n a[p-1].append([y,len(a[p-1])+1])\nfor i in range(n):\n a[i].sort()\n for j in range(len(a[i])):\n a[i][j]=[a[i][j][1],j]\n a....
['Runtime Error', 'Accepted']
['s259698536', 's523964954']
[10292.0, 50108.0]
[42.0, 511.0]
[364, 350]
p03221
u227085629
2,000
1,048,576
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 ci...
['n,m = map(int,input().split())\npyl = [list(map(int,input().split())) for nesya in range(m)]\npredic = dict()\npyl = sorted(pyl,key = lambda x:x[1])\nfor py in pyl:\n p = py[0]\n if p in predic:\n predic[p] += 1\n else:\n predic[p] = 1\n print((str(p).zfill(6))+(str(predic[p]).zfill(6)))', 'n,m = map(int,in...
['Wrong Answer', 'Accepted']
['s204971367', 's720398001']
[37768.0, 51572.0]
[640.0, 675.0]
[288, 359]
p03221
u232852711
2,000
1,048,576
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 ci...
['n, m = map(int, input().split())\npy = [list(map(int, input().split())) for _ in range(m)]\n\nans = [0]*m\nprefecs = [1]*(n+1)\nfor i, (p, y) in enumerate(py):\n top = p\n under = prefecs[p]\n ans[i] = str(top).zfill(6)+str(under).zfill(6)\n prefecs[p] += 1\n\nfor i in range(m):\n print(ans[i])\n', 'n,...
['Wrong Answer', 'Accepted']
['s740578393', 's976021018']
[36708.0, 39828.0]
[513.0, 754.0]
[299, 394]
p03221
u241159583
2,000
1,048,576
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 ci...
['n,m = map(int, input().split())\npy = [list(map(int, input().split())) for _ in range(m)]\npy.sort()\n\nans = []\nb = py[0][0]\ncnt = 0\nfor p,y in py:\n if b == p: cnt += 1\n else:\n b = p\n cnt = 1\n a = [str(p), str(cnt)]\n if len(str(p)) < 6: a[0] = "0"*(6-len(str(p))) + str(p)\n if len(str(cnt)) < 6: ...
['Wrong Answer', 'Accepted']
['s434512440', 's409481981']
[36496.0, 34500.0]
[807.0, 637.0]
[392, 302]
p03221
u244459371
2,000
1,048,576
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 ci...
['n,m = map(int,input().split())\ncity = [[] for _ in range(n+1)]\nret = ["" for _ in range(m)]\ndef createSix(s):\n while len(s) != 6:\n s = "0" + s\n return s\nfor i in range(m):\n a,b = map(int, input().split())\n city[a].append((b, i))\nfor i in range(m):\n city[i].sort()\nprint(city)\nfor i i...
['Runtime Error', 'Accepted']
['s409793835', 's359045590']
[38044.0, 36016.0]
[775.0, 692.0]
[460, 439]
p03221
u252828980
2,000
1,048,576
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 ci...
['n,m = map(int,input().split())\nL = []\nfor i in range(m):\n li = list(map(int,input().split()))\n L.append(li)\n\nli = []\nfor i,j in enumerate(L):\n li.append(j+[i])\nli.sort()\n\ni = 1\nans = []\nwhile i <= n:\n l = []\n for j in range(m):\n if li[j][0] == i:\n l.append(li[j])\n ...
['Wrong Answer', 'Accepted']
['s994960146', 's829149611']
[43624.0, 49660.0]
[2206.0, 620.0]
[518, 630]
p03221
u253681061
2,000
1,048,576
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 ci...
['n,m = [int(x) for x in input().split()]\npy = []\nfor i in range(m):\n p,y = [int(x) for x in input().split()]\n py.append([p,y,i+1])\n\ndef zero(num):\n return str(num).zfill(6)\n\n\nif m == 1:\n print(zero(py[0])+zero(1))\nelse:\n year_py = sorted(py, key=lambda x: x[1])\n dic = {x: 0 for x in ran...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s813217941', 's854104342', 's815213758']
[35624.0, 41980.0, 45620.0]
[497.0, 660.0, 892.0]
[547, 543, 559]
p03221
u253759478
2,000
1,048,576
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 ci...
["import bisect\n\nn, m = [int(_) for _ in input().split(' ')]\n\np, y = [], []\nfor _ in range(m):\n temp = [int(_) for _ in input().split(' ')]\n p.append(temp[0])\n y.append(temp[1])\nys = dict()\nfor i in range(m):\n if not(p[i] in ys):\n ys[p[i]] = []\n ys[p[i]].append(y[i])\n\nfor j in ys.ke...
['Wrong Answer', 'Accepted']
['s087057566', 's167185706']
[35084.0, 29736.0]
[715.0, 646.0]
[449, 438]
p03221
u254871849
2,000
1,048,576
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 ci...
["import sys\n\ndef fill(s): while len(s) < 6: s = '0' + s; return s\ndef create_id(p, o): return fill(str(p)) + fill(str(o))\n\nn, m, *py = map(int, sys.stdin.read().split())\npyi = sorted(zip(zip(*[iter(py)] * 2), range(m)))\n\ndef main():\n res = [None] * m\n prev = j = None\n for (p, y), i in pyi:\n ...
['Runtime Error', 'Accepted']
['s354814385', 's688473171']
[2940.0, 32208.0]
[17.0, 348.0]
[456, 442]
p03221
u263830634
2,000
1,048,576
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 ci...
["import sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\n\nlst = [list(map(int, input().split())) + [i] for i in range(M)]\nprint (lst)\n\nlst.sort(key = lambda x: x[1]) \nlst.sort(key = lambda x: x[0])\n\n\nans = [0] * M\n\ncount = 0\ntmp = 0 \nfor p, y, i in lst:\n if tmp == p:\n count ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s236589735', 's393696109', 's331144380']
[36016.0, 28776.0, 33308.0]
[654.0, 750.0, 569.0]
[511, 437, 513]
p03221
u268554510
2,000
1,048,576
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 ci...
['N,M=map(int,input().split())\nPY=[list(map(int,input().split())) for _ in range(M)]\nPY.sort(key=lambda x:x[1])\nflag=[1]*N\nans=[]\nfor P,Y in PY:\n ans.append(str(P).zfill(6)+str(flag[P-1]).zfill(6))\n flag[P-1]+=1\n \nans.sort\nfor a in ans:\n print(a)', 'N,M=map(int,input().split())\nPY=[list(map(int,input()....
['Wrong Answer', 'Accepted']
['s086133230', 's854391743']
[36864.0, 41448.0]
[614.0, 711.0]
[248, 334]
p03221
u269623316
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\ndict1={}\ndict2={}\nfor i in range(m):\n x,y=map(int,input().split())\n try:\n dict1[x].append([y,i+1])\n except:\n KeyError\n dict1[x]=[[y,i+1]]\nansarr=["0"]*m\nfor i in dict1.keys():\n dict1[i].sort()\n s1=(6-len(str(i)))*\'0\'+str(i)\n for j in ...
['Wrong Answer', 'Accepted']
['s356026020', 's004820772']
[46776.0, 46008.0]
[921.0, 789.0]
[474, 475]
p03221
u272557899
2,000
1,048,576
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 ci...
['import copy\nn, m = map(int, input().split())\ns = []\nfor i in range(m):\n s.append([int(i) for i in input().split()])\n #l2 = l[:]\nt = s[:]\nt.sort()\nt.sort(key=lambda x: x[1])\nco = 1\nfor i in range(m):\n if i != 0:\n if t[i][0] != t[i - 1][0]:\n co = 1\n if t[i][0] <10:\n m...
['Wrong Answer', 'Accepted']
['s673634799', 's414195833']
[30476.0, 30360.0]
[794.0, 790.0]
[982, 1003]
p03221
u273201018
2,000
1,048,576
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 ci...
["from itertools import chain\n\n\nN, M = map(int, input().split())\n\nP = [0] * N\n\nI = list(range(M))\n\nQ = [None] * M\nY = [None] * M\n\nfor m in range(M):\n Q[m], Y[m] = map(int, input().split())\n P[Q[m]-1] += 1\n\nD = zip(I, Q, Y)\nD = sorted(D, key=lambda x: [x[1], x[2]])\nI, Q, Y = map(list, zip(*D))\n\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s339712245', 's994420291', 's220993918']
[40672.0, 13360.0, 39648.0]
[929.0, 149.0, 953.0]
[537, 576, 507]
p03221
u277641173
2,000
1,048,576
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 ci...
['n,m=map(int,input().split())\nlis=[]\nfor i in range(m):\n p,q=map(int,input().split())\n lis.append([q,p])\nlis.sort()\nken=[1]*n\nfor i in range(0,m):\n attack=lis[i]\n kenken=attack[1]\n ken_count=ken[kenken-1]\n moji=""\n moji+="0"*(6-len(str(kenken)))+str(kenken)+"0"*(6-len(str(ken_count)))+str(ken_count)...
['Wrong Answer', 'Accepted']
['s456880093', 's641872052']
[21760.0, 41884.0]
[715.0, 965.0]
[339, 454]
p03221
u278057806
2,000
1,048,576
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 ci...
['from sys import stdin\n\nN, M = map(int, stdin.readline().split())\npy = [list(map(int, stdin.readline().split())) for _ in range(M)]\n\npy.sort()\n\npx = []\n\nptmp = 0\nxtmp = 1\n\nfor p, y in py:\n if p == ptmp:\n xtmp += 1\n px.append([p, xtmp])\n else:\n ptmp = p\n xtmp = 1\n ...
['Wrong Answer', 'Accepted']
['s613275535', 's500044058']
[39404.0, 45980.0]
[665.0, 681.0]
[402, 431]
p03221
u281610856
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\narr = [0 for _ in range(M)]\nfor i in range(M):\n p, y = map(int, input().split())\n arr[i] = [p, y, i]\nprint(arr)\narr.sort(key=lambda x:x[1])\nprint(arr)\narr[0][1] = 1\nans_list = [0] * M\nfor i in range(0, M):\n if i == 0:\n ans_list[i] = [str(arr[0][0]).zfill(6)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s136059201', 's680618780', 's275204423']
[54552.0, 29596.0, 49252.0]
[1020.0, 734.0, 823.0]
[641, 497, 421]
p03221
u282228874
2,000
1,048,576
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 ci...
['n,m = map(int,input().split())\nP = [list(map(int,input().split()))+[0] for i in range(m)]\nX = sorted(P,key = lambda x:x[1])\ncity = {}\nfor p,y,z in X:\n if p in city:\n city[p] += 1\n else:\n city[p] = 1\n z = city[p]\nfor p,y,z in P:\n print(str(p).zfill(6)+str(z).zfill(6))\n', 'N,M = ma...
['Wrong Answer', 'Accepted']
['s742479017', 's143347801']
[30096.0, 33620.0]
[610.0, 666.0]
[294, 346]
p03221
u283719735
2,000
1,048,576
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 ci...
["n, m = [int(x) for x in input().split(' ')]\n\ncities = list()\nfor i in range(m):\n pi, pm = [int(x) for x in input().split(' ')]\n cities.append((pi, pm))\n\np = [0] * (n+1)\nfor city in sorted(cities, key=lambda city: city[1]): # sort by year\n p[city[0]] += 1 # city birth order\n print('{:06d}{:06d}'....
['Wrong Answer', 'Accepted']
['s487436220', 's341675588']
[19792.0, 31596.0]
[576.0, 631.0]
[337, 365]
p03221
u284363684
2,000
1,048,576
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 ci...
['# input\nN, M = map(int, input().split())\n\ncitys = []\nc_append = citys.append\nprefs = []\np_append = prefs.append\npref_in_citys = {}\nfor i in range(M):\n P, Y = map(int, input().split())\n if P not in prefs:\n p_append(P)\n pref_in_citys[P] = []\n city_dict = {\n "birth": Y,\n ...
['Wrong Answer', 'Accepted']
['s220422305', 's397430583']
[48496.0, 35920.0]
[2105.0, 581.0]
[844, 315]
p03221
u288087195
2,000
1,048,576
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 ci...
['# -*- coding: utf-8 -*-\nfrom operator import itemgetter\n\nN, M = list(map(int, input().split()))\nA = [[0] * 4 for i in range(M)]\nfor i in range(M):\n A[i][0], A[i][1] = list(map(int, input().split()))\n A[i][2] = i\n\nsorted_A = sorted(A, key=itemgetter(1))\nprint(sorted_A)\n\nP_num = [1]*N\nfor a in sorted...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s643055329', 's996224040', 's067709172']
[42256.0, 26920.0, 31372.0]
[858.0, 2105.0, 685.0]
[470, 458, 438]
p03221
u290443463
2,000
1,048,576
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 ci...
["N,M = map(int,input().split())\nP=[map(int,input().split()) for _ in range(M)]\nd = {}\nfor p,y in P:\n if p not in d:\n d[p]=[]\n d[p].append(y)\nsd = {k:dict(zip(sorted(v),range(1,1+len(v))))\n for k,v in d.items()}\nfor p,y in P:\n print('%06d%06d' % (p, sd[p][y]))", "N,M = map(int,input().split())\nP=[...
['Runtime Error', 'Accepted']
['s750451081', 's961143229']
[85600.0, 70916.0]
[810.0, 806.0]
[269, 298]
p03221
u294000907
2,000
1,048,576
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 ci...
["#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nn,m = map(int, input().split())\npl =[1]*(n+1)\n\na=[]\nfor i in range(0,m):\n p,l = map(int, input().split())\n s='{:06}{:06}'.format(p,pl[p])\n pl[p]=pl[p]+1\n a.append(s)\na.sort()\nfor i in range(0,m):\n print(a[i])\n", '#!/usr/bin/env python3\n# -*- coding: u...
['Wrong Answer', 'Accepted']
['s439891974', 's472176340']
[12336.0, 38104.0]
[584.0, 644.0]
[261, 371]
p03221
u298297089
2,000
1,048,576
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 ci...
['from heapq import heappush\nN,M = map(int, input().split())\nA = {}\nprefs = []\nyears = []\nfor i in range(M):\n p,y = input().split()\n prefs.append(p)\n years.append(y)\n if p not in A:\n A[p] = [y]\n else:\n heappush(A[p], y)\nres = {}\nfor k,v in A.items():\n for i in range(len(v)...
['Runtime Error', 'Accepted']
['s372942738', 's099772694']
[56988.0, 53700.0]
[470.0, 800.0]
[409, 378]
p03221
u302292660
2,000
1,048,576
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 ci...
['n,m = map(int,input().split())\ninl = [[i] + list(map(int,input().split())) for i in range(m)]\ninl = sorted(inl,key=lambda x:x[1])\ninl = sorted(inl,key=lambda x:x[2])\ncnt = 1\nprint(inl)\nfor i in range(m):\n a = str(inl[i][1]).rjust(6,"0")\n b = str(cnt).rjust(6,"0")\n cnt +=1\n if i !=m-1 and inl[i][...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s041901558', 's175483597', 's321532164', 's811920139']
[39908.0, 37220.0, 44316.0, 37144.0]
[965.0, 935.0, 918.0, 879.0]
[474, 444, 574, 463]
p03221
u305018585
2,000
1,048,576
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 ci...
["n,m = map( int, input().split())\n input_list = [[] for i in range(n)]\n\nfor i in range(m):\n p,y = map(int, input().split())\n input_list[p-1].append((y,i))\n \nfor i in input_list :\n i.sort()\n\nresult = [None]*m\n\nfor p,i in enumerate(input_list) :\n for n, (a,b) in enumerate(i):\n result[b] = str(p+1)...
['Runtime Error', 'Accepted']
['s198318968', 's502261641']
[2940.0, 37480.0]
[17.0, 639.0]
[363, 377]
p03221
u305965165
2,000
1,048,576
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 ci...
['N, M = (int(i) for i in input().split())\ninput_list = [[int(i) for i in input().split()] for i in range(M)] \n\nm_list = [[] for j in range(N)]\n\nfor inputs in input_list:\n m_list[inputs[0]-1].append(inputs[1])\n\nprint(m_list)\nfor arr in m_list:\n arr.sort()\n\nprint(m_list)\n\nfor inputs in input_list:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s243036443', 's332853800', 's251946703']
[39200.0, 32832.0, 36736.0]
[2105.0, 258.0, 505.0]
[407, 439, 455]
p03221
u309977459
2,000
1,048,576
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 ci...
["import bisect\nn, m = map(int, input().split())\np = []\ny = []\npy = []\ncategorized = [[] for i in range(n+1)]\nfor i in range(m):\n tmpp, tmpy = map(int, input().split())\n p.append(tmpp)\n y.append(tmpy)\n categorized[tmpp].append(tmpy)\n\nfor c in categorized:\n c.sort()\nprint(categorized)\nfor i...
['Wrong Answer', 'Accepted']
['s927731595', 's586267273']
[26416.0, 24116.0]
[624.0, 612.0]
[406, 387]
p03221
u310233294
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\nPY = [list(map(int, input().split())) + [i] for i in range(M)]\nPY.sort(key=lambda x: [x[0], x[1]])\nans = []\nP = [0] * (N + 1)\nfor p, y, i in PY:\n P[p] += 1\n tmp = str(p).zfill(8) + str(P[p]).zfill(8)\n ans.append([i, tmp])\nans.sort()\nfor i, a in ans:\n print(a)', ...
['Wrong Answer', 'Accepted']
['s655963357', 's801027598']
[45432.0, 42248.0]
[944.0, 1093.0]
[304, 304]
p03221
u311379832
2,000
1,048,576
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 ci...
["N, M = map(int, input().split())\npLst = [list(map(int, input().split())) for i in range(M)]\n\nfor i in range(len(pLst)):\n pLst[i].append(i)\nnLst = [''] * N\n\nfor i in range(N):\n nLst[i] = str(i + 1).zfill(6)\ntLst = sorted(pLst, key=lambda x: (x[0], x[1]))\nansLst = [''] * M\ntmp = nLst[tLst[i][0] - 1]\ni...
['Runtime Error', 'Accepted']
['s123455182', 's261618346']
[45716.0, 46356.0]
[553.0, 745.0]
[314, 645]
p03221
u313111801
2,000
1,048,576
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 ci...
['def con(var):\n var=str(var)\n while(len(var)<6):\n var="0"+var\n return var\n\n\ndef run():\n N,M=map(int,input().split())\n P=[-1]*M\n Y=[-1]*M\n arr=[]\n for i in range(M):\n P[i],Y[i]=input().split()\n P[i]=int(P[i])-1\n Y[i]=int(Y[i])\n arr.append([P[i],...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s391911608', 's596229638', 's696434409']
[36280.0, 36276.0, 33736.0]
[724.0, 719.0, 692.0]
[566, 583, 531]
p03221
u316386814
2,000
1,048,576
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 ci...
["n, m = list(map(int, input().split()))\nli = []\nyli = []\nfor _ in range(m):\n p, y = list(map(int, input().split()))\n li.append((y, p))\n yli.append(y)\n\nimport numpy as np\nidx = np.argsort(yli)\nsrt = sorted(li)\nans = []\nfrom collections import Counter\npcnt = Counter()\nfor p, y in srt:\n pcnt[p]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s717242868', 's723440011', 's837111056']
[44272.0, 51916.0, 46316.0]
[951.0, 1046.0, 1012.0]
[394, 404, 400]
p03221
u317713173
2,000
1,048,576
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 ci...
['N, M = map(int, input().split())\npref_dict = {}\n\nfor i in range(M):\n P, Y = map(int, input().split())\n pref_dict[i] = [P, Y]\n\nsorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))\nprint(sorted_dict)\n\nans_dict = {}\nbuf = ""\ncount = 1\n\nfor tup in sorted_dict:\n\n row = tup[0...
['Runtime Error', 'Accepted']
['s827648644', 's996760790']
[3064.0, 74096.0]
[17.0, 1224.0]
[605, 649]
p03221
u319695085
2,000
1,048,576
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 ci...
['#!/usr/bin/env python3\n\nimport numpy as np\n\n# line1 = "2 3"\n# line2 = [\'1 32\', \'2 63\', \'1 12\']\n\nN, M = map(int, input().split())\nprefinfo = [input() for i in range(N)]\nPY = [list(map(int, line.split())) for line in prefinfo]\n\nPY = np.array(PY)\ncn = np.array([np.arange(np.shape(PY)[0])])\ncc = np.a...
['Runtime Error', 'Accepted']
['s433720613', 's643979748']
[45700.0, 45660.0]
[1036.0, 1029.0]
[710, 710]