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
u759412327
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())\nC = sorted([list(map(int, input().split())) for m in range(M)])\nA = (N+1)*[0]\nD = {}\n\nfor p,y in C:\n A[p]+=1\n D[y]="%06d%06d" % (p,A[p])\n\nfor p,y in C:\n print(D[y])', 'N,M = map(int,input().split())\nC = sorted([list(map(int,input().split())) for m in range(M)])\nn = 1\n\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s474145661', 's678272588', 's398652147']
[42176.0, 30300.0, 42984.0]
[509.0, 530.0, 400.0]
[199, 281, 219]
p03221
u762420987
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())\nPYlist = [tuple(map(int, input().split())) for _ in range(M)]\nfrom copy import deepcopy\nPYsorted = sorted(deepcopy(PYlist), key=lambda x: x[0])\n\n\ndef zero_ume(num: int) -> str:\n return (6 - len(str(num))) * "0" + str(num)\n\n\nnow_ken = 0\nans_dict = {}\nfor p, y in PYsorted...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s030649076', 's669921786', 's816729171']
[39212.0, 45256.0, 38320.0]
[1047.0, 1143.0, 1106.0]
[498, 528, 477]
p03221
u766684188
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=[]\nfor i in range(m):\n a=i\n b,c=map(int,input().split())\n city.append([a,b,c])\ncity=sorted(city,key=lambda x:(x[1],x[2]))\nprint(city)\ncity[0].append(1)\nfor i in range(1,m):\n if city[i][1]!=city[i-1][1]:\n city[i].append(1)\n else:\n city[i].appe...
['Wrong Answer', 'Accepted']
['s332619669', 's346052532']
[46832.0, 38272.0]
[1082.0, 891.0]
[503, 515]
p03221
u776495719
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 = list(map(int, input().split()))\n\ncities = {}\nprefs = []\n\nfor i in range(1, M + 1):\n p, y = list(map(int, input().split()))\n \n pref = {"city": p, "year": y}\n prefs.append(pref)\n\n if p not in cities:\n cities[p] = [pref]\n else:\n cities[p].append(pref)\nprint(cities)\nfor...
['Wrong Answer', 'Accepted']
['s661240741', 's125955732']
[71604.0, 63516.0]
[1026.0, 900.0]
[537, 509]
p03221
u779455925
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=[list(map(int,input().split())) for i in range(M)]\ndata=sorted(data, key=lambda x: x[1])\nprepri=-1\ncount=0\nprintdata=[]\nfor i in data:\n if prepri!=i[0]:\n prepri=i[0]\n count=1\n else:\n count+=1\n printdata.append("0"*(6 - len(str(prepri))) + str...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s131439129', 's348316718', 's563761332', 's420539569']
[36080.0, 36072.0, 48776.0, 47704.0]
[628.0, 637.0, 1081.0, 1012.0]
[411, 391, 466, 469]
p03221
u780364430
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())\np = []\ny = []\nd = {}\nfor n_ in range(n):\n d[n_ + 1] = []\nfor i in range(m):\n p_, y_ = map(int, input().split())\n p.append(p_)\n y.append(y_)\n d[p_].append(y_)\nfor i in d.keys():\n d[i] = np.argsort(d[i]) + 1\nid_list = []\nfor key in d:\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s281195804', 's997241269', 's409821966']
[55780.0, 42360.0, 33512.0]
[2065.0, 826.0, 679.0]
[441, 597, 356]
p03221
u780962115
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...
['somelists=[]\n\nfor i in range(m):\n a,b=map(int,input().split())\n somelists.append([i,a,b])\n\nsomelists.sort(key=lambda x:(x[1],x[2]))\n\nprefs=1\nnumbers=0\n\nfor x in somelists:\n \n if x[1]==prefs:\n numbers+=1\n \n x.append(numbers)\n if x[1]!=prefs:\n prefs=x[1]\n ...
['Runtime Error', 'Accepted']
['s121434980', 's119871914']
[3064.0, 35504.0]
[18.0, 803.0]
[465, 494]
p03221
u785989355
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...
['\nfrom scipy.stats import rankdata\nN,M = list(map(int,input().split()))\n\nPY = []\nP_Y = [[] for i in range(N)]\n\np_count = [0 for i in range(N)]\n\nfor i in range(M):\n p,y = list(map(int,input().split()))\n P_Y[p-1].append([y,p_count[p-1]])\n p_count[p-1]+=1\n PY.append([p,y])\n \nimport numpy as ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s613372567', 's684636218', 's745001679']
[89052.0, 87904.0, 59400.0]
[2113.0, 2115.0, 1247.0]
[599, 597, 568]
p03221
u787562674
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\ninputs = []\nsorted_inputs = {}\n\nfor _ in range(M):\n P, Y = map(int, input().split())\n inputs.append((P, Y))\n if sorted_inputs.get(P) is None:\n sorted_inputs[P] = [Y]\n else:\n sorted_inputs[P].append(Y)\n\nfor input in sorted_inputs:\n sorted_inp...
['Wrong Answer', 'Accepted']
['s186876794', 's885736310']
[33856.0, 42924.0]
[2105.0, 700.0]
[484, 505]
p03221
u790905630
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 P_Y_list = sorted([input().split() for i in range(m)])\n\n tmp = P_Y_list[0][0]\n counter = 1\n for element_list in P_Y_list:\n if tmp != element_list[0]:\n counter = 1\n tmp = element_list[0]\n element_list[1] = str(c...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s344252483', 's526092808', 's708832809', 's302562832']
[44440.0, 48656.0, 35872.0, 35680.0]
[601.0, 2106.0, 2106.0, 810.0]
[520, 755, 722, 516]
p03221
u793460864
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 = [0]*M\nY = [0]*M\nfor i in range(M):\n P[i],Y[i] = map(int, input().split())\nYx = Y \nY.sort()\ncount = [1]*(N+1)\nans = [0]*M\nfor i in range(M):\n j = Yx.index(Y[i])\n ans[j] = str(P[j]).zfill(6) + str(count[P[j]]).zfill(6)\n count[P[j]] = count[P[j]] +1\n\nfor ...
['Wrong Answer', 'Accepted']
['s690171206', 's570599531']
[15268.0, 30888.0]
[2104.0, 731.0]
[337, 356]
p03221
u794910686
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=[[] for _ in range(N)]\npy=[]\n\nfor i in range(M):\n p,y=[int(i) for i in input().split()]\n py.append((p,y))\n PY[p-1].append(y)\n\nfor i in range(N):\n PY[i].sort()\n\nfor i in range(M):\n p,y=py.pop(0)\n #print(PY[p].index(y))\n p_zero=6-len(str(p))\n...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s631146879', 's962248780', 's669842807']
[28256.0, 39376.0, 37536.0]
[438.0, 832.0, 649.0]
[408, 407, 336]
p03221
u797016134
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())\ncount = [0]*n\npy = []\n\nfor i in range(m):\n p,y = map(int, input().split())\n count[p-1] += 1\n py.append([p,y])\n\nli = sorted(py)\ncount = np.cumsum(count)\n\nfor i in range(m):\n num = li.index(py[i]) + 1\n pref = str(py[i][0])\n if py[i][0]...
['Runtime Error', 'Accepted']
['s318783362', 's772118768']
[32364.0, 35208.0]
[2110.0, 707.0]
[427, 455]
p03221
u797740860
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(" ")]\nps = []\npc = [0 for i in range(0, n + 1)]\n\nfor i in range(0, m):\n ps.append([i] + [int(i) for i in input().split(" ")] + [""])\n\nsorted(ps, key=lambda x: x[2])\n\nfor i in range(0, m):\n pc[ps[i][1]] += 1\n ps[i][3] = str(ps[i][1]).zfill(6) + str(pc[ps[i][1]]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s045701431', 's719222819', 's031493842']
[33032.0, 35740.0, 33800.0]
[637.0, 875.0, 772.0]
[392, 399, 402]
p03221
u798818115
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!\nfrom operator import itemgetter\n\nN,M=map(int,input().split())\n\nl=[[-1]*3 for i in range(M)]\n\nfor i in range(M):\n p,y=map(int,input().split())\n l[i]=[i,10**10*p+y]\n\nl.sort(key=itemgetter(1))\n\npre_n=l[0][1]//10**6\ncount=1\nfor i in range(M):\n n=l[i][1]//10**6\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s138869658', 's721965388', 's582455220']
[22488.0, 26052.0, 25028.0]
[733.0, 876.0, 717.0]
[549, 622, 603]
p03221
u800780376
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\nclass ID:\n def __init__(self,p,y,i):\n self.p = p\n self.y = y\n self.i = i\n self.IDed = False\n self.ID1 = None\n self.ID2 = None\n\n def ID(self):\n for i in range(1,6):\n if self.ID1 < 10**i:\n sel...
['Runtime Error', 'Accepted']
['s102612982', 's098195058']
[54024.0, 55296.0]
[2110.0, 1317.0]
[1049, 887]
p03221
u805332733
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())\nbase = [[int(l) for l in input().split()] for i in range(M)]\nsort_target = sorted(base)\n \n \nprint(sort_target)\nprefecture_index = sort_target[0][0]\ni=0\nresult = []\nfor target in sort_target:\n i = i + 1 if prefecture_index == target[0] else 1\n prefecture_index = target[0]...
['Wrong Answer', 'Accepted']
['s132838212', 's722717001']
[28360.0, 41488.0]
[2106.0, 741.0]
[463, 460]
p03221
u810356688
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(): return sys.stdin.readline().rstrip()\ndef main():\n n,m=map(int,input().split())\n A=[]\n for i in range(m):\n p,y=map(int,input().split())\n A.append((p,y,i))\n A.sort()\n cunt=0\n pre=0\n ans=[]\n for a in A:\n s1=str(a[0])\n if pre!=a[0]:...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s024256472', 's204518431', 's949229222', 's326608332']
[35596.0, 27084.0, 25272.0, 35620.0]
[475.0, 491.0, 450.0, 560.0]
[519, 523, 510, 514]
p03221
u812576525
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()))\npy = [list(map(int,input().split())) + [i] for i in range(m)]\n\nfrom operator import itemgetter\npy = sorted(py,key=itemgetter(1),reverse = False)\npy = sorted(py,key=itemgetter(0),reverse = False)\n#print(py)\n\nB = []\npref = 0\ncity = 0\nfor i in range(m):\n if py[i][0] !=...
['Wrong Answer', 'Accepted']
['s023107258', 's926912835']
[44148.0, 43892.0]
[928.0, 946.0]
[612, 618]
p03221
u813098295
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\n\nN, M = map(int, input().split())\nps, ys = [], []\n\nv = [ [] for _ in range(N+1) ]\n\nfor i in range(M):\n p, y = map(int, input().split())\n ps += [p]; ys += [y];\n v[p].append(y)\n\nfor i in range(N):\n v[i+1].sort()\n\n\nprint (ps)\nprint (ys)\n\nprint (v)\n\nfor i in range(M):\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s021900001', 's159607452', 's225579581']
[29052.0, 22656.0, 24172.0]
[2104.0, 452.0, 783.0]
[417, 507, 353]
p03221
u813102292
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())\nres = list([] for i in range(n))\np,y = [],[]\nfor i in range(m):\n tmp = list(int(i) for i in input().split())\n p.append(tmp[0])\n y.append(tmp[1])\n res[tmp[0]-1].append(tmp[1])\n\nfor i in range(n):\n res[i] = sorted(res[i])\n\nfor i in range(n):\n print(...
['Runtime Error', 'Accepted']
['s564092835', 's048305692']
[30208.0, 47772.0]
[2105.0, 707.0]
[363, 372]
p03221
u814781830
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\nN, M = map(int, input().split())\nPY = [list(map(int, input().split())) for i in range(M)]\nPY.sort(key=lambda x: x[1])\npydict = defaultdict(lambda: 0)\n\nfor i in PY:\n pydict[i[0]] += 1\n print(["{:0=6}".format(i[0]) + "{:0=6}".format(pydict.get(i[0]))])', 'from collectio...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s051008933', 's707509054', 's982161071', 's087600262']
[38388.0, 38108.0, 39412.0, 56908.0]
[769.0, 696.0, 781.0, 851.0]
[292, 290, 293, 385]
p03221
u815666840
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())\npy = []\npyy = []\n\nnpy = []\n\nfor i in range(m):\n\n pyy=list(map(int,input().split()))\n pyy.append(i)\n py.append(pyy)\n\nprint(py)\npy.sort(key=itemgetter(0,1))\n\nprint(py)\n\nnum = 1\n\nnpy.append([str(10**12+py[0][0]*(10**6)+num)[1:1...
['Wrong Answer', 'Accepted']
['s278607637', 's817640240']
[52756.0, 47392.0]
[1166.0, 977.0]
[631, 611]
p03221
u818283165
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[i] = (p,y)\nans = sorted(py.items(),key=lambda x:x[1])\n#print(ans[0][1][1])\ncount = 1\nnumber = []\nnumber.append(count)\n#print(ans)\nfor i in range(1,m):\n if ans[i][1][0] == ans[i-1][1][0]:\n count +...
['Wrong Answer', 'Accepted']
['s989357752', 's323561839']
[38236.0, 44468.0]
[827.0, 984.0]
[504, 539]
p03221
u820047642
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=[[0,0]]\nans=[]\nfor _ in range(M):\n PY.append(list(map(int,input().split())))\nPY.sort(key=lambda x:(x[0],x[1]))\n\nfor i in range(M):\n number=""\n if PY[i+1][0]!=PY[i][0]:\n x=1\n else:\n x+=1\n number+=str(PY[i+1][0]).zfill(6)\n number+=str(x).zfil...
['Wrong Answer', 'Accepted']
['s560920661', 's830103553']
[36604.0, 45608.0]
[722.0, 949.0]
[359, 431]
p03221
u823458368
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 = []\ns = '000000'\nfor i in range(m):\n p, y = map(int, input().split())\n py.append([p, y, i])\npy.sort(key=lambda py:(py[0],py[1]))\n\npy[0].append(1)\nfor i in range(m-1):\n a = 1\n if py[i][0] == py[i+1][0]:\n py[i+1].append(py[i][3]+1)\n else:\n ...
['Wrong Answer', 'Accepted']
['s504975443', 's157391422']
[35488.0, 35480.0]
[795.0, 805.0]
[444, 444]
p03221
u825027400
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\n\nif __name__ == "__main__":\n N, M = map(int, input().split())\n city_list = []\n pref_dec = {}\n for m in range(M):\n p, y = map(int, input().split())\n city_list.append((p, y))\n if p not in pref_dec:\n pref_dec[p] = []\n pref_dec[p].append(y)\n\n...
['Wrong Answer', 'Accepted']
['s926946247', 's118396915']
[41028.0, 44492.0]
[2105.0, 715.0]
[548, 583]
p03221
u826263061
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"""\nCreated on Sun Nov 4 18:54:20 2018\nABC113C\n@author: maezawa\n"""\n\nn, m = list(map(int, input().split()))\np = [0]\ny = [0]\nfor i in range(m):\n pi, yi = list(map(int, input().split()))\n p.append(pi)\n y.append(yi)\n\n#print(p)\n#print(y)\n \ncityn = [\'\']*m\n\nps = [...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s629733805', 's724785732', 's878896969', 's084939464']
[34192.0, 34228.0, 34228.0, 34332.0]
[790.0, 785.0, 770.0, 834.0]
[640, 640, 640, 639]
p03221
u826929627
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\nPY = []\nfor _ in range(M):\n py = list(map(int,input().split()))\n PY.append(py)\n\nPY.sort()\ncnt_pref = {}\nfor py in PY:\n p,y = py[0],py[1]\n if (p in cnt_pref):\n cnt_pref[p] += 1\n else:\n cnt_pref[p] = 1\n out = str(p).zfill(6) + str(cnt_pref[p]).zfill(6)\n pri...
['Wrong Answer', 'Accepted']
['s622883171', 's115639648']
[37728.0, 53088.0]
[731.0, 1102.0]
[309, 430]
p03221
u836737505
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\nfrom collections import defaultdict\nn,m = map(int,input().split())\np = [list(map(int, input().split())) for _ in range(m)]\n\na = defaultdict(list)\nfor x,y in sorted(p):\n a[x].append(y)\nfor x,y in p:\n z=bisect.bisect(a[x],y)\n print("{0:06d}{0:06d}".format(x,z))', 'import bisect\nfrom co...
['Wrong Answer', 'Accepted']
['s696799229', 's635994521']
[43316.0, 43316.0]
[735.0, 772.0]
[282, 288]
p03221
u842964692
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...
['#ABC113_C\n\nN,M=map(int,input().split())\nPYi=[]\nfor i in range(M):\n p,y=map(int,input().split())\n PYi.append([p,y,i])\n\nPYi.sort()\n\nprep=PYi[0][0]\ncc=1#city code\nPYi[0][1]=cc\nfor j in range(1,M):\n p=PYi[j][0]\n if prep==p:\n cc+=1\n else:\n cc=1\n PYi[j][1]=cc\n prep=p\n...
['Wrong Answer', 'Accepted']
['s407053780', 's675384536']
[24740.0, 24732.0]
[880.0, 1113.0]
[484, 498]
p03221
u844005364
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())\np = [list(map(int, input().split()+[i])) for i in range(m)]\n\np.sort()\ncnt = 1\npre = -1\n\nfor city in p:\n if city[0] == pre:\n cnt = cnt + 1\n else:\n pre = city[0]\n\n city.append("{:0>6}{:0>6}".format(city[0], cn...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s430739153', 's700906817', 's962705343', 's341291746']
[38808.0, 40244.0, 3064.0, 41012.0]
[594.0, 710.0, 18.0, 729.0]
[370, 256, 457, 255]
p03221
u844789719
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 = [int(_) for _ in input().split()]\nPN = [[] for _ in range(M)]\nY = [[] for _ in range(N)]\nP = [0 for _ in range(N)]\nfor i in range(M):\n p, y = [int(_) - 1 for _ in input().split()]\n PN[i] = [p, P[p]]\n Y[p].append(y)\n P[p] += 1\nY_rank = [np.argsort(_) for _ in Y]\nprint(P...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s415886620', 's960266077', 's997887617', 's722810160']
[68232.0, 407272.0, 418448.0, 53104.0]
[2111.0, 2134.0, 2135.0, 873.0]
[437, 478, 478, 342]
p03221
u846226907
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\n\nn,m = map(int,input().split())\n\ncnt = [0]*(10**5+4)\n\nyy = []\nyp = []\nfor _ in range(m):\n a,b = map(int,input().split())\n a,b = b,a\n yy.append([a,0])\n yp.append([a,b])\n\ninlist = copy.deepcopy(yp)\nyp.sort()\nyy = dict(yy)\n\nfor i in range(m):\n print(yp[i][1])\n cnt[yp[i][...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s082449034', 's316788413', 's347781470', 's382880399', 's861218827', 's957358571', 's967473636', 's852012088']
[60196.0, 1133340.0, 23080.0, 1135404.0, 18144.0, 33624.0, 3872.0, 60700.0]
[1274.0, 2113.0, 217.0, 2115.0, 2104.0, 2105.0, 2104.0, 1225.0]
[409, 585, 471, 559, 405, 401, 427, 389]
p03221
u850390157
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())\nbirth_list = []\nfor i in range(M):\n Pi, Yi = map(int, input().split())\n birth_list.append([Pi, Yi])\n\ncounter = -1\nprev_pref = -1\nfor city in sorted(birth_list, key=lambda x: (x[0], x[1])):\n print(city)\n if city[0] != prev_pref:\n counter = 1\n else:\n ...
['Wrong Answer', 'Accepted']
['s729405276', 's372839227']
[32976.0, 31052.0]
[850.0, 736.0]
[492, 494]
p03221
u853185302
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 collections\nimport bisect\nn,m=map(int,input().split())\np=[[int(j) for j in input().split()] for i in range(m)]\na=collections.defaultdict(list)\nfor x,y in sorted(p):\n a[x]+=[y]\nprint(a)\nfor x,y in p:\n z=bisect.bisect(a[x],y)\n print("%06d%06d"%(x,z))', 'N, M = map(int,input().split())\nPY = [l...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s131694712', 's896590851', 's973929456']
[45604.0, 115880.0, 41012.0]
[727.0, 2105.0, 697.0]
[264, 361, 255]
p03221
u853952087
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...
["a,b=map(int,input().split())\nL=[[] for i in range(a)]\nl=[]\nll=[]\nu=0\nfor i in range(b):\n u+=1\n c=list(map(int,input().split()))\n c.append(u)\n L[int(c[0])-1].append(c)\n print(c,L)\nfor i in L:\n i.sort(key=lambda x:x[1])\nfor i in L:\n e=0\n for j in i:\n e+=1\n j.append...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s007283402', 's195766587', 's263865830', 's293201884']
[124612.0, 34208.0, 3064.0, 43172.0]
[2104.0, 2105.0, 17.0, 923.0]
[484, 528, 724, 721]
p03221
u860649643
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\nN,M = map(int, input().split())\nX = np.ones((M,3), dtype=int)\nfor i in range(M):\n X[i, 0], X[i, 1] = map(int, input().split())\nfor i in range(N):\n print(np.argsort(X[X[:,0]==i, 1]))\n X[X[:,0]==i, 2] = np.argsort(X[X[:,0]==i, 1])+1\nfor i in range(M):\n print('{:06}{:06}'.format...
['Wrong Answer', 'Accepted']
['s537219585', 's948748818']
[17120.0, 56728.0]
[2109.0, 1978.0]
[325, 415]
p03221
u860657719
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())\nPs =[]\nYs =[]\ndic = {}\nfor i in range(M):\n p, y = map(int, input().split())\n Ps.append(p)\n Ys.append(y)\n ls = dic.get(p, [])\n ls.append(y)\n dic[p] = ls.sort()\nfor i in range(M):\n p = Ps[i]\n y = Ys[i]\n number = dic[p].index(y) + 1\n strp = str...
['Runtime Error', 'Runtime Error', 'Accepted']
['s844674966', 's910970077', 's748905328']
[20164.0, 11060.0, 31824.0]
[356.0, 342.0, 696.0]
[371, 407, 361]
p03221
u864197622
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 = []\nY = []\nfor i in range(M):\n p, y = map(int, input().split())\n P.append(p)\n Y.append(y)\n\nA = [[] for i in range(N)]\n\nfor i in range(M):\n A[P[i]-1].append([i, Y[i]])\n \nfor i in range(N):\n A[i] = sorted(A[i], key=lambda x:x[1])\n\nR = [[] for i in ra...
['Wrong Answer', 'Accepted']
['s235087078', 's006068008']
[44692.0, 43868.0]
[857.0, 924.0]
[475, 477]
p03221
u866769581
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 = [list(input().split()) for _ in range(M)]\nans_lis = [0] * M\nlis_sort = sorted(lis)\nflag = lis_sort[0][0]\ni = 1\nfor x in lis_sort:\n if x[0] != flag:\n flag = x[0]\n i=1\n print('if')\n x[1] = '0'*(6-len(str(i)))+str(i)\n i+=1\nfor x in lis:\n ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s795451710', 's940024919', 's988701549', 's896249984']
[35800.0, 37628.0, 29420.0, 40840.0]
[806.0, 2106.0, 2105.0, 831.0]
[347, 498, 404, 372]
p03221
u870793476
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()]\nid=[[int(i) for i in input().split()]+[j] for j in range(m)]\n\nprint(id)\n\npre_num=[0]*(n+1)\nans=[""]*m\n\nid.sort(key=lambda x:x[1])\n\nfor p,y,i in id:\n pre_num[p]+=1\n ans[i]=str(p).zfill(6)+str(pre_num[p]).zfill(6)\n \nprint("\\n".join(ans))\n', 'n,m=[int(i) for...
['Wrong Answer', 'Accepted']
['s918148035', 's254686452']
[38460.0, 34696.0]
[605.0, 546.0]
[283, 275]
p03221
u874320250
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())\nPY = [tuple(map(int, input().split())) for _ in range(M)]\n\ncity_count = [0]*(N+1)\nfor p, y in PY:\n city_count[p] += 1\nfor ken, count in enumerate(city_count):\n [print(str(1*10**12+ken*10**6+count)[1:]) for i in range(1,count+1)]\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s400760653', 's846656906', 's303939348']
[19448.0, 19444.0, 68468.0]
[345.0, 354.0, 616.0]
[307, 303, 460]
p03221
u875769753
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())\nls = []\nfor i in range(M):\n P,Y = map(int,input().split())\n ls.append([i,P,Y])\nls.sort(key=lambda x:x[1])\nnum = 1\ncity = ls[0][1]\nfor i in range(M):\n if ls[i][1] == city:\n ls[i][2] = num\n num += 1\n else:\n num = 1\n ls[i][2] = num\n ...
['Wrong Answer', 'Accepted']
['s727225920', 's962578671']
[30208.0, 30548.0]
[438.0, 487.0]
[434, 434]
p03221
u877415670
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)]\n\npy.sort(key=lambda x: (x[0],x[1]))\nprint(py)\n_dict = {}\n\nans=[]\nfor i in range(m):\n if not py[i][0] in _dict:\n _dict[py[i][0]]=1\n else:\n _dict[py[i][0]]+=1\n p="0"*(6-len(str(py[i][0])))+str(py[i...
['Wrong Answer', 'Accepted']
['s916705349', 's189202896']
[51012.0, 48736.0]
[1049.0, 951.0]
[465, 462]
p03221
u879674287
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...
['"""\nN: state num\nM: city num\n"""\n\nstate_cnt = {}\ncity_id_dict = {}\n\n(N, M) = list(map(int, input().split()))\n\nfor z in range(M):\n (P, Y) = list(map(int, input().spilt()))\n\n if P not in state_cnt.keys():\n state_cnt[P] = 1\n elif P in state_cnt.keys():\n state_cnt[P] += 1\n \...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s005791323', 's141827012', 's534823406', 's535986423', 's550212554', 's557551330', 's604681121', 's666164002', 's703366179', 's815286472', 's997714547', 's588505298']
[3064.0, 36728.0, 35500.0, 33868.0, 3064.0, 36812.0, 50616.0, 3064.0, 45548.0, 3064.0, 35032.0, 35548.0]
[17.0, 763.0, 798.0, 673.0, 17.0, 2110.0, 948.0, 17.0, 812.0, 17.0, 868.0, 868.0]
[721, 1010, 652, 571, 1010, 403, 918, 910, 910, 726, 589, 598]
p03221
u882359130
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(nm) for nm in input().split()]\nPY = []\nfor m in range(M):\n PY.append([int(py) for py in input().split()])\nPY.sort()\ni = 1\nprint("0"*(6-len(str(PY[0][0]))) + str(PY[0][0]) + "0"*(6-len(str(i))) + str(i))\nfor m in range(1, M):\n if PY[m-1][0] == PY[m][0]:\n print("0"*(6-len(str(PY[m][0]))) + str...
['Wrong Answer', 'Accepted']
['s534714811', 's159606229']
[22584.0, 41376.0]
[699.0, 968.0]
[458, 477]
p03221
u887207211
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())) + [0] for _ in range(M)]\nPY = sorted(PY, key = lambda x: (x[0], x[1]))\nd = {}\nfor py in PY:\n if(py[0] not in d):\n d[py[0]] = 1\n else:\n d[py[0]] += 1\n py[2] = d[py[0]]\nfor py in PY:\n print(str(py[0]).zfill(6) + str(py[2]).zfill(6...
['Wrong Answer', 'Accepted']
['s420612053', 's770957003']
[35584.0, 36380.0]
[793.0, 563.0]
[309, 445]
p03221
u891217808
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\nn, m = map(int, input().split())\nl = []\ndic = defaultdict(list)\nfor i in range(m):\n p, y = map(int, input().split())\n dic[p].append(y)\n l.append([p, y])\nfor key, value in dic.items():\n dic[key] = sorted(value)\nfor p, y in l:\n print(str(p).zfill(6)+str(dic[...
['Wrong Answer', 'Accepted']
['s148174375', 's704300780']
[38708.0, 61880.0]
[2105.0, 784.0]
[332, 367]
p03221
u895515293
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\nmp = {}\nfor i in range(M):\n P,Y=map(int,input().split())\n if not P in mp:\n mp[P] = []\n mp[P].append(Y)\n\nfor k,li in sorted(mp.items()):\n for i, _ in enumerate(li):\n print('{:06d}{:06d}'.format(k, i+1))\n", "N,M=map(int,input().split())\n\nmp = {}\nfor...
['Wrong Answer', 'Accepted']
['s852432985', 's657533830']
[35024.0, 50248.0]
[647.0, 756.0]
[258, 317]
p03221
u896517320
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 = input().split()\nl1 = []\nfor i in range(int(n[1])):\n l1.append(input().split())\n\nfor i in range(int(n[1])):\n for j in range(2):\n l1[i][j] = int(l1[i][j])\n\nprint(l1)\nm = 0\nfor k in l1:\n k.append(m)\n m += 1\n\nprint(l1)\nl3 = sorted(l1)\nprint(l3)\n\nl3[0][1] = 1\nfor i in range(1,len...
['Wrong Answer', 'Accepted']
['s680527733', 's613526855']
[54772.0, 47268.0]
[1211.0, 1069.0]
[701, 674]
p03221
u896741788
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...
['#C-ID\nn,m=map(int,input().split())\nL={}\nlp=[[] for _ in range(n)]\nfor cn in range(m):\n p,y=map(int,input().split())\n lp[p-1].append([y,cn])\n lp[p-1]=sorted(lp[p-1])\nfor pre in range(n):\n k=len(lp[pre])\n if k>0:\n for d in range(k):\n cn=lp[pre][k][1]\n ans="0"*(6-len(str(pre)))+str(pre)+"0...
['Runtime Error', 'Accepted']
['s308097938', 's403361956']
[30496.0, 45472.0]
[2105.0, 795.0]
[413, 425]
p03221
u897328029
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# C - ID\n\nn, m = list(map(int, input().split()))\npy_list = []\n\nfor _ in range(m):\n p, y = list(map(int, input().split()))\n py_list.append((p, y))\n\npy_list = sorted(py_list, key=lambda x: (x[0], x[1]))\n\np_no = py_list[0][0]\ny_index = 1\nno_list = []\n\nfor i, py in enumerate(py_list):\n p, y = p...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s336131646', 's947020832', 's382856184']
[27628.0, 27596.0, 40788.0]
[619.0, 633.0, 734.0]
[538, 577, 641]
p03221
u903948194
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 = []\nY = []\nvar = []\nfor i in range(M):\n p, y = map(int, input().split())\n if p not in P:\n var.append(p)\n P.append(p)\n Y.append(y)\n\nL = zip(range(M), P, Y) \n\nOrder = [None]*M\n\nfor v in var:\n l = filter(lambda x:x[1] == v, L)\n l_ = sorted...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s022184601', 's107842885', 's884713148', 's883866826']
[24528.0, 24520.0, 25308.0, 30612.0]
[2105.0, 2105.0, 2105.0, 708.0]
[466, 472, 462, 324]
p03221
u909162870
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...
['m = nm[1]\nall_city = list()\nfor i in range(m):\n py = list(map(int, input().split()))\n py.append(i)\n all_city.append(py)\nac_list = copy.deepcopy(all_city)\nac_list.sort()\nac_dict = {}\na = 0\nb = 0\nfor i in range(m):\n if ac_list[i][0] == a:\n b += 1\n else:\n a += 1\n b = 1...
['Runtime Error', 'Accepted']
['s287649322', 's531660884']
[3064.0, 58856.0]
[17.0, 1271.0]
[428, 499]
p03221
u912115033
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())\nc = {}\nfor _ in range(m):\n p, y = map(int,input().split())\n if p in c:\n c[p] += 1\n else:\n c[p] = 1\ncs = sorted(c.items(), key=lambda x:x[0])\nfor i in cs:\n for j in range(i[1]):\n print(str(i[0]).zfill(6) + str(j+1).zfill(6))\n', 'n, m = map(in...
['Wrong Answer', 'Accepted']
['s571692880', 's673776985']
[21472.0, 46584.0]
[510.0, 723.0]
[289, 309]
p03221
u917872021
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()))\ncities = []\n\nfor i in range(m):\n p, y = list(map(int, input().split()))\n cities.append([p, y, i])\n\nsorted_cities = sorted(cities, key=lambda x: (x[0], x[1]))\nprint(sorted_cities)\ncnt = 1\nans = []\nfor i in range(m-1):\n p_id = str(sorted_cities[i][0]).rjust(6,...
['Wrong Answer', 'Accepted']
['s483308137', 's720201647']
[45152.0, 45236.0]
[804.0, 736.0]
[662, 641]
p03221
u919235786
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=[]\nfor i in range(n):\n a.append(0)\nfor i in range(m):\n pi,yi=map(int,input().split())\n a[pi-1]+=1\nfor i in range(len(a)):\n for j in range(a[i]):\n print('{0:06d}{1:06d}'.format(i+1,j+1))\n\n", "from operator import itemgetter\nn,m=map(int,input().split())\na=[...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s043686133', 's173492082', 's209046130', 's693934214', 's714212923']
[5192.0, 65068.0, 147000.0, 56064.0, 56068.0]
[537.0, 1071.0, 2417.0, 1026.0, 1005.0]
[237, 510, 459, 499, 503]
p03221
u919689206
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\nl = [[] for i in range(n)]\n\nfor i in range(m):\n p, y = map(int, input().split())\n print('p:{} y:{} i:{}'.format(p, y, i))\n l[ p - 1 ].append(y)\n \nfor i in range(len(l)):\n for j in range(len(l[i])):\n print('{ken:06}{shi:06}'.format(ken=i+1, shi=j+1))...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s166523917', 's841384395', 's154689468']
[22064.0, 549584.0, 33948.0]
[1248.0, 2139.0, 757.0]
[361, 522, 443]
p03221
u919730120
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=[[0]*3 for _ in range(m)]\nfor i in range(m):\n p,y=map(int,input().split())\n py[i][0],py[i][1],py[i][2]=p,y,i\npy.sort()\nans=[[''] for _ in range(m)]\ncnt=[0]*m\nfor p,y,i in py:\n cnt[p]+=1\n ans[i]='0'*(6-len(str(p)))+str(p)+'0'*(6-len(str(cnt[p])))+str(cnt[p])\nans.s...
['Runtime Error', 'Accepted']
['s429330798', 's115199111']
[33832.0, 34040.0]
[820.0, 719.0]
[339, 442]
p03221
u921773161
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 = [0] * M\nY = [0] * M\ncheck = [[] for i in range(N)]\n\nfor i in range(M):\n P[i], Y[i] = map(int, input().split())\n check[P[i]-1].append(Y[i])\n\nfor i in range(N):\n check[i].sort()\n', "N, M = map(int, input().split())\nP = [0] * M\nY = [0] * M\nX = [0] * M\ncheck = ...
['Wrong Answer', 'Accepted']
['s686441808', 's728677013']
[22632.0, 41072.0]
[401.0, 808.0]
[222, 475]
p03221
u921811474
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())\nh = [list(map(int, input().split()))for i in range(M)]\nfor i in range(M):\n h[i].append(i)\nh = sorted(h,key=lambda h:(h[0],-h[1]))\nk = 0\nfor i in range(M):\n if h[i][0] == 1:\n h[i].append("000001")\n h[i].append(str(i+1).zfill(6))\n else:\n h[i].appen...
['Wrong Answer', 'Accepted']
['s204432757', 's518507570']
[43140.0, 39572.0]
[775.0, 802.0]
[450, 498]
p03221
u923341003
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 = []\ny = []\nfor i in range(M):\n p1,y1=[int(i) for i in input().split()]\n p.append(p1)\n y.append(y1)\nfor idx in range(M):\n ans[idx] = [idx, p[idx], y[idx]]\nans = sorted(ans, key=lambda x: x[1])\nans = sorted(ans, key=lambda x: x[2])\nfor idx in range(M):\n if ...
['Runtime Error', 'Accepted']
['s403890098', 's087040665']
[11048.0, 30620.0]
[317.0, 710.0]
[594, 385]
p03221
u924770834
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\nimport math\nfrom collections import defaultdict\n\nn,m = input().split()\nn = int(n)\nm = int(m)\nP,Y = [],[]\nfor _ in range(m):\n\tp,y = input().split()\n\tP.append(p)\n\tY.append(y)\n\nP = [int(p) for p in P]\nY = [int(y) for y in Y]\n\nprint(P)\nprint(Y)\n\nsorted = defaultdict(list)\n\nfor i...
['Wrong Answer', 'Accepted']
['s789564928', 's204806129']
[44792.0, 55600.0]
[2110.0, 847.0]
[461, 512]
p03221
u931462344
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())\nxs = [0]*m\npre = [0]*m\nfor x in range(m):\n xs[x] = list(list(map(int,input().split())) + [x] + [x])\nxs.sort()\n\nprint(xs)\nskip = 0\nfor p in range(1,n+1):\n cnt = 1\n flag = 0\n for x in range(skip,len(xs)):\n if xs[x][0] <= p:\n xs[x][3] = cnt\n ...
['Wrong Answer', 'Accepted']
['s552190979', 's211513849']
[41792.0, 37056.0]
[1078.0, 1024.0]
[514, 504]
p03221
u932465688
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 L.append(list(map(int,input().split())))\nfor j in range(M):\n L[j].append(j)\nL.sort()\nl = L[0][0]\ncnt = 0\nfor k in range(M):\n if l == L[k][0]:\n L[k].append(cnt)\n cnt += 1\n else:\n l = L[k][0]\n cnt = 0\n L[k].append(cnt)\nL = sor...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s355965329', 's720686302', 's882884195']
[44500.0, 46552.0, 36840.0]
[882.0, 1031.0, 709.0]
[447, 453, 372]
p03221
u932868243
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 i in range(m)]\nl=[[] for j in range(n)]\nfor p,y in py:\n l[p-1].append(y)\nfor j in range(n):\n l[j].sort()\nfor j in range(n):\n for t in range(len(l[j])):\n pre='0'*(6-len(str(l[j][t])))+str(l[j][t])\n y='0'*(6-len(str(t+1)))+str(t+1)\n...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s008519600', 's292548215', 's711689432', 's675528624']
[37108.0, 35760.0, 36708.0, 48716.0]
[725.0, 419.0, 684.0, 1016.0]
[323, 319, 315, 409]
p03221
u933622697
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...
['# WIP\nimport sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\n\npy_list = [tuple(map(int, input().split())) for m in range(m)]\npy_list.sort(key=lambda x: x[1])\n\nprint(py_list)\n\ncursor_p = 1\ncurrent = 0\ncity = None\nfor py in py_list:\n p = py[0]\n y = py[1]\n\n if p == cursor_p:\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s825812747', 's906597227', 's918651338']
[23308.0, 18220.0, 39052.0]
[428.0, 378.0, 592.0]
[473, 451, 656]
p03221
u934868410
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 a,b = map(int, input().split())\n py.append([a,b,i])\npy.sort()\nprint(py)\np = py[0][0]\ny = 1\nfor i in range(m):\n if py[i][0] == p:\n py[i][1] = y\n y += 1\n else:\n py[i][1] = 1\n y = 1\n p = py[i][0]\npy = sorted(py, key=lambda x:...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s041209170', 's414412922', 's793259473', 's320381787']
[31288.0, 3064.0, 3064.0, 25520.0]
[796.0, 17.0, 18.0, 751.0]
[360, 338, 330, 350]
p03221
u937706062
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 = [None] * M\nfor i in range(M):\n\tp, y = map(int, input().split())\n\tl[i] = [p, y, i]\nl.sort()\nans = []\nt = l[0][0]\nx = 0\nfor i in l:\n\tif t == i[0]:\n\t\tx += 1\n\t\tans.append([l[2], i[0], x])\n\telse:\n\t\tt = i[0]\n\t\tx = 1\n\t\tans.append([l[2], i[0], x])\nans.sort()...
['Runtime Error', 'Accepted']
['s547229939', 's013545443']
[37564.0, 37820.0]
[764.0, 852.0]
[387, 387]
p03221
u940102677
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 = [[]]*(n+1)\nq = [[]]*(n+1)\np = [0]*m\ny = [0]*m\nfor i in range(m):\n p[i], y[i] = map(int,input().split())\n d[p[i]] = d[p[i]] + [y[i]]\nfor i in range(n+1):\n if len(d[i]) == 0:\n continue\n d[i] = sorted(d[i])\n d[i] = dict([[d[i][j],j] for j in range(len(d[i]))])\nprin...
['Wrong Answer', 'Accepted']
['s442115063', 's300664498']
[47468.0, 34492.0]
[2104.0, 741.0]
[394, 348]
p03221
u940743763
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, attrgetter\n\nn, m = list(map(int, input().split(' ')))\n\npym = [None] * m\nfor i in range(m):\n pym[i] = [i] + list(map(int, input().split(' ')))\n\npyms = sorted(pym, key=itemgetter(1, 2))\n\nx = 1\npyms[0].append(x)\n\nfor i in range(1, m):\n if pyms[i - 1][1] != pyms[i][1]:...
['Wrong Answer', 'Accepted']
['s856339344', 's041737359']
[37512.0, 37512.0]
[847.0, 871.0]
[514, 514]
p03221
u942915776
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())\npys = [list(map(int, input().split())) for _ in range(m)]\nmap_ = {}\nfor i, (p, y) in enumerate(pys):\n map_.setdefault(p, [])\n map_[p].append(i)\nfor val in map_.values():\n val.sort()\n\nans = [None] * m\nfor key, val in map_.items():\n for num, i in enumerate(val):\n...
['Wrong Answer', 'Accepted']
['s622835658', 's241863355']
[51472.0, 51472.0]
[712.0, 770.0]
[398, 422]
p03221
u951480280
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=[[] for i in range(n+1)]\nI=[]\nfor i in range(m):\n p,y=map(int,input().split())\n A[p].append([i,y])\nfor i in range(n+1):\n if A[i] != []:\n for j in range(len(A[i])):\n I.append([A[i][j] ,str(i).zfill(6) ,str(j+1).zfill(6)])\nI.sort(key=lambda x: x[0])\nf...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s134567858', 's241818314', 's263864127', 's779446784']
[53528.0, 57388.0, 43076.0, 53568.0]
[1080.0, 1101.0, 696.0, 1118.0]
[358, 372, 345, 413]
p03221
u951592041
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"""Describe\n"""\nimport numpy as np\nfrom operator import itemgetter\n\ndef main():\n n, m = map(int, input().split())\n data = None\n for i in range(m):\n p, y = map(int, input().split())\n if data is None:\n data = np.array([[p, y]]...
['Wrong Answer', 'Accepted']
['s004380007', 's514303193']
[14532.0, 42976.0]
[2109.0, 724.0]
[1100, 853]
p03221
u960080897
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; from decimal import Decimal\nimport math; from itertools import combinations, product\nimport bisect; from collections import Counter, deque, defaultdict\n\n\nMOD = 10 ** 9 + 7\nINF = 10 ** 9\nPI = 3.14159265358979323846\n\ndef read_str(): return sys.stdin.readline().strip()\ndef read_int(...
['Wrong Answer', 'Accepted']
['s560818611', 's612721427']
[31092.0, 38912.0]
[281.0, 290.0]
[1032, 1090]
p03221
u961683878
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\nn, m = list(map(int, input().split()))\nmat = np.zeros((m, 2))\nfor i in range(m):\n\tmat[i, 0], mat[i, 1] = list(map(int, input().split()))\nmat = np.c_[mat, np.array(range(m))]\nmat = mat[mat[:, 1].argsort()]\ncnt = np.zeros(m)\nres = []\nprint(cnt[2])\nfor i, j in mat[:, :2]:\n\ti = int(i)\n\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s615369937', 's760942175', 's196012424']
[25972.0, 19480.0, 27832.0]
[1181.0, 615.0, 1075.0]
[521, 404, 391]
p03221
u962197874
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 l.append(list(map(int,input().split())))\nl.sort()\np = 0\nfor i in l:\n if i[0] != p:\n p = i[0]\n x = 1\n else:\n x += 1\n print(str(i[0]).zfill(6)+ str(x).zfill(6))', 'import numpy as np\nn, m = map(int,input().split())\...
['Wrong Answer', 'Accepted']
['s961001428', 's572005778']
[28804.0, 34344.0]
[806.0, 875.0]
[250, 265]
p03221
u966408025
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\nms = [0]*m\nfor i in range(m):\n p, y = [int(x) for x in input().split()]\n ms[i] = (p, y)\n\nsorted_ms = sorted(ms, key=lambda x: x[1])\nps = [[]] * n\nfor i in range(n):\n result = list(filter(lambda x: x[0] == i+1, ms))\n ps[i] = result\n\nfor i in range(m):\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s740448029', 's951731835', 's196512311']
[20980.0, 42704.0, 36000.0]
[2109.0, 2106.0, 680.0]
[451, 516, 348]
p03221
u970197315
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())\nS = []\n\nfor i in range(M):\n p,y = map(str,input().split())\n s = "0"*(6-len(p)) + p + "0"*(10-len(y)) + y\n S.append(s)\n\nS.sort()\n\nfor i in range(M):\n l = str(i+1)\n S[i] = S[i][:6] + "0"*(6-len(l)) + l\n print(S[i])\n', 'N,M = map(int,input().split())\nS = []...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s012832522', 's620801395', 's622690002', 's640587445', 's664405695', 's945528117']
[18236.0, 11680.0, 3064.0, 3064.0, 25220.0, 45488.0]
[553.0, 549.0, 17.0, 18.0, 577.0, 967.0]
[262, 261, 354, 361, 339, 530]
p03221
u970899068
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())\ns=[list(map(int, input().split())) for i in range(m)] \nfor i in range(m):\n s[i].append(i+1)\nprint(s)\na=0\ns.sort()\nfor i in range(m):\n if i>1:\n if s[i][0]!=s[i-1][0]:\n a=0\n \n s[i].append(str(0)*(6-len(str(s[i][0])))+str(s[i][0]))\n s[i].appe...
['Wrong Answer', 'Accepted']
['s865199638', 's859146756']
[47240.0, 43632.0]
[966.0, 911.0]
[421, 416]
p03221
u971091945
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 = []\nmli = [0]*m\nli = [""]*m\n\nfor i in range(m):\n p,y = map(int, input().split())\n py.append([p,y,i])\n\npy.sort(key=lambda x: x[1])\n\nfor p,y,i in py:\n mli[p] += 1\n pi = \'{0:05d}\'.format(p)\n yi = \'{0:05d}\'.format(mli[p])\n li[i] = str(pi)+str(yi)\n...
['Runtime Error', 'Accepted']
['s079396931', 's172014041']
[32000.0, 32176.0]
[667.0, 636.0]
[324, 310]
p03221
u973840923
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())\nlist = [[] for i in range(N)]\n\nfor i in range(M):\n j,k = map(int,input().split())\n list[j-1].append((k,i))\n\nans = [None]*M\n\nfor i,j in enumerate(list):\n j.sort()\n for k,(l,m) in enumerate(j):\n ans[m] = "%06d%06d" % (i+1,k+1)\n\nprint(ans)\n', "N,M = map(in...
['Wrong Answer', 'Accepted']
['s513368042', 's984405087']
[39268.0, 61552.0]
[544.0, 922.0]
[287, 391]
p03221
u977389981
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())\nipy = []\n\nfor i in range(m):\n p, y = map(int, input().split())\n ipy.append([i, p, y])\n \nipy = sorted(ipy, key=lambda x: x[2])\n\ncount = {}\norder = {}\n\nfor i, p, y in ipy:\n if not p in count:\n count[p] = 1\n else:\n count[p] += 1\n order[i, ...
['Wrong Answer', 'Accepted']
['s722692888', 's061633155']
[43696.0, 44484.0]
[819.0, 671.0]
[386, 340]
p03221
u978313283
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+1)]\nY=[]\nid=[]\nfor i in range(M):\n a,b=map(int,input().split())\n P[a].append(b)\n Y.append(b)\nfor i in range(N+1):\n P[i].sort()\nfor i in range(1,N+1):\n j=1\n for p in P[i]:\n id[Y.index(p)]=str(i*1000000+j)\n j+=1\nfor i in ...
['Runtime Error', 'Accepted']
['s014568509', 's239527922']
[18712.0, 33024.0]
[380.0, 779.0]
[340, 376]
p03221
u981931040
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())\nbirth = []\nfor i in range(M):\n a , b = map(int,input().split())\n birth.append([a,b,i])\nprint(birth)\nwork_list = sorted(birth,key=lambda x: x[1])\nwork_list.sort()\n#print(birth)\nupper = 1\nlower = 1\nans = []\nfor i in range(1,len(birth)):\n ans.append([work_list[i-1][...
['Wrong Answer', 'Accepted']
['s193678995', 's181552950']
[44632.0, 41904.0]
[1048.0, 1019.0]
[608, 579]
p03221
u984664611
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\n\ndef main():\n n, m = map(int, input().split())\n ans_id = [None]*m\n p_count = [0]*(n+1)\n\n list_ipy = [None]*m\n for i in range(m):\n p, y = map(int, input().split())\n list_ipy[i] = (i, p, y)\n list_ipy.sort(key=lambda x: x[2])\n\n for ...
['Wrong Answer', 'Accepted']
['s363026461', 's524659374']
[30028.0, 29852.0]
[380.0, 410.0]
[556, 556]
p03221
u987164499
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\nimport bisect\n\nn,m = [int(x) for x in stdin.readline().rstrip().split()]\nli = [list(map(int,stdin.readline().rstrip().split())) for _ in range(m)]\n\nlin = [[]for i in range(n)]\nlin2 = []\nli3 = []\nfor j in range(m):\n lin[li[j][0]-1].append(li[j][1])\n lin2.append(li[j][0]-1)\n\nfor...
['Runtime Error', 'Runtime Error', 'Accepted']
['s163106860', 's793146195', 's127741584']
[51164.0, 34684.0, 32952.0]
[720.0, 217.0, 414.0]
[529, 469, 309]
p03221
u987170100
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())\nkv = {}\nlst = []\nfor _ in range(M):\n x, y = map(int, input().split())\n lst.append("{0} {1}".format(x, y))\n if x in kv:\n kv[x][y] = 1\n else:\n kv[x] = {y:1}\n\nfor k1 in sorted(kv.keys()):\n keys = sorted(kv[k1].keys())\n for idx, k2 in enumerate...
['Wrong Answer', 'Accepted']
['s397691394', 's951046066']
[60236.0, 54348.0]
[1201.0, 993.0]
[443, 433]
p03221
u990726146
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 = [0] * M\nfor i in range(M):\n P[i] = list(map(int, input().split())) + [i + 1]\n\nP = sorted(P, key = lambda x: x[1])\nP = sorted(P, key = lambda x: x[0])\n\na = P[0][0]\nc = 0\nfor i in range(M):\n #print(P[i])\n if P[i][0] == a:\n c += 1\n P[i].append(c)\...
['Wrong Answer', 'Accepted']
['s831088341', 's697348031']
[37300.0, 37412.0]
[626.0, 531.0]
[524, 525]
p03221
u991567869
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 = []\n\nfor i in range(m):\n p, y = input().split()\n l.append([p, y])\n\nl.sort()\n\nl[0][1] = 1\n\nfor i in range(1, m):\n if l[i][0] == l[i - 1][0]:\n l[i][1] = l[i - 1][1] + 1\n else:\n l[i][1] = 1\n\nfor i in l:\n ans = "0"*(6 - len(i[0])) + i[0] +...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s126107780', 's642051779', 's499636049']
[29732.0, 29712.0, 43856.0]
[629.0, 710.0, 702.0]
[352, 412, 258]
p03221
u993435350
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\ndef main():\n N,M = map(int,input().split())\n pref = [[] for i in range(N)]\n id = [[]] * M\n \n for i in range(M):\n p,y = map(int,input().split())\n id[i] = [p,y]\n pref[p - 1].append(y)\n \n \n for i in range(N):\n pref[i] = sorted(pref[i])\n \n orders = [0] * N\n \n for...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s654512989', 's721321530', 's370744395']
[3064.0, 33552.0, 33556.0]
[18.0, 687.0, 663.0]
[595, 478, 595]
p03221
u997641430
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=[]\nfor m in range(M):\n data.append(list(map(int,input().split())))\n data[m].append(m)\ndata.sort(key=lambda x:x[1])\n\npref=0\nfor m in range(M):\n if data[m][0]!=pref:\n count=1\n ID=('000000'+str(data[m][0]))[-6:]+('000000'+str(count))[-6:]\n data[m].appen...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s147429740', 's626807257', 's614492740']
[40300.0, 32320.0, 38452.0]
[746.0, 453.0, 820.0]
[383, 416, 454]
p03222
u007808656
2,000
1,048,576
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we t...
['h,w,k=map(int,input().split())\n\ndef amida(h,w,k):\n memo=[[-1 for _ in range(w)] for _ in range(h)]\n memo[0][0]=amida_h1_total(w-1)\n if w>1:\n memo[0][1]=amida_h1_total(w-2)\n for i in range(2,w):\n memo[0][i]=0\n def _amida(h,k):\n if k<=0 or k>w:\n return 0\n ...
['Runtime Error', 'Accepted']
['s924143327', 's305590204']
[3064.0, 3064.0]
[17.0, 30.0]
[705, 838]
p03222
u026788530
2,000
1,048,576
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we t...
['H,W,K = [int(i) for i in input().split()]\n\nDP = [[0 for i in range(W)]for j in range(2)]\n\nt = [0 for i in range(W+10)]\n\nt[1] = 1\nt[2] = 2\nfor i in range(2,W+8):\n t[i+1] = t[i] + t[i-1]\n\n#print(t)\nn = 0\nDP[0][0] = 1\nfor i in range(H):\n if W == 1:\n break\n DP[not(n)][0] = (DP[n][0] * t[W...
['Runtime Error', 'Accepted']
['s484939818', 's513075688']
[3064.0, 3192.0]
[18.0, 18.0]
[593, 623]
p03222
u057916330
2,000
1,048,576
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we t...
['def count(length, on):\n """Count of possible amida patterns"""\n if length < 0:\n return 1\n if length == 0:\n return 1\n ret = count(length - 1, False)\n if not on:\n ret += count(length - 1, True)\n return ret\n\n\n\n# print(count(i, True) + count(i, False))\n\n\nif __nam...
['Runtime Error', 'Accepted']
['s679712337', 's841926341']
[3064.0, 3064.0]
[18.0, 25.0]
[1155, 1221]
p03222
u062459048
2,000
1,048,576
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we t...
['H, W, K = map(int,input().split())\ndp = [[0]*W for _ in range(H+1)]\ndp[0][0] = 1\n\nck = [0]*9\nck[0] = 1\nfor i in range(1,9):\n for j in range(2**(i-1)):\n for k in range(i-1):\n if (j>>k)&(j>>(k+1))==True:\n break\n else:\n ck[i] += 1\nprint(ck)\n\nmod = 10**9+7\nfor i in range(1,H+1):\n ...
['Runtime Error', 'Accepted']
['s144046863', 's715871772']
[3064.0, 3064.0]
[20.0, 19.0]
[625, 719]
p03222
u118642796
2,000
1,048,576
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we t...
['H,W,K = map(int,input().split())\n\ndp = [[0]*(W+2) for _ in range(H+1)]\ndp[0][1] = 1\n\n \n\nfor i in range(1,H+1):\n for x in range(2**(W-1)): \n Alloc = [0]*9\n tmp = x\n for y in range(1,8): \n Alloc[y] = tmp%2\n tmp //= 2 \n for y in range(0,9):...
['Runtime Error', 'Accepted']
['s869390791', 's575464539']
[3064.0, 3064.0]
[81.0, 73.0]
[713, 713]
p03222
u160244242
2,000
1,048,576
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we t...
['input_lst = list(map(int, input().split()))\nh, w, k = input_lst[0], input_lst[1], input_lst[2]\n\ndef row_comb(w):\n if w <= 0:\n return 0\n if w == 1:\n return 1\n if w == 2:\n return 2\n else:\n return row_comb(w-2)+row_comb(w-1)\n\n@lru_cache(maxsize=1000)\ndef trio(h,w):\n...
['Runtime Error', 'Accepted']
['s356204003', 's764040602']
[3188.0, 3812.0]
[18.0, 35.0]
[1304, 1384]
p03222
u189575640
2,000
1,048,576
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we t...
['from sys import exit\nH,W,K = [int(n) for n in input().split()]\nmemo = [[0 for _ in range(H+1)] for __ in range(W)]\nmemo[0][0] = 1\nfor h in range(1,H+1):\n for pt in range((1 << W-1)):\n pts = bin(pt)[2:]\n pts = pts[::-1]\n if "11" in pts: continue\n # print(pts)\n \n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s338774761', 's662959108', 's888981493']
[3064.0, 3064.0, 3064.0]
[17.0, 46.0, 46.0]
[1072, 737, 656]