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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02947 | u861038878 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["# -*- coding: utf-8 -*-\n\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n ... | ['Wrong Answer', 'Accepted'] | ['s145916689', 's619665690'] | [28296.0, 28200.0] | [1984.0, 1873.0] | [958, 986] |
p02947 | u861962192 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['def f_c():\n\n n = int(input())\n s = ["".join(sorted(input())) for _ in range(n)]\n\n c = 0\n for _ in range(n):\n si = s.pop()\n if si in s:\n c += s.count(s2)\n print(c)\n\nif __name__ == "__main__":\n f_c()\n', 'def f_c():\n\n n = int(input())\n d = {}\n dc = {}... | ['Runtime Error', 'Accepted'] | ['s837237089', 's551488483'] | [10208.0, 24172.0] | [2104.0, 384.0] | [241, 306] |
p02947 | u863397945 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['K,X = map(int,input().split())\n\nl = max(X-K+1,-1000000)\nr = min(X+K-1,1000000)\n\nans = []\n\nfor i in range(l,r+1):\n ans.append(str(i))\n\nans = " ".join(ans)\n\nprint(ans)', 'K,X = map(int,input().split())\n\nl = max(X-K+1,-1000000)\nr = min(X+K-1,1000000)\n\nans = []\n\nfor i in range(l,r+1):\n ans.appen... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s148081912', 's731253908', 's064630507'] | [9188.0, 9176.0, 22172.0] | [24.0, 23.0, 237.0] | [168, 168, 166] |
p02947 | u864213970 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import itertools\n\nn = int(input())\nstrs = [str(input()) for _ in range(n)]\n\ncnt = 0\nwhile len(strs) != 0:\n s = strs.pop()\n anagrams = set(["".join(a) for a in itertools.permutations(s)])\n for anag in anagrams:\n if anag in strs:\n cnt += 1\n\nprint(cnt)\n', 'import itertools\n\nn = int(input())\ns... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s105383068', 's671080424', 's996334101'] | [367424.0, 334036.0, 19400.0] | [2119.0, 2119.0, 373.0] | [261, 238, 221] |
p02947 | u865413330 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import collections\n\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n of... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s230605865', 's451817526', 's814838507', 's907016214', 's961820340'] | [67932.0, 12164.0, 13008.0, 12168.0, 17808.0] | [1281.0, 1260.0, 1466.0, 1244.0, 400.0] | [806, 787, 356, 787, 220] |
p02947 | u866124363 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nS = {}\n\ncnt = 0\nfor n in range(N):\n s = ''.join(sorted(input()))\n\n if s in S.keys():\n cnt += S[s]\n S[s] += 1\n print(s)\n else:\n S[s] = 1\n\nprint(cnt)\n", "N = int(input())\nS = {}\n\ncnt = 0\nfor n in range(N):\n s = ''.join(sorted(input()))\n\n ... | ['Wrong Answer', 'Accepted'] | ['s133124941', 's964664800'] | [17852.0, 17852.0] | [949.0, 405.0] | [202, 185] |
p02947 | u867604473 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n=int(input())\ns = [ str(input()) for _ in range(n)]\ns = sorted([sorted(x) for x in s])\npairs = 0\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return... | ['Wrong Answer', 'Accepted'] | ['s232096368', 's079833780'] | [32600.0, 32600.0] | [638.0, 608.0] | [613, 593] |
p02947 | u867763103 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N = int(input())\nDictionary = {}\nfor i in range(N):\n string = "".join(sorted(input()))\n if string in Dictionary:\n Dictionary[string] += 1\n else:\n Dictionary[string] = 1\n\nans = 0\nfor i in Dictionary.values():\n count_tmp = i*(i-1)/2\n ans += co... | ['Wrong Answer', 'Accepted'] | ['s896663873', 's922735328'] | [17848.0, 17848.0] | [394.0, 387.0] | [325, 330] |
p02947 | u871303155 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nl = {}\nfor i in range(N):\n s = input()\n s = ''.join(sorted(s))\n if s in l:\n l[s] += 1\n else:\n l[s] = 0\nans = 0\nvalue_l = [1]\nfor value in l.values():\n if len(value_l) >= value:\n tmp = value_l[value - 1]\n else:\n l_val = len(value_l)\n for i in range(l_val, value):\n... | ['Wrong Answer', 'Accepted'] | ['s216904047', 's451700624'] | [17808.0, 17808.0] | [391.0, 389.0] | [398, 428] |
p02947 | u877616713 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['from collections import Counter\nfrom numpy import cumsum\n \nnum = int(input())\ninput = [input() for i in range(num)]\nrv = 0\ncounters = [sorted(Counter(s).elements()) for s in input]\nstrings = ["".join(s) for s in counters]\ncounts = list(Counter(strings).values())\nfor c in counts:\n rv += cumsum(c)\nprint(rv)... | ['Wrong Answer', 'Accepted'] | ['s373831487', 's941165240'] | [53656.0, 45120.0] | [2110.0, 1186.0] | [307, 299] |
p02947 | u887080340 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import collections\n\nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n r = min(n-r, r)\n if r == 0:\n return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1, r + 1))\n return over // under\n\n\nN = int(input())\ns = [" ".join(sorted(list(inpu... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s136931890', 's786114280', 's934533718'] | [20744.0, 20752.0, 20740.0] | [388.0, 369.0, 375.0] | [452, 416, 434] |
p02947 | u887207211 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['def main():\n N = int(input())\n S = [input() for _ in range(N)]\n\n tmp = []\n d={}\n for s in S:\n x = Counter(s)\n if x in tmp:\n d[tmp.index(x)] += 1\n else:\n tmp.append(x)\n d[tmp.index(x)] = 1 \n \n cnt = 0\n for v in d.values():\n if v == 1:\n continue\n if v == ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s152770421', 's299078418', 's443121052', 's972519740', 's369120981'] | [10268.0, 27532.0, 31596.0, 6900.0, 17848.0] | [138.0, 327.0, 324.0, 2104.0, 241.0] | [444, 416, 176, 429, 377] |
p02947 | u889681568 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["import numpy as np\n\nanum = {}\nans = 0\n\nN = int(input())\nstrings = [''.join(sorted(input())) for i in range(N)]\n\nfor i in range(N):\n if strings[i] in anum:\n ans += anum[i]\n else:\n anum[strings[i]] = 1\n\nprint(ans)\n", "import numpy as np\n\nanum = {}\nans = 0\n\nN = int(input())\nstrin... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s034476470', 's040421884', 's100462924', 's764054410', 's892494830'] | [28696.0, 22036.0, 28680.0, 22328.0, 19404.0] | [474.0, 452.0, 374.0, 2117.0, 350.0] | [232, 207, 238, 606, 201] |
p02947 | u892445454 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N = int(input()) \ninlist = [input() for i in range(N)] \nresult = []\n\n#make dic from input parameters\nfor component in inlist :\n dic = []\n for n in component:\n dic.append(n)\n dic.sort()\n dic2 = "".join(dic)\n result.append(dic2)\nprint(result)\n\ncounter = 0\nfor k1, v1 in enumerate(res... | ['Wrong Answer', 'Accepted'] | ['s413348451', 's880161006'] | [21460.0, 24976.0] | [2105.0, 429.0] | [421, 547] |
p02947 | u892687772 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int(input())\nlists = []\nfor i in range(n):\n a = input()\n k = []\n for i in range(10):\n k.append(a[i])\n k.sort()\n lists.append(k)\nlists.sort()\nlists.append([])\ncount = -1\nans = 0\nprint(lists)\nfor i in range(n):\n if lists[i] != lists[i+1]:\n c = i-count\n count =... | ['Wrong Answer', 'Accepted'] | ['s175961272', 's785554226'] | [39716.0, 24624.0] | [830.0, 723.0] | [341, 328] |
p02947 | u893270619 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["from scipy.misc import comb\nN = int(input())\ns = []\nfor i in range(N):\n s += [''.join(sorted(input()))]\nset_s = set(s)\ncnt = 0\nfor j in set_s:\n cnt += comb(s.count(j),2)\nprint(int(cnt+0.5))", "from collections import Counter\n\nN = int(input())\ns = []\nfor i in range(N):\n s += [''.join(sorted(input()))]... | ['Time Limit Exceeded', 'Accepted'] | ['s857590646', 's566149241'] | [27012.0, 19764.0] | [2109.0, 361.0] | [191, 186] |
p02947 | u894381129 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import math\n\nn = int(input())\ns_list = []\nn_list = []\nana = 0\nfor i in range(n):\n s = sorted(input())\n print(s)\n if len(s_list) > 0:\n for num, s_i in enumerate(s_list):\n if s_i == s:\n n_list[num] += 1\n break\n s_list.append(s)\n n_lis... | ['Wrong Answer', 'Accepted'] | ['s435430376', 's529782790'] | [31304.0, 17852.0] | [2104.0, 388.0] | [545, 222] |
p02947 | u896741788 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n=int(input())\nl=[input() for j in range(n)]\nfor i in range(n)[:-1]:\n\tf=l[i]\n\tfor s in range(n)[i+1:]:\n\t\ta=[f[k] for k in range(10)]\n g=l[s]\n b=[g[c] for c in range(10)]\n q +=1 if sorted(a)==sorted(b)\nprint(q)', 'n=input()\nl=list()\nq=0\nfor k in range(n):\n\tst=input()\n l.appen... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s062290400', 's263219081', 's513000077', 's529331947', 's722150139', 's725963375', 's795792252', 's775092561'] | [2940.0, 2940.0, 2940.0, 78180.0, 78176.0, 78180.0, 2940.0, 20708.0] | [18.0, 17.0, 19.0, 1123.0, 1112.0, 1125.0, 18.0, 1698.0] | [230, 256, 258, 436, 426, 426, 261, 444] |
p02947 | u897329068 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N = int(input())\nss = []\nfor i in range(N):\n\tss.append("".join(sorted(list(input()))))\n\t\ndicS = {}\nfor s in ss:\n\tif s not in dicS:\n\t\tdicS[s] = 1\n\telse:\n\t\tdicS[s] += 1\n\t\t\n#print(dicS)\n\t\t\nans = 0\nfor v in dicS.values():\n\tif v != 1:\n\t\tans += v*(v-1)/2\n\t\nprint(ans)', 'from operator impo... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s035340382', 's504859401', 's999345857'] | [19500.0, 19996.0, 19504.0] | [387.0, 391.0, 378.0] | [261, 463, 268] |
p02947 | u898080410 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["import collections\n\nn = int(input())\ns = np.array([[str(i) for i in input().split()] for i in range(n)])\ns = np.ravel(s)\nans = 0\nsorted_list = [''.join(sorted(e)) for e in s]\n\nc = collections.Counter(sorted_list)\nfor i in c.values():\n for j in range(0, i):\n ans += j\n\nprint(ans)", "import numpy as np\... | ['Runtime Error', 'Accepted'] | ['s451404132', 's492374464'] | [3316.0, 38792.0] | [21.0, 689.0] | [288, 307] |
p02947 | u899953001 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['#!/usr/bin/env python\n\nl = []\nn = int(input())\nfor i in range(n):\n s = input()\n l.append(s)\n\nl_s = []\nfor i in range(n):\n l_s.append(sorted(l[i]))\n\nc = 0\n\nfor i in range(len(l_s)):\n c += l_s[i:].count(l_s[i])-1\n print(l_s[i:].count(l_s[i])-1)\n\nprint(c)', '#!/usr/bin/env python\nimport... | ['Wrong Answer', 'Accepted'] | ['s383628166', 's114783043'] | [32028.0, 14788.0] | [2105.0, 427.0] | [267, 295] |
p02947 | u904331908 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import itertools,math\nn = int(input())\nword = [input() for _ in range(n)]\ncount = 0\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nfor i in range(n):\n word[i] = sorted(word[i])\n\nnew_word = list(sorted(word))\n\nx = 1\n\nfor i in range(n-1):\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s073140106', 's476914155', 's062214302'] | [32456.0, 9008.0, 28228.0] | [515.0, 26.0, 252.0] | [484, 369, 365] |
p02947 | u905582793 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['from collections import Counter\nn=int(input())\ns=[list(input()).sort() for i in range(n)]\nc=Counter(s)\nans=0\nfor i in c.values():\n ans+=i*(i-1)//2\nprint(ans)', 'from collections import Counter\nn=int(input())\ns=[list(input()).sort() for i in range(n)]\nc=Counter(s)\nans=0\nfor i in c.values():\n ans+=i*(i-1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s373478560', 's797006647', 's612584553'] | [4228.0, 4228.0, 31800.0] | [286.0, 293.0, 367.0] | [158, 147, 220] |
p02947 | u905711033 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import numpy as np\n\nN = int(input())\n\nmat = np.zeros(N)\nalphabet = "abcdefghijklmnopqrstuvwxyz"\n\nans_dic = {}\n\nfor i in range(N):\n word = input()\n tmp = 0\n for s in word:\n tmp += 2**alphabet.index(s)\n\n if tmp in ans_dic:\n ans_dic[tmp] += 1\n else:\n ans_dic[tmp] = 1... | ['Wrong Answer', 'Accepted'] | ['s082994261', 's137154029'] | [24996.0, 15808.0] | [938.0, 825.0] | [389, 379] |
p02947 | u907223098 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n=int(input())\ns=[]\nr=[]\nc=0\nfor i in range(n):\n a=input()\n a.sorted()\n s.append(a)\nfor i in range(n):\n if a[i]==a[i+1]:\n c+=1\n r.append(c)\n else:\n c=0\n r.append(c)\nprint(sum(r))', 'n=int(input())\ns=[[] for i in range n]\nr=0\nfor i in range(n):\n a=input()\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s355423771', 's780174405', 's243297548'] | [3316.0, 2940.0, 28276.0] | [21.0, 17.0, 601.0] | [221, 227, 273] |
p02947 | u908383794 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nS = [''.join(sorted(input())) for _ in range(0, N)]\nd = {}\n\nfor s in S:\n if s[0] in d.keys():\n d[s[0]].append(s)\n else:\n d[s[0]] = [s]\n\nresult = 0\n\nfor k in d.values():\n for i, s in enumerate(k):\n for j in range(i + 1, len(k)):\n print(s, k[j])\n... | ['Wrong Answer', 'Accepted'] | ['s538820393', 's885586787'] | [47268.0, 19460.0] | [2104.0, 380.0] | [370, 203] |
p02947 | u909616675 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N=int(input())\nword=[]\nfor i in range(N):\n word.append(input())\n \nalphalist=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]\nnumlist=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]\n\n\nalphalist=[]\nalpha=[[] for i in range... | ['Runtime Error', 'Accepted'] | ['s291201284', 's231068550'] | [17312.0, 10584.0] | [169.0, 355.0] | [624, 406] |
p02947 | u909991537 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['from collections import Counter\n\nn = int(input())\nt = [input() for i in range(n)]\nc_list = []\nans = 0\n\nfor i in range(n):\n c = Counter(input())\n ans += c_list.count(c)\n c_list.append(c)\n \nprint(ans)\n ', "from collections import Counter\n\nn = int(input())\nans = 0\nctr = Counter()\n\nfor i in rang... | ['Runtime Error', 'Accepted'] | ['s034654524', 's982848396'] | [10592.0, 18192.0] | [145.0, 533.0] | [207, 196] |
p02947 | u911449886 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['from sys import stdin\nimport copy\n\nn = int(input())\nS = [stdin.readline()[:-1] for i in [0]*(n-1)]\nS.append(stdin.readline())\ns = []\nfor i in S:\n s.append("".join(sorted(i)))\ns.sort()\narr = []\ntemp = 1\nfor i in range(n-1):\n if temp>1 and s[i]!=s[i+1]:\n arr.append(temp)\n temp = 1\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s148137302', 's163484652', 's548955687'] | [2936568.0, 23808.0, 24028.0] | [2280.0, 181.0, 174.0] | [613, 427, 426] |
p02947 | u916806287 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import collections\n\nn = int(input())\ns = [collections.Counter(input()) for i in range(n)]\nprint(s)\n\ncount = 0 \nfor i in range(n):\n for j in range(i + 1, n):\n if s[i] == s[j]:\n count += 1\n\nprint(count)', 'import collections\n\nn = int(input())\nss = [tuple(sorted(collections.Counter(input()).items... | ['Wrong Answer', 'Accepted'] | ['s578800859', 's144276646'] | [77168.0, 78536.0] | [2107.0, 1390.0] | [209, 298] |
p02947 | u917092881 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N = int(input())\n\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offs... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s010554808', 's455500387', 's946172196', 's266320239'] | [3064.0, 17892.0, 21564.0, 17892.0] | [24.0, 602.0, 2104.0, 473.0] | [845, 831, 329, 849] |
p02947 | u917558625 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int(input())\ndata = []\nfor i in range(n):\n s = list(input())\n s.sort()\n data.append(s)\ndata.sort()\ni=0\nj=0\ncount=0\nfor i in range(n):\n for j in range(i,n):\n if data[i]==data[j]:\n count=count+1\nprint(count)', 'n = int(input())\ndata = []\nfor i in range(n):\n s = list(input())\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s222596450', 's257086237', 's912441727', 's732075185'] | [26304.0, 25156.0, 25280.0, 24652.0] | [2105.0, 657.0, 655.0, 539.0] | [227, 320, 325, 313] |
p02947 | u919730120 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n=int(input())\ns=[sorted(input()) for i in range(n)]\ns.sort()\ncnt=0\nwhile len(s)>1:\n k=s.count(s[0])\n if k==1:\n continue\n else:\n cnt+=int(k*(k-1)/2)\n del s[:k]\nprint(cnt)', "def resolve():\n n=int(input())\n s={}\n for i in range(n):\n x=str(sorted(list(input())))\n if x in... | ['Time Limit Exceeded', 'Accepted'] | ['s636481430', 's377974415'] | [26308.0, 26144.0] | [2105.0, 319.0] | [180, 315] |
p02947 | u921811474 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nS = [''.join(sorted(input().rstrip())) for _ in range(N)]\n\nprint(S)\nfrom collections import Counter\n\ncounter = Counter(S)\nprint(counter.values())\nanswer = sum(x * (x - 1) // 2 for x in counter.values())\nprint(answer)\n", "N = int(input())\nS = [''.join(sorted(input().rstrip())) for _ in rang... | ['Wrong Answer', 'Accepted'] | ['s658169442', 's468116764'] | [22556.0, 19788.0] | [363.0, 350.0] | [234, 201] |
p02947 | u923662841 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N = int(input())\nC = []\nfor i in range(N):\n C.append("".join(sorted(input(i))))\nB = set(C)\nans = 0\nfor j in B:\n t = C.count(j)\n if t > 1:\n ans += int(t*(t-1)/2 )\n# 1->0, 2->1, 3->3, 4->6, 5->10 :: nC2\n \nprint(ans)', 'N=int(input())\ndictionary={}\ncount=0\nfor i in range(N):\n s="".j... | ['Wrong Answer', 'Accepted'] | ['s696026241', 's900853525'] | [16844.0, 17852.0] | [2104.0, 385.0] | [232, 211] |
p02947 | u925567828 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N =int(input())\n\ns = [list(input()) for i in range(N)]\n\n\nfor i in range(len(s)):\n s[i].sort()\n \nans = 0 \ncnt = 1\nfor i in range(1,N):\n for j in range(10):\n \n \n if(s[i][j] != s[i-1][j]):\n break\n else:\n cnt +=1\n continue\n ans += cnt*(cnt-1)/... | ['Wrong Answer', 'Accepted'] | ['s706561339', 's933703771'] | [24208.0, 20028.0] | [557.0, 249.0] | [514, 661] |
p02947 | u932868243 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["from collections import Counter\nn=int(inout())\nl=[''.join(sorted(input())) for _ in range(n)]\nans=0\nfor i in Counter(l).value():\n ans+=i*(i-1)//2\nprint(ans)", 'import itertools\nimport collections\nn=int(input())\nl=[input() for i in range(n)]\nans=0\nfor k in itertools.combinations(l,2):\n l1=[]\n l2=[]\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s252414096', 's356717606', 's640910885', 's785038637'] | [3316.0, 13440.0, 10580.0, 19764.0] | [21.0, 2104.0, 148.0, 349.0] | [157, 334, 244, 158] |
p02947 | u932913455 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nana = {}\nanswer = 0\n\nfor i in range(N):\n s = sorted(input())\n new_str = ''.join(s)\n flag = 0\n\n try:\n k = ana.keys().index(new_str)y\n ana[k] += 1\n answer += ana[k]\n\n except:\n ana[new_str] = 0\n\nprint(answer)", "N = int(input())\nana = {}\nansw... | ['Runtime Error', 'Accepted'] | ['s367157294', 's177440113'] | [2940.0, 17852.0] | [17.0, 424.0] | [265, 282] |
p02947 | u934740772 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import math\n\nN=int(input())\nS=[]\nfor i in range(N):\n s=input()\n ss=list(s)\n ss.sort()\n S.append(ss)\nS.sort()\nans=0\ncnt=0\nfor i in range(N-1):\n if S[i]==S[i+1]:\n cnt+=1\n else:\n ans+=math.factorial(cnt-1)\n cnt=0\nprint(ans)', 'N=int(input())\nS_list=[]\nfor i in r... | ['Runtime Error', 'Accepted'] | ['s402254128', 's067352660'] | [24624.0, 26668.0] | [493.0, 511.0] | [259, 253] |
p02947 | u934868410 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int(input())\ns = []\nfor i in range(n):\n s.append(input())\n\nb = [False]*n\nans = 0\ncount = 1\n\nfor i in range(n):\n if b[i]:\n continue\n for j in range(i+1, n):\n if ana(s[i], s[j]):\n count += 1\n b[j] = True\n ans += count * (count-1) / 2\n count = 1\n b[i] = True\n \nprint(ans)\n ... | ['Runtime Error', 'Accepted'] | ['s573288478', 's103051814'] | [11036.0, 10736.0] | [151.0, 473.0] | [549, 338] |
p02947 | u935151656 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nL = [list(map(str, input().split())) for i in range(N)]\n\nfrom collections import Counter\ndef verify_anagrams(first_word, second_word):\n def get_counter(s):\n return Counter(s.replace(' ', ''))\n if get_counter(first_word) == get_counter(second_word):\n return True\n else:\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s601819296', 's635038270', 's668820825', 's702078374'] | [27760.0, 10208.0, 24212.0, 24232.0] | [307.0, 322.0, 332.0, 487.0] | [495, 179, 207, 212] |
p02947 | u935840914 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int(input())\ns = [str(input()) for _ in range(n)]\nt = []\nans = 0\nfor i in range(n):\n s[i] = sorted(s[i])\n\nt = set(s)\nans = len(s) - len(t)\n\n\nprint(ans)\n', 'n = int(input())\ns = [str(input()) for _ in range(n)]\nans = 0\nfor i in range(n):\n s[i] = "".join(sorted(s[i]))\n print(s[i])\n\n\nfor... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s467300331', 's637929257', 's702893220', 's912997548'] | [24092.0, 11388.0, 24152.0, 19404.0] | [316.0, 2108.0, 319.0, 385.0] | [159, 233, 159, 199] |
p02947 | u936985471 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n=int(input())\ns=[None]*n\nfor i in range(n):\n s[i]=sorted(input())\nimport collections\nc=collections.Counter(s)\nans=0\nfor v in c.valeus():\n ans+=(v*(v-1))//2\nprint(ans)\n ', 'n=int(input())\ns=[None]*n\nfor i in range(n):\n s[i]="".join(sorted(input()))\nimport collections\nc=collections.Counter(s)\nans=0... | ['Runtime Error', 'Accepted'] | ['s939779633', 's673022054'] | [24584.0, 19748.0] | [335.0, 354.0] | [172, 178] |
p02947 | u937642029 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import sys\nimport bisect\ninput = sys.stdin.readline\n \ndef main():\n n=int(input())\n s=[input() for i in range(n)]\n count=0\n \n for i in range(n):\n s[i]=sorted(s[i])\n \n for i in range(n-1):\n s[i].pop(0)\n \n for i in range(n-1):\n for j in range(n-i-1)... | ['Wrong Answer', 'Accepted'] | ['s060669350', 's762571559'] | [27800.0, 19404.0] | [2105.0, 329.0] | [394, 281] |
p02947 | u940635017 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['a = int(input())\nt = [input() for i in range(a)]\ncnt = 0\ndict = {}\nfor i in range(a):\n src = "".join(sorted(t[i]))\n if src in dict.keys():\n dict[src] += 1\n else:\n dict[src] = 0\nans = 0\nfor a in dict.values():\n ans += a*(a+1)/2\nprint(ans)', 'a = int(input())\nt = [input() for i i... | ['Wrong Answer', 'Accepted'] | ['s924741995', 's406083622'] | [24976.0, 24976.0] | [338.0, 336.0] | [263, 268] |
p02947 | u941606493 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['def main():\n n = int(input())\n\n s = list(\'\'.join(sorted(input()[:])) for i in range(n))\n\n count = 0\n for i in range(0, n):\n for j in range(i + 1, n):\n print(i, j)\n if s[i] == s[j]:\n count += 1\n\n print(count)\n\n\nif __name__ == "__main__":\n ... | ['Wrong Answer', 'Accepted'] | ['s634784681', 's784640013'] | [25124.0, 17928.0] | [2104.0, 384.0] | [307, 347] |
p02947 | u942479185 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N=int(input())\nls=[]\nn=0\nfor i in range(N):\n str1=''.join(sorted(input()))\n ls.count(str1)\n ls.append(str1)\nprint(n) \n", "N=int(input())\ndic={}\nans=0\nfor i in range(N):\n str1=''.join(sorted(input()))\n n=len(str1)\n if n in dic:\n if str1 in dic[n]:\n ans+=dic[n]... | ['Wrong Answer', 'Accepted'] | ['s309912006', 's057811313'] | [4060.0, 17852.0] | [2104.0, 422.0] | [134, 297] |
p02947 | u943057856 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n=int(input())\nd=dict()\nfor i in range(n):\n s="".join(sorted(input()))\n if s in d:\n d[s]+=1\n else:\n d[s]=1\nprint(d)\nans=0\nfor k in d.values():\n ans+=k*(k-1)//2\nprint(ans)', 'n=int(input())\nd=dict()\nfor i in range(n):\n s="".join(sorted(input()))\n if s in d:\n d[s]... | ['Wrong Answer', 'Accepted'] | ['s779907469', 's899811593'] | [20504.0, 17852.0] | [385.0, 371.0] | [196, 187] |
p02947 | u947145646 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['#input\nN = int(input())\nS = [sorted(input()) for i in range(N)]\n\nana = 0\nfor s1 in S:\n for s2 in S:\n if s1 == s2:\n ana += 1\n\nprint((ana - N) / 2)', "import collections\n\n#input\nN = int(input())\nS = [''.join(sorted(input())) for i in range(N)]\n\nS = collections.Counter(S)\n\nans = 0\... | ['Wrong Answer', 'Accepted'] | ['s135124978', 's556961199'] | [26256.0, 19760.0] | [2105.0, 357.0] | [166, 190] |
p02947 | u949876708 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import math\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nn = int(input())\nL = []\nS = set()\ncount = 0\nfor i in range(n):\n line = "".join(sorted(list(input())))\n L.append(line)\n S.add(line)\n\n\nfor s in S:\n count += comb(L.count(s), 2)\n\nprin... | ['Runtime Error', 'Accepted'] | ['s126806824', 's684247150'] | [16020.0, 17804.0] | [816.0, 428.0] | [307, 207] |
p02947 | u949981986 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['from operator import itemgetter\n\nn = int(input())\ns = [sorted(input()) for _ in range(n)]\ns_sort = sorted(s, key = itemgetter(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))\n\ncount = 0\ns_count = 0\n\nl = s_sort[0]\n\nprint(s_sort)\n\nfor i in range(1, n):\n if l == s_sort[i]:\n s_count += 1\n count += s_count\... | ['Wrong Answer', 'Accepted'] | ['s803874631', 's833180773'] | [54052.0, 39552.0] | [621.0, 499.0] | [367, 578] |
p02947 | u953868469 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N = int(input())\ntexts = []\nfor i in range(N):\n texts.append((input()))\n\nimport collections\ncounters = []\ncount = 0\nfor text in texts:\n text_list = list(text)\n text_list.sort()\n text = "".join(text_list) \n c = collections.Counter(text)\n counters.append(c)\n\n\n\nccccc = []\nanss = 0\nfo... | ['Runtime Error', 'Accepted'] | ['s298495173', 's629303398'] | [86808.0, 86844.0] | [1981.0, 1938.0] | [490, 492] |
p02947 | u959149013 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["n = int(input())\nd = {}\nans = 0\nfor st in range(n):\n s = ''.join(sorted(input()))\n if d.get(s) == None:\n d[s] = 1\n else:\n ans += d[s]\n d[s] += 1", "n = int(input())\nd = {}\nans = 0\nfor st in range(n):\n s = ''.join(sorted(input()))\n if d.get(s) == None:\n d[s] = ... | ['Wrong Answer', 'Accepted'] | ['s823006824', 's851101223'] | [17852.0, 17852.0] | [409.0, 403.0] | [174, 186] |
p02947 | u962330718 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N=int(input())\nA={}\nans=0\nfor i in range(N):\n s=input()\n s=sorted(s)\n if A.get(s,"Not")=="Not":\n A[s]=1\n else:\n ans+=A[s]\n A[s]+=1\nprint(ans)', 'N=int(input())\nP=[]\nfor i in range(N):\n s=input()\n s=sorted(s)\n P.append(s)\n\nP=sorted(P)\nlast=P[0]\ncnt=0\nans=0... | ['Runtime Error', 'Accepted'] | ['s944373669', 's955909898'] | [8996.0, 31632.0] | [29.0, 377.0] | [174, 244] |
p02947 | u963915126 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import numpy as np\n\nn = int(input())\nsraw = []\n\nfor nn in range(n):\n sraw.append(sorted(input().encode()))\n\nans = 0\n\ns = np.sort(np.array(sraw), axis=0).tolist()\n#print(s)\n\nl = len(s)\n\nfor ss in range(0, l):\n fl = 0\n #print("")\n for sss in range(ss+1, l):\n #print("{0} {1}".format... | ['Wrong Answer', 'Accepted'] | ['s975128853', 's916985299'] | [57488.0, 17852.0] | [2111.0, 401.0] | [438, 234] |
p02947 | u966667387 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["from operator import mul\nfrom functools import reduce\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nN = int(input())\nstr_dict = {}\nfor n in range(N):\n l = ''.join(sorted(input()))\n i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s083152051', 's780396768', 's866536793'] | [18336.0, 3064.0, 18340.0] | [381.0, 17.0, 371.0] | [420, 437, 436] |
p02947 | u967233756 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import numpy as np\nimport collections\n\nn = int(input())\nmoji = [list(map(str,input())) for index in range(n)]\ncount = int(0)\n\nfor index in range(n):\n moji[index].sort()\n moji[index] = "".join(moji[index])\n\nmoji.sort()\nprint(collections.Counter(moji))\n\nfor index in collections.Counter(moji).values():\n... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s262174272', 's802648712', 's867379126', 's898901238', 's252469713'] | [48824.0, 36084.0, 36124.0, 36208.0, 36124.0] | [739.0, 680.0, 653.0, 634.0, 655.0] | [353, 266, 320, 268, 320] |
p02947 | u968638278 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['\n\nN = int(input())\nS = []\nfor i in range(N):\n s = str(input())\n s = \'\'.join(sorted(s))\n S.append(s)\n\ncount = 0\nfor i in range(N):\n Si = S[i]\n for k in range(N):\n if i==k:\n None\n else:\n Sk = S[k]\n if Sk == Si:\n count += 1\... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s060159340', 's933698262', 's501160723'] | [10176.0, 3060.0, 17852.0] | [2104.0, 18.0, 387.0] | [536, 288, 534] |
p02947 | u969236097 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["import sys\np = [r for r in sys.stdin.read().split('\\n') if r != '']\nn = int(p[0])\ns = p[1:]\nfor i, r in enumerate(s):\n t = list(r)\n t.sort()\n s[i] = ''.join(t)\nd = {}\nfor i in s:\n if i in d:\n d[i] += 1\n else:\n d[i] = 0\ncount = 0\nfor k, v in d.items():\n print(k, v)\n ... | ['Wrong Answer', 'Accepted'] | ['s491818267', 's543336857'] | [28040.0, 28040.0] | [360.0, 241.0] | [343, 327] |
p02947 | u969850098 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["import sys \nfrom collections import Counter\nfrom math import factorial\n\ndef combinations_count(n, r):\n return factorial(n) // (factorial(n - r) * factorial(r))\n \ndef main():\n inpurt = sys.stdin.readline\n N = int(input())\n texts = [''.join(sorted(list(input().rstrip()))) for _ in range(N)]\n c = Counter... | ['Runtime Error', 'Accepted'] | ['s091832160', 's260310897'] | [19852.0, 19728.0] | [785.0, 225.0] | [414, 324] |
p02947 | u970809473 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import collections\nn = int(input())\na = []\nres= 0\nfor i in range(n):\n tmp = collections.Counter(input()).most_common()\n if a.count(tmp) >= 1:\n res += a.count(tmp)\n a.append(tmp)\nprint(res)', 'n = int(input())\na = {}\nfor i in range(n):\n tmp = "".join(sorted(input()))\n if tmp in a:\n a[tmp] += 1... | ['Wrong Answer', 'Accepted'] | ['s002784933', 's873987647'] | [11252.0, 17848.0] | [2104.0, 378.0] | [194, 185] |
p02947 | u971237642 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int(input())\ns = ["" for _ in range(n)]\n\nfor i in range(n):\n s[i] = input()\n\n#print(s)\n\ns_list = [[] for _ in range(n)]\nfor i in range(n):\n \n for j in range(10):\n s_list[i].append(s[i][j])\n \n s_list[i].sort()\n\ncheck = []\n\n\n\nfor i in range(n):\n for j in range(i+1, n):\... | ['Wrong Answer', 'Accepted'] | ['s801996486', 's834333117'] | [33296.0, 24980.0] | [2105.0, 353.0] | [671, 481] |
p02947 | u981309686 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n=int(input())\narr=[]\nfrom collections import Counter\nc=Counter([])\nfor _ in range n:\n s=input()\n z=[item for item in s]\n z.sort()\n z=tuple(z)\n c[z]+=1\nans=0\nfor item in c.values():\n ans+=(item*(item-1))//2\nprint (ans)', 'n=int(input())\narr=[]\nfrom collections import Counter\nc=Counter([])\nfor _... | ['Runtime Error', 'Accepted'] | ['s322369330', 's756138151'] | [8860.0, 28156.0] | [22.0, 306.0] | [224, 238] |
p02947 | u981931040 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['#from Collections import Counter\n\nN = int(input())\ncount = 0\nword = []\ndef verify_anagrams(w1, w2):\n f = lambda y: "".join(sorted(map(lambda x: x.replace(\' \', \'\').lower(), y)))\n return f(w1) == f(w2)\n\ndef str_sort(str):\n #f = lambda str: "".join(sorted(map(lambda x: x.replace(\' \', \'\').lower... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s610845900', 's861228233', 's967348622', 's975669422', 's815290491'] | [19736.0, 32928.0, 2940.0, 20476.0, 19760.0] | [2105.0, 924.0, 17.0, 1218.0, 742.0] | [569, 671, 1, 515, 372] |
p02947 | u982139831 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nS = [input() for i in range(N)]\n\n#word_list=list(map(lambda x: ''.join(sorted(x)),S))\nword_dict={}\nfor word in S:\n word=''.join(sorted(word))\n if word in word_dict.keys():\n word_dict[word] = word_dict[word]+(word_dict[word]+1)\n else:\n word_dict[word] = 0\nprint(word_dict)", "word_d... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s677779941', 's888630747', 's259833128'] | [27532.0, 3064.0, 24976.0] | [690.0, 18.0, 325.0] | [297, 700, 266] |
p02947 | u986884213 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["import collections\n\nN = int(input())\nlist = [''.join(sorted(input())) for i in range(N)]\n\nc = collections.Counter(list)\nans_list = c.most_common()\nprint([ans[1] for ans in ans_list if not ans[1]==1])", "import collections\n\nN = int(input())\nlist = [''.join(sorted(input())) for i in range(N)]\n\nc = collectio... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s100035199', 's331823005', 's413734613'] | [24484.0, 24492.0, 24496.0] | [377.0, 369.0, 377.0] | [199, 214, 285] |
p02947 | u986985627 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['from sys import stdin, exit\nfrom math import factorial\ninput = stdin.readline\nlmi = lambda: list(map(int, input().split()))\nmi = lambda: map(int, input().split())\nsi = lambda: input().strip(\'\\n\')\nssi = lambda: input().strip(\'\\n\').split()\n\ndef choose(x):\n return factorial(x)/(2*factorial(x-2))\n\nwords... | ['Runtime Error', 'Accepted'] | ['s075546213', 's513741555'] | [20496.0, 17848.0] | [654.0, 654.0] | [524, 542] |
p02947 | u987143553 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["def main():\n N = int(input())\n\n td = {}\n for _ in range(N):\n str = [ci for ci in input()]\n str.sort()\n t = ''.join(str)\n if t not in td.keys():\n td[t] = 0\n else:\n if td[t] == 0:\n td[t] = 1\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s040758723', 's042343552'] | [3060.0, 19500.0] | [18.0, 385.0] | [402, 351] |
p02947 | u987164499 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['# -*- coding: utf-8 -*-\nfrom sys import stdin\n\nn = int(stdin.readline().rstrip())\ndata = [stdin.readline().rstrip() for _ in range(n)]\nnew = []\nfor i in range(n):\n sort = sorted(data[i])\n sorting = "".join(sort)\n new.append(sorting)\nnew.sort()\nscore = 0\ns = 0\ncount = 0\nprint(new)\nwhile s<n-1:... | ['Wrong Answer', 'Accepted'] | ['s679319002', 's557481641'] | [21708.0, 39040.0] | [2105.0, 269.0] | [545, 334] |
p02947 | u989345508 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['N=int(input())\ns=[]\nfor i in range(N):\n s.append(list(input()).sort())\n\nc=0\nfor j in range(N):\n for i in range(N):\n if i<j:\n if s[i]==s[j]:\n c+=1\n else:\n break\n\nprint(c)\n', 'N=int(input())\ndic={}\nfor i in range(N):\n k="".join(sorted(list(in... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s512359072', 's564697605', 's318375906'] | [3872.0, 17808.0, 17808.0] | [2104.0, 409.0, 413.0] | [227, 188, 197] |
p02947 | u989654188 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int(input())\ns=[]\nm={}\nsum=0\nfor i in range(0,n):\n tmp = (list(input()).sort())\n if tmp in m:\n m[tmp]+=1\n else:\n m[tmp] = 0\nfor k in m:\n if m[k]>1:\n sum+=m[k]\nprint(sum)\n\n', 'import sys\nsys.setrecursionlimit(10000000)\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r =... | ['Wrong Answer', 'Accepted'] | ['s260678861', 's264229439'] | [3060.0, 98276.0] | [334.0, 557.0] | [208, 520] |
p02947 | u992465933 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["import math\nfrom collections import Counter\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ndef main():\n n = int(input())\n array_s = []\n array = []\n for i in range(n):\n array_s.append(input())\n\n for s in array_s:\n a... | ['Wrong Answer', 'Accepted'] | ['s087664722', 's092303189'] | [62820.0, 18520.0] | [2107.0, 363.0] | [755, 480] |
p02947 | u993435350 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['H = int(input())\nS = []\nfor _ in range(H):\n\tS.append(input()) \n\nL = []\n\nfor i in range(0,len(S)):\n\tL.append(sorted(S[i]))\n\nfor i in range(0,len(L)):\n\tL[i] = ",".join(L[i])\n\nprint(L)\n\ncounter = 0\n \nfor i in range(0,len(L)):\n\tfor j in range(i+1,len(L)):\n\t\tif L[i] == L[j]:\n\t\t\tcounter += 1\n... | ['Wrong Answer', 'Accepted'] | ['s493691452', 's325960993'] | [32028.0, 32028.0] | [2105.0, 367.0] | [303, 298] |
p02947 | u995062424 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['import collections\nimport math\n\ndef combinations_count(n, r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\nN = int(input())\ns = [""]*N\nfor i in range(N):\n s[i] = \',\'.join(sorted(input()))\n\nc = collections.Counter(s)\nans = 0\nfor value in c.values():\n ans += combinations_... | ['Runtime Error', 'Accepted'] | ['s951286704', 's293016807'] | [20588.0, 20584.0] | [839.0, 840.0] | [333, 370] |
p02947 | u995102267 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["N = int(input())\nlist_anagram = [''.join(sorted(str(input()))) for i in range(N)]\n\nlist_anagram.sort()\nans = 0\n\nprint(list_anagram)\n\nx = 1\n\nfor i in range(1, N):\n if i != N - 1 and list_anagram[i] == list_anagram[i - 1]:\n x += 1\n elif i != N - 1 and list_anagram[i] != list_anagram[i - 1]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s278962877', 's302940274', 's769383603'] | [14612.0, 14596.0, 10640.0] | [469.0, 550.0, 452.0] | [527, 565, 510] |
p02947 | u996434204 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ["from collections import Counter\n\n\ndef anagrams(word1,word2):\n def counter(s):\n return Counter(s.upper().replace(' ',''))\n return counter(word1) == counter(word2)\n\nN=int(input())\n\ncount=0\ncnt=0\n\nlist=[]\n\nfor i in range(N):\n list.append(input())\n\nfor i in list:\n list.remove(i)\n ... | ['Wrong Answer', 'Accepted'] | ['s299701294', 's049777526'] | [12540.0, 17848.0] | [2104.0, 370.0] | [479, 213] |
p02947 | u998082063 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int(input())\nans_dict = {}\nans = 0\nfor i in range(n):\n s = "".join(sorted(input()))\n if s in ans_dict:\n ans_dict[s] += 1\n else:\n ans_dict[s] = 1\nprint(ans_dict)\nfor j in ans_dict.values():\n ans += j * (j - 1) // 2\nprint(ans)', 'n = int(input())\nans_dict = {}\nans = 0\nfor i ... | ['Wrong Answer', 'Accepted'] | ['s289541749', 's825241542'] | [20496.0, 17852.0] | [400.0, 372.0] | [254, 238] |
p02947 | u999669171 | 2,000 | 1,048,576 | We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,... | ['n = int( input() )\n\ndict = {}\nfor i in range( n ):\n\tsorted_input = "".join( sorted( list( input() ) ) )\n\tprint( sorted_input )\n\tif dict.get( sorted_input ) == None:\n\t\tdict[ sorted_input ] = 0\n\telse :\n\t\tdict[ sorted_input ] += 1\n\ncount = 0\nfor eachValue in dict.values():\n\tcount += eachValue\nprin... | ['Wrong Answer', 'Accepted'] | ['s090151322', 's462792433'] | [18832.0, 18432.0] | [957.0, 438.0] | [305, 587] |
p02948 | u013629972 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools, os\nsys.setrecursionlimit(10**7)\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s097370774', 's143669297', 's301056995', 's454263603'] | [27336.0, 41828.0, 27336.0, 42176.0] | [2105.0, 352.0, 2105.0, 1647.0] | [2793, 1215, 2746, 3317] |
p02948 | u022979415 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ["from heapq import heappop, heapify, heappush\n\n\ndef main():\n n, m = map(int, input().split())\n work = [[] for _ in range(10 ** 4 + 1)]\n for _ in range(n):\n a, b = map(int, input().split())\n work[a].append(b)\n ans = 0\n q = []\n heapify(q)\n for i in range(1, m + 1):\n ... | ['Runtime Error', 'Accepted'] | ['s999261356', 's136053400'] | [13472.0, 24432.0] | [176.0, 272.0] | [509, 492] |
p02948 | u023958502 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import heapq\nN,M = map(int,input().split())\ndays = [[] for _ in range(M + 1)]\nfor n in range(N):\n\ta,b = map(int,input().split())\n\tif a > M:\n\t\tcontinue\n\tdays[a].append(-b)\n\ntotal_reward = 0\nq = []\nfor day in range(M + 1):\n\tthis_day = days[day]\n\tfor reward in this_day:\n\t\theapq.heappush(q,reward)\... | ['Runtime Error', 'Accepted'] | ['s270425535', 's992343875'] | [3064.0, 17604.0] | [17.0, 444.0] | [360, 361] |
p02948 | u024807881 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['def main():\n _, m, ab = map(int, open(0).read().split())\n ab = zip(ab[0::2], ab[1::2])\n pay = 0\n day = 0\n for t in reversed(sorted(ab, key=lambda x: (x[1], x[0]))):\n a, b = t\n\n \n if day > m:\n break\n \n if a > m or day+a > m:\n continue... | ['Runtime Error', 'Accepted'] | ['s551248585', 's590620517'] | [18260.0, 32688.0] | [34.0, 202.0] | [443, 510] |
p02948 | u047535298 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import heapq\nN, M = map(int, input().split())\nW = [tuple(map(int, input().split())) for i in range(N)]\nW.sort()\nprint(W)\nh = []\n\nj = 0\nans = 0\nfor i in range(M+1):\n while j < N and W[j][0] < i+1:\n heapq.heappush(h, (-W[j][1], W[j][1]))\n j += 1\n if h:\n p = heapq.heappop(h)\n ... | ['Wrong Answer', 'Accepted'] | ['s528186881', 's165700334'] | [28368.0, 27076.0] | [649.0, 615.0] | [331, 322] |
p02948 | u054471580 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['n,m = (int(i) for i in input().split())\na=[]\nb=[]\njobs = [[] for i in range(m)]\nfor i in range(n):\n tmp,tmp2 = (int(i) for i in input().split())\n if(tmp>m):\n continue\n a.append(tmp)\n b.append(tmp2)\n jobs[m-tmp].append(tmp2)\n \nans = 0\nh=[]\nfor i in range(m-1,-1,-1):\n for b in... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s396811173', 's647204771', 's836794585'] | [22284.0, 17604.0, 18592.0] | [432.0, 2104.0, 532.0] | [447, 431, 395] |
p02948 | u073852194 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import heapq\n\nn,m = map(int,input().split())\nJobs = [list(map(int,input().split()))for i in range(n)]\n\nDays = [[] for i in range(m)]\nfor i in range(n):\n if Jobs[i][0] <= m-1:\n Days[Jobs[i][0]-1] += [[-Jobs[i][1],Jobs[i][0]]]\n\nHeap = []\nheapq.heapify(Heap)\nans = 0\nfor i in range(m):\n for job... | ['Wrong Answer', 'Accepted'] | ['s109859611', 's854080327'] | [46212.0, 20932.0] | [689.0, 603.0] | [420, 392] |
p02948 | u075595666 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import sys\ninput = sys.stdin.readline\nn,m = map(int,input().split())\nchk = []\nfor i in range(n):\n a,b = map(int,input().split())\n if a <= m:\n chk.append((-b,a))\n\nfrom heapq import heapify, heappop, heappush\nfrom operator import itemgetter\nchk = sorted(chk,key=itemgetter(1))\n\ns = []\nheapify(s)\nans... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s600556642', 's788887234', 's018322519'] | [19072.0, 22300.0, 59364.0] | [358.0, 377.0, 506.0] | [577, 514, 189] |
p02948 | u083624265 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['n, m = map(int, input().split())\n\nj = []\nfor _ in range(n):\n a,b = map(int, input().split())\n if a <= m :\n j.append([a,b])\nj.sort()\np = 0\ntemp = []\nfor i in range(1, m+1):\n while j and j[0][0] <= i:\n a,b = j.pop(0)\n temp.append(b)\n p+=max(temp)\n temp.remove(max(temp)... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s024852686', 's039721705', 's614300906', 's935787325'] | [19928.0, 19996.0, 19928.0, 17252.0] | [2105.0, 2105.0, 2105.0, 541.0] | [313, 325, 296, 342] |
p02948 | u089142196 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['from collections import deque\nN,M=map(int,input().split())\nA=[0]*N \nB=[0]*N \nC=[0]*N\nfor i in range(N):\n A[i],B[i]= map(int,input().split())\n C[i]=[A[i],B[i]]\n \nC.sort(key=lambda x:x[0],reverse=True) は長いものから候補にして考えてみる\nC.sort(key=lambda x:x[1],reverse=True) を最初にもってくる\nD=deque(C)\n\ni=0\nreward=0\n#pr... | ['Wrong Answer', 'Accepted'] | ['s952650847', 's243741324'] | [23088.0, 29996.0] | [519.0, 435.0] | [550, 491] |
p02948 | u091051505 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import bisect\n\nn, m = map(int, input().split())\na_list = []\nfor _ in range(n):\n a, b = map(int, input().split())\n if a <= m:\n a_list.append([a, b])\na_list = sorted(a_list, key=lambda x: (x[0], -x[1]))\na_list_1 = [aa[0] for aa in a_list]\na_list_2 = [aa[1] for aa in a_list]\nans = 0\nfor i in ran... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s126887029', 's339090164', 's786074558', 's806780650', 's873045575', 's927390456', 's318356168'] | [31492.0, 31484.0, 34568.0, 3064.0, 31484.0, 32220.0, 27660.0] | [661.0, 553.0, 2106.0, 18.0, 506.0, 2109.0, 517.0] | [549, 614, 417, 400, 572, 569, 386] |
p02948 | u093861603 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import heapq\nN,M=map(int,input().split())\nAB=[list(map(int,input().split())) for _ in range(N)]\n\nAB.sort(reverse=True)\nworks=[]\nheapq.heapify(works)\nans=0\nAB.append(0)\nfor i in range(1,M+1):\n day=M-i\n latest=i\n while AB and AB[-2][0]<=latest:\n a,b=AB.pop(-2)\n heapq.heappush(works,-b)\n if not ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s234164618', 's686448176', 's758561076', 's262976927'] | [28080.0, 28272.0, 29740.0, 28272.0] | [576.0, 487.0, 577.0, 601.0] | [363, 362, 367, 372] |
p02948 | u095021077 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import numpy as np\n\ntemp=list(map(int, input().split()))\nN=temp[0]\nM=temp[1]\n\nAB=np.array([list(map(int, input().split())) for i in range(N)])\nAB=np.c_[AB, np.zeros((AB.shape[0], 1))]\n\nmoney=0\nfor i in range(1, M+1):\n temp=AB[AB[:, 0]<=i]\n temp=temp[temp[:, 2]==0]\n temp=temp[np.argmax(temp[:, 1])]\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s195820483', 's321158587', 's658908195'] | [37844.0, 12504.0, 32548.0] | [2112.0, 155.0, 577.0] | [442, 69, 311] |
p02948 | u111365362 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['n,m = map(int,input().split())\nab = []\nfor i in range(n):\n a,b = map(int,input().split())\n ab.append([-a,b])\nab.sort()\nab.reverse()\n#print(ab)\nhere = 0\nans = 0\ncnt = -1\npool = []\nfor i in range(m+1):\n while True:\n if here == n:\n break\n elif ab[here][0] == -i:\n pool.append(ab[here][... | ['Wrong Answer', 'Accepted'] | ['s955323210', 's828902322'] | [21964.0, 31968.0] | [2105.0, 630.0] | [427, 363] |
p02948 | u111473084 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['def main():\n import sys\n sys.setrecursionlimit(10**9)\n input = sys.stdin.readline\n from heapq import heappush, heappop\n\n N, M = map(int, input().split())\n AB = [ [] for _ in range(100000) ]\n\n for _ in range(N):\n a, b = map(int, input().split())\n AB[a-1].append(-b)\n\n ... | ['Wrong Answer', 'Accepted'] | ['s876669785', 's602619152'] | [22224.0, 21992.0] | [173.0, 179.0] | [462, 482] |
p02948 | u115110170 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import heapq\n\nn,m = map(int,input().split())\n\nls = [list(map(int,input().split())) for i in range(n)]\n\nls = sorted(ls,key=lambda x:(x[0],-x[1]))\n\nans = 0\na = []\nj = 0\nfor i in range(m-1,-1,-1):\n while j<len(ls) and ls[j][0] == m-i:\n heapq.heappush(a,ls[j][1]*(-1))\n j += 1\n g = -1*heapq.heappop(... | ['Runtime Error', 'Accepted'] | ['s569772104', 's421882452'] | [39316.0, 39316.0] | [667.0, 638.0] | [328, 333] |
p02948 | u116002573 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import collections\ndef main():\n nm = input().split()\n n, m = int(nm[0]), int(nm[1])\n\n d = collections.defaultdict(list)\n for i in range(n):\n ab = input().split()\n ai, bi = int(ab[0]), int(ab[1])\n d[bi].append(ai)\n for bi in d:\n d[bi] = sorted(d[bi], reverse = True... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s204953421', 's263315751', 's304646061', 's797769028', 's933063524'] | [3316.0, 13380.0, 10520.0, 10896.0, 20296.0] | [21.0, 2104.0, 2104.0, 2104.0, 598.0] | [801, 753, 847, 819, 482] |
p02948 | u120233192 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ["# 3.4.3\n\nimport re\nfrom collections import deque\nfrom functools import reduce\nfrom itertools import permutations\nfrom math import pi\nfrom operator import itemgetter\nfrom operator import mul\nfrom operator import xor\nfrom os import linesep\nfrom queue import PriorityQueue\nfrom sys import stdin\n\n\ndef rline... | ['Wrong Answer', 'Accepted'] | ['s711540689', 's375715449'] | [40432.0, 25444.0] | [420.0, 207.0] | [2638, 1418] |
p02948 | u125205981 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['from collections import defaultdict\nfrom heapq import heapify, heappop, heappush\nfrom sys import stdin\n\ndef main():\n N, M = map(int, input().split())\n AB = [tuple(map(int, input().split())) for _ in [0] * N]\n\n ab = defaultdict(list)\n for a, b in AB:\n ab[a].append(b * -1)\n\n ans = 0\n ... | ['Runtime Error', 'Accepted'] | ['s969333534', 's102489391'] | [38280.0, 38584.0] | [236.0, 303.0] | [604, 547] |
p02948 | u126232616 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['n,m = map(int,input().split())\nab = [[] for i in range(1,m+1)]\nfor i in range(n):\n a,b = map(int,input().split())\n ab[a].append(b)\nab = {i:sorted(ab[i],reverse=True) for i in ab}\nprint(ab)\nans = 0\nfor i in range(m)[::-1]:\n rem = m - i\n #print("rem=",rem,"ab[rem]=",ab[rem])\n mx = 0\n fl = ... | ['Runtime Error', 'Accepted'] | ['s641954007', 's549216362'] | [17328.0, 19896.0] | [312.0, 433.0] | [541, 380] |
p02948 | u131944095 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ['import heapq\nn, m = map(int, input().split())\njobs = [[] for _ in range(n)]\n\nfor i in range(n):\n a, b = map(int, input().split())\n if a > m:\n continue\n jobs[m-a].append(b)\n\nque = []\nans = 0\nfor i in range(m-1, -1, -1):\n for wage in jobs[i]:\n heapq.heappush(que, wage*-1)\n if len(que):\n an... | ['Runtime Error', 'Accepted'] | ['s997932518', 's826785964'] | [18488.0, 18456.0] | [444.0, 451.0] | [361, 361] |
p02948 | u139614630 | 2,000 | 1,048,576 | There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea... | ["#!/usr/bin/env python3\n\nfrom operator import neg\nfrom bisect import bisect_left\n\n\nMIN = -10**5-1\n\n\ndef solve(N, M, A, B):\n ab = list(sorted(zip(A, map(neg, B))))\n print(ab)\n total = 0\n for i in range(1, M+1):\n right = bisect_left(ab, (i, MIN))\n if right >= len(ab):\n ... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s352029367', 's468067671', 's388966936'] | [26792.0, 28876.0, 22160.0] | [2105.0, 2109.0, 1120.0] | [855, 1048, 868] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.