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
u545368057
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nPs = [[] for _ in range(N)]\nfor i in range(M):\n j, Y = map(int,input().split())\n Ps[j-1].append([i,Y])\nprint(Ps)\nrets = [""]*M\nfor i,P in enumerate(Ps):\n if len(P)==0:\n continue\n inds = np.array(P)[:,0]\n years = np.array(P)[:,1]\n ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s258640118', 's419900397', 's829802930', 's082610222']
[51916.0, 155432.0, 46316.0, 38444.0]
[2109.0, 2105.0, 2110.0, 648.0]
[454, 419, 545, 425]
p03221
u546338822
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 import bisect\n n,m = map(int,input().split())\n d = [[] for i in range(n)]\n ans = [0 for i in range(m)]\n for i in range(m):\n p,y = map(int,input().split())\n d[p-1].append((y,i))\n for i,d_ in enumerate(d):\n d_.sort()\n for c, d__ in enumerate(d_):\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s237819953', 's892574667', 's276384944']
[38788.0, 39640.0, 38808.0]
[409.0, 2210.0, 407.0]
[454, 640, 452]
p03221
u549383771
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\ntmpsort = [[0]for i in range(n)]\np_list = []\ny_list = []\n\nfor i in range(m):\n p,y = map(int,input().split())\n tmpsort[p-1].append(y)\n p_list.append(p)\n y_list.append(y)\n\nfor i in range(m):\n tmpsort[i].sort()\nfor i in range(len(p_list)):\n idx = tmpsort[p...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s029981818', 's557990803', 's910091018', 's400800125']
[25156.0, 13000.0, 48276.0, 35944.0]
[2105.0, 2104.0, 2106.0, 595.0]
[388, 373, 449, 333]
p03221
u552357043
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['N, M = map(int, input().split())\nfrom collections import defaultdict\nd = defaultdict(list)\nl = [[] for i in range(M)]\nfor i in range(M):\n P,Y = map(str, input().split())\n P = "0" * len(P) + P\n d[P].append(int(Y))\n l[i] = [P,int(Y)]\nfor i in range(M):\n tmp = str((sorted(d[l[i][0]]).index(l[i][...
['Wrong Answer', 'Accepted']
['s233369026', 's461729417']
[45120.0, 58804.0]
[2105.0, 966.0]
[361, 461]
p03221
u557494880
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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)]\nB = []\nd = {}\nfor i in range(M):\n p,y = map(int,input().split())\n B.append((p,y))\n A[p].append(y)\nfor i in range(N+1):\n A[i].sorted\n n = len(A[i])\n for j in range(n):\n d[A[i][j]] = j+1\nfor i in range(M):\n p,y = B[i]\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s701664696', 's937026145', 's774948792']
[28220.0, 28220.0, 37548.0]
[381.0, 391.0, 705.0]
[406, 421, 422]
p03221
u559103167
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = [list(map(int,input().split())) for i in range(m)]\na = collections.defaultdict(list)\nfor x,y in sorted(p):\n a[x]+=[y]\nfor x,y in p:\n print("%06d%06d"%(x,bisect.bisect(a[x],y))', 'n, m = map(int, input().split())\np = [list(map(int, input()...
['Runtime Error', 'Runtime Error', 'Accepted']
['s449539389', 's822836793', 's085963836']
[2940.0, 2940.0, 43324.0]
[17.0, 17.0, 701.0]
[246, 183, 247]
p03221
u569742427
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\n\nN,M=map(int,input().split())\nP=[]\nY=[]\nfor _ in range(M):\n data=[int(_) for _ in input().split()]\n P.append(data[0])\n Y.append(data[1])\n\ny=[]\nfor x in range(1,N+1):\n for m in range(M):\n if P[m]==x:\n y.append(Y[m])\n\n ind=numpy.array(y)\n ind=ind.argsort...
['Wrong Answer', 'Accepted']
['s960967266', 's999905465']
[22024.0, 24492.0]
[2109.0, 738.0]
[477, 417]
p03221
u573970531
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['n,m=list(map(int,input().split()))\ncity=[]\nfor i in range(m):\n city.append(list(map(int,input().split())))\ncity.sort()\nans=[]\ncount=0\nprecity=city[0][0]\nfor i in city:\n if i[0]==precity:\n count+=1\n else:\n count=1\n ans.append(str(i[0]).zfill(6)+str(count).zfill(6))\nans.sort()\nf...
['Wrong Answer', 'Accepted']
['s172098351', 's070998854']
[36496.0, 41416.0]
[659.0, 936.0]
[328, 363]
p03221
u575431498
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\n\nN, M = map(int, input().split())\n\nP = []\nY = []\nPY = [[] for _ in range(N+1)]\n\nfor _ in range(M):\n p, y = map(int, input().split())\n P.append(p)\n Y.append(y)\n PY[p].append(y)\n\nfor i in range(M+1):\n PY[i].sort()\n\nfor i in range(M):\n x = bisect_left(PY...
['Runtime Error', 'Accepted']
['s821586459', 's250557503']
[24116.0, 31676.0]
[636.0, 708.0]
[351, 385]
p03221
u576357314
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nken=[0 for i in range(n)]\nfor i in range(m):\n p,y=map(int,input().split())\n ken[p-1]+=1\nken0=[]\nfor i in range(n):\n for j in range(ken[i]):\n mae=str(i+1)\n ato=str(j+1)\n while len(mae)<6:\n mae='0'+mae\n while len(ato)<6:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s314163722', 's980790211', 's701560357']
[12328.0, 44624.0, 48792.0]
[597.0, 2106.0, 1213.0]
[376, 640, 494]
p03221
u578850957
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nimport bisect\n\nN_ken,M_si = map(int,input().split())\nken_year_map = {}\nfor i in range(1,N_ken+1):ken_year_map[i]=[]\n\nken_list = [0]*M_si\nyear_list = [0]*M_si\n\nfor si in range(M_si):\n ken_list[si],year_list[si] = map(int,input().split())\n ken_year_map[ken_list[s...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s255242630', 's347362671', 's367119652', 's872305272', 's934041806', 's212089892']
[31208.0, 2940.0, 29028.0, 3064.0, 31208.0, 32616.0]
[263.0, 17.0, 244.0, 17.0, 284.0, 492.0]
[499, 485, 527, 451, 485, 510]
p03221
u580362735
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = []\nindex = range(1,M+1)\nfor i in range(M):\n a,b= map(int,input().split())\n P.append(a)\n Y.append(b)\nfor i in range(1,N+1):\n a = [j for j, x in enumerate(P) if x == i]\n for p in range(len(a)+1,1,-1):\n print('{0:04d}'.format(i)+'{0:04d}'.format(p...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s079938736', 's101075629', 's615479816', 's682775989', 's832348726', 's875142105']
[22096.0, 3064.0, 56524.0, 24264.0, 22432.0, 53684.0]
[2109.0, 17.0, 1461.0, 697.0, 679.0, 1416.0]
[310, 319, 399, 273, 273, 382]
p03221
u580697892
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['#coding: utf-8\nfrom copy import deepcopy\n\n\ndef main():\n N, M = map(int, input().split())\n p_dict = {}\n for i in range(M):\n p, y = map(int, input().split())\n if p not in p_dict.keys():\n p_dict[p] = [[y, p, i]]\n else:\n \n p_dict[p].append([y, p,...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s416665449', 's832865813', 's203857006']
[61236.0, 2940.0, 47404.0]
[1013.0, 17.0, 806.0]
[856, 597, 621]
p03221
u581187895
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nimport collections, bisect\n\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]\nfor x, y in sorted(p):\n z = bisect.bisect(a[x], y)\n print("%06d%06d"%(x,z))...
['Wrong Answer', 'Accepted']
['s748091163', 's803751605']
[41112.0, 43328.0]
[603.0, 721.0]
[310, 306]
p03221
u584174687
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nif __name__ == \'__main__\':\n ken_num, city_num = list(map(int, input().split()))\n data = [list(map(int, input().split())).append(i) for i in range(city_num)]\n\n \n # data = [[1,32,0], [2,63,1],[1,12,2]]\n\n data = sorted(data, key=lambda x: (x[0], x[1]))\n\n count = 1\n ken_num = 1\n a...
['Runtime Error', 'Accepted']
['s201032986', 's245155366']
[4800.0, 46236.0]
[309.0, 866.0]
[670, 663]
p03221
u589432040
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 \tl.append(list(map(int, input().split())))\n\ndef FillZero(num,f=6):\n s = ""\n s += (f - len(str(num))) * "0"\n s += str(num)\n return(s)\n\nfor i in range(M):\n l[i].append(i)\n\nl = sorted(l, key = lambda x:(x[0],x[1]))\n\nkey0 = l[0][...
['Runtime Error', 'Runtime Error', 'Accepted']
['s675604342', 's745771668', 's636112148']
[3064.0, 3064.0, 39444.0]
[18.0, 18.0, 897.0]
[568, 464, 574]
p03221
u593019570
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\n\nc = [[] for i in range(a)]\nfor _ in range(b):\n f,g = map(int,input().split())\n c[f - 1].append(g)\n\nd = c.copy()\n\n\nfor i in range(a):\n if c[i] != []:\n c[i].sort()\n\n#print(c)\nh = []\nx =''\ny = ''\nfor j in range(a): \n x = str(j + 1)\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s046521906', 's929031566', 's546702114']
[20144.0, 100452.0, 32776.0]
[2104.0, 2108.0, 734.0]
[611, 531, 434]
p03221
u593567568
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
["import sys\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\n\n\n\n\nN, M = map(int, input().split())\nPY = [[int(x) for x in input().split()] for _ in range(M)]\n\nPREFECTURE = defaultdict(list)\nfor p, y in PY:\n PREFECTURE[p].append(y)\n\nprint(PREFECTURE)\n\nfor i in PREFECTURE.keys():\n ...
['Wrong Answer', 'Accepted']
['s934972998', 's296516618']
[61500.0, 59580.0]
[838.0, 757.0]
[495, 476]
p03221
u594244257
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nimport heapq\n\ndef solve():\n N,M = map(int, input().split())\n cities_in_prefecture = [[] for _ in range(N)]\n city_ids = []\n for _ in range(M):\n P,Y = map(int, input().split())\n x = bisect_left(cities_in_prefecture[P-1], Y)\n heapq.heappush(cities...
['Wrong Answer', 'Accepted']
['s348507679', 's351159987']
[22020.0, 32760.0]
[572.0, 615.0]
[407, 545]
p03221
u595289165
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nname = []\ncity = []\nprefecture = [1] * n\nfor i in range(m):\n a = list(map(int, input().split())) + [i+1]\n city.append(a)\n name.append("{}{}".format("0" * (6 - len(str(a[0]))), a[0]))\ncity_1 = sorted(city, key=lambda x: x[0])\ncity_sorted = sorted(city, key=lambda x: x...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s275567046', 's447744542', 's581356224']
[39244.0, 32568.0, 39208.0]
[909.0, 747.0, 942.0]
[495, 408, 509]
p03221
u595353654
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['# -*- coding: utf-8 -*-\nfrom sys import stdin\nfrom operator import itemgetter\n\nN,M = [int(x) for x in stdin.readline().rstrip().split()]\ncounter = 0\ncountry = 1\n\nID = []\n\nfor i in range(M):\n p,y = [int(x) for x in stdin.readline().rstrip().split()]\n ID.append([p,y,i,"no"])\nID.sort(key=itemgetter(0,...
['Wrong Answer', 'Accepted']
['s096355378', 's335933357']
[32416.0, 32408.0]
[671.0, 636.0]
[564, 564]
p03221
u595375942
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
["from collections import defaultdict\n\nn, m = map(int, input().split())\nPY = [tuple(map(int, input().split())) for _ in range(m)]\nypi = sorted((y, p) for i, (p, y) in enumerate(PY))\nd = defaultdict(lambda: 0)\n\nans = [None]*m\n\nfor y, p in ypi:\n d[p] += 1\n ans[i] = str(p).zfill(6) + str(d[p]).zfill(6)\n\...
['Runtime Error', 'Accepted']
['s363474256', 's946314733']
[24872.0, 44088.0]
[439.0, 670.0]
[327, 333]
p03221
u597374218
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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,bisect\nN,M=map(int,input().split())\nPY=[list(map(int,input().split())) for i in range(M)]\nx=collections.defaultdict(list)\nfor city,year in PY:\n x[city]+=[year]\nfor city,year in PY:\n num=bisect.bisect(x[city],year)\n print("%06d%06d"%(city,num))', 'n,m=map(int,input().split())\ncnt=[...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s008253326', 's050286926', 's119256508', 's121414767', 's127698658']
[42492.0, 37136.0, 47148.0, 27396.0, 43332.0]
[653.0, 701.0, 820.0, 339.0, 714.0]
[271, 251, 269, 245, 279]
p03221
u599547273
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['from itertools import groupby\n\nn, m = map(int, input().split(" "))\npy = [list(map(int, input().split(" "))) for _ in range(m)]\n\npy = [py_i + [i] for i, py_i in enumerate(py)]\npy_ = []\nfor key, group in groupby(py, lambda x: x[0]):\n\tfor i, city in enumerate(group):\n\t\tpy_.append(city + [i+1])\npy = sorted(p...
['Wrong Answer', 'Accepted']
['s048051642', 's436494437']
[40784.0, 45644.0]
[632.0, 1004.0]
[399, 456]
p03221
u600402037
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nimport collections\n\nN, M = map(int, input().split())\nPM = [[int(j) for j in input().split()] for i in range(M)]\nA = collections.defaultdict(list)\nfor x, y in sorted(PM):\n A[x] += [y]\nfor x, y in PM:\n z = bisect.bisect(A[x], y)\n print('%06d%06d'%(x,y))", '# coding: utf-8\nimport sys\n\...
['Wrong Answer', 'Accepted']
['s911969132', 's273059815']
[41024.0, 32540.0]
[699.0, 549.0]
[274, 408]
p03221
u603234915
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['import bisect\nN, M = map(int, input().split())\nP, Y = [], []\npref = [[] for _ in range(N+1)] # non-0-indexed\nfor m in range(M):\n p,y = map(int, input().split())\n P.append(p)\n Y.append(y)\nbisect.insort(pref[p], y)\n\n \nfor p,y in zip(P,Y):\n ans = "{:0>6}".format(p)\n i = bisect.bisect(pref[...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s296225147', 's705493089', 's949046996', 's315052983']
[19484.0, 18200.0, 19472.0, 24116.0]
[530.0, 325.0, 563.0, 689.0]
[357, 366, 359, 407]
p03221
u603681803
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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(" "))\n\ncity = []\nPY = []\nfor i in range(M):\n ll = [i] + list(map(int, input().split(" ")))\n # print(ll)\n PY.append(ll)\n\nPY = sorted(PY, key=lambda x: x[2])\nprint(PY)\n\nken = [1]*N\nanswer = []\nfor i in range(M):\n ue6 = "{0:06d}".format(PY[i][1])\n sita6 = "{...
['Wrong Answer', 'Accepted']
['s173346627', 's396035698']
[47352.0, 43380.0]
[1027.0, 951.0]
[486, 488]
p03221
u603958124
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf\nfrom itertools import accumulate,permutations,combinations,product,combinations_with_replacement\nfrom collections import deque,defaultdict,Counter\nfrom bisect import bisect_left,bisect_right\nfrom operato...
['Wrong Answer', 'Accepted']
['s989305806', 's925929467']
[38408.0, 38384.0]
[422.0, 427.0]
[865, 864]
p03221
u604896914
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 math\n\ndef gcd(a,b):\n """Compute the greatest common divisor of a and b"""\n while b > 0:\n a, b = b, a % b\n return a\n\ndef lcm(a, b):\n """Compute the lowest common multiple of a and b"""\n return a * b / gcd(a, b)\n\n\nN,M = list(map(int, input().split(\' \')))\n\nans = []\n\nPs = {...
['Wrong Answer', 'Accepted']
['s938249302', 's932005640']
[137120.0, 41792.0]
[2112.0, 935.0]
[880, 684]
p03221
u606033239
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['n,m=map(int,input().split())\na=[list(map(int,input().split())) for _ in range(m)]\ns=sorted(a,key=lambda x:(x[0],x[1]))\nf=s[0][0]\nd=1\nfor i in range(m):\n if s[i][0]==f:\n s[i][1]==d\n d+=1\n else:\n f=s[i][0]\n d=1\n s[i][1]=d\n d+=1\n\nfor i in range(m):\n z=st...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s088885974', 's572528206', 's896603502']
[36256.0, 37100.0, 36236.0]
[769.0, 812.0, 733.0]
[391, 323, 356]
p03221
u606090886
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = []\nb = []\nfor i in range(n):\n P,Y = map(int,input().split())\n a.append(P)\n b.append(Y)\n\n\n\n\n\ncount = 0\nans = 0\ni = 0\nA = sorted(a)\nwhile True:\n if m-b[a.index(A[i])] > 0:\n m -= b[a.index(A[i])]\n ans += A[i] * b[a.index(A[i])]\n else:\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s340706230', 's855394830', 's398839788']
[12188.0, 41816.0, 39416.0]
[339.0, 1019.0, 918.0]
[595, 537, 528]
p03221
u607865971
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nimport collections\nimport itertools\nimport math\nimport re\nfrom collections import Counter\nfrom collections import deque\nimport bisect\n\n\nMOD = 10 ** 9 + 7\n\nN, M = [int(x) for x in input().split()]\n\n\nKenList = [[] for _ in range(N)]\n\n\nPYlist = [None] * M\nfor i in range(M):\n P, Y = [int...
['Wrong Answer', 'Accepted']
['s923215719', 's937516170']
[39708.0, 38652.0]
[2105.0, 737.0]
[709, 547]
p03221
u610473220
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nPList = [[] for _ in range(N+1)]\n\nfor i in range(M):\n P, Y = map(int, input().split())\n PList[P].append([i , Y])\n\n#print(PList)\n\nans = [0] * M\n\nfor P, l in enumerate(PList):\n if not l:\n continue\n l.sort()\n for j, (i, Y) in enumerate(l):\n an...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s222987831', 's534422800', 's889388281', 's634068616']
[39112.0, 31744.0, 41416.0, 41392.0]
[683.0, 674.0, 715.0, 642.0]
[389, 497, 374, 373]
p03221
u617037231
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = dict()\nfor i in range(N):\n City[i+1] = []\nfor i in range(M):\n Ken,Year = map(int,input().split())\n City[Ken].append(Year)\nfor i in range(N):\n City[i+1].sort()\nfor i in range(1,N+1):\n for el in City[i]:\n el = City[i].index(el)\ndef Zip_code(Ken,ran...
['Wrong Answer', 'Accepted']
['s024433657', 's005237042']
[27872.0, 39984.0]
[2105.0, 933.0]
[593, 647]
p03221
u619455726
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 -*-\nn,m = map(int, input().split())\ni=0\nlst = []\nwhile i < m: \n lst.append(list(map(int, input().split())) + [i])\n i+=1\nlst.sort()\nj=1\n\ni=1\nfor k in lst:\n if i != k[0]:\n i==k[0]\n j=1\n k[1]=i*1000000+j\n else:\n j+=1\n k[1]=i*1000000+j\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s082345939', 's096665645', 's208188562', 's850114497', 's956557579', 's204439552']
[25224.0, 24480.0, 30580.0, 31060.0, 28656.0, 29488.0]
[581.0, 642.0, 405.0, 546.0, 2105.0, 811.0]
[384, 390, 493, 495, 515, 390]
p03221
u620846115
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = [list(map(int,input().splilt())) for i in range(m)]\na=collections.defaultdict(list)\nfor x,y in sorted(p):\n a[x]+=[y]\nfor x,y in p:\n z=bisect.bisect(a[x],y)\n print("%06d%06d"%(x,z))', 'import collections\nimport bisect\nn,m = map(int,i...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s005049747', 's233138010', 's267934399', 's467197538', 's672795964']
[9472.0, 9404.0, 9468.0, 9336.0, 42992.0]
[27.0, 28.0, 27.0, 27.0, 516.0]
[255, 256, 249, 255, 255]
p03221
u620868411
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 -*-\nn,m = map(int, input().split())\nd = {}\nfor i in range(1,m+1):\n p,y = map(int, input().split())\n if p not in d:\n d[p] = []\n d[p].append([y,i])\n\nfor k in d.keys():\n d[k] = sorted(d[k])\n\nret = []\nfor k in d.keys():\n for i in range(len(d[k])):\n idx = i+1...
['Wrong Answer', 'Accepted']
['s847251222', 's424742340']
[48440.0, 83524.0]
[745.0, 1045.0]
[389, 405]
p03221
u623687794
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\ncities=[[] for i in range(n)]\nfor i in range(1,m+1):\n p,y=map(int,input().split())\n cities[p-1].append(y)\n print(format(str(p),"0>6")+format(str(len(cities[p-1])),"0>6"))', 'n,m=map(int,input().split())\ncities=[[] for i in range(n)]\nfor i in range(1,m+1):\n p,y=map(int,input()....
['Wrong Answer', 'Runtime Error', 'Accepted']
['s852488393', 's923995481', 's770156015']
[19120.0, 10288.0, 31004.0]
[1055.0, 35.0, 735.0]
[202, 205, 499]
p03221
u624617831
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = list(map(int, input().split()))\nN, M = n[0], n[1]\n\nimport numpy as np\n\ndef main():\n M_list = []\n y_array = np.array([[10000000000]*M]*N)\n for i in range(M):\n tmp = list(map(int, input().split()))\n M_list.append(tmp[0])\n y_array[tmp[0]-1,i] = tmp[1]\n\n num_array = np.ze...
['Wrong Answer', 'Accepted']
['s103084690', 's500672823']
[50932.0, 31440.0]
[2109.0, 703.0]
[883, 711]
p03221
u625554679
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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(a) for a in input().split()]\nP = []\nY = []\n\nfor _ in range(M):\n p, y = [int(a) for a in input().split()]\n P.append(p)\n Y.append(y)\n\nindex = {}\nid = ["" for _ in range(len(P))]\n\nfor i in np.argsort(Y):\n index[P[i]] = index.get(P[i], 0)\n id[i] = "{0:06d}".fo...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s422365040', 's818922833', 's331229452']
[36280.0, 40728.0, 36368.0]
[759.0, 1109.0, 774.0]
[391, 391, 392]
p03221
u625729943
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = [[i,0] + list(map(int, input().split())) for i in range(M)]\n# [index, nth city, pref num, birth year]\n\nPY.sort(key=lambda x:(x[2],x[3]))\n\np = -1\nfor i,py in enumerate(PY):\n if p != py[3]:\n p = py[3]\n num = 1\n PY[i][1] = num\n else:\n num += 1\n PY[i][1...
['Wrong Answer', 'Accepted']
['s003913431', 's326580258']
[37276.0, 43012.0]
[772.0, 659.0]
[400, 827]
p03221
u626337957
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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((P, Y, i))\nans = ['']*(M)\nprint(L)\nL.sort(key=lambda x:(x[0], x[1]))\nbefore = L[0][0]\nnum = 0\nfor i in range(M):\n if L[i][0] == before:\n num += 1\n id = '{:06d}'.format(L[i][0]) + '{:06d}'.forma...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s537535356', 's874385220', 's998328232', 's496027796']
[33984.0, 29276.0, 29276.0, 29516.0]
[722.0, 660.0, 691.0, 665.0]
[485, 488, 487, 476]
p03221
u626881915
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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=[1]*(n+1)\nc=[]\nfor i in range(m):\n pi,x =map(int, input().split())\n c.append([i+1, pi, x, 0])\n #p[pi].append(x)\n\n\nx_order = sorted(c, key=lambda e: e[2])\nfor e in range(x_order):\n e[3] = p[pi]\n p[pi] += 1\n\ni_order = sorted(x_order)\nfor e in i_order:\n id=e[1]*10000...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s212677941', 's379939588', 's892130337', 's277524014']
[27600.0, 31540.0, 28224.0, 31540.0]
[432.0, 757.0, 438.0, 701.0]
[375, 368, 269, 373]
p03221
u628538573
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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(m):\n\ta.append([int(n) for n in input().split()])\n\ta[i].append(i)\nprint(a)\nb = []\ncounter = 0\ncounter1 = 1\nfor i in range(m):\n\tc = ""\n\tif a[i][0] < 100000:\n\t\tgetlen = len(str(a[i][0]))\n\t\tc = "0" * (6 - getlen) + str(a[i][0])\n\telse:\n\t\tc = ...
['Wrong Answer', 'Accepted']
['s436338169', 's715046074']
[34796.0, 32372.0]
[673.0, 950.0]
[654, 659]
p03221
u629350026
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\ntemp=[0]*m\nfor i in range(0,m):\n p,y=map(int,input().split())\n temp[i]=[i,p,y]\ntemp.sort(key=lambda x: x[2]) \ntemp.sort(key=lambda x: x[1]) \nprint(temp)\nj=1\nn=1\nfor i in range(0,m):\n if temp[i][1]==n:\n tempn=str(n)\n tempj=str(j)\n temp[i][1]=tempn.zfill(6)\n ...
['Wrong Answer', 'Accepted']
['s258926575', 's933016525']
[39404.0, 37448.0]
[874.0, 856.0]
[550, 661]
p03221
u634208461
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\n#include <map>\n#include <algorithm>\n#include <iomanip>\nusing namespace std;\n\nint main()\n{\n int N, M; cin >> N >> M;\n\n vector< pair<int, int> > rawInput(M);\n vector<vector<int> > prifList(N);\n map<pair<int, int>, int> answer;\n\n for(int i = 0; i < M; ++i)\n {\n int P, Y; cin >>...
['Runtime Error', 'Accepted']
['s458488637', 's152221708']
[2940.0, 71248.0]
[17.0, 972.0]
[910, 418]
p03221
u635272634
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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()))\ntmps = [[] for _ in range(n)]\npyxs = []\n\nfor i in range(m):\n p, y = list(map(int, input().split()))\n pyxs.append([p, y, i])\n\npyxs.sort(key = lambda x: x[1])\n\nnum = [0] * (n+1)\nans = []*m\n\nfor p, y, x in pyxs:\n ans[i] = '{:06}'.format(p) + '{:06}'.format(nu...
['Runtime Error', 'Runtime Error', 'Accepted']
['s398999122', 's929898560', 's119394500']
[32108.0, 52788.0, 39620.0]
[468.0, 2106.0, 701.0]
[355, 442, 359]
p03221
u635974378
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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()))\nPYs = {}\nfor _ in range(M):\n p, y = list(map(int, input().split()))\n if p not in PYs:\n PYs[p] = []\n PYs[p].append(y)\n\nfor p in sorted(PYs.keys()):\n str_p = '{}'.format(p).zfill(6)\n for idx, c in enumerate(sorted(PYs[p])):\n print(str_p + '{...
['Wrong Answer', 'Accepted']
['s436124902', 's408126207']
[34960.0, 61196.0]
[760.0, 991.0]
[339, 511]
p03221
u642012866
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nken = [[] for _ in range(N)]\nshi = [tuple(map(int, input().split())) for _ in range(M)]\nfor s1, s2 in shi:\n ken[s1-1].append(s2)\nfor k in ken:\n k.sort()\nfor s1, s2 in shi:\n print("{:06}{:06}".format(s1, ken[s1-1].index(s2+1)))', 'from operator import itemgetter\nN, M ...
['Runtime Error', 'Accepted']
['s441904843', 's181977802']
[28224.0, 29640.0]
[396.0, 627.0]
[268, 383]
p03221
u645250356
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = []\nd = dict()\nfor i in range(M):\n p,y = map(int,input().split())\n py_list.append([p,y])\npy_sorted = sorted(py_list)\np_temp = py_sorted[0][0]\ncount = 1\nfor p,y in py_sorted:\n if p_temp != p:\n p_temp = p\n count = 1\n d[(p,y)] = count\n c...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s160183312', 's472114003', 's608500398', 's646301708', 's417571740']
[38028.0, 34892.0, 38028.0, 42452.0, 52492.0]
[823.0, 741.0, 827.0, 834.0, 900.0]
[442, 432, 442, 441, 764]
p03221
u647213752
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['N, M = map(int, input().split())\np = list()\nd = dict()\nfor i in range(M):\n inp = map(int, input().split())\n p.append(inp)\n if inp[0] in d:\n d[inp[0]].append(inp[1])\n else:\n d[inp[0]] = [inp[1]]\nfor i in d:\n d[i].sort()\nfor i, j in p:\n print("{:06d}{:06d}".format(i, d[i].in...
['Runtime Error', 'Runtime Error', 'Accepted']
['s351517960', 's945520108', 's011238857']
[3064.0, 3064.0, 32248.0]
[17.0, 17.0, 617.0]
[315, 348, 317]
p03221
u649558044
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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] * m, [0] * m\nsort_year = [0] * m\ninitial_index, count_city = [0] * n, [0] * n\ntmp_counter = [0] * n \nfor i in range(m):\n p[i], y[i] = map(int, input().split())\n count_city[p[i] - 1] += 1\nfor j in range(1, n):\n \tinitial_index[j] = initial_index[j] + count_ci...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s279427127', 's579811324', 's998299032', 's238236457']
[15280.0, 15280.0, 19264.0, 24064.0]
[2104.0, 2104.0, 2105.0, 697.0]
[662, 662, 735, 498]
p03221
u652150585
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nl=[list(map(int,input().split())) for _ in range(m)]\nprint(l)\nfor i in range(m):\n n=1\n for j in range(m):\n if l[i][0]==l[j][0] and l[i][1]>l[j][1]:\n n+=1\n print(str('%06d'%l[i][0])+str('%06d'%n))", "import sys\ninp...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s556905196', 's836605308', 's299847174']
[33392.0, 157500.0, 46748.0]
[2105.0, 2106.0, 799.0]
[288, 321, 475]
p03221
u655227110
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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_list = []\nfor i in range(m):\n\tp, y = map(int, input().split())\n\tcity_list.append([i, p, y, 0])\n\nprint(city_list)\ncity_list = sorted(city_list, key = lambda x: x[2])\nprint(city_list)\ncity_list = sorted(city_list, key = lambda x: x[1])\nprint(city_list)\n\nnowp = 1\nin...
['Wrong Answer', 'Accepted']
['s287857147', 's022296713']
[53424.0, 30328.0]
[1185.0, 773.0]
[724, 639]
p03221
u656995812
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\ntmp = [list(map(int, input().split())) for i in range(m)]\ncity = [[] for i in range(n+1)]\nanswers = [''] * m\n\nfor i, (pref, year) in enumerate(tmp):\n city[pref].append([year, i])\nprint(city)\n\nfor i in range(n+1):\n for j, (year, index) in enumerate(sorted(city[i])):\n ...
['Wrong Answer', 'Accepted']
['s244101199', 's869195584']
[58796.0, 56624.0]
[916.0, 803.0]
[410, 398]
p03221
u665038048
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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)]\nans_dict = {}\nans_lst = []\nfor i in range(m):\n if py[i][0] in ans_dict.keys():\n ans_lst.append('{:0=6}'.format(py[i][0]) +\n '{:0=6}'.format(py[i][0]-1))\n print(ans_lst[-1])\n els...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s289192291', 's965776274', 's595241771']
[35960.0, 44464.0, 32972.0]
[515.0, 625.0, 619.0]
[422, 493, 294]
p03221
u665873062
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = []\nfor i in range(M):\n PYlist_ele = list(map(int,input().split()))\n PYlist_ele.append(i+1)\n PYlist.append(PYlist_ele)\nPYlist.sort()\ncheck = 0\ncount = 0\nP_id = []\nfor i in range(M):\n if check == PYlist[i][0]:\n count +=1\n else:\n count = ...
['Wrong Answer', 'Accepted']
['s273430915', 's455692866']
[47072.0, 46000.0]
[946.0, 971.0]
[499, 528]
p03221
u666198201
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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=[]\ncount=[1]*100000\nnumber=0\nfor i in range(M):\n a, b, = map(int, input().split())\n A.append([b, a])\n\nA.sort()\n\nfor i in range(M):\n number=A[i][1]*1000000+count[int(A[i][1])]\n print(str(number).zfill(12))\n count[int(A[i][1])] +=1\n\n', 'N, M = map(int, in...
['Runtime Error', 'Accepted']
['s464049785', 's553159480']
[21824.0, 48828.0]
[647.0, 903.0]
[281, 350]
p03221
u667024514
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nlis = []\nans = [0 for i in range(m)]\nnum = [0 for i in range(n)]\nfor i in range(m):\n a,b = map(int,input().split())\n lis.append([i,a,b])\nlis.sort(key=itemgetter(2))\nfor i in range(m):\n num[lis[i][1]-1] += 1\n cou = 6-(lis[i][1] // 10)\n co ...
['Wrong Answer', 'Accepted']
['s501130602', 's033895726']
[32120.0, 46008.0]
[656.0, 888.0]
[447, 551]
p03221
u667458133
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = map(int, input().split())\nPY = []\narray = [[] for _ in range(N)]\n\nfor _ in range(M):\n P, Y = map(int, input().split())\n PY.append([P, Y])\n array[P-1].append(Y)\n\nfor p, y in PY:\n n = bisect.bisect_left(array[p-1], y) + 1\n print('%06d%06d' % (p, n))\n", "import bisect\n...
['Wrong Answer', 'Accepted']
['s068414903', 's612736298']
[32792.0, 32792.0]
[584.0, 637.0]
[285, 329]
p03221
u669382434
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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=[]\nP=[[] for i in range(N)]\nans=[0 for i in range(M)]\nfor i in range(M):\n PYi=list(map(int,input().split()))\n PY.append(PYi)\n P[PYi[0]-1].append([i,PYi[1]])\n\nfor i in range(N):\n P[i]=sorted(P[i], key=itemgetter(1))\n\nfor i in ra...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s167782772', 's614579362', 's735368092']
[57708.0, 29492.0, 34712.0]
[1095.0, 736.0, 739.0]
[490, 414, 398]
p03221
u669812251
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['# -*- coding: utf-8 -*-\n\ndef main():\n N, M = [int(i) for i in input().split()]\n cities = []\n for i in range(M):\n p, y = map(int, input().split())\n cities.append([p, y])\n cities.sort()\n\n before = 0\n num = 1\n for p, y in cities:\n if before == p:\n num +...
['Wrong Answer', 'Accepted']
['s399025808', 's540154734']
[21072.0, 37920.0]
[569.0, 830.0]
[457, 631]
p03221
u673338219
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\npy = [list(map(int,input().split())) for _ in range(m)]\ncopy = py\nsorted(py, key=itemgetter(1))\na = [1]*n\nb = [0]*m\nfor i in range(m):\n b[i] = a[py[i][0]-1]\n a[py[i][0]-1] += 1\nfor j in range(m):\n x = py.index(copy[j])\n print(1000000*copy[...
['Wrong Answer', 'Accepted']
['s300512961', 's592314204']
[34184.0, 33556.0]
[2106.0, 701.0]
[327, 395]
p03221
u673361376
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = map(int, input().split())\npy_dict = {}\ncityi_by_year = []\nfor i in range(m):\n p, y = map(int, input().split())\n if p not in py_dict:py_dict[p] = [y]\n else:py_dict[p].append(y)\n cityi_by_year.append([p,y])\n\nfor p, y in cityi_by_year:\n idx = bisect.bisect_left(py_dict[p],y)\n pri...
['Wrong Answer', 'Accepted']
['s787298129', 's318822290']
[36660.0, 41012.0]
[707.0, 686.0]
[377, 255]
p03221
u677312543
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = [[i, list(map(int, input().split()))] for i in range(m)]\n\npy = sorted(py, key=lambda x: (x[1][0],x[1][1]))\nprint(py)\n\ncnt = 1\nprev_p = 0\nfor i in py:\n p, y = i[1][0], i[1][1]\n if prev_p == p:\n cnt += 1\n else:\n cnt = 1\n\n ans = str(p).zfill(...
['Wrong Answer', 'Accepted']
['s196437660', 's710577532']
[53220.0, 47136.0]
[1028.0, 1064.0]
[424, 462]
p03221
u677705680
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\n\n\n"""\n\nN, M = map(int, input().split())\n\ncity = [list(map(int, input().split())) + [i] + [0] for i in range(M)]\n\ncity.sort(key=lambda x: (x[0], x[1]))\nprint(city)\nfor m in range(M):\n if m == 0:\n city[m][3] = 1\n elif city[m][0] != city[m - 1][0]:\n city[m][3] = 1\n else:\n ...
['Wrong Answer', 'Accepted']
['s163659741', 's103086056']
[46592.0, 39812.0]
[919.0, 831.0]
[493, 482]
p03221
u678167152
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
["N, M = map(int, input().split())\npref = [[] for _ in range(N)]\nP,Y = [0]*M,[0]*M\nfor i in range(M):\n P[i],Y[i] = map(int, input().split())\n pref[P[i]-1].append(Y[i])\n\nfor i in range(N):\n pref[i].sort()\n\nfrom bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort\n\ndef s...
['Wrong Answer', 'Accepted']
['s617409196', 's759665405']
[31988.0, 29920.0]
[604.0, 625.0]
[537, 560]
p03221
u680851063
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
["n, m = map(int, input().split())\nl = [list(map(int, input().split(' '))) for _ in range(m)]\nl = sorted(l)\n#print(n,m)\n#print(l)\n\nx = l[0][0]\ny = 1\n#print(x)\n\nfor i in range(m):\n if l[i][0] == x:\n l[i][1] = y\n y += 1\n else:\n y = 1\n l[i][1] = y\n y += 1\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s022411337', 's042920485', 's529792499']
[28820.0, 37380.0, 39204.0]
[673.0, 760.0, 803.0]
[407, 548, 487]
p03221
u682467216
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['# coding=utf-8\nfrom math import floor, ceil, sqrt, factorial, log, gcd\nfrom itertools import accumulate, permutations, combinations, product, combinations_with_replacement\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict\nfrom heapq import heappop, heappush, heappushpop, h...
['Runtime Error', 'Accepted']
['s143812927', 's104387864']
[39980.0, 56600.0]
[331.0, 465.0]
[1624, 1718]
p03221
u682730715
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 sys\n\nimport heapq\nimport re\nimport bisect\nimport random\nimport math\nimport itertools\nfrom collections import defaultdict, deque\nfrom copy import deepcopy\nfrom decimal import *\n\nn, m = map(int, input().split())\np = defaultdict(lambda :defaultdict(int))\ne = [[int(i) for i in input(...
['Wrong Answer', 'Accepted']
['s919502155', 's382028857']
[62220.0, 61536.0]
[720.0, 799.0]
[547, 627]
p03221
u687343821
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\ndata=[]\nfor i in range(M):\n data.append(list(map(int,input().split(" "))))\n\narr = np.array(data)\nc1=np.arange(0,M)\narr=np.insert(arr,2,c1,axis=1)\n#arr_sort=arr[np.argsort(arr[:,0])]\narr_sort=arr[np.argsort(arr[:,1])]\narr_sort=arr_sort[np.argsort(arr_sort...
['Wrong Answer', 'Accepted']
['s234628938', 's890185114']
[46504.0, 50020.0]
[1295.0, 1350.0]
[640, 543]
p03221
u688447129
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\npl=[0]*m\nyl=[0]*m\ncl=[0]*m\nppl=[[] for j in range(n+1)]\nfor i in range(m):\n pl[i],yl[i] = map(int, input().split())\n ppl[pl[i]].append((yl[i], i))\n\nfor i in range(m):\n print("%06d%06d" % (pl[i], cl[i]))', 'n,m=map(int, input().split())\npl=[0]*m\nyl=[0]*m\ncl=[0]*m\n# ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s247419008', 's735363637', 's309024697']
[34380.0, 13128.0, 24052.0]
[535.0, 399.0, 648.0]
[241, 313, 323]
p03221
u691896522
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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()))\ndata = []\nfor i in range(m):\n data.append([i + 1] + list(map(int, input().split())))\ndata = sorted(data, key = lambda x: (x[1], x[2]))\n\nans = [[0,0,0] for i in range(m)]\n\npre = data[0][1]\nnum = 1\nfor i in range(m):\n if pre != data[i][1]:\n num = 1\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s230560753', 's241347315', 's548707468']
[40524.0, 3060.0, 39392.0]
[1117.0, 17.0, 1161.0]
[628, 274, 707]
p03221
u693007703
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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()]\n\nPY = []\nPYd = {i:[] for i in range(1, N+1)}\n\nfor i in range(M):\n x, y = [int(i) for i in input().split()]\n PYd[x].append(y)\n PY.append((x,y))\n \nfor i in PYd.keys():\n PYd[i].sort()\n \nfor p,y in PY:\n str_p = str(p).zfill(6)\n index = str(bi...
['Runtime Error', 'Accepted']
['s596134559', 's484345232']
[37124.0, 38436.0]
[444.0, 700.0]
[358, 373]
p03221
u695079172
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nclass City:\n \n def __init__(self,id,y):\n self.id = id\n self.year = y\n\n\ndef main():\n n,m = map(int,input().split())\n pre_lst = [[] for _ in range(n)] \n city_tags = [0 for _ in range(m)] \n\n for i in range(m):\n p,y = map(int,input().split())\n pre_lst[p-1]....
['Runtime Error', 'Accepted']
['s558975875', 's434259674']
[2940.0, 46216.0]
[17.0, 833.0]
[1182, 1180]
p03221
u695429668
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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_number = []\nP = []\nY = []\nyp = [[] for i in range(N+1)]\n_yp = []\n\nfor i in range(M):\n p, y = map(int, input().split())\n yp[p].append([y, i])\n\n# print(yp)\n\n_l_yp = len(yp)\n\nfor i in range(_l_yp):\n yp[i].sort()\n\n\nans_yp = [[] for i in range(M)]\n\nfor i in...
['Wrong Answer', 'Accepted']
['s431604419', 's084681544']
[48496.0, 46888.0]
[1349.0, 1124.0]
[718, 722]
p03221
u695811449
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nPYI=[PY[i]+[i] for i in range(M)]\n\nPYI.sort(key=lambda x:x[1])\n\nNu=[1]*(N+1)\nANS=[None]*M\n\nfor p,y,i in PYI:\n ANS[i]=(p,Nu[p])\n Nu[p]+=1\n\nprint(ANS)\n\ndef numb(x,y):\n x=str(x)\n y=str(y)\n l=len(x)\n ...
['Wrong Answer', 'Accepted']
['s729545206', 's580625321']
[54744.0, 50268.0]
[775.0, 809.0]
[380, 381]
p03221
u703528810
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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=[[x] for x in range(N)]\n\nfor _ in range(M):\n p,y=map(int,input().split())\n P[p-1].append(y)\ncode=[]\nfor i in range(N):\n temp=sorted(P[i][1:])\n for j in range(len(temp)):\n code.append(str(i+1).zfill(6)+str(j+1).zfill(6))\n\ncode.sort()\nfor c in code:\n pr...
['Wrong Answer', 'Accepted']
['s327850505', 's107672829']
[30660.0, 39108.0]
[670.0, 732.0]
[310, 323]
p03221
u704001626
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 -*-\na = int(input().split()[1])\nc = [int(input().split()[0]) for i in range(a)]\nimport collections\nc = collections.Counter(c)\nfor k,v in sorted(c.items()):\n for i in range(v):\n j = i+1\n print(f'{k:08}{j:08}')\n", "# -*- coding: utf-8 -*-\na = int(input().split()[1])\nc = [...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s021830916', 's290148120', 's724556751']
[3188.0, 21508.0, 46852.0]
[18.0, 487.0, 756.0]
[246, 247, 461]
p03221
u706929073
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = {}\nfor i in range(m):\n (i, j) = map(int, input().split())\n if not i in cities:\n cities[i] = []\n cities[i].append(j)\nprint(cities)\ncodes = []\nfor k, v in cities.items():\n v.sort()\n for i, j in enumerate(v):\n codes.append("{0:06d}".f...
['Wrong Answer', 'Accepted']
['s439783630', 's299884846']
[42048.0, 52924.0]
[685.0, 929.0]
[375, 532]
p03221
u707498674
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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)]\nfor i in range(M):\n p, y = map(int, input().split())\n P[p-1].append(len(P[p-1])+1)\nfor i in range(len(P)):\n for j in range(len(P[i])):\n print("{:0=6}{:0=6}".format(i+1, P[i][j]))\n', 'N, M = map(int, input().split())\nP = [[] for i in ...
['Wrong Answer', 'Accepted']
['s166750269', 's946818620']
[16188.0, 31620.0]
[589.0, 809.0]
[255, 437]
p03221
u711295009
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nindex = 0\nlistForL = []\nlistForL2 = []\nwhile index < m:\n p, y = map(int, input().split())\n listForL.append([p, y])\n listForL2.append([p, y])\n index+=1\n\nlistForL2.sort()\nprint(listForL2)\nlistForId=[]\nindex2 =0\ncount = 0\nbefore=0\nwhile index2 < len(listForL2)...
['Wrong Answer', 'Accepted']
['s292221017', 's910261367']
[40456.0, 41560.0]
[2106.0, 819.0]
[969, 1111]
p03221
u711539583
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\ncs = []\nps = {}\nfor _ in range(m):\n p, y = map(int, input().split())\n cs.appenyd([y, p])\ncss = sorted(cs)\nfor c in css:\n if c[1] in ps:\n ps[c[1]].append(c[0])\n else:\n ps[c[1]] = [c[0]]\n[print('{:06}{:06}'.format(c[1], ps[c[1]].index(c[0])+1))for c in cs]\n\n \n ...
['Runtime Error', 'Accepted']
['s572469209', 's401366646']
[3064.0, 48688.0]
[17.0, 719.0]
[307, 339]
p03221
u712975113
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
["N,M=map(int,input().split())\nPY=[]\nfor i in range(M):\n PY.append(list(map(int,input().split()))+[i+1])\n PY.sort(key=lambda x:(x[0],x[1]))\nprint(PY)\nid=[]\nl=[]\nwhile len(PY)>0:\n p=PY[0][0]\n print(p)\n i=0\n print(i)\n while PY[i][0]==p:\n i+=1\n id.append('0'*(6-len(str(p))...
['Wrong Answer', 'Accepted']
['s315968433', 's503011250']
[21824.0, 30096.0]
[2104.0, 633.0]
[532, 309]
p03221
u714225686
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 math\nimport sys\nfrom itertools import accumulate\nfrom functools import reduce\nimport queue\nfrom fractions import gcd\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\ndef combination_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ndef permutations_count(n, r)...
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s350472284', 's847555064', 's702064572']
[44964.0, 32408.0, 29748.0]
[2105.0, 790.0, 709.0]
[1558, 1493, 428]
p03221
u718096172
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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()]\npyList = [[int(i) for i in input().split()] for _ in range(M)]\npyList = sorted(pyList, key=lambda py: py[1])\n\ncityMap = {}\nfor py in pyList:\n if py[0] in cityMap.keys():\n cityMap[py[0]] += 1\n else:\n cityMap[py[0]] = 1\n\n prefCd = str(py[0]).zfi...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s073946147', 's800138394', 's273831290']
[31368.0, 31620.0, 33624.0]
[600.0, 693.0, 715.0]
[382, 382, 523]
p03221
u721970149
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nN, M = map(int,input().split())\nP = []\nfor i in range(M) :\n p, y = map(int,input().split())\n P.append([p, y, i])\n\nP.sort(key = lambda x: (x[0],x[1]))\nprint(P)\n\nans = [0 for i in range(M)]\ncount = 1\n\nfor i in range(M) :\n num = P[i][2]\n if i > 0 :\n ...
['Wrong Answer', 'Accepted']
['s171922160', 's998378038']
[38112.0, 32040.0]
[629.0, 524.0]
[478, 469]
p03221
u722535636
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = [dict() for i in range(N)]\nilist = [list(map(int, input().split())) for i in range(M)]\nfor i, y in ilist:\n l[i - 1][y] = 1\nl = [dict(sorted(l[i].items())) for i in range(N)]\nfor i in range(N):\n for j, k in enumerate(l[i].keys()):\n l[i][k] = "{:06}{:06}".format...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s438016118', 's620375990', 's315909520']
[114016.0, 114016.0, 29724.0]
[890.0, 916.0, 766.0]
[372, 373, 302]
p03221
u725578977
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
["# -*- coding: utf-8 -*-\nfrom collections import defaultdict\n\n\nn, m = map(int, input().split())\n\np, y = [], []\ndic = {}\nfor _ in range(m):\n pi, yi = map(int, input().split())\n dic[yi] = pi\n\nd = defaultdict(int)\n\nfor _, pi in sorted(dic.items()):\n d[pi] += 1\n print('{:0>6}{:0>6}'.format(pi, ...
['Wrong Answer', 'Accepted']
['s768090973', 's661196284']
[36316.0, 49676.0]
[642.0, 661.0]
[310, 378]
p03221
u728615412
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = [None]*M\npre_lst = []\nfor i in range(M):\n lst[i] = list(map(int,input().split()))\n lst[i].append(i)\nfor k in range(M):\n lst[k][0] = str(lst[k][0])\n lst[k][0] = lst[k][0].zfill(6)\nlst.sort(key = lambda x:x[0])\n\n', "N,M = map(int,input().split())\nlst = [None]*(M+1)\n...
['Wrong Answer', 'Accepted']
['s883607680', 's396346672']
[37760.0, 43280.0]
[552.0, 912.0]
[251, 600]
p03221
u729133443
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
["I=lambda:list(map(int,input().split()));n,m=I();l=[I()+[i]for i in range(M)];c=[0]*-~N;a=[0]*M\nfor p,y,i in sorted(l,key=lambda x:x[1]):c[p]+=1;a[i]='%06d'%p+'%06d'%c[p]\nfor t in a:print(t)", "I=lambda:list(map(int,input().split()[::-1]))\nm,n=I()\nc=[0]*-~n\na=[0]*m\nfor y,p,i in sorted(I()+[i]for i in range(m)):\...
['Runtime Error', 'Accepted']
['s819473916', 's686008998']
[3064.0, 31172.0]
[17.0, 636.0]
[189, 175]
p03221
u736729525
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = [], []\n\nPx = [0] * (N+1)\nfor _ in range(M):\n p, y = [int(x) for x in input().split()]\n Px[p]+=1\n print("%06d%06d" % (p, Px[p]))\n\n', 'N, M = [int(x) for x in input().split()]\n\nPY = []\n\nPx = [0] * (N+1)\nfor i in range(M):\n p, y = [int(x) for x...
['Wrong Answer', 'Accepted']
['s173431215', 's123031205']
[5108.0, 29796.0]
[969.0, 531.0]
[187, 380]
p03221
u740284863
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
['n,m = map(int,input().split())\ncity = [[] for i in range(n)]\ndef f(s):\n s = str(s)\n t = 6 - len(s)\n s = "0"*t + s\n return s\nfor i in range(m):\n ken,year = map(int,input().split())\n city[ken-1].append(year)\nfor i in range(n):\n city[i].sort()\n for j in range(len(city[i])):\n ...
['Wrong Answer', 'Accepted']
['s883704282', 's135217671']
[19376.0, 48580.0]
[610.0, 1090.0]
[345, 429]
p03221
u740767776
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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 = []\nr = []\nfor n in range(n):\n s.append(list(map(int,input().split())))\nfor i in range(n):\n rank = 1\n for j in range(n):\n if s[i][0] == s[j][0] and s[i][1] > s[j][1]:\n rank += 1\n prefString = str(s[i][0])\n rankString = str(rank)\n Number1s...
['Runtime Error', 'Accepted']
['s324247953', 's765224809']
[29360.0, 24744.0]
[2105.0, 783.0]
[435, 371]
p03221
u741397536
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nsys.setrecursionlimit(10 ** 7)\n\nN, M = map(int, input().split())\nL = []\nfor i in range(M):\n P, Y = map(int, input().split())\n L.append([P, Y])\n\nL = sorted(L)\n\nreset = 0\ncount = 0\nfor i in range(M):\n if L[i][0] != reset:\n reset = L[i][0]\n co...
['Wrong Answer', 'Accepted']
['s328460052', 's004705693']
[20976.0, 43956.0]
[464.0, 793.0]
[409, 483]
p03221
u745087332
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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\nfrom collections import Counter, defaultdict\n\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef II(): return int(sys.stdin.readline())\ndef SI(): return input()\n\n\nn, m = LI()\n...
['Wrong Answer', 'Accepted']
['s109103515', 's387033260']
[30376.0, 42740.0]
[623.0, 637.0]
[534, 566]
p03221
u745561510
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nall_city = [list(map(int,input().split())) for i in range(M)]\n\ncity = {}\nfor i in all_city:\n if i[0] in city:\n city[i[0]].append(i[1])\n else:\n city[i[0]] = [i[1]]\n\nunder6 = {}\nfor i,k in city.items():\n city[i] = sorted(k)\n for j in range(len(k)):\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s288225000', 's323536327', 's553447626', 's792844953', 's011152603']
[53408.0, 1970344.0, 1945384.0, 1952796.0, 53408.0]
[810.0, 2228.0, 2228.0, 2230.0, 766.0]
[574, 721, 709, 697, 590]
p03221
u747602774
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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()\nprint(PY)\n\npnow = PY[0][0]\nc = 1\n\nans = [-1 for i in range(M)]\n\nfor i in range(M):\n if pnow != PY[i][0]:\n c = 1\n pnow = PY[i][0]\n ans[PY[i][2]] = str(PY[i][0]).zfill(6) + str(c).z...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s070317778', 's189232937', 's815398729']
[38120.0, 38268.0, 38836.0]
[712.0, 792.0, 516.0]
[345, 411, 335]
p03221
u752767312
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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())\nshi_lst = [list(map(int,input().split())) for i in range(M)]\nshi_sorted = sorted(shi_lst)\n#print(shi_lst)\n\n\ntmp = shi_sorted[0][0] \ncount = 0\nfor i in range(M):\n count += 1\n if tmp != shi_sorted[i][0]:\n count = 1\n tmp = shi_sorted[i][0]\n# ans.append( ("%06d"%tmp) +...
['Wrong Answer', 'Accepted']
['s601848838', 's461981292']
[30344.0, 48612.0]
[674.0, 824.0]
[409, 523]
p03221
u757117214
2,000
1,048,576
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there 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_info = [] \nPref_info = [[] for _ in range(N)] \nfor i in range(M):\n P,Y = map(int,input().split())\n city_info.append([P-1, Y])\n Pref_info[P - 1].append(Y)\nfor i in Pref_info:\n i.sort()\n \nprint("city_info = " + str(city_info))\nprint("Pref_info = " + str(Pre...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s211902031', 's725661107', 's732603511']
[38260.0, 32748.0, 39096.0]
[2105.0, 2105.0, 742.0]
[604, 573, 364]