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 | u442877951 | 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 = [str(sorted(input())) for _ in range(N)]\ncount = 0\nfor i in Counter(S).values():\n count = 1*(i-1)//2\nprint(count)', 'from collections import Counter\nN = int(input())\nS = []\ncount = 0\nfor i in range(N):\n for j in range(i+1, N):\n if Counter(S[i]) == ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s132576990', 's349529614', 's435793626', 's608742271', 's660586654', 's803428694', 's423651861'] | [24560.0, 3316.0, 141708.0, 26864.0, 24560.0, 3316.0, 26860.0] | [471.0, 21.0, 1335.0, 332.0, 476.0, 20.0, 346.0] | [167, 179, 224, 232, 167, 229, 233] |
p02947 | u444082822 | 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 = [input() for i in range(N)]\nL = sorted(list(map("".join, list(map(sorted, list(map(list, L)))))))\nc = 0\nans = 0\nfor j in range(1,N):\n if not L[j] == L[j - 1]:\n if j - c > 2:\n ans += (j - c)*(j - c - 1)/2\n c = j\n elif j + 1 == N:\n ans +... | ['Wrong Answer', 'Accepted'] | ['s026010269', 's325371431'] | [52504.0, 52504.0] | [424.0, 442.0] | [340, 319] |
p02947 | u445624660 | 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())\nd = {}\narr = []\nfor _ in range(n):\n x = list(sorted(input()))\n arr.append(x)\n if x not in d:\n d[x] = 1\n else:\n d[x] += 1\n\nc = 0\nfor a in arr[:0:-1]:\n if d[a] > 0:\n c += d[a] - 1\n d[a] -= 1\n\nprint(c)\n', '\n\n\nn = int(input())\nd = {}\narr... | ['Runtime Error', 'Accepted'] | ['s642649306', 's518436881'] | [3060.0, 18564.0] | [17.0, 620.0] | [307, 472] |
p02947 | u449473917 | 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\n\nn=int(input())\nl=set(map(str,sys.stdin))\nalp=[chr(_) for _ in range(97,97+26)]\nres=[0]\nres2=[0]\nans=0\n\nfor j in range(n):\n ll=list(l[j])\n ll.sort()\n aa="".join(ll)\n tmp2=0\n for z in range(len(res)):\n if aa==res[z]:\n tmp2+=res2[z]\n res2[z]+=1\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s905762226', 's979719175', 's567716437'] | [14700.0, 3188.0, 23436.0] | [50.0, 18.0, 383.0] | [390, 404, 191] |
p02947 | u450478592 | 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())\nmoji = []\n\ncount = 0\n\nfor i in range(n):\n s = sorted(input())\n\n moji.append("".join(s))\n\nprint(moji)\nresult = []\nfor i in range(n):\n if moji[i] in result:\n count += 1\n else:\n result.append(moji[i])\n\nprint(count)\n\n', 'from collections import defaultdict\n\... | ['Wrong Answer', 'Accepted'] | ['s467693622', 's857824866'] | [18944.0, 22456.0] | [2206.0, 245.0] | [256, 229] |
p02947 | u453500284 | 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\ncounter = 0\n\nfor i in range(n):\n string_list= input() \n new_str = ''.join(sorted(string_list))\n new_str_reverse = new_str[::-1]\n if new_str == new_str_reverse:\n counter += 1 \n\nprint(counter)\n \n\n", 'import collections\n\nN = int(input())\ns = ["".join(sorted(inpu... | ['Wrong Answer', 'Accepted'] | ['s157946143', 's051281575'] | [3060.0, 23468.0] | [350.0, 376.0] | [320, 191] |
p02947 | u453642820 | 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 math import factorial\ndef combinations(n,r):\n return factorial(n)//(factorial(n-r)*factorial(r))\nN=int(input())\nS=["".join(sorted(input())) for i in range(N)]\ns=Counter(S)\nans=0\nfor key,value in s.items():\n ans+=combinations(value,2)\nprint(ans)', 'from collections ... | ['Runtime Error', 'Accepted'] | ['s781508314', 's463337140'] | [19752.0, 19760.0] | [735.0, 737.0] | [287, 308] |
p02947 | u457289860 | 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())\ndic = {}\u3000\n\nfor index in range(n):\n temp = ''.join(sorted(list(input())))\n \n if temp in dic:\n dic[temp] = dic[temp] + 1\n \n else:\n dic[temp] = 1\n \nans = 0\n\nfor k in dic.values():\n cnt = 0\n for i in range(k):\n cnt += i\n ans +... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s116020364', 's514990750', 's628223658', 's457987398'] | [2940.0, 2940.0, 20472.0, 17932.0] | [17.0, 17.0, 817.0, 821.0] | [547, 619, 663, 652] |
p02947 | u459233539 | 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())\n\ns = [",".join(sorted(input())) for i in range(n)]\n\nc = collections.Counter(s)\n\nans = 0\nfor i in c.valuses():\n ans += i*(i-1)//2\n\nprint(ans)', 'import collections\n\nn = int(input())\n\ns = [",".join(sorted(input())) for i in range(n)]\n\nc = collections.Counter(s)\n\... | ['Runtime Error', 'Accepted'] | ['s865001745', 's468887503'] | [20592.0, 20592.0] | [332.0, 348.0] | [178, 177] |
p02947 | u459590249 | 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\ts[i].sort()\ncount=0\nfor i in range(n):\n\tfor j in range(n):\n\t\tif s[i]==s[j]:\n\t\t\tcount+=1\nprint((count-n)/2)', 'n=int(input())\ns=[list(input()) for _ in range(n)]\ndic={}\nt=[0]*n\nfor i in range(n):\n\ts[i].sort()\n\tt[i]=str(s[i])... | ['Wrong Answer', 'Accepted'] | ['s930509708', 's939139329'] | [24208.0, 45444.0] | [2105.0, 499.0] | [177, 302] |
p02947 | u460199376 | 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,... | ["count = int(input())\n\nstr_data = dict()\nresult = 0\nfor i in range(count):\n judge_str = ''.join(sorted(input()))\n if judge_str in str_data:\n str_data['judge_str'] += 1\n result += str_data['judge_str']\n else:\n str_data['judge_str'] = 0\n \nprint(result)", "count = int(input())... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s368811910', 's425765406', 's739383033', 's281933952'] | [3060.0, 2940.0, 3060.0, 17852.0] | [336.0, 17.0, 18.0, 391.0] | [282, 224, 207, 277] |
p02947 | u460468647 | 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={}\ncount=0\nfor i in range(N):\n s="".join(sorted(input()))\n if s in dictionary:\n dictionary[s]+=1\n count+=dictionary[s]\n else:\n dictionary[s]=0\nprint(dictionary)\nprint(count)', 'N=int(input())\ndictionary={}\ncount=0\nfor i in range(N):\n s="".join(... | ['Wrong Answer', 'Accepted'] | ['s628147503', 's225489183'] | [20376.0, 17852.0] | [405.0, 386.0] | [229, 211] |
p02947 | u460878159 | 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.special import comb\n\nN=int(input())\nt=tuple([''.join(sorted(list(input()))) for _ in range(N)])\nDic = {}\nans = 0\nfor i in range(N):\n if t[i] in Dic:\n Dic[t[i]]+=1\n else:\n Dic[t[i]]=1\nfor k in tuple(Dic.keys()):\n if Dic[k]==1:\n pass\n else:\n comb(Dic[k],... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s363932698', 's557819869', 's687867571', 's746706730', 's927823309', 's893950440'] | [14284.0, 22256.0, 99460.0, 103816.0, 102148.0, 20000.0] | [176.0, 408.0, 2110.0, 2110.0, 2110.0, 396.0] | [334, 248, 935, 956, 956, 515] |
p02947 | u461454424 | 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 _ in range(N):\n s.append(input())\n\nfor i in range(N):\n s[i] = sorted(s[i])\n\ncounter = 0\nfor i in range(N):\n for j in range((i+1), N):\n if s[i] == s[j:N]:\n counter += 1\n\nprint(counter) ', 'N= int(input())\ns = []\n\nfor _ in range(N):\n s.append(... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s021273064', 's054061694', 's084029446', 's697560570', 's518690520'] | [24988.0, 26384.0, 27020.0, 24988.0, 26384.0] | [2105.0, 347.0, 2105.0, 2105.0, 343.0] | [239, 306, 242, 240, 309] |
p02947 | u464205401 | 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())\nx=[]\ncnt=0\nfor i in range(n):\n a=sorted(input())\nfor i in range(n):\n if a in x:cnt+=1\n else:x.append(a)\nprint(cnt)', "n=int(input())\nx={}\ncnt=0\nfor i in range(n):\n a=''.join(sorted(input()))\n if a in x:x[a]+=1\n else:x[a]=1\n\nfor a in x:\n cnt+=x[a]*(x[a]-1)//2\nprint(cnt)"] | ['Wrong Answer', 'Accepted'] | ['s375041115', 's412327538'] | [3060.0, 17848.0] | [295.0, 392.0] | [132, 155] |
p02947 | u465233325 | 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 a = [input() for i in range(n)]\n num = 0\n for i in range(len(a)):\n a[i] = "".join(sorted(a[i]))\n a.sort()\n for i in range(len(a)):\n e = a[i]\n j = 1\n while i+j < len(a) and e == a[i+j]:\n j = j + 1\n num = num + co... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s137544886', 's246540812', 's319212066', 's326049205', 's495039822', 's683410626'] | [10584.0, 3060.0, 3064.0, 3064.0, 3064.0, 10600.0] | [2104.0, 17.0, 17.0, 17.0, 18.0, 364.0] | [388, 317, 506, 328, 335, 509] |
p02947 | u469953228 | 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\nL=list(map(int,sorted(input().split())))\n\nL=sorted(L)\nfrom scipy.speial import comb\nk=1\nsum=0\nfor i in range(n-1):\n if L[i]==L[i+1]:\n k += 1\n else:\n if k==1:\n sum +=1\n else:\n sum += comb(k,2,exact=True)\n k=1\nif k==1:\n sum += 1\nelse:\n sum += comb(k,2,exact=... | ['Runtime Error', 'Accepted'] | ['s485373060', 's465429083'] | [3064.0, 26044.0] | [17.0, 587.0] | [316, 474] |
p02947 | u472696272 | 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())\ncounters = {}\nfrom collections import Counter\nfor i in range(n):\n s = input()\n c = Counter(s)\n if c not in counters: counters[c] = 1\n else: counters[c] += 1\na = counters.values()\nans = 0\nfor i in range(len(a)):\n ans += a[i]*(a[i]-1)/2\nprint(ans)\n', 'n = int(input())\ndic = {}\nfrom ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s545529279', 's952270429', 's218584632'] | [3316.0, 3316.0, 18244.0] | [20.0, 22.0, 417.0] | [268, 248, 275] |
p02947 | u475991121 | 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())\nd = collections.defaultdict(int)\nfor _ in range(n):\n a = sorted(input())\n s = ''.join(a)\n d[s] += 1\nprint(d)\ncount = 0\nfor v in d.values():\n count += v * (v-1) // 2\nprint(count)", "import collections\nn = int(input())\nd = collections.defaultdict(int)\nfor _ ... | ['Wrong Answer', 'Accepted'] | ['s325102591', 's274575065'] | [22432.0, 18236.0] | [441.0, 429.0] | [225, 216] |
p02947 | u478266845 | 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\ndef Speed_Anag_Count(String):\n count = {}\n for i in String:\n i = sorted(i)\n i = str(''.join(i))\n if count.get(i) != True:\n count[i] = 0\n count[i] += 1\n \n return count\n\nN = int(input())\n\nS = [str(input()) for _ in range(N)]\n\ncount ... | ['Wrong Answer', 'Accepted'] | ['s958611779', 's536180644'] | [34292.0, 34260.0] | [485.0, 480.0] | [409, 406] |
p02947 | u482532694 | 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().split())\n\nfor i in range(0, len(s)):\n s[i] = sorted(s[i])\n s[i] = ''.join(s[i])\n\ns = sorted(s)\n\ntmp_count = 1\ncount = 0\nfor i in range(0, len(s)-1):\n if s[i] == s[i+1]:\n tmp_count += 1\n else:\n count += tmp_count * (tmp_count - 1) // 2\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s144962332', 's303939516', 's595117373', 's734773288'] | [3064.0, 3064.0, 3064.0, 11536.0] | [17.0, 20.0, 19.0, 461.0] | [371, 481, 331, 334] |
p02947 | u490084374 | 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 = [sorted(list(input())) for a in range(n)]\n\nans = 0\nle = len(li)\nwhile le > 1:\n t = li[0]\n cnt = 0\n for n, w in reversed(list(enumerate(li[1:]))):\n if t == w:\n cnt += 1\n li.pop(n + 1)\n ans += cnt * (cnt + 1) / 2\n li.pop(0)\n le = len(li)\n\nprint(ans)', 'n = int(in... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s253870476', 's359348470', 's547968271', 's922212148', 's926845000'] | [37280.0, 35392.0, 35872.0, 35616.0, 19404.0] | [2106.0, 2106.0, 2106.0, 2106.0, 355.0] | [288, 288, 288, 284, 212] |
p02947 | u490305870 | 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)]\ncount = {}\n\nfor s in S:\n ls = ("").join(sorted(list(s)))\n if ls in count:\n if count[ls] == 1:\n count[ls] = 3\n else:\n count[ls] +=1\n else:\n count[ls] = 0\nprint(count)\nprint(sum(count.values()))', 'N = int(input())\nS = [input() for _ ... | ['Wrong Answer', 'Accepted'] | ['s004620402', 's647050486'] | [27536.0, 29204.0] | [345.0, 452.0] | [263, 246] |
p02947 | u491762407 | 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().split())\nSlist = [0] * N\nfor i in range(N):\n Slist[i] = sorted(S[i])\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\nif len(Slist) - len(get_unique_list(Slist)) == 0:\n print(0)\nelse:\n print(len(Slist) - l... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s099567504', 's512479874', 's529456358', 's629417033', 's629620101', 's845313022', 's797535562'] | [3828.0, 2940.0, 47504.0, 3828.0, 2940.0, 3064.0, 19788.0] | [18.0, 17.0, 2106.0, 18.0, 17.0, 17.0, 341.0] | [337, 339, 352, 263, 346, 351, 179] |
p02947 | u492447501 | 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())\nlst = []\ncount = 0\nst = []\n\nfor i in range(N):\n if i==0:\n in_pu = input()\n l = list(in_pu)\n lst.append(in_pu)\n st.append(set(l))\n continue\n \n in_pu = input()\n l = list(in_pu)\n lst.append(list(in_pu))\n \n if set(l) in st:\n count = count + 1 \nprint(count+len... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s022269595', 's166693740', 's361114760', 's382000883', 's411434268', 's522363207', 's749680956', 's830802837', 's926995536', 's887939747'] | [24180.0, 24180.0, 22272.0, 22272.0, 3060.0, 22272.0, 22272.0, 100360.0, 2940.0, 19504.0] | [414.0, 406.0, 403.0, 403.0, 17.0, 398.0, 404.0, 2110.0, 17.0, 397.0] | [316, 298, 334, 251, 251, 251, 334, 279, 303, 239] |
p02947 | u492929439 | 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\n\nfor i in range(N):\n str = input()\n s[i] = ''.join(sorted(str))\n\ns.sort()\nans = 0\nfor i in range(N):\n current = s[i]\n if(i == N-1):\n break\n \n samenum = 0\n while(s[i] == current):\n if(i == N-1):\n break\n samenum += 1\n i += 1\n ans += (samenum * (sa... | ['Wrong Answer', 'Accepted'] | ['s396444283', 's367052628'] | [12200.0, 10544.0] | [2104.0, 442.0] | [325, 334] |
p02947 | u494058663 | 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())\nDict = {}\nans = 0\nfor i in range(n):\n tmp = list(input())\n tmp = tmp.sort()\n tmp = str(tmp)\n\n if tmp not in Dict:\n Dict[tmp] = 1\n else:\n ans += 1\n\nprint(ans)', "n = int(input())\nDict = {}\nans = 0\ntmp_list = []\nfor i in range(n):\n tmp = list(input())\n... | ['Wrong Answer', 'Accepted'] | ['s641637613', 's207709005'] | [3060.0, 39040.0] | [371.0, 429.0] | [203, 345] |
p02947 | u498620941 | 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())\npara = [[c for c in input()] for i in range(N)]\nprint(para)\ndef check(a,b):\n\n for i in range(10):\n if a[i] != b[i]:\n return False\n return True\n \na = 0 \nfor i in range(N):\n b = 0 \n for j in range(i+1,N):\n if check(para[i],para[j]):\n ... | ['Wrong Answer', 'Accepted'] | ['s989769495', 's805892003'] | [39436.0, 39704.0] | [2105.0, 416.0] | [336, 282] |
p02947 | u498658826 | 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 File "./main.py", line 16, in solve\n result += int((v-1) * 0.5 (1 + v-1))\nTypeError: \'float\' object is not callable\n\n\n', '#!/usr/bin/env python3\nimport sys\nfrom collections import defaultdict\nfrom collections import Counter\n\ndef solve(N: int, s: "List[str]"):\n count_dict = defaultdict(int)\n ... | ['Runtime Error', 'Accepted'] | ['s624328268', 's374176916'] | [2940.0, 81808.0] | [17.0, 1793.0] | [124, 1006] |
p02947 | u504256702 | 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\n\nfor i in range(n):\n s = ''.join(sorted(input()))\n if s not in d:\n d[s] = 1\n else:\n d[s] += 1\n#print(d)\nfor k, v in d.items():\n if v != 1:\n print(v)\n ans += v * (v - 1) / 2\n\nprint(int(ans))\n\n", "n = int(input())\nd = {}\nans = 0\n\n... | ['Wrong Answer', 'Accepted'] | ['s540689111', 's773115402'] | [17848.0, 17852.0] | [371.0, 383.0] | [259, 250] |
p02947 | u504836877 | 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 = []\nfor i in range(N):\n A.append(input())\n\ndic = {}\nfor i in range(N):\n temp = {}\n for j in range(10):\n if A[i][j] in temp:\n temp[A[i][j]] += 1\n else:\n temp[A[i][j]] = 1\n if dic in temp:\n dic[temp] += 1\n else:\n dic[te... | ['Runtime Error', 'Accepted'] | ['s528970509', 's802954934'] | [10268.0, 27096.0] | [148.0, 687.0] | [421, 406] |
p02947 | u506858457 | 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())\nS=[''.join(sorted(input())) for _ in range(N)]\nC=collections.Counter(S)\nans=0\nfor si in S:\n n=C[si]\n ans+=n*(n-1)//2\nprint(ans)", 'n=int(input()) \n\nS = []\nfor _ in range(H):\n S.append(set(input()).sort)\nprint(n-len(set(S))+1)', 'n=int(input()) \n\nS = []\nfor _ in... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s026320659', 's235740514', 's680742076', 's835541585', 's910797126', 's939832092'] | [19760.0, 3064.0, 3060.0, 3060.0, 3060.0, 23436.0] | [359.0, 19.0, 18.0, 18.0, 17.0, 376.0] | [163, 143, 143, 145, 143, 211] |
p02947 | u511449169 | 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,... | ['nCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\n\nn = int(input())\ns = [str(input()) for _ in range(n)]\ns_set = set(["".join(sorted(_)) for _ in [i for i in s]])\ns = ["... | ['Runtime Error', 'Accepted'] | ['s607916548', 's378790005'] | [28408.0, 18944.0] | [1875.0, 384.0] | [464, 541] |
p02947 | u511899838 | 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())\ntatelist = [input() for i in range(n)]\n\njlist = [collections.Counter(tatelist[i]) for i in range(n)]\n\ncount = 0\nfor i in range(n):\n for j in range(n-i):\n if jlist[i] == jlist[j]:\n count += 1\n \nprint(count)', 'n = int(input())\ntatelist ... | ['Wrong Answer', 'Accepted'] | ['s002259645', 's677113744'] | [61436.0, 47756.0] | [2107.0, 363.0] | [274, 337] |
p02947 | u518042385 | 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 w=list(input())\n l.append(w)\nl=sorted(l)\nc=0\nc1=0\nw1=l[0]\nfor i in range(n):\n if w1==l[i]:\n c1+=0\n else:\n c+=c1*(c1-1)//2\n c1=1\nc+=c1*(c1-1)//2\nprint(c)\n', 'from collections import defaultdict\nn=int(input())\nl=defaultdict(int)\nfor i in range(n):... | ['Wrong Answer', 'Accepted'] | ['s726131624', 's387386267'] | [25548.0, 18184.0] | [464.0, 463.0] | [206, 218] |
p02947 | u520843951 | 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 math import factorial\nn = int(input())\ns = [''.join(sorted(list(input()))) for _ in range(n)]\n\ndef combination(i):\n return factorial(i) // (factorial(i-2) * factorial(2))\n\ncnt = Counter(s)\nprint(cnt)\nans = 0\nfor i in cnt.values():\n print(i)\n ans += combinatio... | ['Runtime Error', 'Accepted'] | ['s115462982', 's024686107'] | [35680.0, 24216.0] | [459.0, 233.0] | [321, 212] |
p02947 | u522293645 | 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\nclist = [None for _ in range(n)]\ncnt = 0\n\nfor i in range(n):\n clist[i] = Counter(input())\n\nfor i in range(n):\n if i < n:\n for j in range(i+1,n):\n if clist[i] == clist[j]:\n cnt += 1\n\nprint(cnt)', "from collections import Counter\n\n# from fractio... | ['Runtime Error', 'Accepted'] | ['s374502811', 's630380846'] | [9724.0, 23892.0] | [30.0, 222.0] | [251, 453] |
p02947 | u522506260 | 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(intput())\ns = []\nfor i in range(n):\n tmp = str(input())\n tmp.sort()\n s.append(tmp)\n\na = [0 for i in range(10**3)]\nfor i in range(2, 10**3):\n x = a[i-1] + (i-1)\n a.append(x)\n\nans = 0\nfor _ in list(set(s)):\n ans+= a[s.count(_)]\n \nprint(ans)', 'n = int(intput())\ns = []\nfor i in range(n):... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s090948648', 's275320819', 's396056995', 's456145446', 's522344692', 's666423206', 's669065914', 's792972142', 's834148083', 's402343238'] | [3064.0, 3064.0, 3064.0, 16432.0, 3064.0, 3064.0, 3060.0, 3064.0, 3064.0, 17808.0] | [17.0, 18.0, 17.0, 2104.0, 18.0, 18.0, 17.0, 17.0, 18.0, 434.0] | [253, 250, 380, 273, 234, 249, 243, 234, 234, 257] |
p02947 | u525796732 | 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 math\nstdin = sys.stdin\n\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(stdin.readline().rstrip())\nnm = lambda: map(int, stdin.readline().split())\nnl = lambda: list(map(int, stdin.readline().split()))\n\nN=int(input())\nS=[''.join(sorted(input())) for _ in range(N)]\nS.sort()\n\nr=1\n... | ['Wrong Answer', 'Accepted'] | ['s070219850', 's504850823'] | [14612.0, 11512.0] | [760.0, 759.0] | [565, 556] |
p02947 | u527261492 | 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={}\ntotl=0\n\nfor i in range(n):\n s=list(input())\n s.sort()\n t=''.join(s)\n \n if t in d:\n d[t]+=1\n else:\n d[t]=1\n\nfor t in d:\n totl+=d[t]*(d[t]-1)/2\n\nprint(totl)", 'n=int(input())\nS=[]\nfor i in range(n):\n S.append(tuple(sorted(input().split())))\nprint(n-len(set(S)))\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s096085643', 's242977692', 's391634282', 's701782653', 's222144342'] | [17928.0, 21924.0, 21108.0, 21924.0, 17808.0] | [405.0, 275.0, 245.0, 292.0, 415.0] | [187, 109, 101, 246, 193] |
p02947 | u528087569 | 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\nnum = int(input())\nwords = {}\n\nfor i in range(num):\n a = str(sorted(list(input())))\n \n if a in words:\n words[a] += 1\n else:\n \twords[a] = 1\n\npoints = list(words.values())\nsum = 0\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)... | ['Runtime Error', 'Accepted'] | ['s396411276', 's050364976'] | [21984.0, 21984.0] | [957.0, 983.0] | [385, 408] |
p02947 | u528748570 | 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)]\nS = []\nfor i in range(N):\n S.append("".join(sorted(s[i])))\nprint(S)\n\ncnt = 0\nfor i in range(N):\n cnt += S.count(S[i]) - 1\nprint(cnt / 2)\n', 'N = int(input())\ns = [list(input()) for _ in range(N)]\nS = []\nfor i in range(N):\n temp = "".join(s... | ['Wrong Answer', 'Accepted'] | ['s206646750', 's634110038'] | [35656.0, 40688.0] | [2106.0, 409.0] | [198, 263] |
p02947 | u531220228 | 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 = [""]*N\n\nfor i in range(N):\n S[i] = 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 =... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s024292681', 's491162471', 's745172356'] | [27680.0, 26868.0, 27044.0] | [490.0, 281.0, 327.0] | [921, 567, 1051] |
p02947 | u531258707 | 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())\ns = []\nfor i in range(N):\n ss = input()\n s.append(ss)\nt= []\nfor i in range(N):\n tt= sorted(s[i])\n t.append(tt)\n#s.sort()\n#print(t)\n\ncount = 0\nfor i in range(N):\n a = tt.count(tt[i])\n count = count+a\nprint(count-N)', 'import collections as cl\nimpo... | ['Runtime Error', 'Accepted'] | ['s136481046', 's446798100'] | [31612.0, 29080.0] | [308.0, 378.0] | [267, 397] |
p02947 | u531579566 | 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\nimport collections\n\n\nn = int(input())\n\ninputlist = []\n\nfor i in range(n):\n inputlist.append("".join(sorted(list(input()))))\n\ncounter = collections.Counter(inputlist)\n\ncounter = dict(counter)\n\nans = 0\nprint(ans)\n', 'import collections\nimport math\n\n\nn = int(input())\n\ninputlist = []... | ['Wrong Answer', 'Accepted'] | ['s493136133', 's110115152'] | [22920.0, 22920.0] | [382.0, 776.0] | [512, 476] |
p02947 | u531813438 | 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\nimport fractions\n\nN = int(input())\ns=[0]*N\nS = []\nmydict = {}\nflag=0\nfor i in range(N):\n s_sorted =''.join(map(str, sorted(str(input()))))\n S.append(s_sorted)\nc = Counter(S)\ndic = {k: v for k, v in c.items() if v !=1}\nif dic == {}:\n print(0)\nelse:\n ans =0\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s207759401', 's241569690', 's784134794', 's948004033', 's867148936'] | [22300.0, 22256.0, 22308.0, 22308.0, 39040.0] | [541.0, 538.0, 532.0, 548.0, 410.0] | [478, 476, 379, 460, 299] |
p02947 | u532514769 | 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 < 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 offset = (n - r) % p\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s062544495', 's299553261', 's012748576'] | [25432.0, 40328.0, 25432.0] | [697.0, 820.0, 513.0] | [841, 849, 330] |
p02947 | u535171899 | 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\ndic={}\nfor i in range(n):\n s=''.join(sorted(list(input())))\n dic[s]=dic.get(s,0)+1\n\nans=0\nfor key,value in dic.items():\n if value<2:\n continue\n ans+=int(factorial(value) / factorial(2) / factorial(value - 2))\nprint(ans)", "from math import factorial\nn = int(input())\n... | ['Runtime Error', 'Accepted'] | ['s022471554', 's532197798'] | [17808.0, 17932.0] | [419.0, 804.0] | [256, 277] |
p02947 | u536685012 | 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,... | ['alp = {"a":2, "b":3,"c":5,"d":7,"e":11,"f":13,"g":17,"h":19,"i":23,"j":29,\n "k":31,"l":37,"m":41,"n":43,"o":47,"p":53,"q":59,"r":61,"s":67,"t":71,\n "u":73,"v":79,"w":83,"x":3.3,"y":2.3,"z":1.3}\n\nn = int(input())\n\ns = []\n\nfor i in range(n):\n tss= str(input()) # tss; temporary str s\n ts = 1\... | ['Time Limit Exceeded', 'Accepted'] | ['s540567854', 's852821911'] | [8668.0, 17848.0] | [2104.0, 467.0] | [549, 211] |
p02947 | u539517139 | 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 i in range(n):\n a=sorted(input())\n if a in d.keys():\n d[a]+=1\n else:\n d[a]=1\nl=list(d.values())\nc=0\nfor i in l:\n c+=(i*(i-1))//2\nprint(c)\n ', 'from collections import Counter as co\nn=int(input())\na=[str(sorted(input())) for _ in range(n)]\nd=co(a)\nl=d.values()\nc=0\n... | ['Runtime Error', 'Accepted'] | ['s922453894', 's138122000'] | [3060.0, 24560.0] | [17.0, 471.0] | [174, 159] |
p02947 | u539850805 | 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 combo(a):\n return (math.factorial(a))/(math.factorial(a-2)*2)\n\nfrom collections import Counter\nn = int(input())\ncount = 0\nstring = [input() for i in range(n)]\nstring2 = [''.join(sorted(x)) for x in string]\n\n'''for i in range(n-1):\n for j in range(i+1, n):\n if string2[i] == str... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s045774391', 's534050976', 's555542294', 's184508206'] | [34080.0, 40012.0, 26960.0, 34064.0] | [686.0, 426.0, 294.0, 703.0] | [630, 476, 337, 634] |
p02947 | u542190960 | 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,... | ["\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nfrom collections import Counter\n\nN = int(input())\nS = [''.join(map(str,(sorted(str(input()))))) for i in range(N)]\nprint(S)\ncounter = Counter(S)\nprint(counter)\n\nanswer = sum(x*(x-1)//2 f... | ['Wrong Answer', 'Accepted'] | ['s161456446', 's517131962'] | [32540.0, 19760.0] | [577.0, 504.0] | [343, 202] |
p02947 | u546104065 | 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 = list(map(str, input().split()))\n# S = list(map(str, input().split()))\nS = []\nfor _ in range(H):\n S.append(input())\n\n\nS=[''.join(sorted(a)) for a in S]\n\n\ncount=[0]*(len(set(S)))\nunique_S=list(set(S))\nans=0\nfor ele in S:\n count[unique_S.index(ele)]+=1\ncount=sorted(count,revers... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s439682330', 's601434811', 's733421324', 's914493862', 's842944796'] | [3064.0, 3316.0, 3064.0, 3064.0, 18236.0] | [17.0, 21.0, 17.0, 17.0, 433.0] | [747, 668, 673, 697, 268] |
p02947 | u546417841 | 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\nimport sys\n\ninput=sys.stdin.readline\n\nnum=int(input())\nstl =[''.join(sorted(input().strip('\\n'))) for i in range(num)]\nprint(stl)\n\nduplicate=[x for x in set(stl) if stl.count(x) > 1]\n\ncount=0\n\nfor dup in duplicate:\n n=stl.count(dup)\n count += factorial(n) // 2 // facto... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s864050450', 's990600345', 's344654950'] | [18332.0, 16384.0, 19404.0] | [2104.0, 2104.0, 366.0] | [326, 294, 260] |
p02947 | u547167033 | 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\ndef cmb(n,r):\n return factorial(n)//(factorial(r)*factorial(n-r))\nn=int(input())\ns=[input() for i in range(n)]\ns.sort()\ncnt=0\nans=0\nfor i in range(1,n):\n if s[i]==s[i-1]:\n cnt+=1\n else:\n ans+=cmb(cnt+1,2)\n cnt=0\nprint(ans)', 'from math import factorial\nfrom collec... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s071147945', 's127879016', 's822900870', 's279171443'] | [10580.0, 25008.0, 10580.0, 25516.0] | [193.0, 1216.0, 196.0, 825.0] | [261, 416, 262, 383] |
p02947 | u556594202 | 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 _ in range(n)]\n\ncnt=0\nfor i in range(n):\n if s.count(s[i])!=1\n cnt += s.count(s[i])/s.count(s[i])\nprint(cnt-n)\n', 'n = int(input())\ns = ["".join(sorted(list(input()))) for _ in range(n)]\n\ncnt=0\nfor i in range(n):\n if s.count(s[i])!=1:\... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s166930788', 's561568708', 's628395522', 's829800402', 's468313379'] | [8964.0, 16296.0, 8956.0, 8912.0, 16404.0] | [27.0, 2206.0, 25.0, 21.0, 261.0] | [178, 179, 162, 151, 295] |
p02947 | u556849401 | 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 i in range(n):\n a = input();k = 0\n for j in range(10):\n k+= ord(a[j]) - 95\n if k not in d:\n d[k] = 1\n else:\n d[k]+=1\nif len(d) == 0:\n print(0)\nelse:\n print(max(d.values()))', 'n = int(input())\nd = {}\nfor i in range(n):\n a = input();k = 0\n for j in range(10... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s029804340', 's373545460', 's942251314'] | [3060.0, 3060.0, 17924.0] | [393.0, 19.0, 388.0] | [215, 214, 288] |
p02947 | u557235596 | 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# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\nimport math\n\nN = int(input())\nH = defaultdict(int)\n\nfor i in range(N):\n s = "".join(sorted(input()))\n H[s] += 1\n\nret = 0\nfor v in H.values():\n ret += math.factorial(v) // (math.factorial(v - 2) * math.factorial(... | ['Runtime Error', 'Accepted'] | ['s761990763', 's466940164'] | [18232.0, 18232.0] | [773.0, 799.0] | [317, 336] |
p02947 | u558494840 | 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())\n#c = 0\n\nsort_list = list()\nfor i in range(n):\n i_sort = "".join(sorted(input()))\n #sort_dict[i] = i_sort\n sort_list.append(i_sort)\n #if not sort_dict[0]:\n # if sort_dict[i] == sort_dict[i-1]:\n # c += 1\ncounts = 0\ncc = collections.Counter(sort_list)\nv, c = ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s105517099', 's436786061', 's964687210'] | [31660.0, 31660.0, 31748.0] | [419.0, 417.0, 422.0] | [496, 462, 501] |
p02947 | u559103167 | 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 = []\na = 0\nb = 0\nfor i in range(N):\n s.append(''.join(sorted(list(input()))))\n \na = len(s)\nb = len(set(s))\n\nprint(int((a - b)*2))", 'N = int(input())\ns = []\nfor i in range(N):\n s.append(sorted(list(input())))\n\nans = 0\nfor i in range(N):\n for j in range(N):\n if n... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s183955896', 's340572920', 's829968441', 's284371616'] | [16432.0, 24208.0, 39436.0, 17808.0] | [366.0, 371.0, 2105.0, 438.0] | [154, 222, 235, 221] |
p02947 | u561231954 | 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(sorted(input()))\nans=0\nfor i in range(n):\n for j in range(n):\n if S[i]==S[j]:\n ans+=1\n \nprint((ans-n)/2)', "n=int(input())\nS=[''.join(sorted(input())) for i in range(n)]\n\n\nmemo={}\nans=0\nfor i in range(n):\n if S[i] no... | ['Wrong Answer', 'Accepted'] | ['s935832427', 's683397957'] | [26256.0, 19400.0] | [2105.0, 361.0] | [188, 195] |
p02947 | u566428756 | 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={}\nans=0\nfor i in range(N):\n s=''.join(sorted(input()))\n if s in d:\n ans+=d[s]\n d[s]+=1\n else:\n d[s]=1\nprint(ans)", "import sys\nread_=sys.stdin.buffer.readline\n\nN=int(read_())\nans_d={}\nans=0\nfor i in range(N):\n s=''.join(sorted(input()))\n if s in ans_d:\n ... | ['Runtime Error', 'Accepted'] | ['s104034722', 's484847333'] | [2940.0, 17860.0] | [17.0, 377.0] | [145, 225] |
p02947 | u567053725 | 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\namount = int(input())\nstrings = list(map(str, [input() for i in range(amount)]))\nsum = 0\nsum2 = 0\n\nfor i in range(len(strings)):\n\t# print(strings[i])\n\tabc = list(strings[i])\n\tabc.sort()\n\tstrings[i] = ''.join(abc)\n\t# print(strings[i])\n\nstrings.sort()\n\nfor j in range(len(strings)-1):\... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s523999441', 's525750402', 's479657242'] | [11036.0, 11036.0, 11036.0] | [379.0, 363.0, 385.0] | [490, 359, 495] |
p02947 | u572343785 | 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("".join(sorted(input())))\n\nS=set(s)\n\nimport math\n\ndef cmb(n,r):\n return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))\n\n\nans=0\nfor x in S:\n a=s.count(x)\n ans+=cmb(a,2)\nprint(ans)\n', 'n=int(input())\ns=[]\nfor i in range(n):\n... | ['Runtime Error', 'Accepted'] | ['s160450027', 's882193092'] | [16392.0, 27080.0] | [747.0, 401.0] | [254, 459] |
p02947 | u573754721 | 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\ninput = sys.stdin.readline\n\nN = int(input())\nlis_all = []\nlis_pat = []\nlis_num = []\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ncount = 0\nfor i in range(N):\n lis_S = list(str(input()))\n lis_S.sort()\n if lis_S not in lis_all:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s159283119', 's608857737', 's759347321', 's481576059'] | [3064.0, 25244.0, 24208.0, 17848.0] | [18.0, 2104.0, 2104.0, 378.0] | [495, 358, 344, 192] |
p02947 | u578489732 | 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\n# ----------------------------------------------------------------\n# Use Solve Function\n\ndef solve(lines):\n def c(n):\n if n == 1:\n return 0\n else:\n return n * (n - 1) // 2\n\n\n N = int(lines.pop(0))\n NLIST = {}\n for i in range(N):\n l = ''.... | ['Wrong Answer', 'Accepted'] | ['s440108172', 's570065999'] | [21376.0, 20352.0] | [1838.0, 1766.0] | [588, 571] |
p02947 | u580327099 | 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 python3\n# -*- coding: utf-8 -*-\n\nimport sys\nfrom operator import mul\nfrom functools import reduce\n\ninput = sys.stdin.readline\n\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 // ... | ['Wrong Answer', 'Accepted'] | ['s264336852', 's242610820'] | [18388.0, 18388.0] | [204.0, 208.0] | [784, 824] |
p02947 | u580362735 | 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 combinations(n, r):\n if n == r:\n return 1\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nN = int(input())\ns = [sorted(input())]\nans = 0\nfor i in range(N-1):\n s_i = sorted(input())\n s.append(s_i)\ns = sorted(s)\ncount=1\nfor j in range(N-1):\n if s... | ['Runtime Error', 'Accepted'] | ['s930607313', 's805007198'] | [26280.0, 25472.0] | [813.0, 786.0] | [440, 461] |
p02947 | u581040514 | 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_dict = {}\nN = int(input())\nfor _ in range(N):\n s = ''.join(sorted(input()))\n if s not in S_dict.keys():\n S_dict[s] = 0\n else:\n S_dict[s] += S_dict[s] + 1\nprint(sum(map(long, S_dict.values())))", "ans = 0\nN = int(input())\ns_list = [''.join(sorted(input())) for _ in range(N)]\ns_list.... | ['Runtime Error', 'Accepted'] | ['s383459910', 's647021596'] | [17848.0, 10640.0] | [758.0, 416.0] | [217, 310] |
p02947 | u582663624 | 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(str(input())) for i in range(n)]\ncnt=0\nnums=[x for x in range(n)]\nfor m in l:\n m.sort()\nprint(l)\nfor i in nums[:n-1]:\n for j in l[i+1:]:\n if(l[i]==j):\n cnt+=1\nprint(cnt)', 'n=int(input())\nl=[list(str(input())) for i in range(n)]\ncnt=0\nnums=[x for x in range(n)]\nfor m in... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s461472847', 's620266763', 's523629641'] | [43532.0, 43532.0, 23436.0] | [2105.0, 2105.0, 424.0] | [202, 212, 182] |
p02947 | u585348179 | 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\nn=int(input())\nS = []\nfor i in range(n):\n S.append(''.join(sorted(input())))\n\ncnt = Counter(S)\n \nans = 0\nfor num in cnt.values():\n ans += num*(num-1)/2\nprint(ans)\n", "from collections import Counter\n\n\nn=int(input())\nS = []\nfor i in range(n):\n S.append(''.... | ['Wrong Answer', 'Accepted'] | ['s552963862', 's591890515'] | [19760.0, 19760.0] | [354.0, 366.0] | [203, 204] |
p02947 | u589599801 | 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 isAnagram(s, ss):\n\ti = 0\n\twhile ss != "" and i < len(s):\n\t\tss.replace(s[i], \'\')\n\t\ti += 1\n\tif ss == "":\n\t\treturn 1\n\telse:\n\t\treturn 0\n\n\nc = int(input())\n\nstrings = []\nfor i in range(c):\n\tstrings.append(input())\n\ncount = 0\nfor i in range(c):\n\tfor j in range(i, c):\n\t\tcount += isA... | ['Wrong Answer', 'Accepted'] | ['s361622488', 's263254581'] | [10268.0, 23436.0] | [2104.0, 374.0] | [327, 280] |
p02947 | u589695410 | 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 countPairs(str_arr):\n\tcount = 0\n\tfor i in range(N):\n\t\tfor j in range(i+1,N):\n\t\t\tif str_arr[i] == str_arr[j]:\n\t\t\t\tcount += 1\n\treturn count\n\n\nN = int(input())\nstr_arr = []\n\nfor i in range(N):\n\tstr = input()\n\tstr_arr.append(str)\n\nprint(countPairs(str_arr))', 'import operator as op\nfrom... | ['Wrong Answer', 'Accepted'] | ['s658294791', 's008174241'] | [10268.0, 27880.0] | [2104.0, 745.0] | [257, 651] |
p02947 | u589753618 | 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,... | ['for i in range(n):\n s.append("".join(sorted(input())))\ns.sort()\n\na = 0\nr = 0\ni = 1\nl = len(s)\nwhile i < l:\n if s[i] == s[i-1]:\n r = r+1\n else:\n a = a + sum(range(r+1))\n r = 0\n i = i+1\n\nif r > 0: a = a + sum(range(r+1))\nprint(a)', 'n = int(input())\n\ns = []\nfor i in ... | ['Runtime Error', 'Accepted'] | ['s693863920', 's228657375'] | [3060.0, 10640.0] | [17.0, 458.0] | [260, 286] |
p02947 | u591503175 | 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 code here\n \'\'\'\n import collections\n N = int(input())\n Ss = [sorted([item for item in input()]) for _ in range(N)]\n \n sss = []\n for line in Ss:\n sss.append(\'\'.join(line))\n line_cnt = collections.Counter(sss)\n\n cnt = 0\n for letter, nu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s588871146', 's719837982', 's694315476'] | [50772.0, 50632.0, 50720.0] | [299.0, 299.0, 301.0] | [425, 483, 455] |
p02947 | u593019570 | 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())\nb = []\nfor _ in range(a):\n b.append(sorted(list(input())))\n\nfor i in range(a):\n for j in range(i+1, a):\n check = True\n for k in range(10):\n if b[i] != b[j]:\n check = False\n if check = True:\n ans += 1\nprint(ans)', "a = int(input())\nb = {}\nstrings = ''\nans = ... | ['Runtime Error', 'Accepted'] | ['s292313150', 's429239463'] | [2940.0, 17808.0] | [17.0, 461.0] | [255, 285] |
p02947 | u593567568 | 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\nSS = []\nfor i in range(N):\n s = list(input())\n s.sort()\n SS.append(s)\n \nSS.sort()\n\nans = 0\nprev = None\ncnt = 0\nfor i in range(N):\n s = SS[i]\n if s == prev:\n if not cnt:\n cnt = 2\n else:\n cnt += 1\n else:\n ans += cnt\n cnt = 0\n prev = s\n \nans += cn... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s096798821', 's697299237', 's712720677', 's860118699', 's907303765', 's346579652'] | [26304.0, 24912.0, 59508.0, 3064.0, 110584.0, 39364.0] | [517.0, 485.0, 2106.0, 17.0, 2109.0, 586.0] | [309, 243, 476, 491, 494, 305] |
p02947 | u597017430 | 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 = [0] * N\nfor i in range(N):\n A_temp = input()\n A[i]= sorted([c for c in A_temp])\ncount = 0\n\nB = sorted(A)\nA_unique_count = 1\nfor i in range(N-1):\n if B[i] != B[i+1]:\n A_unique_count += 1\n\nC = 0 \nnum = 0\n\nprint(B)\n\nfor i in range(A_unique_count):\n# print( 'i' + str(i))\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s656734341', 's859449471', 's815198453'] | [40484.0, 40608.0, 25392.0] | [2105.0, 2105.0, 602.0] | [428, 424, 411] |
p02947 | u602773379 | 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,... | ['counter={}\nans=0\nfor i in range(n):\n\tss = sorted(s[i])\n\tss=("").join(ss)\n\tif ss not in counter:\n\t\tcounter[ss]=0\n\telse:\n\t\tcounter[ss]+=1\n\t\tans+=counter[ss]\n\nprint(ans)', 'n=int(input())\ns=[]\nfor _ in range(n):\n\ts.append(str(input()))\n\ncounter={}\nans=0\nfor i in range(n):\n\tss = sorted(s[i]... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s469423751', 's552042704', 's191244420'] | [8980.0, 30716.0, 29176.0] | [26.0, 486.0, 246.0] | [166, 283, 230] |
p02947 | u606146341 | 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\nimport collections\n \nn = int(input())\nlists = [str(input()) for i in range(n)]\n \nlists2 = ["".join(sorted(i)) for i in lists]\nl = collections.Counter(lists2)\nc = l.values()\n \nprint(sum([i * (i - 1)/ 2 for i in c]))', 'import collections\n\nn = int(input())\nlists = [str(input()) for i in ra... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s048002862', 's295566863', 's552444728'] | [26960.0, 27592.0, 27620.0] | [310.0, 307.0, 311.0] | [231, 212, 217] |
p02947 | u616117610 | 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\ns = []\ncnt = []\nfor i in range(n):\n s_ = list(str(input()))\n s_.sort()\n if s_ in s:\n cnt[s.index(s_)] += 1\n else:\n s.append(s_)\n cnt.append(1)\n\nprint(sum(cnt))', 'n = int(input())\ns = list(ranege(n))\nfor i in range(n):\n s[i] = list(str(input()))\n s[i].sort()\n\... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s007457115', 's058681930', 's517045007', 's912921299', 's052985413'] | [5612.0, 3060.0, 3060.0, 3060.0, 17800.0] | [2104.0, 17.0, 18.0, 17.0, 427.0] | [197, 200, 197, 201, 204] |
p02947 | u619144316 | 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,defaultdict\nimport math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nN = int(input())\nA = defaultdict(int)\nfor _ in range(N):\n c = Counter(list(input()))\n d = sorted(c.items(),key= lambda x:x[0])\n A[tupl... | ['Runtime Error', 'Accepted'] | ['s736767566', 's347798041'] | [74764.0, 74764.0] | [1927.0, 1851.0] | [394, 412] |
p02947 | u620846115 | 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(list(input())))\n if S in d.keys():\n d[S] +=1\n else:\n d[S] = 1\n\nans = 0\nfor i in d.values():\n ans += n*(n-1)//2\nprint(ans)", "n = input()\ns = [''.join(sorted(input())) for i in range(n)]\ncount = 0\nfor i in range(n):\n for j in... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s042394575', 's097487435', 's210000899', 's356430376', 's391389489', 's536208240', 's887958441', 's893770934', 's441944159'] | [22112.0, 8944.0, 9292.0, 22120.0, 9332.0, 9124.0, 9416.0, 9312.0, 22176.0] | [263.0, 24.0, 23.0, 262.0, 25.0, 22.0, 28.0, 26.0, 264.0] | [198, 167, 181, 207, 172, 161, 176, 184, 199] |
p02947 | u622045059 | 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 = [sorted(input()) for _ in range(n)]\n \n print(s)\n cnt = 0\n for i in range(n):\n for j in range(i+1,n):\n if s[i] == s[j]:\n cnt += 1\n\n print(cnt)\n\n\nif __name__ == "__main__":\n main() ', 'def main(): \n n = int(i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s006223264', 's031880310', 's270541320'] | [39436.0, 41820.0, 19400.0] | [2105.0, 2105.0, 351.0] | [272, 299, 296] |
p02947 | u622847899 | 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())\n\ndic={}\nfor i in range(n):\n s=''.join(sorted(input()))\n if s in dic:\n dic[s] += 1\n else:\n dic[s] = 1\nans=0\nfor n in dic.values():\n ans += math.factorial(n) // (math.factorial(n-2) * math.factorial(2))\n\nprint(ans)\n", "import math\n\nn=int(input())\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s042562767', 's544459057', 's946035680'] | [17848.0, 17848.0, 17848.0] | [774.0, 777.0, 783.0] | [267, 283, 285] |
p02947 | u625963200 | 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=[list(input()) for _ in range(n)]\nss.sort()\nans=[]\nfor s in ss:\n tmp=''\n s.sort()\n for t in s:\n tmp+=t\n ans.append(tmp)\nprint(ans)\n\ncnt=0\nfor uniq in list(set(ans)):\n for i in range(ans.count(uniq)):\n cnt+=i\nprint(cnt)\n", "n=int(input())\nss=[list(input()) for _ in range(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s145587575', 's796888751', 's264775135'] | [39564.0, 35904.0, 24980.0] | [2106.0, 2106.0, 337.0] | [248, 256, 254] |
p02947 | u626228246 | 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())\ns = [list(input()) for S in range(n)]\ncnt = 0\nfor i in range(n):\n\ts[i].sort()\nduplicated_data = [tuple(d) for d in s]\nunique_data = set(duplicated_data)\ns_set = [list(d) for d in unique_data]\nprint(s_set)\nfor j in range(len(s_set)):\n\tif s.count(s_set[j]) >= 2:\n\t\tk = s.coun... | ['Wrong Answer', 'Accepted'] | ['s369854373', 's762085645'] | [68812.0, 23880.0] | [2214.0, 233.0] | [392, 827] |
p02947 | u627803856 | 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)]\n\nlis=[collections.Counter(list(s[i])) for i in range(n)]\ncnt=0\nfor i in range(n):\n for j in range(i+1,n):\n if lis[i].items()==lis[j].items(): cnt+=1\nprint(cnt)', "n = int(input())\nd = {}\nfor i in range(n):\n s = sorted(list(input())) \n s = ''.j... | ['Runtime Error', 'Accepted'] | ['s985624892', 's197464037'] | [10268.0, 17808.0] | [140.0, 424.0] | [214, 226] |
p02947 | u628285938 | 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"""\nCreated on Thu Sep 10 00:32:19 2020\n\n@author: liang\n"""\n\nN = int(input())\nd = dict()\nfor i in range(N):\n S = input()\n S = \'\'.join(sorted(list(S)))\n print(S)\n if S in d.keys():\n d[S] += 1\n else:\n d[S] = 1\n\nans = 0\nfor n in d.values():\n a... | ['Wrong Answer', 'Accepted'] | ['s985088843', 's527995690'] | [22116.0, 22188.0] | [489.0, 262.0] | [323, 324] |
p02947 | u628794221 | 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 = [0]*(N+1)\nfor i in range(N):\n tmp = sorted(list(input()))\n s[i] = ''.join(tmp)\ns[-1] = 'zzzzzzzzzzz'\ns.sort()\n\nans = 0\nfor i in range(N):\n k = 1\n while s[i] == s[i+k]:\n ans += 1\n k += 1\n ", "N = int(input())\ns = [0]*(N+1)\nfor i in range(N):\n tmp = ... | ['Wrong Answer', 'Accepted'] | ['s480329711', 's785800559'] | [12408.0, 10572.0] | [2104.0, 466.0] | [237, 272] |
p02947 | u629350026 | 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())\ndict={}\ncount=0\nfor i in range(0,n):\n temp=str(input())\n temp=sorted(list(temp))\n temp="".join(temp)\n if temp in dict:\n dict[temp]=dict[temp]+1\n count=count+dict[temp]\n else:\n dict[temp]=1\nprint(count)', 'n=int(input())\ndict={}\ncount=0\nfor i in range(0,n):\n temp=str(input... | ['Wrong Answer', 'Accepted'] | ['s763220976', 's126222053'] | [17808.0, 17808.0] | [451.0, 465.0] | [230, 230] |
p02947 | u629538480 | 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 = []\ncount=0\nfor i in range(N):\n a = list(input())\n a.sort()\n s.append(a)\n\nwhile True:\n if len(s) == 0:\n break\n count += s.count(s[0])\n s=[i for i in s if i != s[0]]\n \nprint(count)', 'for i in range(N):\n a = list(input())\n a.sort()\n s.append(a)\n\nduplicate_list = dupl... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s473163328', 's644549168', 's680826938'] | [26984.0, 3068.0, 18236.0] | [2105.0, 18.0, 444.0] | [209, 210, 199] |
p02947 | u634653487 | 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\nans = 0\ns = []\nN = int(input())\nfor i in range(N):\n\ttmp = []\n\tstring = input()\n\tfor st in string:\n\t\ttmp.append(st)\n\ts.append(tmp)\n\nfor m in range(len(s)):\n\tfor n in range(len(s)):\n\t\tif Counter(s[n])==Counter(s[m]) and s[m] != s[n]:\n\t\t\tans+=1\nprint(ans/2)', 'f... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s131036436', 's906096662', 's129197246'] | [24436.0, 26484.0, 17892.0] | [2105.0, 2105.0, 487.0] | [286, 253, 249] |
p02947 | u636251914 | 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\nimport math\n\nN = int(input())\nprint("No")', 'import math\nfrom itertools import groupby\n\nN = int(input())\nS = ["".join(sorted(input())) for i in range(N)]\nsizes = [len(list(v)) for k, v in groupby(sorted(S))]\n\n\ndef combinations_count(n, r):\n if n == 1:\n return 0\n return ... | ['Runtime Error', 'Accepted'] | ['s712398513', 's932923716'] | [9084.0, 17604.0] | [26.0, 460.0] | [61, 375] |
p02947 | u642528832 | 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 = [(sorted(input())) for _ in range(N)]\nc = collections.Counter(S)\nans = 0\nfor i in set(S):\n n = c[i]\n ans += n*(n-1)//2\nprint(ans)', "import collections\n\nN = int(input())\nS = [''.join(sorted(input())) for _ in range(N)]\nc = collections.Counter(S)\nans = 0\npr... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s051126034', 's105124245', 's332937410', 's515869067', 's699426522', 's848761730', 's538361764'] | [30568.0, 27980.0, 9408.0, 30620.0, 89240.0, 30548.0, 34868.0] | [216.0, 269.0, 28.0, 218.0, 2208.0, 221.0, 272.0] | [176, 193, 185, 185, 104, 174, 181] |
p02947 | u646130340 | 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 = []\nl_cnt = []\nfor i in range(N):\n s.append(''.join(sorted(input())))\n\ndic = {}\nfor x in s:\n if dic.get(x) == None:\n dic[x] = 1\n else:\n dic[x] += 1\n\nprint(list(map(lambda n: n*(n-1)//2,list(dic.values()))))", "N = int(input())\ns = []\nl_cnt = []\nfor i in range(N):\n s.appe... | ['Wrong Answer', 'Accepted'] | ['s851911037', 's843583249'] | [19404.0, 19400.0] | [369.0, 376.0] | [235, 234] |
p02947 | u650265349 | 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())\ns = []\n\nfor _ in range(N):\n s.append(str(input()))\n \ncnt = 0\nfor i in range(N):\n delete = []\n s1 = s.pop()\n s1list = list(s1)\n same = 0\n \n for j in range(len(s)-1, -1, -1):\n s2 = s[j]\n s2list = list(s2) \n if sorted(s1list) == sorted(s2list):\n delete... | ['Runtime Error', 'Accepted'] | ['s939606354', 's378651035'] | [11032.0, 19828.0] | [417.0, 427.0] | [427, 253] |
p02947 | u652057333 | 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\ninput = sys.stdin.readline\n\nfrom math import factorial\n\ndef ncr(n, r):\n return factorial(n) / factorial(r) / factorial(n - r)\n\nfrom collections import defaultdict\n\n\nn = int(input())\nd = defaultdict(lambda: 0)\n\nfor i in range(n):\n s = list(str(input()).rstrip())\n s.sort()\n s = "... | ['Runtime Error', 'Accepted'] | ['s243434089', 's518645787'] | [22396.0, 18184.0] | [457.0, 300.0] | [431, 876] |
p02947 | u652583512 | 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 C(n) :\n if n == 1:\n return 1\n sum = 1\n while (n > 1):\n sum *= n\n n -= 1\n return sum // 2\n\ndef main():\n N = int(input())\n dic = {}\n for i in range(N):\n s = ''.join(sorted(input()))\n\n if s in dic:\n dic[s] += 1\n else:\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s630260352', 's984524386', 's036521596'] | [17852.0, 2940.0, 17852.0] | [2104.0, 17.0, 372.0] | [431, 201, 217] |
p02947 | u662449766 | 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 math\n\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n lines = ["".join(sorted(input().strip())) for _ in range(n)]\n count = 0\n for text in set(lines):\n txt_cnt = lines.count(text)\n count += int(math.factorial(txt_cnt) / math.factorial(txt_cnt - 2)) /... | ['Runtime Error', 'Accepted'] | ['s901825858', 's630434193'] | [16328.0, 24756.0] | [610.0, 232.0] | [367, 533] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.