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
u319818856
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 identify(N: int, M: int, PY: list) -> list:\n _PY = [(i, p, y) for i, (p, y) in enumerate(PY)]\n _PY.sort(key=lambda x: x[2])\n _PY.sort(key=lambda x: x[1])\n\n now_p = 0\n now_o = 1\n ids = []\n for i, p, _ in _PY:\n if p != now_p:\n now_p = p\n now_o = 1\n ...
['Wrong Answer', 'Accepted']
['s965874685', 's147677820']
[44748.0, 43980.0]
[804.0, 753.0]
[628, 628]
p03221
u320567105
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...
['2 3\n2 55\n2 77\n2 99', 'ri = lambda: int(input())\nrl = lambda: list(map(int,input().split()))\nrr = lambda N: [ri() for _ in range(N)]\nYN = lambda b: print(\'YES\') if b else print(\'NO\')\nINF = 10**18\n\nN,M=rl()\nP=[0]*M\nY=[0]*M\ndic = [[] for _ in range(N+1)]\nfor i in range(M):\n P[i],Y[i] = rl()\n dic...
['Runtime Error', 'Accepted']
['s793890105', 's020316272']
[2940.0, 30256.0]
[17.0, 718.0]
[18, 445]
p03221
u322297639
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)]\npy.sort(key=lambda x: x[1])\nnow = py[0][0]\ncount = 0\nfor i in range(m):\n if now == py[i][0]:\n count += 1\n else:\n now = py[i][0]\n count = 1\n print("{:06}".format(py[i][0]) + "{:06}".format...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s025768124', 's297632702', 's871401921', 's960895949']
[29144.0, 29272.0, 49088.0, 31372.0]
[638.0, 641.0, 1071.0, 744.0]
[315, 315, 503, 408]
p03221
u323125813
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_d = {}\nans_l = ["" for _ in range(M)]\nfor i in range(M):\n P,Y = map(int,input().split())\n city_d.setdefault(P,[])\n city_d[P].append([Y,i])\n\nfor p,y_orgnum in city_d.items():\n for j,sorted_y_orgnum in enumerate(sorted(y_orgnum,key=lambda x:x[0])):\n ans_l...
['Wrong Answer', 'Accepted']
['s056225901', 's474013283']
[48780.0, 47616.0]
[812.0, 829.0]
[403, 403]
p03221
u324314500
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\ns2nn = lambda s: [int(c) for c in s.split(' ')]\n\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\n\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\n\nii2ss = lambda n: [sys.stdin.readline() for _ in range...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s662867808', 's743801990', 's814004275', 's629482869']
[3064.0, 27436.0, 27168.0, 97520.0]
[18.0, 323.0, 353.0, 585.0]
[1142, 530, 546, 1149]
p03221
u329036729
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\ninfo_list = []\n\nfor i in range(m):\n pi, yi = map(int, input().split())\n info_list.append([i, pi, yi])\nprint(info_list)\n\nfrom operator import itemgetter\ninfo_list.sort(key = itemgetter(1))\ninfo_list.sort(key = itemgetter(2))\nprint(info_list)\n\np = info_list[0][1]\nj...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s189264382', 's621615703', 's519323985']
[41004.0, 42032.0, 35028.0]
[983.0, 903.0, 740.0]
[593, 489, 495]
p03221
u333190709
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\nfrom operator import itemgetter\n\nN, M = input().split()\nN, M = int(N), int(M)\nC = [input().split() for i in range(M)]\n\nfor i, c in enumerate(C):\n C[i] = [int(c[0]), int(c[1])]\n C[i].append(i)\n\nC_sorted = sorted(C, key = lambda x: (x[0], x[1]))\n\ncounter = 1\ncurrent = 1\n\nfor c in C_...
['Wrong Answer', 'Accepted']
['s430774058', 's863811270']
[62264.0, 50228.0]
[1234.0, 1141.0]
[692, 675]
p03221
u334712262
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 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, prod...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s072877200', 's643488944', 's893337011']
[45872.0, 49324.0, 63308.0]
[895.0, 756.0, 825.0]
[1349, 1368, 1430]
p03221
u335278042
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 lis.append(list(map(int,input().split())))\nl_2=sorted(lis, key=lambda x: x[1])\ndic={}\nfor i,j in l_2:\n dic[i]=dic.get(i,0)+1\n res='{:0=6}{:0=6}'.format(i,dic[i])\n lis[lis.index([i,j])]=res\nprint(lis)", "import sys\ninput=sys.stdin.readline...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s098778777', 's208514256', 's751699341', 's179363128']
[30224.0, 3064.0, 43928.0, 38324.0]
[2109.0, 17.0, 520.0, 468.0]
[268, 325, 299, 300]
p03221
u335295553
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(N)]\n\nPY_sort = sorted(PY)\n\ntmp = dict()\n\nbefore = 0\nfor py in PY_sort:\n if before != py[0]:\n count = 0\n count += 1\n tmp[py] = count\n\nfor py in PY:\n print("{:06}{:06}".format(tmp[py][0],tmp[py][1]))',...
['Runtime Error', 'Accepted']
['s902856329', 's659099273']
[28656.0, 29316.0]
[491.0, 600.0]
[301, 317]
p03221
u343671593
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,y = 0,0\nmy_dict = dict()\ndef genFrstSix(P):\n\tstr_ = str(P)\n\twhile(len(str(str_))<6):\n\t\tstr_ = "0"+ str_\n\t\t# print(str_)\n\treturn str_\nP,Y,tup=[],[],[]\nfor i in range(M):\n\tp,y = map(int,input().split())\n\ttup.append((p,y))\n\tif p in my_dict.keys():\n\t\tmy_dict[p].a...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s209785834', 's346366389', 's690700316', 's891131943']
[62096.0, 64108.0, 56948.0, 54428.0]
[2107.0, 2107.0, 2107.0, 765.0]
[660, 783, 846, 694]
p03221
u346194435
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 numbering(Y, P):\n \n \n idx = int(P) - 1\n Pwas[idx] = Pwas[idx] + 1\n num = P.zfill(6) + str(Pwas[idx]).zfill(6)\n return num\n\nN, M = input().split()\nN = int(N)\nM = int(M)\nPY = []\nPwas = [0 for i in range(N)]\n\nfor i in range(M):\n Px, Yy = input().split()\n \n PY.append((Yy, P...
['Wrong Answer', 'Accepted']
['s251844464', 's826765128']
[24256.0, 35940.0]
[545.0, 539.0]
[468, 375]
p03221
u346395915
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\ncity = [[] for _ in range(n+1)]\narr = []\n\nfor i in range(m):\n s,t = map(int,input().split())\n city[s].append(t)\n arr.append((s,t))\n \nfor i in range(m):\n x = str(arr[i][0])\n y = str(city[int(x)].index(arr[i][1]))\n print(x.rjust(6, "0") + y.rjust(6,"0"))...
['Wrong Answer', 'Accepted']
['s938573108', 's278160515']
[29608.0, 36336.0]
[2105.0, 696.0]
[311, 369]
p03221
u346629192
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())\npairs = [list(map(int,input().split())) for i in range(M)]\n\np_count = [1] * (N + 1)\nfor r in sorted(pairs, key=lambda x: x[1]):\n r.append("{:06}{:06}".format(r[0], p_count[r[0]]))\n p_count[r[0]] += 1\nprint(pairs)\n\nprint("\\n".join((r[2] for r in pairs)))', 'N, M = map(i...
['Wrong Answer', 'Accepted']
['s758841139', 's745933062']
[46052.0, 39028.0]
[624.0, 531.0]
[292, 279]
p03221
u347640436
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_left\nn, m = map(int, input().split())\ndata = [list(map(int, input().split())) for _ in range(n)]\nt = [[] for _ in range(n)]\nfor p, y in data:\n t[p - 1].append(y)\nfor i in range(n):\n t[i].sort()\nfor p, y in data:\n nth = bisect_left(t[p - 1], y) + 1\n print("%06d%06d" % (p, nth))\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s614502608', 's639226774', 's763452019']
[37300.0, 35936.0, 36748.0]
[638.0, 2106.0, 648.0]
[308, 270, 315]
p03221
u350997995
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 = []\narr = [[]for j in range(10**5)]\nfor i in range(M):\n listA = list(map(int,input().split()))\n P.append(listA[0])\n Y.append(listA[1])\n arr[listA[0]].append(listA[1])\n arr[listA[0]].sort()\nfor i in range(M):\n num = Y[i]\n for k in range(M):\n if arr[P[i]][...
['Runtime Error', 'Accepted']
['s376994541', 's177857112']
[34000.0, 33896.0]
[2105.0, 375.0]
[394, 310]
p03221
u354916249
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_originals = tuple(PY)\nN_counter = [0] * N\nM_counter = [0] * M\n\nPY.sort(key=lambda val: val[1])\n\nfor i in range(M):\n N_counter[PY[1]-1] += 1\n M_counter[i] = N_counter[PY[1]-1]\n\nfor i in PY_originals:\n ans =...
['Runtime Error', 'Accepted']
['s106141280', 's124557094']
[31452.0, 31012.0]
[409.0, 854.0]
[377, 461]
p03221
u357751375
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 = [[] for i in range(m)]\nfor i in range(m):\n a,b = map(int,input().split())\n l[i] = [a,b,i]\nl = list(sorted(l,key=lambda x: x[0]))\nans = [[] for i in range(m)]\nx = 0\ny = 1\nfor i in range(m):\n if x != l[i][0]:\n x = l[i][0]\n y = 1\n else:\n y...
['Wrong Answer', 'Accepted']
['s540098589', 's914135009']
[46204.0, 45816.0]
[623.0, 707.0]
[467, 475]
p03221
u360515075
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\nN, M = map(int, input().split())\nP = [[int(i) for i in input().split()] for _ in range(M)]\nD = defaultdict(list)\n\nfor p, y in sorted(P):\n D[p] += [y]\n \nfor p, y in sorted(P):\n z = D[p].index(y)\n print ("%06d%06d"%(p, z+1))\n', 'from collections import d...
['Wrong Answer', 'Accepted']
['s395218043', 's669721366']
[41032.0, 41012.0]
[2106.0, 681.0]
[277, 276]
p03221
u361381049
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 = list(map(int, input().split()))\n a.append(i)\n py.append(a)\n\npy = sorted(py, key=lambda x:x[1])\npy = sorted(py, key=lambda x:x[0])\n#print(py)\n\nans = [[0] * 2 for i in range(m)]\ncnt = 0\nval = py[0][2]\nfor i in range(m):\n if py[i...
['Wrong Answer', 'Accepted']
['s898900157', 's320530102']
[39188.0, 42212.0]
[925.0, 930.0]
[547, 586]
p03221
u366886346
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=[]\nans=[""]*m\ncount=1\nfor i in range(m):\n p,y=input().split()\n num.append([p,y,i])\nprint(num)\nstry= lambda val: val[1]\nnum.sort(key=stry)\nstrp= lambda val: val[0]\nnum.sort(key=strp)\nfor i in range(m):\n p=str(num[i][0])\n if i!=0 and num[i][0]==num[i-1][0]:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s731925607', 's933489064', 's879109070']
[41396.0, 35472.0, 32212.0]
[752.0, 745.0, 707.0]
[476, 403, 392]
p03221
u371467115
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 _ in range(n)]\nans=[None]*n\n\nfor i in range(m):\n p,y=map(int,input().split())\n a.append((y,i))\n \nfor i,b in enumerate(a):\n b.sort()\n for j,(y,k) in b:\n ans[k]='%06d%06d' % (i+1,j+1)\n \nprint(*ans,sep='\\n')", "n,m=map(int,input().split())\na=[[] for _ in r...
['Runtime Error', 'Accepted']
['s161140131', 's462881583']
[24488.0, 37480.0]
[354.0, 592.0]
[254, 270]
p03221
u373274281
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+1)\nY = [0]*(m+1)\nfor i in range(1, m+1):\n P[i], Y[i] = map(int, input().split())\nPP = [[] for i in range(n+1)]\n#print(PP)\nfor i in range(1, m+1):\n p = P[i]\n y = Y[i]\n PP[p].append((i, y))\n\nfor i in range(1, n+1):\n if len(PP[i]) == 0:\n con...
['Wrong Answer', 'Accepted']
['s148292592', 's169312670']
[33536.0, 47324.0]
[578.0, 726.0]
[516, 556]
p03221
u374103100
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\nN, M = map(int, input().split())\nc_l = [list(map(int, input().split())) for _ in range(M)]\n\ndict = {}\n\nfor c in c_l:\n if c[0] in dict:\n dict[c[0]].append(c[1])\n else:\n dict[c[0]] = [c[1]]\n\n\nfor k, v in dict.items():\n v.sort()\n\nprint(dict)\n\nfor c in c_l:\n idx = dict[c[0]...
['Wrong Answer', 'Accepted']
['s125033851', 's043122654']
[46880.0, 35008.0]
[2105.0, 746.0]
[413, 379]
p03221
u374671031
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)]\n\nA = []\nfor i in range(M):\n A.append([0,1000000000000])\n\nfor i in range(M):\n PY[i].extend(A[i])\n\nPY.sort\n\nP = 0\n\n\nfor i in range(M):\n if P != PY[i][0]:\n P = PY[i][0]\n S = 1\n\n else:\n S += 1\n\n ...
['Wrong Answer', 'Accepted']
['s896747548', 's285880294']
[40020.0, 43528.0]
[559.0, 816.0]
[415, 426]
p03221
u374802266
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\ndef zaatu(a):\n b=list(set(a))\n for i in range(len(a)):\n a[i]=bisect.bisect_left(b,a[i])\n return a\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 a[p-1].append([p,y,i])\nfor i in range(n):\n a[i].sort(key=la...
['Wrong Answer', 'Accepted']
['s782336842', 's991562849']
[56616.0, 49352.0]
[898.0, 764.0]
[532, 523]
p03221
u375616706
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, M = map(int,input().split())\nP=[]\nY=[]\ncities=[]\nfor i in range(M):\n try:\n s = input()\n p,y = s.split()\n city=(p,y)\n cities.append(city) \n P.append(p)\n Y.append(y)\n\n except:\n break\nsort_city=sorted(cities,key=lambda x:(x[0],x[1]))\nprefs = sor...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s027523863', 's115322167', 's427926557', 's461336302', 's783833355', 's793556776', 's580570941']
[39824.0, 37780.0, 38764.0, 37448.0, 40472.0, 39392.0, 46748.0]
[2106.0, 2106.0, 2106.0, 763.0, 2106.0, 579.0, 824.0]
[613, 698, 683, 461, 665, 415, 427]
p03221
u377989038
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 lst = [[] for _ in range(n + 1)]\n py = []\n for i in range(m):\n p, y = map(int, input().split())\n py.append([p, y])\n lst[p].append(y)\n\n for i in lst:\n i.sort\n ans = []\n ...
['Wrong Answer', 'Accepted']
['s013870070', 's976750652']
[41380.0, 63808.0]
[2105.0, 735.0]
[457, 331]
p03221
u382176416
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())\nl=[]\nid_list=[]\nfor i in range(m):\n l.append(list(map(int, input().split())))\nl=sorted(l, key=itemgetter(1))\nidx=0\nfor j in range(m):\n if j == 0:\n idx=1\n else:\n if l[j][0] == l[j-1][0]:\n idx+=1\n else:\n idx =1\n id_list....
['Wrong Answer', 'Accepted']
['s620916485', 's830949290']
[41464.0, 46544.0]
[667.0, 1063.0]
[372, 511]
p03221
u383196771
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\nnum = {}\nfor i in range(M):\n P_i, Y_i = map(int, input().split())\n if P_i in num:\n num[P_i].append((Y_i, i))\n else:\n num[P_i] = [(Y_i, i)]\n\ndisplay = [0] * M\nfor i in num.keys():\n k = str(0) * (6 - len(str(i))) + str(i)\n for index, j in enume...
['Wrong Answer', 'Accepted']
['s504132873', 's953137610']
[45420.0, 42972.0]
[1122.0, 945.0]
[494, 471]
p03221
u384261199
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\nimport numpy as np\n\nN,M = map(int, input().split())\npy = [[int(i) for i in input().split()] for i in range(M)]\n\npref_dic = {}\nfor i in range(N):\n pref_dic[i+1] = []\nfor e,index in zip(py, range(M)):\n pref = e[0]\n year = e[1]\n \n pref_dic[pref].append((index, year))\n \ncity_n...
['Wrong Answer', 'Accepted']
['s834193482', 's936995610']
[79864.0, 84728.0]
[1913.0, 1860.0]
[1029, 1021]
p03221
u386782537
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\nlength = [list(map(int,input().split())) for _ in range(M)]\nfor i in range(M):\n length[i].insert(2,i)\nlength = sorted(length)\nprint(length)\nans_list =[0]*M\ncount = 1\nfor i in range(M):\n if i == 0:\n ans = str(length[i][0]).zfill(6) + str(count).zfill(6)\n ans_list...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s550983690', 's668634580', 's501387558']
[51544.0, 3060.0, 45612.0]
[1066.0, 17.0, 1006.0]
[728, 116, 714]
p03221
u386819480
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\nimport sys\n\n\ndef solve(N: int, M: int, P: "List[int]", Y: "List[int]"):\n a = sorted([[P[i], Y[i]] for i in range(M)], key=lambda x:(x[0],x[1]))\n \n ans = []\n t = -1\n c = 0\n for p,y in a:\n if(p != t):\n t = 0\n c += 1\n ans.append(str(p...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s165635847', 's239249171', 's552588887', 's624544218', 's854279934', 's444990963']
[30060.0, 21168.0, 39268.0, 28144.0, 30128.0, 44944.0]
[448.0, 309.0, 2105.0, 2105.0, 441.0, 671.0]
[1028, 305, 346, 384, 1046, 1166]
p03221
u388697579
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# your code goes here\ndef main():\n\tbuf = input().split()\n\tn = int(buf[0])\n\tm = int(buf[1])\n\t\n\tpy = np.zeros((m, 4), dtype="int")#num, p, year, num in p\n\tfor i in range(m):\n\t\tpy[i][0] = i+1#################\n\t\tbuf = input().split()\n\t\tpy[i][1] = int(buf[0])\n\t\tpy[i][2] = int(b...
['Wrong Answer', 'Accepted']
['s963460462', 's425897303']
[42712.0, 42716.0]
[1429.0, 1464.0]
[662, 663]
p03221
u388927326
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\nclass City:\n def __init__(self, i1, p, y, o=None):\n self.i1 = i1\n self.p = p\n self.y = y\n self.o = o\n\n def __repr__(self):\n return f"City({self.i1}, {self.p}, {self.y}, {self.o})"\n\n def get_id(self):\n return f"{self.p:06}{self.o:0...
['Runtime Error', 'Accepted']
['s678669920', 's180666345']
[2940.0, 110692.0]
[18.0, 800.0]
[953, 957]
p03221
u391875425
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 read():\n return int(input())\n\ndef reads():\n return list(map(int, input().split()))\n\nn,m = reads()\ncnt = {k:[] for k in range(n+1)}\nbuf = [None]*m\nfor i in range(m):\n p,y = reads()\n cnt[p].append((y,i))\nfor p,l in cnt.items():\n if not l:\n continue\n l.sort()\n print(l)\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s817875139', 's895085354', 's465471639']
[56460.0, 56460.0, 53088.0]
[859.0, 928.0, 677.0]
[400, 405, 387]
p03221
u393224521
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)) \nprint(D)\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) \n\npr...
['Wrong Answer', 'Accepted']
['s802617057', 's565649207']
[41672.0, 37480.0]
[884.0, 617.0]
[690, 671]
p03221
u397531548
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())\nA=[[] for j in range(N)]\npx=[]\nfor i in range(M):\n p,x=map(int,input().split())\n A[p-1].append(x)\n px.append([p,x])\nfor m in range(N):\n A[m].sort()\nfor k in range(M):\n q=bisect.bisect_left(A[px[k][0]-1],px[k][1])\n print("0"*(6-len(str(px[k][1]))...
['Wrong Answer', 'Accepted']
['s386291185', 's629351300']
[32648.0, 32732.0]
[755.0, 820.0]
[360, 350]
p03221
u400738660
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 = input().split()\nplist = []\nylist = []\nn = int(n)\nm = int(m)\nanslist = [0 for i in range(m)]\nlist = [[] for i in range(n+1)]\nfor i in range(m):\n p,y = input().split()\n p = int(p)\n y = int(y)\n plist.append(p)\n ylist.append(y)\nfor i in range(m):\n for j in range(n+1):\n if pli...
['Wrong Answer', 'Accepted']
['s525849279', 's937730747']
[29844.0, 43788.0]
[2105.0, 832.0]
[732, 644]
p03221
u401487574
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([p,y])\nls.sort(key= lambda x:x[1])\nls.sort(key= lambda x:x[0])\npre = ls[0][0]\ncnt = 1\nfor p,y in ls:\n if p==pre:\n print(str(p).zfill(6) + str(cnt).zfill(6))\n cnt+=1\n else:\n ...
['Wrong Answer', 'Accepted']
['s960201258', 's172281023']
[21632.0, 39336.0]
[633.0, 767.0]
[378, 470]
p03221
u404676457
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()))\n\npy = []\n\nfor i in range(m):\n py.append(input().split())\n\nmapa ={}\n\nfor i in range(m):\n if py[i][0] in mapa:\n mapa[py[i][0]][py[i][1]] = i\n else:\n mapa[py[i][0]] = {py[i][1]:i}\n\nans = ['' for _ in range(m)]\n\nfor i in mapa:\n pri = map...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s072206038', 's377373057', 's600186850']
[80316.0, 76888.0, 74876.0]
[649.0, 988.0, 767.0]
[465, 503, 488]
p03221
u414430923
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()))\ninfo = [list(map(int, input().split())) for i in range(m)]\n\npref = {}\nfor p,y in info:\n if not p in pref: pref[p] = [y]\n else: pref[p].append(y)\n\nid = {}\nfor p,years in pref.items():\n id[p] = {}\n for i,y in enumerate(years):\n id[p][y] = str(p).zfill...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s183775258', 's226902352', 's553480553']
[83464.0, 72896.0, 83460.0]
[778.0, 2109.0, 729.0]
[367, 388, 384]
p03221
u416758623
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(6) + str(P[p]).zfill(6)\n ans.append([i,tmp])\nans.sort()\nfor i,a in ans:\n print(a)', '...
['Runtime Error', 'Accepted']
['s625502623', 's062990338']
[46368.0, 42280.0]
[870.0, 937.0]
[303, 301]
p03221
u422104747
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())\n\nl1 = [[] for i in range(n)]\nl2 = []\n\nfor i in range(m):\n p,y = map(int,input().split())\n l1[p-1].append(y)\n l2.append((p,y))\n\nfor p in range(n):\n l1[p].sort()\n\nfor i in range(m):\n p = l2[i][0]\n k = bisect.right(l1[p-1],l2[i][1])\n p = ...
['Runtime Error', 'Accepted']
['s754105408', 's214850960']
[28196.0, 29604.0]
[413.0, 660.0]
[382, 388]
p03221
u423585790
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\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\nimport itertools\nsys.setrecursionlimit(10**5)\nstdin = sys.stdin\ndef LI(): return list(map(int, stdin.readline().split()))\ndef LF():...
['Wrong Answer', 'Accepted']
['s999015026', 's083518082']
[36872.0, 47300.0]
[2106.0, 536.0]
[1475, 1538]
p03221
u426501657
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 = []\n\nIndexs = []\nSyuturyoku = []\n\n\nfor j in range(N):\n\tP.append([0])\n\n\nfor i in range(M):\n\tp,y = map(int,input().split())\n\n\tP[p-1].append(y)\n\tIndexs.append(y)\n\tSyuturyoku.append(("0","0"))\n\nfor i in range(len(P)):\n\tP[i].sort()\n\tP[i] = list(map(str,P[i]))\n\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s046473874', 's315710954', 's962118209']
[39640.0, 46924.0, 38136.0]
[2106.0, 2106.0, 702.0]
[1035, 967, 416]
p03221
u427344224
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\nshi_map = []\n\nfor i in range(M):\n p, y = map(int, input().split())\n shi_map.append([i, p, y])\n\nshi_map = sorted(shi_map, key=lambda x: (x[1], x[2]))\nprint(shi_map)\n\nresult = {}\nshi_count = {}\nfor i, p, y in shi_map:\n\n if p in shi_count:\n c = shi_count[...
['Wrong Answer', 'Accepted']
['s230321393', 's282900407']
[55548.0, 36180.0]
[1073.0, 683.0]
[597, 481]
p03221
u432333240
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_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')\nyears = [np.sort(P_Y_list[np.where(P_Y_list[:,0]==i)][:,1]) for i in set(P_Y_list[:, 0])]\nfor l in P_Y_list:\n left = str(l[0]).zfill(6)\n right = str(np.where(years[list(set(P_Y_list[:,0])).index(l[0])]=...
['Runtime Error', 'Accepted']
['s926427504', 's745928877']
[3064.0, 50556.0]
[18.0, 1618.0]
[359, 450]
p03221
u434822333
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\ncity = []\nfor i in range(M):\n\tp, y = map(int, input().split())\n\tcity.append([p, y, i])\ncity.sort()\n\nprint(city)\n\nout = [0]*M\ncnt = 1\nfor i in range(len(city)):\n\tout[city[i][2]] = '{0:06d}{1:06d}'.format(city[i][0], cnt)\n\ttry:\n\t\tif city[i+1][0] == city[i][0]: cnt ...
['Wrong Answer', 'Accepted']
['s011209742', 's564648266']
[34008.0, 31300.0]
[800.0, 678.0]
[376, 363]
p03221
u440129511
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()))]\nl=[1]*n\nfor i in range(m):\n py[i].append(i+1)\npy.sort()\nfor i in range(m):\n py[i].append( str(py[i][0]).zfill(6) + str(l[py[i][0]-1]).zfill(6))\n l[py[i][0]-1]+=1\npy.sort(key=lambda x:x[2])\nfor i in range(m):\n print(py[i][-1])', 'n...
['Runtime Error', 'Accepted']
['s389215449', 's290761400']
[3828.0, 39652.0]
[18.0, 822.0]
[302, 320]
p03221
u442877951
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\ninput = sys.stdin.readline\nN,M = map(int,input().split())\nPY = {n: [] for n in range(N + 1)}\nfor i in range(M):\n p,y = map(int,input().split())\n PY[p].append((y, i))\nprint(PY)\nfor p,y in PY.items():\n y.sort()\n for j, (z, i) in enumerate(y):\n top_number = '0'*(6-len(str(p)))+str(p)\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s147189206', 's443239605', 's230632275']
[44384.0, 49992.0, 44448.0]
[625.0, 639.0, 726.0]
[389, 438, 389]
p03221
u443010331
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 get_line():\n return input().split(\' \')\n\nclass element:\n def __init__(self, P, Y, idx):\n self.P = P\n self.Y = Y\n self.idx = idx\n def __lt__(self, other):\n return self.Y < other.Y\n\nN, M = map(int, get_line())\nels = [0] * M\nfor i in range(M):\n p, y = map(int, get_line())\n els[i] = E...
['Runtime Error', 'Accepted']
['s626262481', 's113594710']
[3828.0, 50180.0]
[19.0, 1061.0]
[550, 550]
p03221
u447528293
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 year(x):\n return Y[x]\n\nN, M = [int(s) for s in input().rstrip().split()]\nP = []\nY = []\nfor m in range(M):\n input_line = [int(s) for s in input().rstrip().split()]\n P.append(input_line[0])\n Y.append(input_line[1])\n\npref = [[] for _ in range(N)]\nfor m in range(M):\n pref[P[m]-1].append(m)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s636968009', 's944985720', 's911368800']
[34392.0, 34408.0, 45440.0]
[2105.0, 2105.0, 676.0]
[583, 603, 415]
p03221
u447749982
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\nprefectures = [[] for i in range(N)]\n\n\nfor city in range(M):\n P, Y = map(int, input().split())\n prefectures[P-1].append(Y)\n\n\nfor prefecture, cities in enumerate(prefectures):\n if cities == []:\n continue\n else:\n cities.sort()\n \n for x, c...
['Wrong Answer', 'Accepted']
['s134471659', 's506950963']
[19376.0, 57864.0]
[614.0, 1184.0]
[500, 942]
p03221
u449473917
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 \npref = [[0] for i in range(N+1)]\nimport collections\nq = collections.deque()\n \nfor i in range(M):\n p,y = map(int, input().split())\n pref[p].append(y)\n q.append((p,y))\nfor p in pref:\n p.sort()\n \nprint(q)\nimport bisect\n...
['Wrong Answer', 'Accepted']
['s830235786', 's934252303']
[36304.0, 31084.0]
[626.0, 431.0]
[387, 363]
p03221
u450339194
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\ncounts = defaultdict(int)\nnumbers = {}\n\ncities = []\nfor i in range(M):\n p, y = map(int, input().split())\n cities.append([i, p, y])\n\nsorted_cities = sorted(cities, key=lambda x: x[2])\nfor city in sorted_cities:\n i, p, y = city\n counts[p] += 1\n numbers[i] =...
['Runtime Error', 'Accepted']
['s420439946', 's577980363']
[3064.0, 47324.0]
[17.0, 654.0]
[387, 423]
p03221
u450904670
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 = list(map(int, input().split()))\ncities = defaultdict(list)\ncities = [ list(map(int, input().split())) for _ in range(m)]\nsorted = sorted(\n cities,\n key = lambda x: (x[0], x[1])\n)\nhoge = 0\nfirst_code = 0\nfuga = 0\nsecond_code = 0\nfor city in sorted:\n if(hoge < c...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s041613435', 's869488246', 's928349409', 's449163407']
[36520.0, 36932.0, 3064.0, 101064.0]
[793.0, 804.0, 18.0, 1107.0]
[521, 519, 485, 537]
p03221
u452284862
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\n\nfor i in range(M):\n p,y = map(int,input().split())\n P.append(p)\n Y.append(y)\n\nA = [0]*M\nC = [0]*M\n\nB = [0]*M\nfor i in range(M):\n B[i] = Y[i]*100000+i\n\nB.sort()\n\nfor i in range(M):\n d = B[i] % 100000\n k = P[d] - 1\n\n C[d] =...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s564886535', 's860448536', 's267429376']
[22516.0, 4596.0, 21820.0]
[491.0, 20.0, 546.0]
[373, 347, 347]
p03221
u454524105
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())\nl = []\nfor _ in range(m):\n l.append([int(x) for x in input().split()])\nd = {}\nfor i in range(m):\n k = str(l[i][0])\n if k not in d.keys():\n d[k] = 1\n else:\n d[k] += 1\n print(k.zfill(6) + str(d[k]).zfill(6))', 'import bisect as bis\nn, m =...
['Wrong Answer', 'Accepted']
['s331716531', 's307220144']
[36352.0, 24120.0]
[558.0, 657.0]
[275, 419]
p03221
u455317716
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\np_y_list = []\ny_count = [1]*(M+1)\n\nfor i in range(M):\n p_y_list.append([int(x) for x in input().split()])\n p_y_list[i].append(i)\np_y_list.sort(key = lambda x:x[1])\n\nfor i in p_y_list:\n i[1] = y_count[i[0]]\n y_count[i[0]] += 1\n\np_y_list.sort(key = lamb...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s172701799', 's230958973', 's360296851', 's817284172', 's669731582']
[26908.0, 26536.0, 3828.0, 29036.0, 26684.0]
[515.0, 708.0, 19.0, 790.0, 768.0]
[395, 384, 384, 614, 384]
p03221
u456033454
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...
['ken_num, city_num = map(int,input().split())\ncity_list = [None for _ in range(city_num)]\nken_list = [1 for _ in range(ken_num+1)]\nid_list = [None for _ in range(city_num)]\nfor index in range(city_num):\n city_list[index] = list(map(int,input().split()))\n city_list[index].append(index)\ncity_list = sorted(c...
['Wrong Answer', 'Accepted']
['s484936358', 's640649152']
[44084.0, 41852.0]
[676.0, 768.0]
[503, 523]
p03221
u456353530
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...
['Data = list(map(int, input().split()))\nN = Data[0]\nM = Data[1]\ndel(Data)\nData = []\nfor i in range(M):\n Data.append(list(map(int, input().split())))\nData.sort()\nCnt = 0\nNum = 0\nStr = ""\nfor i in range(M):\n if Num == Data[i][0]:\n Cnt += 1\n else:\n Cnt = 1\n Num = Data[i][0]\n Str = format(Num...
['Wrong Answer', 'Accepted']
['s472750091', 's868228921']
[28816.0, 35480.0]
[830.0, 832.0]
[343, 425]
p03221
u457683760
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()]\nP=[[int(i) for i in input().split()] for j in range(m)]\n\ndef prefecturesort(i):\n return i[0]\n\ndef yearsort(i):\n return i[1]\n\nW=[0 for i in range(n)]\nZ=[]\n\nfor i in range(m):\n P[i].append(i)\n W[P[i][0]]+=1\n\nP.sort(key=prefecturesort)\nP_c=[]\nsum=0\nfor...
['Runtime Error', 'Runtime Error', 'Accepted']
['s151001916', 's309305212', 's447898195']
[52880.0, 26820.0, 53500.0]
[1273.0, 426.0, 1263.0]
[657, 591, 663]
p03221
u463655976
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(N)]\n\nPY = sorted(PY)\n\nkeyP = -1\nfor P, Y in PY:\n if keyP != P:\n keyP = P\n keyNo = 1\n\n print("{:0>6}{:0>6}", keyP, keyNo)\n keyNo += 1\n', 'N, M = map(int, input().split())\nPY = [list(map(int, input().split())) f...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s576700774', 's758525523', 's229813552']
[30092.0, 28832.0, 39348.0]
[711.0, 661.0, 824.0]
[228, 235, 327]
p03221
u463775490
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 = [[] for _ in range(n+1)]\nfor i in range(m):\n p,y = map(int,input().split())\n s[p].append([y,i])\ns[p].sort()\nans = ['']*m\nfor p in range(1,n+1):\n cnt = 1\n for (y,i) in s[p]:\n ans[i] = '{:06}{:06}'.format(p,cnt)\n cnt += 1\nprint(' '.join(ans))", "n...
['Wrong Answer', 'Accepted']
['s388752787', 's168684615']
[41416.0, 39088.0]
[613.0, 708.0]
[301, 319]
p03221
u470208427
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()))\na = [[] for i in range(n+1)]\nb = []\nfor i in range(m):\n p,s = list(map(int,input().split()))\n a[p].append(s)\n b.append([p,s])\nprint(a)\nfor i in range(n+1):\n a[i].sort()\nprint(a)\nfor i in range(m):\n ken = b[i][0]\n si = a[ken].index(b[i][1]) +1\n ke...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s012304314', 's134258949', 's788408954']
[41200.0, 43000.0, 38920.0]
[2105.0, 602.0, 840.0]
[380, 371, 420]
p03221
u471828790
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\nimport sys\n#input = sys.stdin.readline().strip\nN, M = map(int, input().split())\nclist = []\nHQ = [[] for _ in range(N)]\nfor i in range(M):\n p, y = map(int, input().split())\n clist.append((p, y))\n heapq.heappush(HQ[p - 1], y)\nprint(HQ)\n\ncmap = {}\nfor p, q in enumerate(HQ):\n cnt = ...
['Wrong Answer', 'Accepted']
['s242098242', 's536030238']
[45856.0, 43240.0]
[910.0, 841.0]
[524, 514]
p03221
u473530997
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\nclass City:\n def __init__(self, index, pref, time):\n self.index = index\n self.pref = pref\n self.time = time\n self.sort_res = None\n def get_id(self):\n str1 = "0"*(6-len(str(self.pref)))+str(self.pref)\n str2 = "0"*(6-len(str(self.sort_res)))+str(self.sort_res)\n return str1 + ...
['Runtime Error', 'Accepted']
['s893229141', 's583213649']
[3064.0, 52592.0]
[18.0, 927.0]
[892, 1047]
p03221
u474270503
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=list(sorted(PY))\nls=[]\ncurrent=0\nct=1\nfor i in range(M):\n s1=str(PY[i][0])\n s2=''\n for j in range(6-len(s1)):\n s2+='0'\n s3=s2+s1\n\n if current==PY[i][0]:\n ct+=1\n else:\n ct=...
['Wrong Answer', 'Accepted']
['s915827678', 's766429145']
[41420.0, 43880.0]
[964.0, 1090.0]
[489, 522]
p03221
u476124554
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,y = [],[]\nfor i in range(m):\n v1,v2 = map(int,input().split())\n p.append(v1)\n y.append(v2)\n \npy = zip(p,y,range(m))\npy = sorted(py)\np,y,index = zip(*py)\n \nans = []\nstart = p[0]\ncount = 1\nfor i in range(m):\n if start == p[i]:\n ans.append(str(p[i])....
['Runtime Error', 'Accepted']
['s670554191', 's714454907']
[31484.0, 44972.0]
[620.0, 867.0]
[572, 571]
p03221
u476435125
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=list(map(int,input().split()))\n#n=nm[0]\n#m=nm[1]\nn,m=map(int,input().split())\n#py=[]\ny=[]\n#py=[[[]]*m]\npy=[[]]*m\n#y=[[]]*n\n#print(py)\n\n# py.append([])\nfor i in range (n):\n y.append([])\nfor i in range(m):\n py[i]=list(map(int,input().split()))\n y[py[i][0]-1].append(py[i][1])\nfor i in ra...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s010920811', 's260318539', 's890511491', 's775706958']
[47428.0, 31004.0, 44000.0, 47448.0]
[750.0, 2109.0, 2106.0, 720.0]
[994, 870, 863, 994]
p03221
u477855214
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 _ in range(M):\n py.append(list(map(int, input().split())))\nd = {}\nnow = 0\nnum = 0\nfor p, y in sorted(py):\n if now != p:\n now = p\n num = 1\n d[(p, y)] = num\n num += 1\nfor p, y in py:\n print('{0:6}{0:6}'.format(p, d[(p, y)]))", "N, M...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s407557610', 's863374925', 's788732125']
[45836.0, 45832.0, 45836.0]
[762.0, 747.0, 756.0]
[296, 298, 298]
p03221
u480200603
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())\ncity = [[0] for _ in range(n)]\nbuffer = []\n\nfor i in range(m):\n p, y = map(int, input().split())\n buffer.append(list([p, y]))\n city[p - 1].append(y)\n\nfor i in range(n):\n city[i].sort()\n\nfor i in range(m):\n p, y = ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s231234648', 's962313169', 's251547632']
[3064.0, 37372.0, 35220.0]
[17.0, 646.0, 549.0]
[376, 451, 329]
p03221
u485716382
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 \n \n \n\n N, M = map(int, input().split())\n # PY = []\n # for _ in range(M):\n # a = list(map(int, input().split()))\n # PY.append(a)\n PY = [list(map(int, input().split())) for _ in range(M)]\n PY_sorted = sorted(PY, key=lambda x: x[1])\n\n city_count = {}\n order = {}\n for i, (...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s163197459', 's693509299', 's835033595', 's056954062']
[51824.0, 51828.0, 54016.0, 44484.0]
[725.0, 734.0, 616.0, 747.0]
[770, 703, 771, 385]
p03221
u493520238
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,m = map(int, input().split())\npyl = [ [] for _ in range(n+1) ]\n\nfor i in range(m):\n p,y = map(int, input().split())\n pyl[p].append((y,i))\n\nans = ['']*m\nfor p, yil in enumerate(pyl):\n top = str(p).zfill(6)\n yil.sort()\n for order,(y,i) in enumerate(yil):\n print(order,i)\n bo...
['Wrong Answer', 'Accepted']
['s906908562', 's961624241']
[39076.0, 39000.0]
[502.0, 448.0]
[412, 389]
p03221
u494058663
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())\nprefecture = [[] for i in range(N+1)]\nans = []\nfor i in range(M):\n p,y = map(int,input().split())\n prefecture[p].append([y,i])\n prefecture[p].sort()\nfor i in range(1,N+1):\n tmp_p = str(i)\n while(len(tmp_p)!=6):\n tmp_p = '0'+tmp_p\n for j in range(1,le...
['Wrong Answer', 'Accepted']
['s737864983', 's401407691']
[58244.0, 45388.0]
[2105.0, 893.0]
[613, 452]
p03221
u496744988
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\ncities = sorted(([list(map(int, input().split())) + [i] for i in range(m)]))\nprint(cities)\npref = cities[0]\ncounter = 1\nfor city in cities:\n if pref != city[0]:\n counter = 1\n pref = city[0]\n rank = counter\n number = str(pref).zfill(6) + str(rank).zfill(6...
['Wrong Answer', 'Accepted']
['s458853963', 's929305486']
[39372.0, 35376.0]
[913.0, 848.0]
[431, 417]
p03221
u499966353
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 = []\nfor i in range(m):\n p, y = map(int, input().split())\n ps.append([p, y, i+1])\n\nps = sorted(ps)\nps\n\nans = []\ncount = 1\nfor i in range(m):\n if (i != 0 and (ps[i])[0] != (ps[i-1])[0]):\n count = 1\n else:\n pass\n ans.append([(ps[i])[2], 10...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s848025865', 's895040222', 's710158596']
[39484.0, 39484.0, 39484.0]
[908.0, 1005.0, 889.0]
[435, 435, 436]
p03221
u500297289
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\nl = [[] for _ in range(N + 1)]\n\nfor py in PY:\n l[py[0]].append(py[1])\n\nfor py in PY:\n l[py[0]].sort()\n\nfor py in PY:\n print('{:0>7}'.format(py[0]) + '{:0>7}'.format(l[py[0]].index(py[1]) + 1))\n", "N, M = m...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s059861487', 's499436753', 's752934200', 's341856845']
[36148.0, 36136.0, 36368.0, 24740.0]
[2106.0, 2106.0, 2106.0, 730.0]
[293, 292, 292, 356]
p03221
u501451051
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\nlis = []\nfor i in range(m):\n a = list(map(int, input().split()))\n a.append(i)\n lis.append(a)\nprint(lis)\n\nt = 1\ntmp = sorted(lis)[0][0]\n\nnlis =[]\n\nfor i in sorted(lis):\n if tmp == i[0]:\n a = str(i[0])\n left = a.zfill(6)\n right = str(...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s319381610', 's346084329', 's786448573', 's142344805']
[46928.0, 28368.0, 31772.0, 46784.0]
[801.0, 561.0, 773.0, 821.0]
[516, 415, 446, 506]
p03221
u502314533
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())\nyears = []\nfor i in range(1,M+1):\n p,y = map(int,input().split())\n years.append((p,y,i))\n\nprefectureOrdering = [1] * (10 ** 5 + 1)\ninputOrdering = [False] * (10 ** 5 + 1)\n\nyears.sort()\n\nprint(years)\nfor i in years:\n s = ""\n s += "0" * (6 - len(str(i[0]))) + str...
['Wrong Answer', 'Accepted']
['s036382971', 's203217882']
[32668.0, 29820.0]
[720.0, 717.0]
[505, 492]
p03221
u502731482
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, m = map(int, input().split())\ndata = [[] for _ in range(n)]\nfor i in range(m):\n p, y = map(int, input().split())\n data[p - 1].append([y, i])\n\nans = [None] * m\nfor i in range(n):\n data[i].sort()\n for j in range(len(data[i])):\n y, k = data[i][j]\n print(k)\n ans[k] = '0'...
['Wrong Answer', 'Accepted']
['s152962655', 's554643878']
[39908.0, 39088.0]
[936.0, 895.0]
[430, 413]
p03221
u504562455
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()]\ncity = []\npref = [0 for i in range(n)]\nfor i in range(m):\n p, y = [int(_) for _ in input().split()]\n pref[p-1] += 1\n city.append([p,y,i])\n\ncity.sort(key = lambda x: (x[0], x[1]))\ncnt = 1\nfor i in range(m):\n city[i].append(cnt)\n if cnt == pref[city[i]...
['Wrong Answer', 'Accepted']
['s226235541', 's661809135']
[36376.0, 36272.0]
[869.0, 856.0]
[469, 468]
p03221
u505420467
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=[]\nfor i in range(m):\n a,b=map(int,input().split())\n p.append([i,a,b,0])\nps=sorted(p,key=lambda i:(i[1],i[2]))\ncnt=1\nprint(ps)\nfor i in range(m):\n if i!=0:\n if ps[i][1]==ps[i-1][1]:\n print("aaa")\n cnt+=1\n ps[i][3]=cnt\n ...
['Wrong Answer', 'Accepted']
['s817658557', 's024525998']
[49256.0, 35104.0]
[1123.0, 912.0]
[554, 509]
p03221
u506689504
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())\ncities = {}\nP = {}\nY = []\nfor i in range(M):\n p,y = map(int, input().split())\n cities[i] = (p,y)\n Y.append(y)\n\nsorted_Y = sorted(Y)\nsorted_P = {p:sorted(P[p].items(), key=lambda x:x[1]) for p in P}\n\nP_i = np.zeros(N)\nans = {}\nfor i in sorted_...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s265647120', 's528936679', 's546019895', 's855092420', 's662350373']
[38276.0, 52292.0, 56024.0, 3064.0, 29376.0]
[2113.0, 769.0, 789.0, 17.0, 677.0]
[422, 376, 360, 759, 775]
p03221
u506910932
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())\n\n\norder = []\npre = [[0] for _ in range(n + 1)]\n\nfor i in range(m):\n p, y = map(int, input().split())\n order.append([p, y])\n pre[p].append(y)\n\n\nfor i in range(n + 1):\n pre[p].sort()\n\n順に,各県の何番目かをにぶたんで探す', "from collections import defaultdict\nn,...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s026858995', 's519006432', 's988654722', 's519089528']
[35880.0, 43564.0, 35704.0, 43800.0]
[2206.0, 419.0, 2206.0, 448.0]
[343, 377, 461, 395]
p03221
u513081876
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 = [[] for i in range(M)]\nans = [""] * M\nnum = [0] * M\nfor i in range(M):\n ken, year = map(int, input().split())\n data[i] = [ken, year, i]\n \ndata.sort(key=lambda x:x[1])\n\nfor p, y, i in data:\n num[p-1] += 1\n ans[i] = str(p).zfill(6) + str(num[p-1]).zfill...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s010168535', 's416736957', 's474187722', 's637665826', 's566995558']
[30896.0, 32164.0, 32176.0, 3064.0, 32160.0]
[562.0, 619.0, 663.0, 17.0, 630.0]
[340, 337, 345, 326, 337]
p03221
u513434790
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\nfrom itertools import accumulate\n\nN, M = map(int, input().split())\nP = []\np = [0] * (N+1)\nfor i in range(M):\n p1, y1 = map(str, input().split())\n p[int(p1)] += 1\n P.append(int(p1+y1.rjust(10,"0")))\n \nans = np.argsort(P)\nans = np.argsort(ans)\np = list(accumulate(p))\n\nfor i...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s022449731', 's060377171', 's610915692', 's382544903']
[22184.0, 22268.0, 51756.0, 22800.0]
[581.0, 567.0, 2022.0, 1453.0]
[412, 416, 622, 413]
p03221
u515052479
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 = []\nbase_1 = []\nkey = {}\nans_str = []\nans_n = []\n\nfor i in range(m):\n p,y = map(int,input().split())\n base.append([p,y])\n base_1.append([p,y])\n \nbase_1.sort(key = lambda x:x[1])\n\nfor i in range(m):\n p_str = str(base_1[i][0])\n len_p = len(list(p_str))\n temp ...
['Wrong Answer', 'Accepted']
['s624858344', 's241282745']
[45108.0, 47152.0]
[942.0, 1013.0]
[628, 690]
p03221
u518042385
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 p,y=map(int,input().split())\n l.append([y,i,p])\nl=sorted(l)\nl1=[0 for i in range(n+1)] \nl2=[[] for i in range(m)] #shi\nfor i in range(m):\n l1[l[i][2]]+=1\n l2[l[i][1]]=[l1[l[i][2]],l[i][2]]\nfor i in range(m):\n w=""\n w+="0"*(6-len(str(l[i][1])))+s...
['Wrong Answer', 'Accepted']
['s113473077', 's260338776']
[38308.0, 39632.0]
[969.0, 900.0]
[400, 402]
p03221
u518375128
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\ndef main():\n N,M = list(map(int, input().split()))\n lst = []\n anslst = []\n for i in range(M):\n P,Y = list(map(int, input().split()))\n lst.append({'city_id':i, 'pref':P, 'year':Y})\n print(lst)\n for i in range(N):\n tmp = [ d for d in lst...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s187263888', 's552540662', 's660968674', 's238814900']
[115488.0, 99560.0, 99520.0, 99504.0]
[2107.0, 898.0, 887.0, 1075.0]
[866, 761, 759, 811]
p03221
u521323621
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...
['t=input()\nN=int(t.split()[0])\nM=int(t.split()[1])\n\ncity=[0]*M\nfor i in range(M):\n te=[int(x) for x in input().split()]\n city[i]={\'i\':i+1,\'p\':int(te[0]),\'y\':int(te[1])}\n\ncity_sorted = sorted(city,key = lambda x: (x[\'p\'], x[\'y\']))\n\nx=0\ntemp_p=city_sorted[0][\'p\']\nfor c in city_sorted:\n if te...
['Wrong Answer', 'Accepted']
['s191464063', 's623143135']
[52304.0, 52020.0]
[810.0, 772.0]
[452, 434]
p03221
u527261492
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=[]\nfor i in range(m):\n p,y=map(int,input().split())\n lst.append([p,y])\nlst.sort(lambda x:(x[0],x[1]))\nj=1\nfor i in range(m):\n if lst[i][0]==lst[min(m-1,i+1)][0]:\n s=str(lst[i][0])\n t=str(j)\n s.zfill(6)\n t.zfill(6)\n u=s+t\n j+=1\n print(int(u))\n e...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s314427640', 's344649725', 's444767814', 's490666095', 's544383447', 's556533226', 's621586971', 's689541952', 's772874994', 's795147145', 's867135013', 's875273773', 's877887486', 's432733405']
[19628.0, 28480.0, 39840.0, 21268.0, 27656.0, 19620.0, 27652.0, 27644.0, 27652.0, 27632.0, 19616.0, 22792.0, 19616.0, 41376.0]
[334.0, 631.0, 744.0, 553.0, 559.0, 336.0, 521.0, 505.0, 553.0, 545.0, 330.0, 345.0, 332.0, 955.0]
[418, 325, 488, 440, 419, 453, 405, 339, 382, 427, 311, 484, 394, 492]
p03221
u529012223
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\n\nN, M = map(int, input().split())\nP = [list(map(int, input().split())) for i in range(M)]\n\nans = collections.defaultdict(list)\n\nfor p, y in sorted(P):\n ans[p] += [y]\nfor p, y in P:\n print("%06d%06d"%(p, bisect.bisect(a[p], y)))', 'import collections\nimport bisect\n\n...
['Runtime Error', 'Accepted']
['s458983157', 's681438050']
[43324.0, 43324.0]
[541.0, 765.0]
[266, 268]
p03221
u530110933
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\nimport itertools\nimport math\n\nN,M=[int(x) for x in input().split()]\nC=[[int(x) for x in input().split()] for i in range(M)]\n\nps=dict()\nfor c,(p,y) in enumerate(C):\n if not p in ps:\n ps[p]=[]\n ps[p].append((y,c))\n\nqs=[]\nfor p,cs in ps.items():\n cs.so...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s000359030', 's405951692', 's541507806']
[57792.0, 57792.0, 57792.0]
[833.0, 776.0, 818.0]
[426, 426, 426]
p03221
u535907456
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\nL = list(map(int,input().split()))\nN = L[0]\nM = L[1]\nP = list()\nY = list()\nS = list()\nfor x in range(0,N):\n S.append(list())\nfor x in range(0,M):\n X = list(map(int,input().split()))\n P.append(X[0])\n Y.append(X[1])\n S[X[0]-1].append(X[1])\nfor y in range(0,M):\n ...
['Wrong Answer', 'Accepted']
['s320239432', 's225133384']
[30224.0, 30416.0]
[777.0, 864.0]
[524, 558]
p03221
u538381753
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 = [int(x) for x in input().split(' ')]\npy = [tuple(input().split(' ')) for _ in range(m)]\n\nd = defaultdict(list)\n\nfor x, y in py:\n d[x].append(int(y))\n\nans = {}\n\nfor k, v in d.items():\n print(k, v)\n for i, x in enumerate(sorted(v), start=1):\n an...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s477506126', 's977346071', 's022344669']
[73108.0, 40476.0, 71508.0]
[983.0, 587.0, 751.0]
[381, 361, 370]
p03221
u540761833
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([p,y,i])\nPY.sort()\nprint(PY)\n\nans = [0 for i in range(M)]\nc = 1\nd = 0\nfor i in range(M):\n \n if c == PY[i][0]:\n d += 1\n else:\n c = PY[i][0]\n d = 1\n ans[PY[i][2]]...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s028823786', 's190602736', 's747335921', 's346934469']
[33932.0, 31444.0, 21336.0, 24700.0]
[781.0, 764.0, 2105.0, 792.0]
[411, 402, 721, 487]
p03221
u540815635
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 zeroPadding(num):\n return "%06d"%num\n\nclass Row:\n def __init__(self, i, pref_id, year):\n self.i = i\n self.pref_id = pref_id\n self.year = year\n self.city_id = -1\n \n def __str__(self):\n return "{i: %d, pref_id: %d, year: %d, city_id: %d}"%(self.i, self.p...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s205489945', 's259817505', 's549445128', 's884078275', 's772785067']
[3064.0, 3064.0, 3064.0, 57324.0, 50252.0]
[17.0, 17.0, 17.0, 649.0, 1029.0]
[1133, 1132, 1153, 1155, 1181]
p03221
u543954314
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 = [tuple(map(int,input().split())) for _ in range(m)]\nd = [list() for _ in range(n)]\nfor x in l:\n d[x[0]-1].append(x[1])\nfor r in d:\n r.sort()\nfor x in l:\n p = x[0]\n y = d[x[0]-1].index(x[1]) + 1\n print("{:06}{:06}".format(p,y)', 'n,m = map(int,input().split())\nl = [tu...
['Runtime Error', 'Accepted']
['s207866144', 's039562925']
[3064.0, 67104.0]
[17.0, 809.0]
[265, 349]