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 | u229518917 | 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={}\ncnt=0\nfor i in range(N):\n Z=sorted(list(input()))\n K="".join(Z)\n if K in S:\n S[K]+=1\n else:\n S[K]=1\nfor T in S.values():\n mul=1\n v=1\n if T>1:\n for t in range(T,1,-1):\n mul*=t\n cnt+=mul\n else:\n continue\nprint(i... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s547926318', 's630637842', 's773856469'] | [17808.0, 17932.0, 17808.0] | [2104.0, 2103.0, 412.0] | [311, 324, 285] |
p02947 | u230416699 | 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\nfor i in range(N):\n s = input()\n S.append(''.join(sorted(s)))\n\nS.sort()\ncount = 0\nsw = 0\nfor i in range(1, len(S)):\n if S[i-1]==S[i]:\n sw = 1\n count += 1\n else:\n if sw==1:\n count += 1\n sw = 0\n\nif sw==1:\n count += 1\... | ['Wrong Answer', 'Accepted'] | ['s415164714', 's009208627'] | [10588.0, 10700.0] | [398.0, 392.0] | [311, 447] |
p02947 | u231685196 | 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,... | ['d = {}\nfor i in range(n):\n temp = [0 for i in range(26)]\n s = input()\n for c in s:\n t = ord(c)-97\n temp[t]+=1\n for i in range(26):\n temp[i] = str(temp[i])\n txt = ",".join(temp)\n if txt not in d:\n d[txt] = 1\n else:\n d[txt] += 1\nans = 0\nfor k in d:\... | ['Runtime Error', 'Accepted'] | ['s522630879', 's781467694'] | [3064.0, 21476.0] | [18.0, 1489.0] | [368, 385] |
p02947 | u241159583 | 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 _ in range(N):\n a = "".join(sorted(input()))\n if a not in s:\n s[a] = 0\n else: s[a] += 1\n\nans = 0\nprint(s)\nfor v in s.values():\n ans += v\n if v > 1: ans += 1\nprint(ans)', 'from collections import Counter\nn = int(input())\ns = Counter(["".join(sorted(input())) for _ in ... | ['Wrong Answer', 'Accepted'] | ['s666413979', 's426097736'] | [20376.0, 19760.0] | [389.0, 338.0] | [203, 166] |
p02947 | u242031676 | 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 fun(x):\n ret = 1\n while x:\n ret *= x\n x -= 1\n return ret\n\ndef cmb(n,r):\n if n==r: return 1\n else: return fun(n) // (fun(r)*fun(n-r))\n\n\n\n\nn = int(input())\n\nss = [sorted(input()) for i in range(n)]\nss.sort()\n\ntmp = ss[0]\nsss = [0]*n\nj = 0\nfor i in range(n):\n if... | ['Time Limit Exceeded', 'Accepted'] | ['s311675280', 's047620408'] | [27332.0, 24652.0] | [2105.0, 534.0] | [444, 243] |
p02947 | u243755204 | 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 factorial(i):\n ans = 1\n for j in range(1,i+1):\n ans *= j\n return ans\n\nN = int(input())\nA = [input() for i in range(N)]\na = []\nfor i in A:\n b = list(i)\n b.sort()\n a.append(b)\n\na.sort()\nans = a[0]\ncount=0\nfor i in range(1,N):\n ans = a[i]\n for j in range(i,N):\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s552746696', 's554407592', 's914580592', 's367578764'] | [33464.0, 78952.0, 31828.0, 17808.0] | [2105.0, 2112.0, 2105.0, 380.0] | [350, 349, 446, 261] |
p02947 | u247830763 | 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\nn = int(input())\nls = list(input() for i in range(n))\na = []\nb = 0\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nfor j in range(n):\n t = list(ls[j])\n t.sort()\n m = " ".join(t)\n a.append(m)\nc = collectio... | ['Runtime Error', 'Accepted'] | ['s694478485', 's497788978'] | [32432.0, 20584.0] | [2105.0, 788.0] | [405, 419] |
p02947 | u249218227 | 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())\nli = [input() for x in range(N)]\nans = 0\nwli = list()\nfor k in li:\n wli.append(sorted(list(k))\nfor i in range(N):\n word = wli[i]\n for j in range(i+1, N):\n comp = wli[j]\n if word == comp:\n ans += 1\nprint(ans) ', 'import collections\nN = int(inpu... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s847697811', 's966380450', 's078497101'] | [2940.0, 10592.0, 25332.0] | [17.0, 146.0, 346.0] | [270, 242, 251] |
p02947 | u252828980 | 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\nli = []\nfor i in range (n):\n li.append(sorted(list(input())))\nli.sort()\n\ndef comb(x,y):\n d = itertools.combinations(x,y)\n return len(list(d))\n\ncnt = 0\na = []\nfor i in range(n-1):\n if li[i] == li[i+1]:\n a.append(i+1)\n if i == n-2:\n a.append("1")\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s364539431', 's672853436', 's785308867', 's990428240'] | [3064.0, 3064.0, 2940.0, 24068.0] | [17.0, 19.0, 17.0, 227.0] | [420, 554, 369, 213] |
p02947 | u254871849 | 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,... | ['# 2019-11-16 14:51:41(JST)\nimport sys\nimport collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l\n# import itertools\n# from functools import reduce\n# import operator as op\nfrom scipy.misc im... | ['Wrong Answer', 'Accepted'] | ['s601304218', 's547005758'] | [29584.0, 135256.0] | [953.0, 502.0] | [714, 651] |
p02947 | u255595446 | 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,... | ['num = int(input())\ndata = []\nfor _ in range(num):\n tmp = input()\n data.append(tmp.sort())\ndata = data.sort()\ncount = 0\nfor i in range(num):\n tmp = data[i]\n for j in range(i+1,num):\n if tmp == data[j]:\n count+=1\n else:\n break\nprint(count)', 'num = int(input... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s307147200', 's881508939', 's352658178'] | [3060.0, 40316.0, 17852.0] | [17.0, 2105.0, 271.0] | [285, 285, 549] |
p02947 | u268291479 | 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\n\nstr_list = [input() for i in range(N)]\n\nimport itertools as iter\ncomb_list = list(iter.combinations(str_list, 2))\n\ndef from_cache(cache_dict, word):\n if word in cache_dict.keys():\n return cache_dict\n\n cnt_dict = {}\n for s in list(word):\n if s not in cnt_dict.key... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s029772020', 's068024733', 's323758454', 's816647099', 's845832359', 's890104703', 's938595697'] | [1898908.0, 1665644.0, 1895452.0, 3064.0, 3064.0, 1902752.0, 17808.0] | [2223.0, 2206.0, 2227.0, 17.0, 17.0, 2223.0, 404.0] | [856, 408, 834, 394, 426, 868, 425] |
p02947 | u272075541 | 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\nchars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",\n "w", "x", "y", "z"]\n\n\ndef eratosthenes_sieve(n):\n primes = [2]\n for odd in range(3, n + 1, 2):\n for p in primes:\n if odd % p == 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s016881573', 's253387994'] | [29744.0, 17332.0] | [980.0, 677.0] | [685, 1586] |
p02947 | u273201018 | 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())\n\nF = [None] * (N+1)\nF[0] = 1\n\nfor i in range(1, N+1):\n F[i] = F[i-1] * i\n\nS = [''.join(sorted(list(input()))) for i in range(N)]\n", "import math\n\nfrom collections import Counter\n\n\nN = int(input())\n\nS = [''.join(sorted(list(input()))) for i in r... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s067647847', 's423416462', 's066288629'] | [3956.0, 19724.0, 19720.0] | [2285.0, 756.0, 762.0] | [185, 210, 280] |
p02947 | u274080981 | 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 clc(num):\n return 1+num*(num-1)/2 +num-1\n\nn =int(input())\ncnt=0\npr=0\ns=[None]*n\nans=[0]*n\nfor i in range(n):\n s[i]=sorted(input())\ns.sort()\nfor j in range(0, n-1, 1):\n if s[j] == s[j+1]:\n ans[cnt] += 1\n else:\n cnt +=1\nclcnums = [clc(n) for n in ans if n!= 0]\nprint(sum(clcnums))', 'def c... | ['Wrong Answer', 'Accepted'] | ['s138209466', 's568809209'] | [25420.0, 25420.0] | [539.0, 561.0] | [292, 297] |
p02947 | u274635633 | 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)]\nfor i in range(n):\n s[i]=sorted(s[i])\ns=sorted(s)\ncounta=1\nans=0\nfor i in range(n-1):\n if s[i]==s[i+1]:\n counta+=1\n else:\n ans+=counta*(counta-1)\n counta=0\nans+=counta*(counta-1)\nprint(ans)', 'n=int(input())\ns=[input() for i in range(n)]\nfor i i... | ['Wrong Answer', 'Accepted'] | ['s916361867', 's617117123'] | [25500.0, 25432.0] | [488.0, 508.0] | [246, 252] |
p02947 | u276204978 | 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_ = input()\n s.append(sorted(s_)[0])\n\nss = list(set(s))\n\nres = 0\nfor ssi in ss:\n res += s.count(ssi) - 1\n \nprint(res)', "n,*sl, = map(lambda x:''.join(sorted(x)),open(0).read().split())\ncount = 0\ndict = {}\nfor s in sl:\n if s in dict:\n count... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s218742717', 's326457877', 's726422957', 's155190054'] | [3872.0, 21128.0, 26884.0, 21128.0] | [327.0, 196.0, 2105.0, 191.0] | [174, 175, 186, 188] |
p02947 | u277312083 | 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\nn = int(input())\nl = ["".join(sorted(input())) for i in range(n)]\nl.sort()\nc = 0\nb = l[0]\nans = 0\nfor s in l[1:]:\n if s == b:\n c += 1\n else:\n ans += c * (c + 1) * 0.5\n c = 0\n b = s\nprint(ans)', 'from collections import Counter\nn = int(input())\nc = Counter(["".... | ['Wrong Answer', 'Accepted'] | ['s313648029', 's141949277'] | [11012.0, 19804.0] | [426.0, 385.0] | [233, 172] |
p02947 | u278057806 | 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 defaultdict\n\nN = int(input())\nS = [list(input()) for i in range(N)]\n\nd = defaultdict(int)\n\nfor s in S:\n s.sort()\n s = "".join(s)\n d[s] += 1\n\nans = 0\n\nfor key in list(d):\n ans += d[key] * (d[key] - 1) // 2\n\nprint(ans)\nprint(d)\n', 'from collections import Counter a... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s040977595', 's580547428', 's718347906'] | [45304.0, 3436.0, 39428.0] | [423.0, 218.0, 407.0] | [262, 235, 253] |
p02947 | u279718559 | 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 s = [''.join(sorted(input())) for _ in range(N)]\n from collections import Counter\n c = Counter(s)\n print(sum((x*(x-1))//2 for x in c.values()))", "N = int(input())\ns = [''.join(sorted(input())) for _ in range(N)]\nfrom collections import Counter\n\nc = Counter(s)\nprint(sum((x * (... | ['Runtime Error', 'Accepted'] | ['s053942330', 's864349520'] | [2940.0, 19788.0] | [17.0, 353.0] | [175, 165] |
p02947 | u280978334 | 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().sort() for _ in range(N)]\n\nfrom scipy.misc import comb\n\ndef main():\n dic = {}\n ans = 0\n for s in S:\n if s in dic:\n dic[s] += 1\n else:\n dic[s] = 1\n for val in dic.values():\n if val > 1:\n ans += comb(val,2)\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s119650225', 's453713054', 's899292504', 's410609804'] | [3060.0, 3060.0, 16304.0, 30992.0] | [17.0, 17.0, 370.0, 385.0] | [366, 369, 766, 690] |
p02947 | u286486951 | 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 pandas as pd\nN = int(input())\nhoge = list(input())\n"df = pd.DataFrame([], columns=["words"])\nprint(hoge)', 'from collections import Counter\nN = int(input())\nlis = ["".join(sorted(list(input()))) for _ in range(N)]\nkeys, values = zip(*Counter(lis).most_common())\nvalues = list(filter(lambda x: x >= 2, va... | ['Runtime Error', 'Accepted'] | ['s248362758', 's909287368'] | [2940.0, 25572.0] | [17.0, 434.0] | [111, 278] |
p02947 | u288948615 | 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 = [list(input()) for _ in range(N)]\nfor i in range(N):\n S[i] = sorted(S[i])\n\ncount = 0\nfor i in range(N):\n for j in range(i+1, N):\n if S[i] != S[j]:\n count += j - i\n break\n\nprint(count)', "N = int(input())\ndic = {}\ns = 0\nfor n in range(N):\n v = ''... | ['Wrong Answer', 'Accepted'] | ['s441335575', 's529194192'] | [24212.0, 17852.0] | [2105.0, 388.0] | [239, 170] |
p02947 | u293403071 | 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\nslist = []\nfor h in range(n):\n slist.append(input())\n\nnewlist = []\nword=[]\nwordy = ""\nfor i in range(n):\n word = list(slist[i])\n word.sort()\n for jk in range(len(word)):\n\t wordy = wordy+word.pop()\n newlist.append(wordy)\n wordy=""\nnew2list = sorted(newlist)\n\nprint(new2list)\... | ['Wrong Answer', 'Accepted'] | ['s284377837', 's145847946'] | [22928.0, 26676.0] | [2104.0, 603.0] | [443, 419] |
p02947 | u297801580 | 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\nfrom math import factorial\n\nN =int(input())\ncnts = [frozenset(collections.Counter(list(input())).items()) for _ in range(N)]\nxs = collections.Counter(cnts)\nans = 0\nfor _,v in xs.items():\n if v>=1:\n a = factorial(v) // (2*factorial(v - 2))\n ans +=a\nprint(ans)', 'import co... | ['Runtime Error', 'Accepted'] | ['s799989038', 's442497871'] | [140716.0, 140716.0] | [1746.0, 1784.0] | [294, 293] |
p02947 | u298945776 | 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())\nwordl = {}\nans = 1\n\nfor i in range(N):\n w = input()\n wl = []\n for j in range(10):\n wl.append(w[j])\n wl.sort()\n w2 = ' '\n for p in range(10):\n w2 += wl[p]\n if w2 in wordl:\n ans += 1\n else:\n wordl[w2] = 0\n\nprint(ans)\n\n", "N = int(i... | ['Wrong Answer', 'Accepted'] | ['s035548833', 's994679101'] | [17892.0, 17892.0] | [760.0, 782.0] | [729, 760] |
p02947 | u301624971 | 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=[]\ncnt=dict()\n\n\nfor _ in range(N):\n tmp=list(input())\n sort_tmp=sorted(tmp)\n stmp=''.join(sort_tmp)\n if((stmp in s)==True):\n n=s.index(stmp)\n if((n in cnt.keys())==False):\n cnt[n]=1\n else:\n cnt[n]+=1\n else:\n s.append(stm... | ['Wrong Answer', 'Accepted'] | ['s037534377', 's755603164'] | [4172.0, 19500.0] | [2104.0, 372.0] | [387, 427] |
p02947 | u303059352 | 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 = 0\ndict = {}\nfor _ in range(n):\n s = sorted(list(input()))\n if dict[s] == NULL:\n dict[s] = 0\n ans += dict[s]\n dict[s] += 1\nprint(ans)', "n = int(input())\nans = 0\ndict = {}\nfor _ in range(n):\n s = str(''.join(sorted(list(input()))))\n try:\n ans += dic... | ['Runtime Error', 'Accepted'] | ['s472487887', 's428931429'] | [3060.0, 17808.0] | [17.0, 493.0] | [174, 193] |
p02947 | u305940825 | 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().split() for i in range(N)]\ncount = 0\n\ns = [sorted(str(i)) for i in s]\nprint(s)\nfor i in range(N):\n for j in range(i+1, N):\n if s[i] == s[j]:\n count += 1\nprint(count)\n', "N = int(input())\ns = [''.join(sorted(input())) for i in range(N)]\ns.sort()\ncount = ... | ['Wrong Answer', 'Accepted'] | ['s987989471', 's818709733'] | [60028.0, 10640.0] | [2108.0, 400.0] | [217, 254] |
p02947 | u306412379 | 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 = []\ncnt = 0\n\nfor i in range(n):\n s = sorted(list(input()))\n arr.append(s)\n\nfor i in range(n):\n for j in range(i,n):\n if arr[i] == arr[j]:\n cnt += 1\n \n\nprint(cnt//2)', 'n = int(input())\narr = []\ncnt = 0\n\nfor i in range(n):\n s = sorted(list(input()))\n arr.append... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s177739075', 's563444613', 's859699442', 's892032304'] | [30412.0, 30428.0, 30516.0, 56880.0] | [2206.0, 2206.0, 2206.0, 385.0] | [200, 213, 213, 314] |
p02947 | u306950978 | 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())\na = []\nans = 0\nfor i in range(n):\n a.append("".join(sorted(input())))\n\nc = collections.Counter(a)\nan = c.values()\n\nfor i in an:\n ans += i*(i-1)/2\nprint(ans)', 'import collections\n\nn = int(input())\na = []\nans = 0\nfor i in range(n):\n a.append("".join(sort... | ['Wrong Answer', 'Accepted'] | ['s659553140', 's721319609'] | [19760.0, 19760.0] | [350.0, 356.0] | [199, 204] |
p02947 | u307516601 | 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 \ndef get_counter(s):\n return Counter(s)\n\nn = int(input())\nl = []\nfor i in range(n):\n for s in input():\n l.append(s)\n\nans = 0\ni = 0\nwhile i < len(l):\n ans += sum([get_counter(l[i]) == get_counter(l[n]) for n in range(i+1,n)])\n i += 1\nprint(ans)', "imp... | ['Wrong Answer', 'Accepted'] | ['s930336341', 's045242871'] | [12000.0, 17804.0] | [2104.0, 409.0] | [295, 231] |
p02947 | u309120194 | 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())\ns = [input() for _ in range(N)]\n\n\nfor i in range(N):\n s[i] = Counter(s[i]).most_common()\n ', 'N = int(input())\ns = [input() for _ in range(N)]\n\nfor i in range(N):\n s[i] = list(set(s[i]))\n \nprint(len(set(s)))', "from collections import Counter\n\nN = ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s458276367', 's867503949', 's610985791'] | [80892.0, 23016.0, 29048.0] | [633.0, 238.0, 249.0] | [172, 115, 517] |
p02947 | u309834353 | 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 c(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = int(input())\n# k,x = map(int,input().split())\ns_l = []\nfor i in range(n):\n s_l.append(input())\n\nfor i in range(n):\n a = ''\n for x in sorted(s_l[i]):\n a += x\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s413275473', 's692301224', 's630780749'] | [16400.0, 16400.0, 19832.0] | [2104.0, 2104.0, 415.0] | [581, 1034, 488] |
p02947 | u310381103 | 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 math import factorial\nN=int(input())\ncount=[0]\nu=0\ns=[sorted(input()) for i in range(N)]\ns=sorted(s)\nfor t in range(N-1):\n if s[t+1]==s[t]:\n count[u]+=1\n else:\n u.append(0)\nfor i in range(u):\n a=factorial(u)/factorial(2)/factorial(u-2)\nprint(a)', "N=int(input())\ncount=0\ns=[i... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s029520024', 's081141445', 's536013181', 's612016678', 's838464871', 's787689019'] | [25420.0, 10268.0, 13876.0, 24208.0, 25420.0, 19504.0] | [500.0, 143.0, 2104.0, 334.0, 487.0, 358.0] | [272, 138, 271, 172, 275, 244] |
p02947 | u311601704 | 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())\n\nin_str = []\nfor _ in range(n):\n i = input()\n in_str.append(''.join(sorted(i)))\n\n\ndef cmb(n, r):\n \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 ... | ['Wrong Answer', 'Accepted'] | ['s988675105', 's266098558'] | [11508.0, 11508.0] | [629.0, 433.0] | [1026, 1026] |
p02947 | u314089899 | 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,... | ['#137c\n# sys.stdin.readline()\nimport sys\ninput = sys.stdin.readline\n\nN = int(input())\nA = [str(input()) for _ in range(N-1)]\nA = [str[0:10] for str in A]\nA.append(str(input()))\n\nsList = []\nappend = sList.append\nans = 0\n\nfor string in A: #2<N<10^5\n \n \n dictionarized_string = {letter: string.count... | ['Wrong Answer', 'Accepted'] | ['s877645581', 's140882695'] | [17308.0, 23652.0] | [2104.0, 518.0] | [435, 511] |
p02947 | u317779196 | 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 = [str(input()) for i in range(n)]\ns_sort = [sorted(i) for i in s]\nans = 0 \nfor i in range(n):\n for j in range(i+1,n):\n ans += s_sort[j:].count(s_sort[i])\n\nprint(ans)', 'n = int(input())\ns = [str(input()) for i in range(n)]\ns_sort = [sorted(i) for i in s]\nans = 0 \nfor i in r... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s118963009', 's870145974', 's955079894', 's597772891'] | [34060.0, 31260.0, 26636.0, 26512.0] | [2105.0, 297.0, 314.0, 309.0] | [196, 331, 305, 310] |
p02947 | u325282913 | 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\ndef P(n, r):\n return math.factorial(n)//math.factorial(n-r)\ndef C(n, r):\n return P(n, r)//math.factorial(r)\ndef moji(s):\n tmp = []\n for i in range(10):\n tmp.append(s[i])\n tmp.sort()\n new_s = ''\n for i in range(10):\n new_s += tmp[i]\n return new_s\n\nN = in... | ['Runtime Error', 'Accepted'] | ['s177083217', 's817224898'] | [17932.0, 18908.0] | [1031.0, 780.0] | [497, 354] |
p02947 | u325956328 | 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\nlist_s = []\nfor j in range(n):\n \n list_s.append(''.join(sorted(s[j])))\n\nm = {}\nfor i in range(n):\n if list_s[i] not in m:\n m[list_s[i]] = 1\n else:\n m[list_s[i]] += 1\n\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s296784283', 's677281251', 's995391213'] | [26640.0, 26640.0, 26640.0] | [388.0, 374.0, 347.0] | [568, 572, 498] |
p02947 | u326245870 | 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 -*-\nn = int(input())\ns = [0]*n\ncount = 0\neach_count = {}\n\nfor si in s:\n tmp = list(str(input()))\n tmp.sort()\n si = "".join(tmp)\n\nfor si in s:\n if each_count.setdefault(si, 0) == 0:\n each_count[si] = 1\n else:\n count += each_count[si]\n each_count[s... | ['Wrong Answer', 'Accepted'] | ['s104121332', 's131631396'] | [3828.0, 19464.0] | [381.0, 409.0] | [324, 332] |
p02947 | u327248573 | 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\nfrom itertools import groupby\nn = int(stdin.readline().rstrip())\nsary = [sorted(stdin.readline().rstrip()) for _ in range(n)]\n\ngr = groupby(sary.sort())\n\nres = 0\n\nfor k, g in gr:\n if k >= 2:\n res += k * (k - 1) // 2\n\nprint(res)', 'from sys import stdin\nfrom itertools impo... | ['Runtime Error', 'Accepted'] | ['s554166878', 's922179394'] | [24652.0, 11428.0] | [374.0, 291.0] | [259, 299] |
p02947 | u327311253 | 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,... | ['\nx = []\nn = int(input())\nfor i in range(n):\n x.append(sorted(list(input())))\nx = sorted(x)\ns = 0\nsu = 0\n\nfor i in range(0,n-1):\n if(x[i] == x[i+1]):\n s=s+1\n continue\n else:\n su += s*(s+1)/2\n s=0\nsu += s*(s+1)//2\nprint(su)\n\n ', '\nx = []\nn = int(input())\nfor... | ['Wrong Answer', 'Accepted'] | ['s411928089', 's456471871'] | [26288.0, 26288.0] | [568.0, 654.0] | [264, 265] |
p02947 | u329407311 | 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\nList=[\'\'.join(sorted(input())) for i in range(N)]\nList.sort()\nList.extend("1")\ncnt = 0\nnum = 1\n\nfor i in range(N):\n a = List[i]\n b = List[i+1]\n if a != b: \n cnt = cnt + num * (num-1) / 2\n num = 0 \n else:\n num = num + 1\n\nprint(int(cnt))', 'N = int(input())\n\nList=[\... | ['Wrong Answer', 'Accepted'] | ['s924321501', 's314375539'] | [10640.0, 10640.0] | [417.0, 405.0] | [268, 268] |
p02947 | u330690418 | 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 _ in range(N):\n s = [0]*26\n for i in map(lambda: ord(c)-97, input()):\n s[i] += 1\n\nres = 0\nfor i in range(N):\n for j in range(i+1, N):\n if S[i] == S[j]:\n res += 1\n\nprint(res)', 'N = int(input())\nd = dict()\n\nfor _ in range(N):\n s = "".joi... | ['Runtime Error', 'Accepted'] | ['s121978362', 's403883748'] | [3064.0, 17848.0] | [18.0, 372.0] | [235, 195] |
p02947 | u330993305 | 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,... | ["num = int(input())\nrange_arr = range(num)\n\nstrs = [[] for i in range_arr]\nfor i in range_arr:\n strs[i] = input()\n\ndef conv(str):\n str_arr = list(str)\n str_arr.sort()\n return ''.join(str_arr)\n\nnew_strs = list(map(lambda v: conv(v), strs))\nnew_strs.sort()\ncompact_strs = list(set(new_strs))\n\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s095893931', 's933978035', 's348779563'] | [3060.0, 23560.0, 26964.0] | [17.0, 2105.0, 401.0] | [488, 505, 431] |
p02947 | u331327289 | 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 main():\n n = int(input())\n cnt = Counter()\n ans = 0\n for i in range(n):\n s = sorted(input())\n\n if cnt[s] == 0:\n cnt[s] = 1\n else:\n ans += cnt[s]\n cnt[s] += 1\n print(ans)\n\n\nif __name__ == "__mai... | ['Runtime Error', 'Accepted'] | ['s229077088', 's847609870'] | [9344.0, 22372.0] | [25.0, 246.0] | [317, 325] |
p02947 | u334928930 | 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())\nstrings=[list(str(input())) for a in range(N)]\nsorteds=[]\nfor thing in strings:\n thing.sort()\n sorteds.append("".join(thing))\nprint(sorteds)\nM=len(list(set(sorteds)))\nprint(N-M)', 'import math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.fa... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s427588016', 's770997683', 's892939045', 's935969759', 's607541092'] | [39576.0, 24652.0, 39500.0, 15020.0, 30560.0] | [379.0, 465.0, 2105.0, 437.0, 871.0] | [198, 338, 425, 372, 372] |
p02947 | u336564899 | 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(list(input()))) for i in range(N)]\n\n\nsdict = {}\n\nans = 0\n\nfor i in range(N):\n\n s_i = str(s[i])\n\n if s_i in sdict:\n \n sdict[s_i]+= 1\n continue\n\n for j in range(i+1,N):\n sdict[s_i] = 0\n\nfor i in sdict.values():\n ans += i*(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s277743615', 's786242055', 's001609441'] | [10176.0, 19404.0, 19400.0] | [2108.0, 401.0, 368.0] | [367, 353, 353] |
p02947 | u343454379 | 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\nsu=[]\nfor i in s:\n su=sorted(list(i))\n i="".join(su)\n\n\ncount=0\nwhile len(su)>0:\n j=su[0]\n del su[0]\n c=su.count(j)+1\n count+=c*(c-1)/2\n su=[i for i in su if i!=j]\n \nprint(int(count))', 'import collections\nN=int(input())\nsu=... | ['Wrong Answer', 'Accepted'] | ['s463131353', 's814930702'] | [10268.0, 19828.0] | [298.0, 363.0] | [256, 190] |
p02947 | u343850880 | 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 a = input()\n a = set([i for i in a])\n s.append(a)\ncount = 0\nfor i in range(len(s)):\n for j in range(i+1,len(s)):\n if s[i]==s[j]:\n count+=1\n break\nprint(count)', 'import math\nn = int(input())\ns = []\nfor i in range(n):\n ... | ['Wrong Answer', 'Accepted'] | ['s662784030', 's439569536'] | [77556.0, 28060.0] | [564.0, 704.0] | [239, 357] |
p02947 | u346424924 | 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\nfrom scipy.misc import comb\nn = int(input())\ns = [''.join(sorted(input())) for i in range(n)]\n\nc = 0\nr = collections.Counter(s)\nfor k, v in r.items():\n if v > 1:\n c += comb(v, 2)\n\nprint(int(c))\n", "from itertools import combinations\nimport collections\nfrom scipy.misc import ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s654311269', 's716554748', 's744498959'] | [29548.0, 29492.0, 19760.0] | [1084.0, 1098.0, 350.0] | [223, 253, 179] |
p02947 | u347640436 | 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 from collections import Counter\n from sys import stdin\n readline = stdin.readline()\n N = int(readline())\n t = Counter([''.join(sorted(readline()[:-1])) for _ in range(N)])\n print(sum(t[k] * (t[k] - 1) // 2 for k in t))\nmain()\n", "def main():\n from collections import Counter\n from sys im... | ['Runtime Error', 'Accepted'] | ['s795662907', 's434579057'] | [3316.0, 19748.0] | [20.0, 241.0] | [245, 243] |
p02947 | u349091349 | 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 = [input() for i in range(N)]\nctr = Counter()\nanswer = 0\nfor s in S:\n a = ''.join(sorted(list(s)))\n print(a)\n if a in ctr:\n ans += ctr[a]\n ctr[a] += 1\nprint(answer)", "from collections import Counter\nN = int(input())\nS = [input() for i... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s391449541', 's856563415', 's915779800'] | [26292.0, 26336.0, 25300.0] | [515.0, 521.0, 427.0] | [234, 237, 238] |
p02947 | u350213364 | 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())\nstrings = []\nfor i in range(n):\n strings.append(input())\ndic = {}\nfor l in [Counter(s) for s in strings]:\n ll = str(l)\n if ll in dic:\n dic[ll] += 1\n else:\n dic[ll] = 0\nres = 0\nfor k , v in dic.items():\n res += v * (v + 1)/2\npri... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s510618852', 's978238085', 's059778646'] | [84088.0, 3316.0, 26860.0] | [1594.0, 20.0, 1990.0] | [310, 305, 370] |
p02947 | u353855427 | 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.append("".join(sorted(input())))\nS.sort()\nC = []\ncnt = 1\nfor i in range(N - 1):\n if S[i] == S[i + 1]:\n cnt += 1\n else:\n C.append(cnt)\n cnt = 1\nC.append(cnt)\nans = 0\nfor cnt in C:\n ans += int(com... | ['Wrong Answer', 'Accepted'] | ['s401925324', 's318959783'] | [22012.0, 11272.0] | [2109.0, 419.0] | [321, 295] |
p02947 | u354916249 | 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 cmb(n, r):\n if n - r < 0: return 0\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'] | ['s613018575', 's050927895'] | [10212.0, 11404.0] | [346.0, 425.0] | [933, 931] |
p02947 | u358254559 | 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 = []\nfor _ in range(N):\n S.append(input())\n\n\n\nfor i in range(len(S)):\n S[i]=''.join(sorted(S[i]))\n\nS.sort()\n\nres=0\nfor i in range(len(S)-1):\n if S[i] == S[i+1]:\n print(S[i])\n res+=1\n\nprint(res)", "N = int(input())\n\nS = []\nfor _ i... | ['Wrong Answer', 'Accepted'] | ['s331065506', 's067264644'] | [11384.0, 24464.0] | [399.0, 407.0] | [260, 324] |
p02947 | u358957649 | 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 as counter\nii = lambda:int(input())\nmi = lambda:list(map(int,input().split()))\nix = lambda x:list(input() for _ in range(x))\nmix = lambda x:list(li() for _ in range(x))\niix = lambda x:list(int(input()) for _ in range(x))\n##########\ndef main(n,s):\n res = 0\n f... | ['Wrong Answer', 'Accepted'] | ['s372742881', 's115836776'] | [19772.0, 19764.0] | [339.0, 341.0] | [476, 465] |
p02947 | u361381049 | 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)]\nd = {}\nfor i in s:\n c = ''.join(sorted(i))\n if not c in d.keys():\n d[c] = 0\n d[c] += d[c]\n e = d.values()\nf = 0\nfor _ in e:\n f += _ - 1\nif f>= 0:\n print(f)", "n = int(input())\n\ndic = {}\nfor i in range(n):\n s = input()\n s = ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s035137267', 's241140793', 's961270328'] | [24980.0, 17848.0, 17852.0] | [375.0, 416.0, 412.0] | [230, 223, 224] |
p02947 | u365858785 | 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())\nlis=sorted([sorted([f for f in input()]) for i in range(a)])\nlis+=["w"]\nkari=""\nans=0\ncou=1\nfor i in lis:\n if kari!=i:\n ans+=cou*(cou-1)/2\n cou=1\n kari=i\n else:\n cou+=1\nprint(ans)', 'a=int(input())\nlis=sorted([sorted([f for f in input()]) for i in range(a)])\nlis+=["w"]\nkar... | ['Wrong Answer', 'Accepted'] | ['s040256647', 's506141349'] | [25448.0, 25448.0] | [606.0, 603.0] | [208, 213] |
p02947 | u369094007 | 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 _ in range(n)]\nc = [i in range(1, n)]', 'n = int(input())\nb = {}\nans = 0\nfor _ in range(n):\n x = list(input())\n x.sort()\n x = "".join(x)\n if not x in b:\n b[x] = 0\n else:\n b[x] += 1\n ans += b[x]\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s134825002', 's878130670'] | [3888.0, 17804.0] | [23.0, 404.0] | [69, 177] |
p02947 | u369752439 | 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,... | ['s_hist = collections.Counter()\n\nN = int(input())\nfor n in range(N):\n s = input().strip()\n s_hist[" ".join(sorted(s))] += 1\n\nans = 0\nfor pair in s_hist.most_common():\n ans += s_hist[pair[0]]*(s_hist[pair[0]]-1)/2\n if(pair[1] == 1):\n break\nprint(int(ans))', 'import collections\n\ndef make... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s136140232', 's266622548', 's811046317', 's385794491'] | [3060.0, 3316.0, 15708.0, 24416.0] | [17.0, 21.0, 2104.0, 522.0] | [272, 303, 457, 292] |
p02947 | u370429695 | 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 = {}\ntotal = 0\n\nfor i in range(n):\n string = list(input())\n string.sort(reverse = False)\n if tuple(string) in s:\n s[tuple(string)] += 1\n else:\n s[tuple(string)] = 1\n\nfor i in s:\n if i != 1:\n total += sum([i for i in range(1,i)])\n\nprint(total)', 'N... | ['Runtime Error', 'Accepted'] | ['s795911781', 's889651045'] | [23652.0, 23648.0] | [515.0, 514.0] | [297, 301] |
p02947 | u371385198 | 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\nN = int(input())\na = [input() for _ in range(N)]\n\nd = dict()\nfor x in a:\n s = ''.join(sorted(x))\n if s not in d.keys():\n d[s] = 1\n else:\n d[s] += 1\n\nprint(sum([comb(i, 2) for i in d.value... | ['Runtime Error', 'Accepted'] | ['s583697104', 's437485911'] | [29316.0, 29108.0] | [451.0, 451.0] | [308, 341] |
p02947 | u372102441 | 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#L = list(map(int, input().split()))\nimport math\nimport sys\nimport heapq\nimport fractions\n\n\ndef cmb(n, r):\n if n - r < r:\n r = n - r\n if r == 0:\n return 1\n if r == 1:\n return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s359681352', 's923077940', 's438860763'] | [26120.0, 10268.0, 26692.0] | [285.0, 326.0, 566.0] | [1041, 248, 1022] |
p02947 | u374802266 | 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())\nprint(len(set([''.join(sorted(i)) for i in [input() for i in range(n)]])))", 'n=int(input())\nprint(len(set([sorted(i) for i in [input() for i in range(n)]])))', "def ra(a): \n ll,l=[],1\n for i in range(len(a)-1):\n if a[i]==a[i+1]:\n l+=1\n else:\n ll.append... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s155360329', 's651046759', 's613670448'] | [23344.0, 37404.0, 23348.0] | [205.0, 209.0, 237.0] | [89, 80, 337] |
p02947 | u374829922 | 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 count = 0\n lists =[]\n count_dict = {}\n\n for i in range(n):\n input_data = ''.join(sorted(input()))\n if input_data in lists:\n if input_data not in count_dict.keys():\n count_dict[input_data] = 1\n \n count_d... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s169738424', 's226555411', 's831731487', 's429247761'] | [4792.0, 10624.0, 51072.0, 17852.0] | [2104.0, 2104.0, 2106.0, 367.0] | [490, 374, 402, 369] |
p02947 | u375282392 | 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 = []\nss = []\nfor i in range(n)\n\ts.append(str(input()))\n \tss.append(sorted(str(input())))\n \nc = 0\nfor i in range(n)\n\tfor l in range(i+1,n)\n \t\tif ss[i] == ss[l]:\n \t\tc += 1\nprint(c)\n ', 'n = int(input())\n\nss = []\nfor i in range(n):\n\tss.append(sorted(str(input())))\n... | ['Runtime Error', 'Accepted'] | ['s548939921', 's994886327'] | [2940.0, 25420.0] | [17.0, 515.0] | [209, 197] |
p02947 | u381572531 | 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 = map(str, input().split())\nslist = []\nfor w in a:\n _w = ''.join(sorted(list(w)))\n slist.append(_w)\nn_dup = len(slist) - len(list(set(slist)))\nprint(n_dup)", "n = int(input())\na = map(str, input().split())\nslist = []\nfor w in a:\n _w = ''.join(sorted(list(w)))\n slist.append(_w)\n print(_w)\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s783047439', 's950605199', 's925809795'] | [3060.0, 3060.0, 17892.0] | [17.0, 17.0, 387.0] | [163, 194, 300] |
p02947 | u395202850 | 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())\ncnt = 0\n\nsList = []\n\nfor n in range(0, N):\n string = list(input())\n sList.append(string)\n sList[n].sort()\n print(sList[n])\n\nfor i in range(0, N - 1):\n for j in range(i + 1, N):\n if sList[i] == sList[j]:\n cnt += 1\nprint(cnt)\n', "import collections\n\n\n... | ['Wrong Answer', 'Accepted'] | ['s944471944', 's622004146'] | [31120.0, 24040.0] | [2105.0, 232.0] | [274, 235] |
p02947 | u395944336 | 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,... | ["Ncount = int(input())\nstrings = []\ncount_flag = 0\nletters = {}\nletters_count = []\nfor i in range(Ncount):\n strings.append(''.join(sorted(input())))\nprint(strings)\nfor i in strings:\n if i not in letters:\n letters[i] = 0\n else :\n letters[i] += 1\n letters[i] += letters[i] - 1\n\nfor i in letters... | ['Wrong Answer', 'Accepted'] | ['s350562587', 's722532736'] | [22172.0, 19400.0] | [907.0, 360.0] | [351, 267] |
p02947 | u396890425 | 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())\nWords = [input() for t in range(n)]\n\nWords2=[]\nfor i in Words:\n i=''.join(sorted(i))\n Words2.append(i)\n\nc = collections.Counter(Words2)\n\nvalues, counts = zip(*c.most_common())\n\nprint(counts)\n\nans=0\nfor j in counts:\n ans+=j*(j-1)//2\nprint(ans)", ... | ['Wrong Answer', 'Accepted'] | ['s494732687', 's635780720'] | [38760.0, 38756.0] | [382.0, 390.0] | [297, 283] |
p02947 | u401487574 | 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,... | ['di ={}\nn = int(input())\ndi = {}\nfor i in range(n):\n sl = tuple(sorted(list(input()))\n if sl in di:\n di[sl] += 1\n else:\n di[sl] = 1\ndef nc2(n):\n a = 1\n for i in range(1,n):\n a *= i\n return int(a / 2)\nls = di.items()\ncnt = 0\nfor i in ls:\n cnt += nc2(i[1])\nprint(cn... | ['Runtime Error', 'Accepted'] | ['s786580977', 's861054297'] | [2940.0, 17932.0] | [17.0, 436.0] | [303, 274] |
p02947 | u402584185 | 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)]\n\ns_int = []\na_ord = ord('a')\nfor _s in s:\n v = list(map(lambda x: ord(x)-a_ord, _s))\n v = sum([v[i]*26**i for i in range(len(v))])\n s_int.append(v)\n\ns_int = sorted(s_int)\n\ncnt = 0\nold = -1\nfor i in s_int:\n _cnt = 1\n if old == i:\n... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s189235623', 's395063578', 's713910409', 's105420552'] | [29480.0, 19764.0, 19752.0, 19752.0] | [1026.0, 364.0, 385.0, 373.0] | [405, 182, 212, 213] |
p02947 | u405012111 | 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)]\nss = [sorted(s[i]) for i in range(n)]\ndic = [''.join(ss[i]) for i in range(n)]\ncnt = 0\nfor i in range(len(dic)-1):\n for j in range(len(dic)-2):\n if dic[i] == dic[j]:\n cnt += 1\nprint(int(cnt)-len(dic))\n", "n = int(input())\ns = [input() fo... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s387178212', 's746493954', 's428147406'] | [38556.0, 44692.0, 17852.0] | [2106.0, 379.0, 389.0] | [271, 252, 176] |
p02947 | u405137387 | 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\nn = int(input())\nlst = list()\nnum = 0\nflag = 1\nfor i in range(n):\n\n s = input()\n s = list(s)\n s.sort()\n lst.append(s)\n\nlst.sort()\n\nfor i in range(n-1):\n if (lst[i] == lst[i+1]):\n flag = flag + 1\n else:\n num = num + math.factorial(flag) // (math.factorial(f... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s473598552', 's513764799', 's360451315'] | [25504.0, 39436.0, 25516.0] | [782.0, 2105.0, 787.0] | [428, 248, 455] |
p02947 | u405660020 | 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 fractions\n\n\ndef P(n, r):\n return fractions.factorial(n)//fractions.factorial(n-r)\n\ndef C(n, r):\n return P(n, r)//fractions.factorial(r)\n\nn = int(input())\nstr_list = []\nfor i in range(n):\n str_list.append(list(sorted(input())))\nstr_list=sorted(str_list)\nstr_list.append("a")\n\nans=0\ncnt=... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s018263572', 's607425122', 's838526427', 's717086069'] | [27476.0, 27052.0, 25448.0, 19824.0] | [586.0, 843.0, 643.0, 222.0] | [512, 492, 543, 218] |
p02947 | u405733072 | 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 resolve():\n n = int(input())\n words = []\n for _ in range(n):\n words.append(str(sorted(list(input()))))\n a = collections.Counter(words)\n ans = 0\n for i in a.values():\n ans += i*(i-1)//2\n print(ans)\nresolve()', 'import collections\ndef resolve():\n n = int(input())\n ... | ['Runtime Error', 'Accepted'] | ['s235261393', 's642126689'] | [20924.0, 28732.0] | [287.0, 310.0] | [245, 264] |
p02947 | u407415713 | 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 \n b=list(input())\n b.sort\n mojiretu = ''.join(b)\n if mojiretu not in s:\n s.append(mojiretu)\nprint(len(s))", "#c\nn = int(input())\ncount=0\ndic={}\nfor i in range(n):\n \n b=list(input())\n b.sort()\n mojiretu = ''.join(b)\n if mo... | ['Wrong Answer', 'Accepted'] | ['s980614496', 's437924041'] | [4072.0, 17808.0] | [2104.0, 385.0] | [197, 294] |
p02947 | u408620326 | 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())\nsn=[list(input()).sort() for _ in range(N)]\nprint(sn)', "N=int(input())\ndict={}\nfor _ in range(N):\n s=''.join(sorted(input()))\n dict[s]=dict.setdefault(s,0)+1\n \ncnt=0\nfor c in dict.values():\n cnt+=(1+c-1)*(c-1)//2\n \nprint(cnt)"] | ['Wrong Answer', 'Accepted'] | ['s866039456', 's264386931'] | [5656.0, 17852.0] | [284.0, 390.0] | [68, 174] |
p02947 | u409773778 | 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 = [["" for j in range(10)] for i in range(n)]\n\n for i in range(n):\n s[i] = list(input()).sort()\n\n print(int(count_anagram(s[0], s[1:], 0)))\n\n\ndef count_anagram(s, str_list, total):\n cnt = 0\n tmp = []\n for i, t in enumerate(str_list):\n i... | ['Runtime Error', 'Accepted'] | ['s681608251', 's871277975'] | [24180.0, 19760.0] | [1179.0, 353.0] | [614, 213] |
p02947 | u410118019 | 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 defaultdict\nn = int(input())\ns = [''.join(sorted(input())) for i in range(n)]\ndd = defaultdict(int)\nfor i in range(n):\n dd[s[i]] += 1\nc = 0\nprint(dd)\nfor i in dd.values():\n c += i * (i-1) // 2\nprint(c)", "from collections import defaultdict\nn = int(input())\ns = [''.join(sorted(in... | ['Wrong Answer', 'Accepted'] | ['s707741485', 's331490203'] | [23252.0, 19800.0] | [404.0, 381.0] | [227, 217] |
p02947 | u417365712 | 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\ninputs = sys.stdin.readlines()\n\nn = int(inputs[0])\nS = inputs[1:]\n\nd = defaultdict(lambda: -1)\nfor i in range(n):\n s = ''.join(sorted(list(S[i])))\n d[s] += 1\n\nans = 0\nfor v in d.values():\n ans += v*(v+1)//2\nprint(ans)", "import sys\nfrom collections import defaultdict\ninputs = sys.s... | ['Runtime Error', 'Accepted'] | ['s971516173', 's288515291'] | [11028.0, 26080.0] | [30.0, 294.0] | [237, 282] |
p02947 | u418199806 | 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 = {}\nfor _ in range(N):\n S = "".join(sorted(input()))\n print("S",S)\n print("D",D)\n if S in D:\n D[S] += 1\n else:\n D[S] = 1\n\nans = 0\nfor v in D.values():\n ans += v * (v - 1) // 2\n\nprint(ans)', 'N = int(input())\nD = {}\nfor _ in range(N):\n S = "".joi... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s235144823', 's461936952', 's717338114', 's108163177'] | [134752.0, 134748.0, 26256.0, 17848.0] | [2103.0, 2103.0, 2106.0, 372.0] | [239, 239, 196, 205] |
p02947 | u419877586 | 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())\nss = [sorted(input()) for i in range(n)]\ncnt = 0\ncounter = Counter(ss)\nfor k, v in counter.items():\n cnt += v*(v-1)/2\nprint(cnt)', 'from collections import Counter\nn = int(input())\nss = [sorted(input()) for i in range(n)]\ndic = Counter(ss)\ncnt=0\nfor k, v i... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s119691233', 's124928450', 's215794984', 's265061961', 's436407862', 's466274580', 's519882995', 's570002916', 's575280812', 's580666924', 's600625106', 's681439761', 's765650346', 's808852395', 's856122625', 's879099582', 's133126810'] | [24468.0, 24468.0, 24212.0, 22580.0, 24468.0, 54260.0, 24208.0, 24208.0, 24208.0, 24468.0, 24468.0, 24468.0, 22580.0, 24208.0, 24212.0, 54260.0, 19764.0] | [323.0, 322.0, 315.0, 1333.0, 318.0, 2107.0, 317.0, 316.0, 319.0, 327.0, 320.0, 325.0, 2105.0, 312.0, 316.0, 966.0, 351.0] | [178, 165, 159, 276, 170, 231, 59, 175, 85, 152, 107, 160, 258, 202, 196, 208, 192] |
p02947 | u422590714 | 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 copy\nimport math\nimport sys\n\nsys.setrecursionlimit(10 ** 7)\n\nN = int(input())\ns_list = [input() for i in range(N)]\n\n\ndef split(word):\n return [char for char in word]\n\n\nnormalized_s_list = sorted([''.join(sorted(split(s))) for s in s_list])\n\nuniqued_s_list = sorted(list(set(normalized_s_list)... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s612113926', 's829538455', 's334023319'] | [24544.0, 24544.0, 24544.0] | [603.0, 447.0, 534.0] | [654, 633, 641] |
p02947 | u425019904 | 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 math import factorial\nN = int(input())\nP = {}\nans = 0\ndef counter(s):\n ret = [0]*26\n for ss in s:\n ret[ord(ss)-ord('a')] += 1\n return tuple(ret)\nfor _ in range(N):\n s = input()\n c = counter(s)\n if not c in P.keys():\n P[c] = 1\n else:\n P[c] += 1\nfor v in P.... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s213762956', 's577618867', 's369973023'] | [35928.0, 35932.0, 35932.0] | [946.0, 732.0, 953.0] | [381, 384, 399] |
p02947 | u425900376 | 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())\ns = [input() for i in range(n)]\nst = []\nans = 0\nfor i in range(n):\n sti = str(sorted(s[i]))\n st.append(sti)\ncount = Counter(st)\nfor i in count.values():\n if i != 1:\n for j in range(1, i):\n ans += j * (j - 1) // 2\nprint(ans)\n',... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s419447248', 's853740971', 's478437334'] | [31728.0, 11932.0, 31664.0] | [412.0, 2104.0, 528.0] | [301, 208, 322] |
p02947 | u430414424 | 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 collections import Counter\nfrom itertools import combinations\n\nN = int(input())\nc = ["".join(sorted(str(input()))) for x in range(N)]\ncs = Counter(c)\n\nprint(cs)\nans=0\nfor i in cs.values():\n if i!=1:\n ans += (i * (i-1))/2\n\nprint(int(ans))', '# -*- coding: utf-8 -*-\... | ['Wrong Answer', 'Accepted'] | ['s414974855', 's874087989'] | [31144.0, 19728.0] | [429.0, 355.0] | [276, 266] |
p02947 | u431484963 | 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)]\ndef get_unique_list(seq):\n seen = []\n return [x for x in seq if x not in seen and not seen.append(x)]\n\n# [[1, 1], [0, 1], [0, 0], [1, 0]]\nfor i in range(n):\n s[i] = sorted(s[i])\nprint(len(get_unique_list(s)))', "n = int(input())\ns = [input() for i in... | ['Wrong Answer', 'Accepted'] | ['s926689778', 's100774288'] | [26524.0, 29204.0] | [2105.0, 354.0] | [266, 424] |
p02947 | u433380437 | 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,... | ['S=[]\ncho=[0]\np=0\nn = int(input())\nfor i in range(n):\n s=sorted(input())\n if s in S:\n cho[p]+=1\n p+=1\n S.append(s)\nimport collections\nfrom scipy.special import comb\na=0\nSd=list(set(S))\nc = collections.Counter(S)\nfor p in range(len(Sd)):\n if c[Sd[p]] >=2:\n a += comb(c... | ['Runtime Error', 'Accepted'] | ['s564140838', 's757545730'] | [48704.0, 59892.0] | [2206.0, 427.0] | [333, 284] |
p02947 | u434872492 | 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 = input()\n S.append(s)\nfor i in range(N):\n S[i] = ''.join(sorted(S[i]))\n\ncount = 0\nt = dict()\nfor i in range(N):\n if S[i] in t:\n t[S[i]] += 1\n else:\n t[S[i]] = 1\nans = 0\nfor key in t:\n ans += (t[key]*(t[key]-1))/2\n\n\nprin... | ['Wrong Answer', 'Accepted'] | ['s559776673', 's101714867'] | [19484.0, 19472.0] | [344.0, 345.0] | [304, 307] |
p02947 | u436982376 | 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_list = []\nanagrams = []\nans = 0\n\nfor i in range(n):\n s = list(input())\n s = sorted(s)\n s_list.append(s)\n\nfor i in range(n):\n for j in range(i+1,n):\n print(s_list[i],s_list[j])\n if s_list[i] == s_list[j]:\n ans = ans + 1\n print(i,j)\n\nprint(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s134545064', 's899511453', 's893892135'] | [69776.0, 24208.0, 17852.0] | [2105.0, 2105.0, 570.0] | [306, 234, 249] |
p02947 | u438186430 | 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\nfor j in range(N):\n S[j].sort()\n S[j] = ''.join(S[j])\n\nans = 0 \n\nfor k in range(N):\n for l in range(k+1,N):\n print(k, l)\n if k < l:\n if S[k] == S[l]:\n print(True)\n ans += 1\n \nprint(ans)", "N = int(input())\nS = [l... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s373839169', 's421452508', 's600949000', 's746304135', 's418990043'] | [36112.0, 2940.0, 25856.0, 24212.0, 24208.0] | [2105.0, 17.0, 2105.0, 237.0, 463.0] | [272, 308, 316, 312, 405] |
p02947 | u440129511 | 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\nn=int(input())\ns=[]\nfor i in range(n):\n sl=list(input())\n sl.sort()\n s.append("".join(sl))\n\nl=collections.Counter(s).values()\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nc=0\nfor i in range(len(l)):\n ... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s284607959', 's450213369', 's505445786', 's883230643', 's398736463'] | [19848.0, 3316.0, 3872.0, 3316.0, 19728.0] | [361.0, 21.0, 284.0, 21.0, 766.0] | [354, 336, 80, 320, 370] |
p02947 | u440161695 | 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(n):\n return (n**2-n)//2\nans=0\nN=int(input())\nd=dict()\nfor i in range(N):\n s=sorted(input())\n if s not in d:\n d[s]=0\n d[s]+=1\nfor i in d:\n ans+=f(i)\nprint(ans)', 'N=int(input())\nd={}\nans=0\nfor _ in range(N):\n s=input()\n s=sortde(s)\n if s in d:\n d[s]+=1\n else:\n d[s]=0\nfor i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s075510779', 's163782849', 's985068464'] | [3060.0, 3060.0, 11412.0] | [17.0, 24.0, 456.0] | [172, 173, 235] |
p02947 | u440975163 | 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())\np = [list(str(input())) for _ in range(n)]\nln = []\na = []\nans = 0\nfor i in p:\n a.append(Counter(i))\n if Counter(i)not in ln:\n ln.append(Counter(i))\n\nln2 = [0] * len(ln)\n\nfor j in a:\n ln2[ln.index(j)] += 1\n\ndef cmb(n, r):\n if n - r < ... | ['Wrong Answer', 'Accepted'] | ['s227766734', 's964776607'] | [75532.0, 19760.0] | [2106.0, 359.0] | [893, 206] |
p02947 | u441254033 | 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,... | ["\nN = int(input())\n\nS = [''.join(sorted(input())) for _ in range(N)]\n\n\ncnt = 0\n\nfor i,si in enumerate(S):\n for sj in S[i:]:\n if si == sj:\n cnt += 1\n \n \n \n \nprint(cnt) ", "n = int(input())\ns = []\n\nalphabet = 'abcdefghijklmnopqrstuvwxyz'\nh = dict(zip(alphabet,[0] * len(alphabet)))... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s315089769', 's711775061', 's816248959'] | [11068.0, 11004.0, 17852.0] | [2104.0, 2104.0, 392.0] | [186, 326, 185] |
p02947 | u441823651 | 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 text = input()\n text = ''.join(sorted(text))\n s.append(text)\n\ncount = {}\nfor i in s:\n if i in count:\n count[i] += 1\n else:\n count[i] = 1\n\nsum = 0\nfor v in count.values():\n int(v)\n sum += (v*(v-1)/2)\n\nprint(sum)", "n = int(input())\ns = []\nfo... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s491679179', 's512161635', 's910583601'] | [19504.0, 19404.0, 17852.0] | [385.0, 367.0, 372.0] | [267, 253, 196] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.