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
u667024514
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nlis = []\nfor _ in range(n):\n s = list(str(input()))\n s.sort()\n lis.append(s)\nlis.sort()\nans = 0\nnum = 0\nfor i in range(n-1):\n if lis[i+1] == lis[i]:\n num += 1\n else:\n ans += (num * (num+1))//2\n num = 0\nprint(ans)', 'n = int(input())\nlis = []\nfor _ in range(n):\n s = li...
['Wrong Answer', 'Accepted']
['s005243213', 's683717447']
[24652.0, 24652.0]
[546.0, 565.0]
[243, 269]
p02947
u668503853
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['N=int(input())\nS=["".join(sorted(input())) for _ in range(N)]\ndic={}\nfor s in S:\n if s not in dic:\n dic.setdefault(s,1)\n else:\n dic[s]+=dic[s]\nprint(dic)\nli=list(dic.values())\nprint(sum(li)-len(li))', 'N=int(input())\nS=["".join(sorted(input())) for _ in range(N)]\ndic={}\nans=0\nfor s in S:\n if s...
['Wrong Answer', 'Accepted']
['s376867819', 's387867098']
[21192.0, 19404.0]
[548.0, 347.0]
[206, 178]
p02947
u668924469
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['import math\n\nn = int(input())\ns = sorted(["".join(sorted(input())) for i in range(n)])\na = 0\nb = []\nfor i in range(n-1):\n if s[i]==s[i+1]:\n a += 1\n if i==n-2:\n b.append(a)\n a = 0\n else:\n b.append(a)\n a = 0\nfor i in range(len(b)):\n a += math.factorial(b[i])\nprint(a)', 'import ...
['Wrong Answer', 'Accepted']
['s740232021', 's725360153']
[11424.0, 14144.0]
[2104.0, 406.0]
[290, 196]
p02947
u669173971
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\ncount = 0\ndic = {}\nfor _ in range(n):\n key = ''.join(sorted(input()))\n if key in dic:\n c += dic[key]\n dic[key] += 1\n else:\n dic[key] = 1\nprint(count)", "n = int(input())\ncount = 0\ndic = {}\nfor _ in range(n):\n key = ''.join(sorted(input()))\n if key in...
['Runtime Error', 'Accepted']
['s382652784', 's477407389']
[17848.0, 17852.0]
[350.0, 391.0]
[196, 200]
p02947
u670512177
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\n\ns = [input() for i in range(N)]\n\nline = defaultdict(int)\n\nfor anagram in s:\n a = sorted(anagram)\n line[''.join(a)] += 1\n\n_sum = 0\n\nfor i in line:\n _sum += line[i]\n\nprint(_sum * (_sum-1) / 2)\n", "from collections import defaultdict\n\nN = int(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s194721567', 's919255000', 's665901768']
[25332.0, 25332.0, 25332.0]
[350.0, 365.0, 361.0]
[249, 333, 261]
p02947
u671352108
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
["# Green Bin\nn = int(input())\ns = [input() for i in range(n)]\nm = 0\nlist = {}\nfor i in s:\n i = ' '.join(sorted(i))\n if i in list:\n list[i] = list[i] + 1\n else:\n list[i] = 1\nfor i in list.values():\n l = i -1\n m = m + int(((l * (l + 1)) / 2))\nprint(list)", "# Green Bin\nn = int(input())\ns = [in...
['Wrong Answer', 'Accepted']
['s670371090', 's247938262']
[30988.0, 25744.0]
[354.0, 334.0]
[262, 259]
p02947
u671861352
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nS = [input() for _ in range(N)]\n\nd = {}\nfor s in S:\n s = "".join(sorted(s))\n if s in d:\n d[s] += 1\n else:\n d[s] = 1\nans = 0\nfor v in d.values():\n if v > 1:\n ans += comb(v, 2)\nprint(ans) ', 'N = int(input())\nS = [...
['Runtime Error', 'Accepted']
['s800158299', 's041077450']
[14280.0, 24976.0]
[177.0, 303.0]
[275, 194]
p02947
u672220554
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nlists = []\nresult = 0\ntempres = 0\nfor i in range(N):\n lists.append(input())\n\nsortedlist = []\nfor i in range(0, N):\n sortedlist.append(sorted(lists[i]))\n\nsortedlist.sort()\nfor i in range(0, N):\n if tempres != 0:\n tempres -= 1\n continue\n\n for j ...
['Wrong Answer', 'Accepted']
['s248341329', 's028214655']
[32412.0, 31828.0]
[2106.0, 518.0]
[473, 482]
p02947
u672475305
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nlst = []\nlstn = [0] *10**5\nj = 0\n\nfor i in range(n):\n s = input()\n c = Counter(s)\n if c not in lst:\n lst.append(c)\n lstn[j] = 1\n j += 1\n else:\n k = lst.index(c)\n lstn[k] += 1\n \nprint(sum(lstn))', ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s025983587', 's476001959', 's625990863']
[10740.0, 10356.0, 26856.0]
[2104.0, 2104.0, 286.0]
[297, 563, 203]
p02947
u673338219
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 _ in range(n):\n si = str(input())\n di = {}\n for i in range(10):\n if si[i] in di.keys():\n di[si[i]] += 1\n else:\n di[si[i]] = 1\n frag = True\n for j,st in enumerate(li[0]):\n if di == st:\n li[1][j] += 1\n frag = False\n if frag:\n li[0].append(di)\n li[1].append(1)\...
['Runtime Error', 'Accepted']
['s648806879', 's105824964']
[3064.0, 17888.0]
[18.0, 561.0]
[354, 260]
p02947
u674052742
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 Wed Mar 25 18:54:16 2020\n\n@author: Kanaru Sato\n"""\n\nn = int(input())\nDict = {}\nans = 0\n\nfor i in range(n):\n s = list(input())\n s.sort()\n if s in Dict:\n ans += Dict[s]\n Dict[s] += 1\n else:\n Dict[s] = 1\n\nprint(ans)', '# -*- codi...
['Runtime Error', 'Accepted']
['s186001377', 's538159889']
[3060.0, 17808.0]
[17.0, 390.0]
[284, 305]
p02947
u674190122
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
["lens = int(input())\nhashes = sorted()[''.join(sorted(input())) for _ in range(lens)])\ni = 0\nj = 0\nr = 0\nans = 0\nwhile i < lens - 1:\n i += 1\n if hashes[i] == hashes[j]:\n r += 1\n else:\n ans += (r * (r + 1)) // 2\n r = 0\n j = i\nans += (r ( r + 1))//2\nprint(ans)", "from ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s151565751', 's394776929', 's883041402', 's952993117']
[2940.0, 19764.0, 10208.0, 25088.0]
[17.0, 338.0, 368.0, 545.0]
[294, 189, 286, 329]
p02947
u674588203
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\ndic={}\n\nans=0\n\nfor i in range(N):\n si=input()\n # ci=Counter(si)\n \n \n sorted_s=''.join(sorted(Counter(si).elements()))\n if sorted_s in dic:\n ans+=dic[sorted_s]\n dic[sorted_s]+=1\n else:\n dic[sorted_s]=1\n\nprint(a...
['Runtime Error', 'Runtime Error', 'Accepted']
['s119737285', 's611807746', 's550309209']
[9000.0, 8928.0, 22304.0]
[26.0, 27.0, 520.0]
[363, 364, 361]
p02947
u680851063
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = []\nfor i in range(n):\n tmp = list(input())\n tmp.sort()\n tmp = ''.join(tmp)\n l.append(tmp)\n\nfrom collections import Counter\nc = Counter(l)\nnum = c.values()\n\nfrom math import factorial\ndef combinations_count(n, r):\n return factorial(n) // (factorial(n - r) * factorial...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s598530401', 's737380414', 's771030671']
[19760.0, 39436.0, 19760.0]
[774.0, 2105.0, 772.0]
[408, 275, 449]
p02947
u684180760
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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, M = map(int, input().split())\nA = [] \nB = [] \nfor i in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\nc = 0\nfor i in range(M):\n if A[i] + i < M:\n c = c + B[i]\n \n\n\n\nprint(c)\n\n', '# -*- coding: utf-8 -*-\n\nN = int(input())\n\n\nar = []\nfor ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s618821568', 's735191321', 's806894334', 's424379268']
[3060.0, 16996.0, 3060.0, 17000.0]
[17.0, 418.0, 17.0, 426.0]
[290, 403, 257, 408]
p02947
u685983477
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\ndef main4():\n dd = collections.defaultdict(int)\n n = int(input())\n res = 0\n for i in range(n):\n s = input()\n s.sort()\n dd[''.join(s)]+=1\n for i in dd.values():\n res += (i*(i-1))//2\n print(res)\n\nif __name__ == '__main__':\n main4()", "imp...
['Runtime Error', 'Accepted']
['s192533778', 's687802436']
[9296.0, 22464.0]
[26.0, 238.0]
[297, 303]
p02947
u686230543
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nwords = dict()\ncount = 0\nfor i in range(n):\n s = sorted(input())\n if s in words:\n count += words[s]\n words[s] += 1\n else:\n words[s] = 0\nprint(count)', "n = int(input())\nwords = dict()\ncount = 0\nfor i in range(n):\n s = ''.join(sorted(input()))\n if s in words:\n count +=...
['Runtime Error', 'Accepted']
['s129482427', 's876548438']
[3060.0, 17852.0]
[17.0, 388.0]
[177, 186]
p02947
u687929074
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nliss = {}\nfor i in range(N):\n s = input()\n a = sorted(s)\n if a in liss:\n liss[a] += 1\n else:\n liss[a] = 1\n\nans = 0\nfor cc in liss:\n ans = ans + (liss[cc] * (liss[cc] - 1) / 2)\nprint(int(ans))\n', 'import collections\nN = int(input())\nliss = {}\nfor i in range(N):\n s = input...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s005260745', 's172430914', 's281647250', 's321259800', 's393970353', 's430736493', 's563072011', 's566056490', 's633006835', 's635653045', 's667064277', 's965295022']
[3060.0, 3316.0, 3316.0, 9844.0, 3060.0, 4084.0, 9716.0, 4084.0, 9844.0, 9844.0, 3316.0, 17892.0]
[17.0, 20.0, 20.0, 2104.0, 17.0, 27.0, 2104.0, 22.0, 2104.0, 2104.0, 20.0, 389.0]
[220, 240, 240, 316, 220, 337, 314, 309, 306, 307, 321, 229]
p02947
u688319022
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nfor i in range(N):\n s[i] = input()\ni=0\nCo=[]\nwhile s != []:\n counter = 1\n a = s.pop(0)\n for word in s:\n if word == a:\n s.remove(word)\n counter+=1\n Co.append(counter)\nsummary = 0\nfor i in range(len(Co)):\n summary+=Co[i]*(Co[i]-1)//2\...
['Wrong Answer', 'Accepted']
['s626522588', 's380318048']
[12148.0, 25420.0]
[2104.0, 549.0]
[316, 278]
p02947
u690037900
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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=[sorted(input()) for _ in range(N)]\nY=[]\nfor i in range(len(L)):\n Y.append("".join(L[i]))\nprint(len(set(Y)))', 'import collections\nN=int(input())\ns=[str(sorted(input())) for i in range(N)]\nc=collections.Counter(s)\nprint(sum((v*(v-1))//2 for v in c.values()))']
['Wrong Answer', 'Accepted']
['s239899226', 's427110293']
[37580.0, 28720.0]
[365.0, 295.0]
[128, 146]
p02947
u692054751
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [sorted(input()) for _ in range(N)]\nS = sorted(S)\nprint(sum(map(lambda x: x*(x-1)//2, Counter(S).values())))\n', 'import string\n\ndef bwords(str):\n str = list(str)\n bword = [0]*len(string.ascii_lowercase)\n for s in str:\n \tbword[string.ascii_lowercase....
['Runtime Error', 'Wrong Answer', 'Accepted']
['s030295773', 's226329621', 's999889407']
[25808.0, 5160.0, 24560.0]
[485.0, 2104.0, 484.0]
[162, 780, 159]
p02947
u692453235
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = defaultdict(int)\n\nfor i in range(N):\n s = sorted(input())\n w = "".join(s)\n S[w] += 1\n\nprint(S)\nans = sum([(i*(i-1))//2 for i in list(S.values())])\n\nprint(ans)', 'N = int(input())\ncount = 0\nans = 0\nlis = [0]*N\n\nfor i in range(N):\n s = inp...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s268522599', 's423369858', 's041563822']
[22428.0, 6964.0, 18236.0]
[465.0, 384.0, 427.0]
[219, 269, 210]
p02947
u693007703
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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, math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ncnt = 0\n\nN = int(input())\nstring_counters = []\n\ncnt = dict()\nfor i in range(N):\n string = collections.Counter(input())\n if string not in string_counters:\n str...
['Runtime Error', 'Accepted']
['s990244220', 's015920933']
[10668.0, 17852.0]
[2104.0, 401.0]
[511, 190]
p02947
u693391925
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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)]\nans=0\ndp = list(range(N))\n\nfor i in range(N):\n for k in range(i+1,N):\n if dp[i] == dp[k]:\n ans += 1\n else:\n A=list(sorted(s[i]))\n for j in list(sorted(s[...
['Wrong Answer', 'Accepted']
['s121291377', 's404332033']
[14236.0, 31616.0]
[2104.0, 717.0]
[693, 560]
p02947
u693716675
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nbuf = []\nans = 0\n\nfor i in range(n):\n lists = [i for i in input().split()]\n lists.sort()\n s = "".join(lists)\n buf.append(s)\n \nbuf.sort()\nsame= 0\nsent= buf[0]\n\nfor i in range(1,n):\n if buf[i]==sent:\n same += 1\n else:\n sent = buf[i]\n ans += (same*(same+1))//2\n sam...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s591524760', 's803194460', 's937938343', 's369072643']
[10584.0, 10584.0, 10640.0, 10584.0]
[358.0, 307.0, 349.0, 428.0]
[347, 333, 347, 360]
p02947
u695655590
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nAns = 0\nN = int(input())\nS = []\nT = []\nU = []\nfor _ in range(N):\n S.append(str(input()))\nT = ['a'] * N \nU = ['a'] * N\n\nfor i in range(N):\n U[i] = ''.join(sorted(S[i]))\n\nT = sorted(U)\n\nj = 0\nwhile j < N:\n for k in range(1,N):\n if j + k == N - 1:\n if T[j] != T[j + k]:\n ...
['Wrong Answer', 'Accepted']
['s438167944', 's862027034']
[19292.0, 19296.0]
[474.0, 474.0]
[511, 544]
p02947
u697696097
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 tmp=list(input().strip()).sort()\n tmp="".join(tmp)\n s[tmp]=s.get(tmp,0)+1\n \nans=0\nfor key in s.keys():\n v=s[key]\n if v<2:\n continue\n cmb=v*(v-1)\n cmb=cmb//2\n ans+=cmb\nprint(ans)', 'n=int(input())\ndic={}\nfor i in range(n):\n tmp="".join(sorted(list(...
['Runtime Error', 'Accepted']
['s773719513', 's710117429']
[9096.0, 22160.0]
[24.0, 262.0]
[229, 201]
p02947
u704563784
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 count(data):\n dic = {}\n for d in data:\n if d in dic:\n dic[d] += 1\n else:\n dic[d] = 1\n return dic\n\nn = int(input())\ndata = []\nfor _ in range(n):\n s = input()\n data.append(count(s))\nans = 0\nfor i in range(n):\n for ii in range(i+1, n):\n if...
['Runtime Error', 'Accepted']
['s304590017', 's833924841']
[2940.0, 17848.0]
[17.0, 384.0]
[357, 374]
p02947
u706414019
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nN = int(input())\ndic_s = {}\nfor i in range(N):\n s = "".join(sorted(input()))\n if s in dic_s:\n dic_s[s] += 1\n else:\n dic_s[s] = 1\ncounter = 0\nfor key,value in dic_s...
['Runtime Error', 'Accepted']
['s709831410', 's930556023']
[22092.0, 22212.0]
[453.0, 449.0]
[372, 394]
p02947
u706929073
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\n\ndef is_anagram(s_i, s_j):\n for k in range(10):\n found = False\n for l in range(10):\n if s_i[k] == s_j[l]:\n found = True\n break\n if not found:\n return False\n return True\n\n\nnu...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s592760646', 's946772156', 's919394186']
[10268.0, 25420.0, 10988.0]
[992.0, 460.0, 473.0]
[497, 290, 450]
p02947
u707870100
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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#ABC137C\nimport copy\nimport sys\nimport math\n\nn = int(input())\n#tmp = input().split()\n#hoge = list(map(lambda a: int(a), tmp))\n#k=hoge[0]\n#x=hoge[1]\n\nlist = [[0 for i in range(26)] for j in range(n)]\n#list[0][1]=1\n#print(list)\n\nhash=[]\nfor i in range(0,26):\n\thash.append([])\n...
['Wrong Answer', 'Accepted']
['s721758840', 's593412491']
[45076.0, 18400.0]
[2106.0, 587.0]
[942, 491]
p02947
u711539583
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = input()\n k = set(list(s))\n if k in d:\n d[k] += 1\n else:\n d[k] = 1\nans = 0\nfor k in d:\n n = d[k]\n ans += n * (n - 1) / 2\nprint(ans)', 'n = int(input())\nd = {}\nfor _ in range(n):\n s = input()\n k = tuple(sorted(list(s)))\n if k in d:\n d[...
['Runtime Error', 'Accepted']
['s344280434', 's743320020']
[3064.0, 23652.0]
[18.0, 479.0]
[190, 202]
p02947
u718401738
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['iport numpy as np\nn=int(input())\nans=[]\nfor i in range(n):\n qw=input()\n ans.append(np.zeros(10))\n for j in range(10):\n ans[i][j]=qw[j]\n ans[i].sort()\n\nans.sort()\na=0\nfor i in range(n-1):\n for j in range(n-1-i):\n if ans[i]==ans[i+j+1]:\n a+=1\n else:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s676827545', 's935946495', 's521528228']
[2940.0, 12488.0, 35952.0]
[17.0, 149.0, 853.0]
[328, 329, 448]
p02947
u720384347
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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([sorted((input())) for i in range(N)])\ncount = 0\n\nfor i in range(N-1):\n num=0\n if(s[i]==s[i+1]): \n num += 1\n elif(num>0):\n count += num*(num-1)/2\n \nprint(count)', 'N = int(input())\ns = sorted([sorted((input())) for i in range(N)])\ncount = 0\n\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s054737339', 's405904433', 's466258156', 's551414338', 's703654328', 's835572515', 's981879897', 's493324038']
[25420.0, 25420.0, 11408.0, 24208.0, 25420.0, 11408.0, 25420.0, 11408.0]
[509.0, 506.0, 380.0, 340.0, 516.0, 389.0, 524.0, 388.0]
[222, 243, 272, 159, 245, 274, 243, 277]
p02947
u724844363
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['n = int(input())\nS = [str(input()) for _ in range(n)]\ncount = 0\nfor i in range(n):\n for j in range(n):\n if i == j or i > j: \n continue\n else:\n ana1 = []\n ana2 = []\n for k in range(10):\n ana1.append(S[i][k])\n ana2.ap...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s039121535', 's106085737', 's404827305', 's226107147']
[27036.0, 10268.0, 49180.0, 23436.0]
[2104.0, 2104.0, 2104.0, 379.0]
[542, 407, 444, 572]
p02947
u729300713
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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(list(input().strip()))))\nans = 0\ntmp = 0\nss = sorted(s)\nprev = \'\'\nfor iss in ss:\n if prev != iss:\n prev = iss\n ans += int((tmp*(tmp+1))/2)\n tmp = 0\n elif prev == iss:\n print("prev :{}, iss :{}".format(prev, iss))\n ...
['Wrong Answer', 'Accepted']
['s269888165', 's707229161']
[14392.0, 11380.0]
[501.0, 452.0]
[363, 365]
p02947
u729911693
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = []\nans = 0\n\nfor i in range(n):\n s.append(''.join(sorted(input())))\ns.sort()\nprint(s)\n\ncnt = 1\nfor j in range(0, n-1):\n if s[j] == s[j+1]:\n cnt += 1\n if j == n-2:\n ans += cnt*(cnt-1)/2\n else:\n ans += cnt*(cnt-1)/2\n cnt = 1\n \nprint(ans)", "n = int(input())\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s241812864', 's787285534', 's793991743']
[14604.0, 10640.0, 10640.0]
[439.0, 411.0, 417.0]
[278, 269, 274]
p02947
u732870425
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nss = []\ncnt = 0\nfor i in range(N):\n x = "".join(list(s[i]))\n if x in ss:\n cnt += ss.count(x)\n ss.append(x)\n\nprint(cnt)', 'from collections import Counter\n\nN = int(input())\nS = [input() for _ in range(N)]\n\nctr = Counter()\nans = 0\nfor s...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s010297673', 's268151183', 's284394311', 's502811042', 's539367638', 's486926669']
[11164.0, 19824.0, 17412.0, 19824.0, 19824.0, 24976.0]
[2105.0, 425.0, 2105.0, 405.0, 422.0, 351.0]
[184, 222, 258, 222, 222, 200]
p02947
u733608212
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 _ in range(n)]\nl = [sorted([j for j in i]) for i in l]\nl = ["".join(i) for i in l]\nal = list(set(l))\nans_dict = {}\nans = 0\nfor i in l:\n if i in ans_dict:\n ans += ans_dict[i]\n ans_dict[i]+=1\n else:\n ans_dict[i] = 1\n ans = 0\n\npr...
['Wrong Answer', 'Accepted']
['s683551570', 's734216580']
[31256.0, 31260.0]
[384.0, 393.0]
[310, 296]
p02947
u747309718
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 *\n \nn = int(input())\ndic = defaultdict(int)\nfor i in range(n):\n dic["".join(sorted(input()))] += 1\nprint(dic.items())\n \nans = 0\nfor k,v in dic.items(): \n print(v)\n ans += int(v*(v-1)/2)\n \nprint(ans)', 'from collections import *\n \nn = int(input())\ndic = defaultdict(int)\nfor...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s079951860', 's266992775', 's570959928']
[26656.0, 26656.0, 18236.0]
[602.0, 566.0, 448.0]
[244, 235, 214]
p02947
u747427153
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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(input()) for i in range(n)]\nl = ["".join(sorted(i)) for i in l]\nl.sort()\nm = [l.count(l[i]) - 1 for i in range(n)]\no = [i*(i-1)/2 for i in m]\nprint(sum(o))\n', 'import collections\nn = int(input())\ns = ["".join(sorted(input())) for i in range(n)]\nl = collections.Counter(s)\nans = su...
['Wrong Answer', 'Accepted']
['s339632966', 's732288127']
[31440.0, 19760.0]
[2105.0, 342.0]
[183, 165]
p02947
u747703115
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
["import sys\nfrom collections import Counter\n\nn, *S = sys.stdin.read().split()\nn = int(n)\n\ndef main():\n t = [''.join(sorted(t)) for t in s]\n c = Counter(t)\n cnt = 0\n for v in c.values():\n cnt += v*(v-1)\n print(cnt//2)\n\nmain()", "import sys\nfrom collections import Counter\n\nn, *S = ...
['Runtime Error', 'Accepted']
['s458236107', 's418293930']
[11456.0, 28296.0]
[31.0, 176.0]
[245, 245]
p02947
u750651325
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef X(): r...
['Wrong Answer', 'Accepted']
['s056788035', 's605865492']
[25032.0, 23592.0]
[255.0, 241.0]
[729, 716]
p02947
u751717561
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nfrom collections import Counter\na=Counter(S)\n\nans = 0\n\nfor i in a.values():\n if i>1:\n ans += i*(i-1)/2\n\nprint(ans)", "N = int(input())\nS = [''.join(sorted(list(input()))) for _ in range(N)]\n\nfrom collections import Count...
['Wrong Answer', 'Accepted']
['s167954895', 's357819230']
[19760.0, 19760.0]
[368.0, 365.0]
[197, 202]
p02947
u752694775
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nsl = []\nfor i in range(n):\n S = ''.join(sorted(input()))\n sl.append(S)\nprint(sl)\ncount = 0\ndict ={}\n\nfor s in sl:\n if s in dict:\n count += dict[s]\n dict[s] += 1\n else:\n dict[s] = 1\nprint(count)", "n,*sl, = map(lambda x:''.join(sorted(x)),open(0).read().split())\ncount = 0\...
['Wrong Answer', 'Accepted']
['s487490551', 's006121768']
[22172.0, 21128.0]
[377.0, 191.0]
[223, 188]
p02947
u756604554
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nstrings = {}\n\nfor _ in range(N):\n s = sorted(list(input()))\n join_s = ''.join(s)\n if join_s in strings:\n strings[join_s] += 1\n else:\n strings[join_s] = 0\n \nprint(strings)", "N = int(input())\n\nstrings = {}\n\nans = 0\n\nfor _ in range(N):\n s = sorted...
['Wrong Answer', 'Accepted']
['s650135734', 's603961258']
[20476.0, 17808.0]
[433.0, 421.0]
[221, 249]
p02947
u756829954
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\n\nl = [sorted(input()) for _ in range(n)]\ndellist = lambda items, indices: [item for idx, item in enumerate(items) if idx not in indices]\n\nwhile True:\n a = l.pop(0)\n li = []\n for i in range(len(l)):\n if l[i] == a:\n li.append(i)\n\n dellist(l, li)\n\n ...
['Runtime Error', 'Accepted']
['s209756498', 's237114753']
[28176.0, 19764.0]
[2109.0, 369.0]
[341, 182]
p02947
u758223800
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\na = [input() for i in range(n)]\n\nfor i in range(n):\n a[i] = ''.join(sorted(a[i]))\n\na = sorted(a)\n\nans = 0\nsum = 1\nfor i in range(n-1):\n if a[i] == a[i+1]:\n sum += 1\n else :\n ans += (sum*(sum-1))/2\n sum = 1\n\nans += (sum*(sum-1))/2\nprint(ans)", "n = int...
['Wrong Answer', 'Accepted']
['s042054503', 's306356802']
[11352.0, 11452.0]
[391.0, 367.0]
[288, 293]
p02947
u760794812
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nN=int(input())\ndic={}\nsum=0\nfor i in range(N):\n s=list(input())\n s.sort()\n s = "".join(s)\n if s in dic:\n sum+=dic[s]\n dic[s]+=1\n else:\n dic[s]=1\nprint(dic)', 'import sys\ninput = sys.stdin.readline\n\nN=int(input())\ndic={}\nsum...
['Wrong Answer', 'Accepted']
['s305503297', 's173451414']
[20980.0, 17804.0]
[258.0, 244.0]
[230, 230]
p02947
u761087127
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 _ in range(N)]\nc = 0\nfor i in range(N-1):\n for j in range(i+1, N):\n if s[i]==s[j]:\n print((i,j), s) \n c += 1\nprint(c)', 'N = int(input())\no = {}\nc = 0\nfor _ in range(N):\n k = "".join(sorted(input()))\n if k not in o:\n o[k] = 0\n els...
['Wrong Answer', 'Accepted']
['s263545073', 's006101072']
[135860.0, 17848.0]
[2105.0, 388.0]
[174, 172]
p02947
u762420987
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nc = Counter([sorted(input()) for _ in range(N)])\nprint(sum([(v*(v+1))//2 for v in c.values()]))', 'from collections import Counter\nN = int(input())\nc = Counter([tuple(sorted(input())) for _ in range(N)])\nprint(sum([(v*(v-1))//2 for v in c.values()]))']
['Runtime Error', 'Accepted']
['s419667462', 's029348218']
[24596.0, 26352.0]
[324.0, 382.0]
[144, 151]
p02947
u762469320
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [input() for i in range(n)]\ns = map(list,s)\nlst = []\nfor i in s:\n i.sort()\n lst.append(''.join(i))\nans = collections.Counter(lst)\nctr = 0\nfor v in ans.items():\n if v != 1:\n ctr += v\nprint(ctr)", "import collections\n\nn = int(input())\ns = [input() for i in...
['Runtime Error', 'Accepted']
['s857766648', 's900368172']
[20296.0, 20204.0]
[290.0, 307.0]
[239, 272]
p02947
u764569828
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['I0 = lambda :map(int,input().split())\nI1 = lambda :int(input())\nI2 = lambda :list(map(int,input().split()))\n#####################################################\nfrom collections import defaultdict\nn = I1()\nd = defaultdict(int)\nfor i in range(n):\n d[sorted(input())]+=1\nres=0\nfor i in d.keys():\n if d[...
['Runtime Error', 'Accepted']
['s801103180', 's276950610']
[3316.0, 18224.0]
[21.0, 417.0]
[370, 379]
p02947
u764956288
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = int(input())\n\n word_dict = dict()\n count = 0\n\n for i in range(N):\n word = sorted(input())\n if word not in word_dict:\n word_dict[word] = 1\n else:\n count += 1\n\n print(count)\n \nif __name__ == '__main__':\n C()\n", "def C():\n ...
['Runtime Error', 'Accepted']
['s661340045', 's086941660']
[3056.0, 17848.0]
[17.0, 375.0]
[284, 343]
p02947
u765865533
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nans=0\nN = int(input())\nA=[]\nfor i In range(N):\n x=collections.Counter(list(input()))\n for s in A:\n if x==s:\n ans+=1\n else:\n A.append(x)\nprint(ans)', 'N = int(input())\ndic = {}\nans = 0\nfor i in range(N):\n tmp = "".join(sorted(input()))\n ...
['Runtime Error', 'Accepted']
['s529972789', 's979620865']
[2940.0, 17852.0]
[17.0, 391.0]
[207, 197]
p02947
u768135953
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nmap = {}\nfor i in range(n):\n str = ''.join(sorted(input()))\n print(str)\n if str in map:\n map[str] += 1\n else:\n map[str] = 1\n\nans = 0\nfor value in map.values():\n ans += value * (value - 1) // 2\n\nprint(ans)", "n = int(input())\nmap = {}\nfor i in range(n):\n str = ''.join(sort...
['Wrong Answer', 'Accepted']
['s480406147', 's660915709']
[18748.0, 17852.0]
[900.0, 384.0]
[232, 219]
p02947
u771167374
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
["n = int(input())\nl = []\nfor i in range(n):\n s = ''.format(sorted(input()))\n l.append(s)\n print(s)\nans = 0\nfor j in range(n-1):\n if l[j] == l[j+1]:\n ans += 1\nprint(ans)", 'from collections import Counter\nn = int(input())\nl = ["".join(sorted(input())) for _ in range(n)]\nlcnt = Counter(l)...
['Wrong Answer', 'Accepted']
['s054122399', 's245068373']
[4000.0, 23340.0]
[828.0, 396.0]
[186, 223]
p02947
u772588522
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [x for x in [Counter(list(input()[:-1])) for _ in range(n)]]\n\n\nalphabet = set('abcdefghijklmnopqrstuvwxyz')\ns_list = [''.join([str(s_i[a]) for a in alphabet]) for s_i in s]\n\nfor x in s_list:\n print(x)\n\ncount = 0\ni = 0\n\nfor x in s_list:\n i += 1\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s221213594', 's363223405', 's848172534']
[68760.0, 68760.0, 24980.0]
[2108.0, 2108.0, 361.0]
[396, 391, 282]
p02947
u773686010
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nShop_List=[]\nfor i in range(N):\n Temp_List=list(input().split())\n Temp_List[1]=int(Temp_List[1])\n Temp_List.append(i+1)\n Shop_List.append(Temp_List)\n\n\nShop_List_Sorted = sorted(Shop_List, key=lambda x:(x[0], -x[1]))\nfor k in range(N):\n print(Shop_List_Sorted[k][2])\n', "##...
['Runtime Error', 'Accepted']
['s873114104', 's531567452']
[9200.0, 19756.0]
[21.0, 351.0]
[360, 369]
p02947
u774729733
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['n = int(input())\nl = [input() for i in range(n)]\n\nmylist = []\nfor s in l:\n s_list = [ c for c in s]\n mylist.append("".join(sorted(s_list)))\n\nans=0\nfor i in range(len(mylist)):\n print(mylist)\n ans += mylist.count(mylist[0]) - 1\n del mylist[0]\n\nprint(ans)', "n = int(input())\ni = 0\nsortedS...
['Runtime Error', 'Accepted']
['s914752070', 's318986060']
[152448.0, 17852.0]
[1478.0, 424.0]
[268, 280]
p02947
u778204640
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = {}\nfor i in range(n):\n s = ''.join(sorted(list(input())))\n if s not in dic:\n dic[s] = 0\n dic[s] += 1\nans = 0\nfor i in dic.values():\n ans += i * (i - 1)\nprint(ans)", 'n = int(input())\ndic = {}\nfor i in range(n):\n s = list(input()).sorted()\n if s not in dic:\n dic[s] = 0...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s328150767', 's765031309', 's789497794', 's576338549']
[17808.0, 3060.0, 3060.0, 17808.0]
[440.0, 18.0, 18.0, 441.0]
[192, 184, 183, 197]
p02947
u781379878
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\ts.append("".joint(sorted([a for a in input()])))\npair = 0\nfor i in range(N-1):\n\tfor j in range(i+1, N):\n\t\tif s[i] == s[j]:\n\t\t\tpair += 1\nprint(pair)', 'def main():\n\tN = int(input())\n\ts = {}\n\tpair = 0\n\tfor _ in range(N):\n\t\tb = "".join(sorted([a for ...
['Runtime Error', 'Accepted']
['s400776077', 's321874474']
[3060.0, 17852.0]
[18.0, 465.0]
[191, 200]
p02947
u782098901
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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(["".join(sorted(input())) for _ in range(N)])\n\nres = 0\nns = S[0]\nc = 1\nfor i in range(1, N):\n if S[i] == ns:\n c += c\n else:\n res += c\n c = 1\n ns = S[i]\n\nif c != 1:\n res += c\n\nprint(res)\n', 'from collections import defaultdict\n\nN = in...
['Wrong Answer', 'Accepted']
['s367655188', 's198968689']
[11408.0, 19760.0]
[540.0, 371.0]
[251, 234]
p02947
u782930273
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 sys\ninput = sys.stdin.readline\n\nN = int(input())\nS = ["".join(sorted(input()[:-1])) for _ in range(N)]\nc = Counter(S)\nprint(c)\nprint(sum([k*(k-1)//2 for k in c.values()]))', 'from collections import Counter\n\nN = int(input())\nS = ["".join(sorted(input())) for _ in rang...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s234408526', 's244677106', 's291932609', 's358932992', 's656740806', 's015314175']
[31148.0, 31176.0, 19816.0, 10176.0, 31124.0, 19752.0]
[281.0, 426.0, 176.0, 190.0, 423.0, 336.0]
[210, 167, 141, 164, 172, 158]
p02947
u783459736
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nn = int(input())\ns = [input() for i in range(n)]\n\nans = 0\nd = {}\nfor i in s:\n a = [c for c in i]\n a.sort()\n print(a)\n a = "".join(a)\n if a in d:\n ans+= d[a]\n d[a] +=1\n else:\n d[a] = 1\nprint(ans)\n', 'import sys\nn = int(input())\ns = [input() for i in ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s115962488', 's865481309', 's605433239']
[29388.0, 29392.0, 24976.0]
[566.0, 656.0, 341.0]
[245, 265, 232]
p02947
u785795721
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['n = int(input())\nS = ["".join(sorted(input())) for _ in range(n)]\nd = []\nfor i in S:\n d.setdefault(i, 0)\n d[i] += 1\nans = 0\nfor value in d.values:\n ans = value * (value) / 2\nprint(ans)', "n = int(input())\nS = [''.join(sorted(input())) for _ in range(n)]\nd = {}\nfor i in S:\n d.setdefault(i, 0)\n d...
['Runtime Error', 'Accepted']
['s371060935', 's796915005']
[10208.0, 19400.0]
[309.0, 355.0]
[187, 201]
p02947
u787456042
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 as C\nfrom scipy.misc import comb\nn=int(input());s=[input() for _ in range(n)]\nprint(int(sum(map(lambda x:comb(x,2),C(tuple(sorted(C(i).most_common(),key=lambda x:x[0]))for i in s).values()))))', 'from collections import Counter as C\nn,*s=open(0)\nprint(sum(x*(x-1)//2 for x in C(tup...
['Wrong Answer', 'Accepted']
['s971804687', 's708444749']
[91900.0, 31080.0]
[2113.0, 250.0]
[224, 128]
p02947
u788703383
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [input() for _ in range(N)]\nS = ["".join(sorted(input())) for _ in range(N)]\n\nans = 0\nfor i in range(N):\n for j in range(i+1,N):\n if S[i] == S[j]:\n ans += 1\n S.pop(j)\n break\nprint(ans)', 'N = int(input())\nS = ["".join(sorted(input())) for _...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s289270249', 's498492450', 's675632407', 's183418770']
[10208.0, 19404.0, 10208.0, 19528.0]
[2104.0, 358.0, 1095.0, 368.0]
[249, 224, 263, 231]
p02947
u789565565
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 i in range(n)]\nprint(s)\nc = Counter(s)\nprint(c)\nl = sum((v*(v-1)/2) for v in c.values())\nprint(l)', 'from collections import Counter\nn = int(input())\ns = [str(sorted(input())) for i in range(n)]\n\nc = Counter(s)\n\nl = sum((v*(v-...
['Wrong Answer', 'Accepted']
['s905711983', 's040275580']
[50444.0, 24532.0]
[638.0, 484.0]
[176, 165]
p02947
u794438087
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 collections\n\nn=int(input())\na=[''.join(sorted(input())) for _ in range(n)]\n \nprint(a)\n\nans = 0\nfor v in collections.Counter(a).values():\n if v != 1:\n ans += v - 1\nprint(ans)", "import sys\n\na = []\nfor l in sys.stdin:\n if l == '\\n':\n break\n else :\n a.a...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s066921643', 's151972782', 's202748096', 's360115203', 's597956040', 's622946330', 's686110141', 's913695299', 's046968635']
[22532.0, 11040.0, 2940.0, 10276.0, 10276.0, 13340.0, 22816.0, 23456.0, 19752.0]
[343.0, 654.0, 17.0, 53.0, 48.0, 522.0, 1201.0, 2108.0, 356.0]
[201, 487, 458, 486, 550, 479, 528, 509, 210]
p02947
u794753968
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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(sorted(["".join(sorted(input())) for _ in range(N)]))\ns_set = set(s)\n\nprint(len(s) - len(set(s)) + sum(range(1, len(set(s)))))', 'N = int(input())\ns = ["".join(sorted(input())) for _ in range(N)]\n\nmp = {}\nfor c in s:\n if c in mp:\n mp[c] += 1\n else:\n mp[c] = 1\...
['Wrong Answer', 'Accepted']
['s473291851', 's467501949']
[21088.0, 19404.0]
[410.0, 398.0]
[152, 230]
p02947
u794910686
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 d=input()\n print(d)\n a.append("".join(sorted(d)))\n#print(a)\n\ncount=0\nfor i in range(n):\n temp=a.pop()\n count+=a.count(temp)\nprint(count)', 'from collections import Counter\nn=int(input())\nd=Counter()\nans=0\nfor i in range(n):\n t=str("".join(sort...
['Wrong Answer', 'Accepted']
['s628651870', 's138482031']
[11296.0, 18236.0]
[2108.0, 524.0]
[191, 175]
p02947
u796842765
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [sorted(input()) for i in range(N)]\nSS = []\nfor i in S:\n SS.append("".join(i))\ncount = 0\n\nc = collections.Counter(SS)\n\nfor i in c.values():\n A = SS.count(i)\n count += (A*(A-1)) // 2\n\nprint(count)', 'import collections\nN = int(input())\nS = [sorted(input(...
['Wrong Answer', 'Accepted']
['s459269576', 's776731485']
[45616.0, 45600.0]
[2207.0, 263.0]
[244, 224]
p02947
u796942881
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\n# from scipy.special import comb\nfrom scipy.misc import comb\n\n\ndef main():\n s = Counter(["".join(sorted(i)) for i in open(0).read().split()[1:]])\n ans = 0\n for v in s.values():\n ans += comb(v, 2)\n print(int(ans))\n return\n\n\nmain()\n', 'def main():...
['Wrong Answer', 'Accepted']
['s465166192', 's793452647']
[31992.0, 21000.0]
[2109.0, 171.0]
[383, 251]
p02947
u801049006
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [''.join(sorted(input())) for _ in range(N)]\n\nprint(Counter(s).values())\nans = 0\nfor i in Counter(s).values():\n ans += i * (i-1) // 2\n\nprint(ans)\n", "from collections import Counter\n\nN = int(input())\ns = [''.join(sorted(input())) for _ in range(N)...
['Wrong Answer', 'Accepted']
['s602864028', 's640593307']
[23052.0, 19760.0]
[374.0, 344.0]
[203, 176]
p02947
u801106491
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nN=int(input())\n\nD={}\nans=0\nfor i in range(N):\n s =".".join(sorted(input()))\n if s in D.keys():\n D[s]+=1\n ans+=D[s]\n else:\n D[s]=1\n\nprint(ans)', 'import sys\ninput=sys.stdin.readline\n\nN=int(input())\n\nD={}\nans=0\nfor i in range(N):\n...
['Wrong Answer', 'Accepted']
['s776902774', 's476175050']
[18528.0, 18528.0]
[264.0, 262.0]
[208, 210]
p02947
u802627598
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 i in range(n):\n tmp = []\n tmp = list(input())\n tmp.sort()\n s.append("".join(tmp))\n\ns.sort()\ncnt = 0\nkey = s[0]\nflag = 0\nfor i in range(n-1):\n if key == s[i] and s[i] == s[i+1]:\n cnt += 1\n flag = 1\n elif s[i] != s[i+1]:\n if flag == 1...
['Wrong Answer', 'Accepted']
['s432454360', 's432691023']
[10664.0, 19756.0]
[459.0, 336.0]
[406, 170]
p02947
u802673431
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nfor _ in range(n):\n word = ''.join(sort(list(input())))\n word_l.append(word)\n \nword_counter = Counter(word_l)\nprint('{}'.format(sum(word_counter.values()) - n)\n", "from collections import Counter\nn = int(input())\nword_l = list()\nfor _ in range(n):\n word...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s003570376', 's359152220', 's548983093', 's609374623', 's750618003', 's840659085', 's459961209']
[2940.0, 2940.0, 2940.0, 3316.0, 3316.0, 2940.0, 19728.0]
[17.0, 17.0, 19.0, 21.0, 20.0, 17.0, 406.0]
[212, 228, 200, 228, 228, 229, 256]
p02947
u806855121
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 collections import defaultdict\nimport math\n\ndef combination(n, r):\n return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))\n\nN = int(input())\nL = defaultdict(int)\nans = 0\nfor _ in range(N):\n s = sorted(list(input()))\n L[s] += 1\n\nfor c in L.item...
['Runtime Error', 'Runtime Error', 'Accepted']
['s001681197', 's052121733', 's410613208']
[3316.0, 3316.0, 22364.0]
[21.0, 20.0, 967.0]
[348, 345, 340]
p02947
u807772568
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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,collections as cl,bisect as bs\nsys.setrecursionlimit(100000)\nmod = 10**9+7\nMax = sys.maxsize\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 ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s169450227', 's208518119', 's470358705', 's822475957', 's091982845']
[34756.0, 46616.0, 46656.0, 46652.0, 34756.0]
[740.0, 741.0, 769.0, 761.0, 588.0]
[1431, 1426, 1372, 1384, 1456]
p02947
u807864121
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = {}\nfor i in range(N):\n s = ''.join(sorted(input()))\n if s not in S.keys():\n S[s] = 0\n continue\n print(S)\n S[s] += 1\n ans += S[s]\nprint(ans)\n", "N = int(input())\nans = 0\nS = {}\nfor i in range(N):\n s = ''.join(sorted(input()))\n if s not in...
['Runtime Error', 'Accepted']
['s017872371', 's476234573']
[139772.0, 17852.0]
[2104.0, 398.0]
[198, 185]
p02947
u809457879
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['n = int(input())\nl = [input() for i in range(n)]\n\nfrom collections import Counter\nans = 0\nfor w1,w2 in l:\n if Counter(w1) == Counter(w2):\n ans += 1\nprint(ans)', "N=int(input())\nl=[]\nfrom collections import Counter\nfor i in range(N):\n l.append(''.join(sorted(input())))\nl1=Counter(l).values()\nfrom ma...
['Runtime Error', 'Accepted']
['s129542323', 's388047986']
[10524.0, 19784.0]
[143.0, 754.0]
[162, 257]
p02947
u812576525
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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(str(input())) for _ in range(N)]\n\nB = []\nfor i in range(N):\n s = ''.join(S[i])\n print(s)\n B.append(s)\n\n\nans = 0\nfor i in range(N-1):\n for j in range(i+1,N):\n if B[i] == B[j]:\n ans += 1\nprint(ans)", 'from collections import Counter\nN = int(inpu...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s645139685', 's691883216', 's962094102', 's581082903']
[32512.0, 85336.0, 83336.0, 44196.0]
[2106.0, 2109.0, 2109.0, 473.0]
[263, 324, 320, 293]
p02947
u815878613
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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\nimport sys\n\nfrom scipy.misc import comb\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\n\n\ndef main():\n N = int(readline())\n S = read().split()\n S = list(map(lambda x: sorted(x.decode('UTF-8')), S))\n\n A = defaultdict(int)\n for i in ra...
['Time Limit Exceeded', 'Accepted']
['s907739639', 's290183576']
[51140.0, 41220.0]
[2115.0, 263.0]
[456, 426]
p02947
u819048695
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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(0,N):\n a = input()\n s.append(sorted(a))\nt = 0\nwhile len(s)>0:\n a = s.count(s[0])\n if a==1:\n continue\n else:\n a = (a*(a-1))/2\n t = t+a\n s.remove(s[0])\nprint(t)', 'N = int(input())\ns = []\nfor i in range(0,N):\n a = input()\...
['Time Limit Exceeded', 'Accepted']
['s327732348', 's980188648']
[26228.0, 25392.0]
[2105.0, 592.0]
[236, 273]
p02947
u820357030
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
["N = int(input())\nS = [input() for i in range(N)]\n\nd = {}\n\nS_trans = [''.join(sorted(list(s))) for s in S]\n\ncount = 0\nfor s in S_trans:\n if s in d:\n d[s] += 1\n else:\n d[s] = 1\n count += d[s]\n\nprint(count)", 'N = int(input())\nS = [input() for i in range(N)]\n\nfrom collections import defaultdic...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s383267035', 's683595947', 's994014058', 's687007233']
[26516.0, 158028.0, 29412.0, 26640.0]
[342.0, 1520.0, 332.0, 313.0]
[212, 465, 244, 210]
p02947
u829479414
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = 0\nscounts = []\nN = int(input())\nfor n in range(N):\n s = sorted(input())\n found = False\n index = -1\n for i in range(len(scounts)):\n if scounts[i][0] == s:\n found = True\n count += scounts[i][1]\n scounts[i][1] += 1\n break\n elif sc...
['Runtime Error', 'Accepted']
['s269849497', 's649504205']
[3064.0, 25548.0]
[17.0, 550.0]
[655, 450]
p02947
u829908012
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nb=[]\nx=0\nt=1\nfor i in range(N):\n\n a=list(input())\n\n a.sort(reverse=False)\n\n b.append(a)\n\n\nwhile True:\n\n if len(b)==1:\n break\n\n q=b[0]\n\n if q==b[t]:\n\n x+=1\n\n \n\n if t==len(b)-1:\n\n del b[0]\n t=0\n\n t+=1\n', 'N=int(input()...
['Wrong Answer', 'Accepted']
['s499481127', 's333253920']
[26256.0, 24652.0]
[2105.0, 632.0]
[269, 297]
p02947
u831311378
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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' for i in range(10)] for j in range(n)]\nfor i in range(n):\n s[i]=list(input())\n s[i].sort()\nj=0\ntans=1\nf = 1\nans=0\ndonei=[]\nfor i in range(n):\n if not i in donei:\n j=n-1\n while j>i:\n if s[i]==s[j]:\n tans = tans + 1\...
['Runtime Error', 'Accepted']
['s023976475', 's654499021']
[28596.0, 10764.0]
[2105.0, 399.0]
[464, 299]
p02947
u836737505
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\nb = []\nfor i in range(n):\n a = "".join(sorted(input()))\n b.append(a)\nc = Counter(b).values()\nans = 0\nfor j in c:\n ans += int((i-1)*i/2)\nprint(ans)', "from collections import Counter\nn = int(input())\ns = Counter([''.join(sorted(input())) for _ in ra...
['Wrong Answer', 'Accepted']
['s430653692', 's489732174']
[19764.0, 19764.0]
[386.0, 342.0]
[204, 161]
p02947
u837342248
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 math\n\nn = int(input())\ns = [input() for _ in range(n)]\nans = 0\nwhile len(s) > 0:\n count = 1\n si = Counter([x for x in s[0]])\n j = 1\n while j < len(s):\n if si == Counter([x for x in s[j]]):\n count += 1\n s.pop(j)\n else:...
['Runtime Error', 'Accepted']
['s655532036', 's401823558']
[12660.0, 39040.0]
[2104.0, 427.0]
[414, 228]
p02947
u839188633
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [Counter(input()) for _ in range(n)]\n\nprint(s)\nans = 0\nfor i in range(n):\n for j in range(i + 1, n):\n if s[i] == s[j]:\n ans += 1\n\nprint(ans)\n', 'from collections import Counter\n\nn = int(input())\ns = [list(input()) for _ in rang...
['Wrong Answer', 'Accepted']
['s042234015', 's687495007']
[77168.0, 30740.0]
[2107.0, 362.0]
[216, 236]
p02947
u842388336
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\ncheck = {}\nlst = []\n\nfor _ in range(n):\n s = list(input())\n s.sort()\n s = "".join(s)\n lst.append(s)\n try:\n check[s]+=1\n else:\n check.update({s:1})\n \ncnt=0\ncheck_set = set(lst)\nfor c in check_set:\n temp_cnt = check[c]\n cnt += temp_cnt*(temp_cnt-1)/2\nprint(int(cnt))',...
['Runtime Error', 'Accepted']
['s577311693', 's476068927']
[2940.0, 23068.0]
[17.0, 534.0]
[297, 299]
p02947
u842651507
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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={}\n\nfor i in range(n):\n a=input()\n newa="".join(sorted(a))\n dict[newa]=dict.get(newa,0)+1\n\nans=0\n\nfor i in dict:\n ans+=dict[i]*(dict[i]-1)/2\n\nprint(ans)', 'n=int(input())\ndict={}\n\nfor i in range(n):\n a=input()\n newa="".join(sorted(a))\n dict[newa]=dict.get(newa,0)+1\n\nans...
['Wrong Answer', 'Accepted']
['s506202602', 's999722699']
[17892.0, 17892.0]
[408.0, 400.0]
[176, 182]
p02947
u842964692
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['#ABC137_C\nN=int(input())\nans=[]\ncnt=0\nfor _ in range(N):\n str_list=input()\n dic={}\n for i in range(10):\n if str_list[i] in dic:\n dic[str_list[i]]+=1\n else:\n dic[str_list[i]]=1\n ans.append(dic)\nwhile len(ans)>1: \n cnt+=temp=ans.count(ans.pop(0))\nprint(c...
['Runtime Error', 'Accepted']
['s347819090', 's928609365']
[2940.0, 25328.0]
[17.0, 416.0]
[307, 213]
p02947
u844123804
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\ntmp = []\nfor i in range(num):\n tmp.append(sorted(input()))\n\ntmp = sorted(tmp)\nans = 1\nfor i in range(len(tmp)-1):\n if tmp[i] == tmp[i+1]: ans += 1\n else:\n if ans>1: pass\n else: ans = 1\nif ans==1: ans=0\nprint(ans)', 'num = int(input())\ntmp = {}\nfor i in range(num):\n if i in...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s044343956', 's902514313', 's552916203']
[25420.0, 3060.0, 17848.0]
[527.0, 17.0, 377.0]
[240, 136, 244]
p02947
u849034889
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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())\ns = [input() for _ in range(N)]\n\nword = {}\ncnt = 0\nfor i in s:\n i = sorted(i)\n time = word.get(i, 0)\n cnt += time\n word[i] = time + 1\nprint(cnt)\n', 'import collections\nn = int(input())\nl = list(str(input()) for _ in range(n))\n# d = [{} for _ in range(n)]\n#\n# for m, a in ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s215238719', 's707537743', 's856067469', 's012216324']
[10268.0, 31592.0, 2940.0, 24976.0]
[145.0, 2104.0, 17.0, 324.0]
[175, 728, 130, 181]
p02947
u852367841
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
['n=int(input())\ns = [input() for i in range(n)]\n\nprint(s)\nfor i in range(n):\n s[i] = sorted(s[i])\n\ncount_list = []\nfor _s in s:\n count_list.append(s.count(_s))\n\ncount_count_list = []\nfor i in range(1,11):\n count_count_list.append(int(count_list.count(i)/i)) \n\nprint(count_count_list)\n\nans = 0\...
['Wrong Answer', 'Accepted']
['s639393438', 's268373212']
[27624.0, 28520.0]
[2105.0, 1442.0]
[434, 529]
p02947
u852386636
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when 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 = [str(sorted(input())) for _ in range(N)]\n\nC = Counter(S)\nans = 0\nfor v in C.values():\n ans += v * (v - 1) // 2\nprint(ans)']
['Wrong Answer', 'Accepted']
['s451914881', 's548606172']
[2940.0, 24560.0]
[17.0, 495.0]
[1, 178]
p02947
u854690176
2,000
1,048,576
We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots,...
["N = int(input())\nl = [input() for i in range(N)]\nmydict = {}\ncount = 0\nvalue = 1\nfor i in range(N):\n l[i] = ''.join(sorted(l[i]))\n if l[i] in mydict.keys():\n count += 1\n else:\n mydict[l[i]] = value\n value += 1\nprint(count)\nprint(mydict)", "N = int(input())\nl = [input() for ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s430114840', 's981714070', 's283717979']
[27536.0, 10268.0, 23056.0]
[374.0, 278.0, 351.0]
[266, 124, 318]