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
p03424
u839873388
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['S = list(input().split())\nc = "kara"\nif S == "Y":\n\tc = "Four"\nelse :\n\tc = "Three"\n\t\nprint(c)', 'n = int(input())\nS = list(input().split())\nc = "kara"\nfor i in range(n):\n\tif S[i] == "Y":\n\t\tc = "Four"\n\telse :\n\t\tc = "Three"\n\t\nprint(c)', 'n = int(input())\nS = list(input().split())\nc = "Three"\nfor i in range(n):\n\tif S[i] == "Y":\n\t\tc = "Four"\n\nprint(c)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s176389082', 's548394155', 's020004580']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[92, 135, 113]
p03424
u842118372
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n=input()\ns={str(x) for x in input().split()}\nprint(len(s))', 'n=input()\ns={str(x) for x in input().split()}\nif len(s) == 4:\n print("Four")\nelse:\n print("Three")']
['Wrong Answer', 'Accepted']
['s981261545', 's093501130']
[2940.0, 2940.0]
[17.0, 17.0]
[59, 104]
p03424
u845427284
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n = int(input())\ns = list(map(int, input().split()))\nprint("Four" if "Y" in s else "Three")', 'n = int(input())\ns = list(input().split())\nprint("Four" if "Y" in s else "Three")']
['Runtime Error', 'Accepted']
['s086269831', 's927736375']
[2940.0, 2940.0]
[17.0, 20.0]
[91, 81]
p03424
u856555908
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['x = input().split(" ")\nt = True\nfor i in x:\n if i == \'Y\':\n t = False\n\nif t:\n print("Three")\nelse:\n print("Four")', 'x = input().split(" ")\nt = True\nfor i in x:\n if i == \'Y\':\n t = False\n continue\n\nif t:\n print("Three")\nelse:\n print("Four")', 'y = input()\nx = input().split(" ")\nt = True\nfor i in x:\n if i == \'Y\':\n t = False\n continue\n\nif t:\n print("Three")\nelse:\n print("Four")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s424480473', 's898974839', 's274540697']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 19.0]
[128, 145, 157]
p03424
u870286225
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["# -*- coding: utf-8 -*-\n\nN = input()\n\nS = raw_input().split()\n\nif 'Y' in S:\n\tprint('Four')\nelse:\n\tprint('Three')", '# -*- coding: utf-8 -*-\n\nN = input()\n\nS = raw_input().split()\n\nif "Y" in S:\n\tprint(\'Four\')\nelse:\n\tprint(\'Three\')', '# -*- coding: utf-8 -*-\n\nN = input()\n\nS = input().split()\n\nif "Y" in S:\n\tprint(\'Four\')\nelse:\n\tprint(\'Three\')']
['Runtime Error', 'Runtime Error', 'Accepted']
['s921820664', 's925061858', 's122204821']
[2940.0, 2940.0, 2940.0]
[19.0, 17.0, 17.0]
[175, 175, 171]
p03424
u870518235
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N = int(input())\nS = list(map(int, input().split()))\n\nif "Y" in S:\n print("Four")\nelse:\n print("Three")\n', 'N = int(input())\nS = list(map(str, input().split()))\n\nif "Y" in S:\n print("Four")\nelse:\n print("Three")\n']
['Runtime Error', 'Accepted']
['s702937056', 's140428428']
[9028.0, 9064.0]
[25.0, 26.0]
[110, 110]
p03424
u874333466
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N = int(input())\nS = list(map(str, input().split()))\n\ncolor = []\n\nfor i in S:\n if i in color:\n pass\n else:\n color.append(i)\n \nprint(len(color))', "N = int(input())\nS = list(map(str, input().split()))\n\ncolor = []\n\nfor i in S:\n if i in color:\n pass\n else:\n color.append(i)\n \nif len(color) == 4:\n print('Four')\nelse:\n print('Three')\n\n"]
['Wrong Answer', 'Accepted']
['s448503042', 's021279097']
[9072.0, 9016.0]
[28.0, 27.0]
[154, 197]
p03424
u879870653
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N = int(input())\nS = list(map(int,input().split()))\np = S.count("P")\nw = S.count("W")\ng = S.count("G")\ny = S>count("Y")\nans = p+w+g+y\nif ans == 3 :\n print("Three")\nelse :\n print("Four")\n ', 'N = int(input())\nS = list(map(str,input().split()))\np = S.count("P")\nw = S.count("W")\ng = S.count("G")\ny = S>count("Y")\nans = p+w+g+y\nif ans == 3 :\n print("Three")\nelse :\n print("Four")\n ', 'N = int(input())\nS = list(map(str,input().split()))\nS = list(set(S))\np = S.count("P")\nw = S.count("W")\ng = S.count("G")\ny = S.count("Y")\nans = p+w+g+y\nif ans == 3 :\n print("Three")\nelse :\n print("Four")\n ']
['Runtime Error', 'Runtime Error', 'Accepted']
['s501600363', 's569365379', 's954734945']
[3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[196, 196, 213]
p03424
u883792993
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["N=int(input())\nS=list(map(int,input().split()))\nbucket=[]\nfor i in range(N):\n if S[i]=='P':\n bucket[0]+=1\n elif S[i]=='W':\n bucket[1]+=1\n elif S[i]=='G':\n bucket[2]+=1\n else:\n bucket[3]+=1\nif 4 - bucket.count(0)==3:\n print('Three')\nelse:\n print('Four')", "N=int(input())\nS=list(map(str,input().split()))\nbucket=[0*i for i in range(4)]\nfor i in range(N):\n if S[i]=='P':\n bucket[0]+=1\n elif S[i]=='W':\n bucket[1]+=1\n elif S[i]=='G':\n bucket[2]+=1\n else:\n bucket[3]+=1\nif 4 - bucket.count(0)==3:\n print('Three')\nelse:\n print('Four')"]
['Runtime Error', 'Accepted']
['s972563215', 's531580642']
[3060.0, 3064.0]
[18.0, 18.0]
[298, 319]
p03424
u893063840
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n = int(input())\ns = list(map(int, input().split()))\n\nprint("Four" if "Y" in s else "Three")\n', 'n = int(input())\ns = list(input().split())\n\nprint("Four" if "Y" in s else "Three")\n']
['Runtime Error', 'Accepted']
['s597514940', 's510482055']
[2940.0, 2940.0]
[17.0, 17.0]
[93, 83]
p03424
u898058223
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n=int(input())\na=list(map(int,input().split()))\nif len(set(a))==3:\n print("Three")\nelse:\n print("Four")', 'n=int(input())\na=list(input().split())\nif len(set(a))==3:\n print("Three")\nelse:\n print("Four")']
['Runtime Error', 'Accepted']
['s927995920', 's858608043']
[9088.0, 8916.0]
[27.0, 29.0]
[105, 96]
p03424
u903005414
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["N = int(input())\nA = list(map(int, input().split()))\nfor a in A:\n if a == 'Y':\n print('Four')\n exit()\nprint('Three')", "N = int(input())\nA = input().split()\nfor a in A:\n if a == 'Y':\n print('Four')\n exit()\nprint('Three')\n"]
['Runtime Error', 'Accepted']
['s034683727', 's379380604']
[2940.0, 2940.0]
[17.0, 17.0]
[123, 108]
p03424
u905582793
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n=int(input())\nh=list(map(input().split()))\nif len(list(set(h)))==3:\n print("Three")\nelse:\n print("Four")\n', 'n=int(input())\nh=list(map(int,input().split()))\nif len(list(set(h)))==3:\n print("Three")\nelse:\n print("Four")', 'n=int(input())\nh=list(input().split())\nif len(list(set(h)))==3:\n print("Three")\nelse:\n print("Four")\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s536801223', 's928173917', 's273299602']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[108, 111, 103]
p03424
u918601425
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N=int(input())\nfor i in range(N):\n x=int(input())\n if x=="Y":\n print("Four")\n break\nelse:\n print("Three")\n ', 'N=int(input())\nls=input().split()\nfor i in range(N):\n x=ls[i]\n if x=="Y":\n print("Four")\n break\nelse:\n print("Three")\n \n']
['Runtime Error', 'Accepted']
['s249769279', 's579793025']
[2940.0, 2940.0]
[17.0, 17.0]
[117, 130]
p03424
u923279197
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["n=int(input())\ns=list(input().split())\nif 'Y' in s:\n print('four')\nelse:\n print('three')", "n=int(input())\ns=list(input().split())\nif 'Y' in s:\n print('Four')\nelse:\n print('Three')"]
['Wrong Answer', 'Accepted']
['s941294070', 's656184678']
[2940.0, 3188.0]
[17.0, 22.0]
[94, 94]
p03424
u928784113
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['# -*- coding: utf-8 -*-\nN = int(input())\na = []\nfor i in range(1,N+1):\n a.append(input())\n \nif a.count("Y") == 0:\n print("Three")\nelse:\n print("Four")', 'N = int(input())\nS = list(map(int,input().split()))\nif S.count("Y") == 0:\n print("Three")\nelse:\n print("Four")', '# -*- coding: utf-8 -*-\nN = int(input())\na = []\nfor i in range(1,N+1):\n a.append(input())\nif a.count("Y") == 0:\n print("Three")\nelse:\n print("Four")', 'N = int(input())\na = [input() for i in range(1:N)]\nif a.count("Y") == 0:\n print("Three")\nelse:\n print("Four")', 'N = int(input())\nfor i in (list(input().split())):\n if i == "Y":\n print("Four")\n exit()\n\nprint("Three")']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s119836061', 's474514779', 's531647343', 's824786731', 's525302705']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0, 18.0, 17.0]
[154, 112, 151, 111, 140]
p03424
u929618357
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N = int(input())\nstr = input().split()\nprint(str)\nif \'Y\' in str:\n print("Four")\nelse:\n print("Three")\n', 'N = int(input())\nstr = input().split()\nif \'Y\' in str:\n print("Four")\nelse:\n print("Three")']
['Wrong Answer', 'Accepted']
['s382633175', 's073612604']
[2940.0, 2940.0]
[17.0, 17.0]
[108, 96]
p03424
u931462344
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n = input()\nprint(len(set(input().split())))', 'n = input()\nprint(len(set(input().split()))', 'n = input()\nif len(set(input().split())) == 3:\n\tprint("Three")\nelse:\n\tprint("Four") ']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s567501438', 's758852222', 's658228905']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[44, 43, 85]
p03424
u931938233
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["input()\nprint('Three' if 'Y' in input().split() else 'Four')", "input()\nprint('Four' if 'Y' in input().split() else 'Three')"]
['Wrong Answer', 'Accepted']
['s626265391', 's582906629']
[9028.0, 8992.0]
[29.0, 30.0]
[60, 60]
p03424
u936985471
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n=input()\na=input().split()\nprint(("Three","Four")[len(set(a))==4]', 'n=input()\na=input().split()\nprint(("Three","Four")[len(set(a))==4])\n']
['Runtime Error', 'Accepted']
['s710351336', 's447202396']
[2940.0, 2940.0]
[17.0, 18.0]
[66, 68]
p03424
u940102677
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n = int(input())\na = list(input())\nflag = False\nfor i in range(n):\n if a[i] == "Y":\n flag = True\n\nif flag == Ture:\n print("Four")\nelse:\n print("Three")', 'n = int(input())\na = list(input())\nfor i in range(n):\n if a[i] == "Y":\n print("Four")\n exit()\n \nprint("Three")']
['Runtime Error', 'Accepted']
['s566305442', 's331412867']
[2940.0, 2940.0]
[17.0, 17.0]
[157, 120]
p03424
u941753895
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["\nN=int(input())\nl=list(map(int,input().split()))\n\nln=len(set(l))\n\nif ln==3:\n print('Three')\nelse:\n print('Four')", "\nN=int(input())\nl=list(map(str,input().split()))\n\nln=len(set(l))\n\nif ln==3:\n print('Three')\nelse:\n print('Four')"]
['Runtime Error', 'Accepted']
['s313497515', 's244554914']
[2940.0, 2940.0]
[17.0, 17.0]
[122, 122]
p03424
u957872856
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N = int(input())\nS = input().split()\nprint(S)\nif len(set(S)) == 3:\n print("Three")\nelse:\n print("Four")\n', 'N = int(input())\nS = list(input())\nprint(S)\nif len(set(S)) == 3:\n print("Three")\nelse:\n print("Four")\n', 'N = int(input())\nS = input().split()\nif len(set(S)) == 3:\n print("Three")\nelse:\n print("Four")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s897790429', 's970479814', 's657917548']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 20.0]
[106, 104, 96]
p03424
u958053648
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N=int(input())\nS=list(map(str,input().split()))\nSS=set(S)\nlength=len(SS)\nprint("four" if length==4 else "three")', 'N=int(input())\nS=list(map(str,input().split()))\nSS=set(S)\nlength=len(SS)\nprint("Four" if length==4 else "Three")']
['Wrong Answer', 'Accepted']
['s650448800', 's053186246']
[2940.0, 2940.0]
[17.0, 17.0]
[112, 112]
p03424
u966891144
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["num = int(input())\ndata = input().rstrip().split(' ')\ncount = 0\nif data.count('P') > 0 or data.count('W') > 0 or data.count('G') > 0 or data.count('Y') > 0:\n count++\nprint(count)", "num = int(input())\ndata = input().rstrip().split(' ')\ncount = 0\nif data.count('P') > 0 or data.count('W') > 0 or data.count('G') > 0 or data.count('Y') > 0:\n count++\n\nif count == 3:\n print('Three')\nelif count == 4:\n print('Four')", 'N = int(input())\ns = input().split()\nif "Y" in s:\n print("Four")\nelse:\n print("Three")']
['Runtime Error', 'Runtime Error', 'Accepted']
['s391921524', 's752492466', 's789957904']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[179, 232, 92]
p03424
u969708690
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N=int(input())\nL=list(map(int,input().split()))\nL=set(L)\nif len(L)==4:\n print("Four")\nelse:\n print("Three")', 'N=int(input())\nL=list(input().split())\nL=set(L)\nif len(L)==4:\n print("Four")\nelse:\n print("Three")']
['Runtime Error', 'Accepted']
['s061182922', 's456469309']
[9168.0, 9076.0]
[23.0, 28.0]
[109, 100]
p03424
u969848070
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["n = int(input())\nk = len(set(map(str, input().split())))\nif k = 4:\n print('Four')\nelse:\n print('Three')\n", "n = int(input())\nk = len(set(map(str, input().split())))\nif k == 4:\n print('Four')\nelse:\n print('Three')"]
['Runtime Error', 'Accepted']
['s283880314', 's089897590']
[8940.0, 9156.0]
[25.0, 27.0]
[106, 106]
p03424
u970198631
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["N = int(input())\nM = set()\nMM = input().split()\nfor i in MM:\n M.add(i)\nprint(len(M))\nif len(M) == 3:\n print('Three')\nelse:\n print('Four')", "N = int(input())\nM = set()\nMM = input().split()\nfor i in MM:\n M.add(i)\n\nif len(M) == 3:\n print('Three')\nelse:\n print('Four')"]
['Wrong Answer', 'Accepted']
['s723140112', 's198536610']
[9084.0, 9084.0]
[26.0, 27.0]
[140, 127]
p03424
u970809473
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["n = int(input())\na = list(map(int, input().split()))\nif a.count('Y') == 0:\n print('Three')\nelse:\n print('Four')", "n = int(input())\na = list(map(str, input().split()))\nif a.count('Y') == 0:\n print('Three')\nelse:\n print('Four')"]
['Runtime Error', 'Accepted']
['s361603688', 's297361778']
[2940.0, 2940.0]
[18.0, 17.0]
[113, 113]
p03424
u972892985
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['n = int(input())\ns = list(input().split())\n\nif len(set(s)) == 3:\n print("Four")\nelse:\n print("Three")\n', 'n = int(input())\ns = list[input().split()]\n\nif len(set(s)) == "Y":\n print("Four")\nelse:\n print("Three")', 'n = int(input())\nfor i in range(n):\n s = input():\n if s == "Y":\n print("Four")\n break\n else:\n print("Three")', 'n = int(input())\ns = list(input().split())\n\nif len(set(s)) == 3:\n print("Three")\nelse:\n print("Four")\n']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s518872026', 's602053347', 's945693219', 's484743591']
[2940.0, 2940.0, 2940.0, 3316.0]
[17.0, 17.0, 17.0, 21.0]
[104, 105, 130, 104]
p03424
u975012184
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["n = int(input())\nok = False\nfor i in range(n):\n t = input()\n if(t == 'Y'):\n ok = True\n break\n \nif(ok):\n print('Four')\nelse:\n print('Three')", "n = int(input())\nt = 'Y'\nx = input().split()\n \nif(t in x):\n print('Four')\nelse:\n print('Three')"]
['Runtime Error', 'Accepted']
['s811767624', 's097487923']
[2940.0, 3064.0]
[17.0, 17.0]
[152, 100]
p03424
u977349332
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["N = int(input())\nS = input().split()\n\nfor x in S:\n if x is 'Y'\n \tprint('Four')\n exit()\n else:\n print('Three')", "N = int(input())\nS = list(input().split())\n\nprint('Four' if 'Y' in S else 'Three')"]
['Runtime Error', 'Accepted']
['s327451407', 's280041581']
[2940.0, 3064.0]
[17.0, 17.0]
[118, 82]
p03424
u977642052
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['def main(n, s):\n a = set(s)\n\n if len(a) == 3:\n print(\'Three\')\n elif len(a) == 4:\n print(\'Four\')\n\n\nif __name__ == "__main__":\n n = int(input())\n s = list(map(int, input().split()))\n\n main(n, s)\n', 'def main(n, s):\n a = set(s)\n\n if len(a) == 3:\n print(\'Three\')\n elif len(a) == 4:\n print(\'Four\')\n\n\nif __name__ == "__main__":\n n = int(input())\n s = list(input().split())\n\n main(n, s)\n']
['Runtime Error', 'Accepted']
['s919772639', 's504486497']
[2940.0, 2940.0]
[18.0, 17.0]
[225, 215]
p03424
u988832865
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["N = int(input())\nS = set(map(int, input().split()))\n\nprint('Three' if len(S) == 3 else 'Four')\n", "N = int(input())\nS = set(input().split())\n\nprint('Three' if len(S) == 3 else 'Four')\n"]
['Runtime Error', 'Accepted']
['s842018768', 's316162435']
[3316.0, 2940.0]
[19.0, 19.0]
[95, 85]
p03424
u993461026
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['N = int(input())\narare = list(map(int, input().rstrip().split()))\ncount = {"P": 0, "W": 0, "G": 0, "Y": 0}\nfor i in range(N):\n cur = arare[i]\n if cur == "P":\n count["P"] += 1\n elif cur == "W":\n count["W"] += 1\n elif cur == "G":\n count["G"] += 1\n else:\n count["Y"] += 1\nprint("Four" if count["Y"] >= 1 else "Three")', 'N = int(input())\narare = input().rstrip().split()\ncount = {"P": 0, "W": 0, "G": 0, "Y": 0}\nfor i in range(N):\n cur = arare[i]\n if cur == "P":\n count["P"] += 1\n elif cur == "W":\n count["W"] += 1\n elif cur == "G":\n count["G"] += 1\n else:\n count["Y"] += 1\nprint("Four" if count["Y"] >= 1 else "Three")']
['Runtime Error', 'Accepted']
['s390431221', 's230849859']
[3064.0, 3064.0]
[17.0, 17.0]
[331, 315]
p03424
u994988729
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
['from collections import Counter\nN=input()\nc = Counter(list(map(int,input().split())))\nif len(c)==4:\n print("Four")\nelse:\n print("Three")', 'N = int(input())\nA = input().split()\n\nif len(set(A)) <= 3:\n print("Three")\nelse:\n print("Four")\n']
['Runtime Error', 'Accepted']
['s021019725', 's128369381']
[3316.0, 2940.0]
[20.0, 17.0]
[138, 102]
p03424
u999893056
2,000
262,144
In Japan, people make offerings called _hina arare_ , colorful crackers, on March 3. We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow. We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: `P`, white: `W`, green: `G`, yellow: `Y`. If the number of colors of the arare in the bag was three, print `Three`; if the number of colors was four, print `Four`.
["n = int(input())\n\ns_list = list(input().split())\ns_set = set(s_list)\nanswer = len(list(s_set))\nprint('Four' if answer == 3 else 'Three')", "n = int(input())\n\ns_list = list(input().split())\ns_set = set(s_list)\nanswer = len(list(s_set))\nprint('Four' if answer == 4 else 'Three')"]
['Wrong Answer', 'Accepted']
['s350085829', 's494938109']
[3060.0, 2940.0]
[19.0, 17.0]
[136, 136]
p03425
u000623733
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import itertools\nN = int(input())\n\nnum_dic = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}\nfor i in range(N):\n S = input()\n if S[0] in num_dic.keys():\n num_dic[S[0]] += 1\n\nans = 0\nprint(num_dic)\nfor i, j, k in itertools.combinations(num_dic.keys(), 3):\n ans += num_dic[i] * num_dic[j] * num_dic[k]\nprint(ans)\n", "import itertools\nN = int(input())\n\nnum_dic = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}\nfor i in range(N):\n S = input()\n if S[0] in num_dic.keys():\n num_dic[S[0]] += 1\n\nans = 0\nfor i, j, k in itertools.combinations(num_dic.keys(), 3):\n ans += num_dic[i] * num_dic[j] * num_dic[k]\nprint(ans)\n"]
['Wrong Answer', 'Accepted']
['s301354020', 's576146514']
[3060.0, 3060.0]
[175.0, 184.0]
[320, 305]
p03425
u017415492
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['using System;\nusing static System.Console;\nusing System.Linq;\nusing System.Collections.Generic;\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(ReadLine());\n List<string> s = new List<string>();\n \n for (int i=0;i<n;i++)\n {\n s.Add(ReadLine());\n }\n var hashSet = new HashSet<string>(s);\n s = hashSet.ToList();\n List<int> ans = new List<int>();\n \n for (int i=0;i<5;i++)\n {\n ans.Add(0);\n }\n \n for (int i=0;i<s.Count;i++)\n {\n if (s[i].Substring(0,1)=="M")\n {\n ans[0]+=1;\n }\n else if (s[i].Substring(0,1)=="A")\n {\n ans[1]+=1;\n }\n else if (s[i].Substring(0,1)=="R")\n {\n ans[2]+=1;\n }\n else if (s[i].Substring(0,1)=="C")\n {\n ans[3]+=1;\n }\n else if (s[i].Substring(0,1)=="H")\n {\n ans[4]+=1;\n }\n }\n int answ=0;\n for (int i=0;i<5;i++)\n {\n for (int j=i+1;j<5;j++)\n {\n for (int k=j+1;k<5;k++)\n {\n if (i!=j && j!=k && i!=k)\n {\n answ+=ans[i]*ans[j]*ans[k];\n }\n }\n }\n }\n WriteLine(answ);\n }\n}', 'import itertools\nn=int(input())\nm=list("MARCH")\nd=[0]*5\nfor i in range(n):\n s=input()\n for j in range(len(m)):\n if s[0]==m[j]:\n d[j]+=1\nans=0\nfor i in list(itertools.combinations(list(range(5)), 3)):\n k=list(i)\n ans+=d[k[0]]*d[k[1]]*d[k[2]]\nprint(ans)']
['Runtime Error', 'Accepted']
['s778935506', 's752734191']
[8940.0, 9220.0]
[24.0, 218.0]
[1276, 263]
p03425
u023540496
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N = int(input())\n\nlist_pop = [0] * 5\nfor i in range(N):\n s = input()\n if list(s)[0] == 'M':\n list_pop[0] += 1\n if list(s)[0] == 'A':\n list_pop[1] += 1\n if list(s)[0] == 'R':\n list_pop[2] += 1\n if list(s)[0] == 'C':\n list_pop[3] += 1\n if list(s)[0] == 'H':\n list_pop[4] += 1\n\n\nprint(list_pop)\n\nanswer = 0\nfor i in range(3):\n for j in range(4)[i+1:]:\n for k in range(5)[j+1:]:\n answer += list_pop[i] * list_pop[j] * list_pop[k]\n \n \nprint(int(answer))", "N = int(input())\n\nlist_pop = [0] * 5\nfor i in range(N):\n s = input()\n if list(s)[0] == 'M':\n list_pop[0] += 1\n if list(s)[0] == 'A':\n list_pop[1] += 1\n if list(s)[0] == 'R':\n list_pop[2] += 1\n if list(s)[0] == 'C':\n list_pop[3] += 1\n if list(s)[0] == 'H':\n list_pop[4] += 1\n\n\n\n\nanswer = 0\nfor i in range(3):\n for j in range(4)[i+1:]:\n for k in range(5)[j+1:]:\n answer += list_pop[i] * list_pop[j] * list_pop[k]\n \n \nprint(int(answer))"]
['Wrong Answer', 'Accepted']
['s720111898', 's071878213']
[3064.0, 3444.0]
[378.0, 362.0]
[528, 513]
p03425
u027622859
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N = int(input())\ns = [input()[0] for _ in range(N)]\nt = []\nans = 0\nfor k in 'MARCH':\n t.append(s.count(k))\nfor i in range(32):\n u = []\n for j in range(5):\n u.append(t[j])\n if len(u) == 3:\n ans += u[0]*u[1]*u[2]\nprint(ans)", "N = int(input())\ns = [input()[0] for _ in range(N)]\nt = []\nans = 0\nfor k in 'MARCH':\n t.append(s.count(k))\nfor i in range(32):\n u = []\n for j in range(5):\n if i&(1<<j):\n u.append(t[j])\n if len(u) == 3:\n ans += u[0]*u[1]*u[2]\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s380261374', 's941451285']
[3864.0, 3864.0]
[145.0, 139.0]
[247, 272]
p03425
u030726788
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['import sys\nN=int(input())\nS=[]\nfor i in range(N):\n S.append(input()[0])\n \nCount=[]\nCount.append(S.count("M"))\nCount.append(S.count("A"))\nCount.append(S.count("R"))\nCount.append(S.count("C"))\nCount.append(S.count("H"))\n\nZero=Count.count(0)\nif(Zero>=3):print(0)\nelif(Zero==2):\n Count.remove(0)\n Count.remove(0)\n pat=1\n for i in Count:pat*=i\n print(pat)\nelif(Zero==1):\n Count.remove(0)\n patA=1\n for i in Count:patA*=i\n pat=0\n for i in Count:pat+=patA//i\n print(pat)\nelif(Zero==0):\n patA=1\n for i in Count:patA*=i\n pat=0\n for i in range(5):\n for j in range(5):\n if(i==j):continue\n else:\n pat+=patA//Count[i]//Count[j]\n print(pat//2)\nprint(Count)', 'import sys\nN=int(input())\nS=[]\nfor i in range(N):\n S.append(input()[0])\n \nCount=[]\nCount.append(S.count("M"))\nCount.append(S.count("A"))\nCount.append(S.count("R"))\nCount.append(S.count("C"))\nCount.append(S.count("H"))\n\nZero=Count.count(0)\nif(Zero>=3):print(0)\nelif(Zero==2):\n Count.remove(0)\n Count.remove(0)\n pat=1\n for i in Count:pat*=i\n print(pat)\nelif(Zero==1):\n Count.remove(0)\n patA=1\n for i in Count:patA*=i\n pat=0\n for i in Count:pat+=patA//i\n print(pat)\nelif(Zero==0):\n patA=1\n for i in Count:patA*=i\n pat=0\n for i in range(5):\n for j in range(5):\n if(i==j):continue\n else:\n pat+=patA//Count[i]//Count[j]\n print(pat//2)']
['Wrong Answer', 'Accepted']
['s095885488', 's061545800']
[4016.0, 4016.0]
[149.0, 145.0]
[739, 726]
p03425
u036340997
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n = int(input())\nmarch = {'m': 0, 'a': 0, 'r': 0, 'c': 0, 'h': 0}\nfor i in range(n):\n s = input()[0]\n try:\n march[s] += 1\n except:\n pass\nans = 0\n\nfor key1 in march.keys():\n for key2 in march.keys():\n if key1 != key2:\n for key3 in march.keys():\n if key3 != key1 and key3 != key2:\n ans += key1 * key2 * key3\nprint(ans)", "n = int(input())\nmarch = {'m': 0, 'a': 0, 'r': 0, 'c': 0, 'h': 0}\nfor i in range(n):\n s = input()[0].lower()\n try:\n march[s] += 1\n except:\n pass\nans = 0\n\nfor key1 in march.keys():\n for key2 in march.keys():\n if key1 != key2:\n for key3 in march.keys():\n if key3 != key1 and key3 != key2:\n ans += march[key1] * march[key2] * march[key3]\nprint(ans//6)"]
['Runtime Error', 'Accepted']
['s260690327', 's041562395']
[3060.0, 3188.0]
[196.0, 241.0]
[350, 382]
p03425
u046187684
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['n = int(input().strip())\ns = [input().strip() for _ in range(n)]\nnum = [0 for _ in range(5)]\nnum[0] = len([True for _s in s if _s[0] == "M"])\nnum[1] = len([True for _s in s if _s[0] == "A"])\nnum[2] = len([True for _s in s if _s[0] == "R"])\nnum[3] = len([True for _s in s if _s[0] == "C"])\nnum[4] = len([True for _s in s if _s[0] == "H"])\nans = 0\nfor i in range(5):\n for j in range(i, 5):\n for k in range(j, 5):\n ans += num[i] * num[j] * num[k]\nprint(ans', 'def solve(string):\n n, *s = string.split()\n num = [len([True for _s in s if _s[0] == _i]) for _i in "M A R C H".split()]\n ans = 0\n for i in range(5):\n for j in range(i + 1, 5):\n for k in range(j + 1, 5):\n ans += num[i] * num[j] * num[k]\n return str(ans)\n\n\nif __name__ == \'__main__\':\n print(solve(input()))\n', 'n = int(input().strip())\ns = [input().strip() for _ in range(n)]\nnum_m = len([True for _s in s if _s[0] == "M"])\nnum_a = len([True for _s in s if _s[0] == "A"])\nnum_r = len([True for _s in s if _s[0] == "R"])\nnum_c = len([True for _s in s if _s[0] == "C"])\nnum_h = len([True for _s in s if _s[0] == "H"])\nprint(num_m * num_a * num_r + num_m * num_a * num_c + num_m * num_a * num_h + num_m * num_r * num_c\n + num_m * num_r * num_h + num_m * num_c * num_h + num_a * num_r * num_c +\n num_a * num_r * num_h + num_a * num_c * num_h + num_r * num_c * num_h', 'n = int(input().strip())\ns = [input().strip() for _ in range(n)]\nnum = [0 for _ in range(5)]\nnum[0] = len([True for _s in s if _s[0] == "M"])\nnum[1] = len([True for _s in s if _s[0] == "A"])\nnum[2] = len([True for _s in s if _s[0] == "R"])\nnum[3] = len([True for _s in s if _s[0] == "C"])\nnum[4] = len([True for _s in s if _s[0] == "H"])\nans = 0\nfor i in range(5):\n for j in range(i, 5):\n for k in range(j, 5):\n ans += num[i] * num[j] * num[k]\nprint(ans)', 'from functools import reduce\nfrom itertools import combinations\nfrom operator import mul\n\n\ndef solve(string):\n n, *s = string.split()\n # num = [len([True for _s in s if _s[0] == _i]) for _i in "M A R C H".split()]\n initial = "MARCH"\n num = [0 for _ in range(6)]\n for _s in s:\n i = initial.find(_s[0])\n num[i] += 1\n return str(sum([reduce(mul, n) for n in combinations(num[:5], 3)]))\n\n\nif __name__ == \'__main__\':\n n = int(input())\n print(solve(\'{}\\n\'.format(n) + \'\\n\'.join([input() for _ in range(n)])))\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s011305958', 's207168321', 's779161061', 's803889605', 's161963818']
[3064.0, 3060.0, 3064.0, 10520.0, 12468.0]
[17.0, 17.0, 17.0, 170.0, 188.0]
[474, 357, 560, 475, 541]
p03425
u059210959
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['#encoding:utf-8\n\nimport math\nimport itertools\n\nn = int(input())\ns = []\nfor i in range(n):\n s.append(str(input()))\n\nchosen_names = {"m":0,"a":0,"r":0,"c":0,"h":0}\n\nfor name in s:\n if name[0] == "M":\n chosen_names["m"] += 1\n elif name[0] == "A":\n chosen_names["a"] += 1\n elif name[0] == "R":\n chosen_names["r"] += 1\n elif name[0] == "C":\n chosen_names["c"] += 1\n elif name[0] == "H":\n chosen_names["h"] += 1\n\nanswer = 0\ncapitals = list("march")\ncapital_set = itertools.com\nbinations(capitals,3)\nfor capital in capital_set:\n answer += chosen_names[capital[0]] * chosen_names[capital[1]] * chosen_names[capital[2]]\n\n\nprint(answer)\n\n\n\n\n# return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))\n', '#encoding:utf-8\n\nimport math\nimport itertools\n\nn = int(input())\ns = []\nfor i in range(n):\n s.append(str(input()))\n\nchosen_names = {"m":0,"a":0,"r":0,"c":0,"h":0}\n\nfor name in s:\n if name[0] == "M":\n chosen_names["m"] += 1\n elif name[0] == "A":\n chosen_names["a"] += 1\n elif name[0] == "R":\n chosen_names["r"] += 1\n elif name[0] == "C":\n chosen_names["c"] += 1\n elif name[0] == "H":\n chosen_names["h"] += 1\n\nanswer = 0\ncapitals = list("march")\ncapital_set = itertools.combinations(capitals,3)\nfor capital in capital_set:\n answer += chosen_names[capital[0]] * chosen_names[capital[1]] * chosen_names[capital[2]]\n\n\nprint(answer)\n\n\n\n\n# return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))\n']
['Runtime Error', 'Accepted']
['s237976779', 's568685789']
[9800.0, 9908.0]
[195.0, 191.0]
[793, 792]
p03425
u061982241
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N = int(input())\nS ="MARCH"\nS2 = [0]*len(S)\nn=0\n\nfor i in range(N):\n s = input()\n for k, j in enumerate(S1):\n if s[0] == j:\n S2[k]+=1\n \nfor i in range(len(S2)):\n for j in range(i+1,len(S2)):\n for k in range(j+1,len(S2)):\n n +=S2[i]*S2[j]*S2[k]\n \nprint(n)', 'N = int(input())\nS ="MARCH"\nS2 = [0]*len(S)\nn=0\n\nfor i in range(N):\n s = input()\n for k, j in enumerate(S2):\n if s[0] == j:\n S2[k]+=1\n \nfor i in range(len(S2)):\n for j in range(i+1,len(S2)):\n for k in range(j+1,len(S2)):\n n +=S2[i]*S2[j]*S2[k]\n \nprint(n)\n', 'N = int(input())\nS ="MARCH"\nS2 = [0]*len(S)\nn=0\n\nfor i in range(N):\n s = input()\n for k, j in enumerate(S):\n if s[0] == j:\n S2[k]+=1\n \nfor i in range(len(S2)):\n for j in range(i+1,len(S2)):\n for k in range(j+1,len(S2)):\n n +=S2[i]*S2[j]*S2[k]\n \nprint(n)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s049848839', 's210547522', 's540978844']
[3060.0, 3188.0, 3060.0]
[17.0, 246.0, 275.0]
[313, 314, 312]
p03425
u067983636
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N = int(input())\nS = "ACHMR"\ndic = {s:0 for s in S}\nfor _ in range(N):\n s = input()[0]\n if s in S:\n dic[s] += 1\n \n \nres = 0\nfor s0 in S[:3]:\n for s1 in S[1:4]:\n if s0 >= s1:\n continue\n for s2 in S[2:5]:\n if s2 >= s1:\n continue\n res += dic[s0] * dic[s1] * dic[s2] \nprint(res)', 'N = int(input())\nS = "MARCH"\ndic = {s:0 for s in S}\nfor _ in range(N):\n s = input()[0]\n if s in S:\n dic[s] += 1\n \nprint(sum([dic[a] * dic[b] * dic[c] for a in S for b in S for c in S if a < b < c]))\n']
['Wrong Answer', 'Accepted']
['s586882297', 's967126098']
[3064.0, 3060.0]
[170.0, 169.0]
[369, 219]
p03425
u076917070
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['import sys\ninput=sys.stdin.readline\n\nh = {}\nfor c in "MARCH":\n h[c] = 0\n\nn = int(input())\nfor i in range(n):\n s = input().strip()\n h[s[0]] += 1\n#print(h)\n\nimport itertools\nans = 0\nfor i,j,k in itertools.combinations("MARCH", 3):\n ans += h[i]*h[j]*h[k]\nprint(ans)\n', 'import sys\ninput=sys.stdin.readline\n\nh = {}\nfor c in "MARCH":\n h[c] = 0\n\nfor i in range(int(input())):\n c = input().strip()[0]\n if c in h:\n h[c] += 1\n\nimport itertools\nans = 0\nfor i,j,k in itertools.combinations("MARCH", 3):\n ans += h[i]*h[j]*h[k]\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s109614976', 's402817562']
[3060.0, 3060.0]
[62.0, 66.0]
[275, 278]
p03425
u077179028
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N=int(input())\nS=list(input().split())\nm,a,r,c,h = 0,0,0,0,0\nfor s in S:\n if 'M' == s[0]:\n m+=1\n elif 'A' == s[0]:\n a+=1\n elif 'R' == s[0]:\n r+=1\n elif 'C' == s[0]:\n c+=1\n elif 'H' == s[0]:\n h+=1\n\nprint(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)", "N=int(input())\nS=list(input().split())\nm,a,r,c,h = 0,0,0,0,0\nfor s in S:\n if 'M' == s[0]:\n m+=1\n elif 'A' == s[0]:\n a+=1\n elif 'R' == s[0]:\n r+=1\n elif 'C' == s[0]:\n c+=1\n elif 'H' == s[0]:\n h+=1\n\nprint(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)", "N=int(input())\nS=[input() for i in range(N)]\nm,a,r,c,h = 0,0,0,0,0\nfor s in S:\n if 'M' == s[0]:\n m+=1\n elif 'A' == s[0]:\n a+=1\n elif 'R' == s[0]:\n r+=1\n elif 'C' == s[0]:\n c+=1\n elif 'H' == s[0]:\n h+=1\n\nprint(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s139043871', 's298942362', 's041104620']
[3064.0, 3064.0, 9772.0]
[17.0, 17.0, 161.0]
[301, 301, 307]
p03425
u077291787
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['# ABC089C - March\nfrom itertools import combinations as comb\n\n\ndef main():\n N, *S = open(0).read().split()\n cnt = [sum(s.startswith(i) for S) for i in "MARCH"]\n ans = sum(x * y * z for x, y, z in comb(cnt, 3))\n print(ans)\n\n\nif __name__ == "__main__":\n main()', '# ABC089C - March\nfrom itertools import combinations as comb\n\n\ndef main():\n N, *S = open(0).read().split()\n capitals = [s[0] for s in S]\n cnt = [capitals.count(i) for i in "MARCH"]\n ans = sum(x * y * z for x, y, z in comb(cnt, 3))\n print(ans)\n\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s728572520', 's043537056']
[2940.0, 10864.0]
[17.0, 39.0]
[273, 297]
p03425
u086503932
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import itertools\nimport math\n\nN = int(input())\nS_list = []\nfor i in range(N):\n S_list.append(input())\n\ncount_M = 0\ncount_A = 0\ncount_R = 0\ncount_C = 0\ncount_H = 0\n\nfor l in S_list:\n if l.startswith('M'):\n count_M += 1\n elif l.startswith('A'):\n count_A += 1\n elif l.startswith('R'):\n count_R += 1\n elif l.startswith('C'):\n count_C += 1\n elif l.startswith('H'):\n count_H += 1\n\ncount = [count_M,count_A,count_R,count_C,count_H]\nc = list(itertools.combinations(count,3))\nprint(c)\nx = 0\nfor i in c:\n i_list = list(i)\n x += i_list[0]*i_list[1]*i_list[2]\nprint(x)\n", "import itertools\nimport math\n\nN = int(input())\nS_list = []\nfor i in range(N):\n S_list.append(input())\n\ncount_M = 0\ncount_A = 0\ncount_R = 0\ncount_C = 0\ncount_H = 0\n\nfor l in S_list:\n if l.startswith('M'):\n count_M += 1\n elif l.startswith('A'):\n count_A += 1\n elif l.startswith('R'):\n count_R += 1\n elif l.startswith('C'):\n count_C += 1\n elif l.startswith('H'):\n count_H += 1\n\ncount = [count_M,count_A,count_R,count_C,count_H]\nc = list(itertools.combinations(count,3))\nx = 0\nfor i in c:\n i_list = list(i)\n x += i_list[0]*i_list[1]*i_list[2]\nprint(x)\n"]
['Wrong Answer', 'Accepted']
['s712821410', 's682315982']
[9792.0, 9792.0]
[207.0, 206.0]
[616, 607]
p03425
u094191970
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n=int(input())\nd={'M':0,'A':0,'R':0,'C':0,'H':0}\nfor i in range(n):\n s=input()\n if s[0]=='M':\n d['M']+=1\n if s[0]=='A':\n d['A']+=1\n if s[0]=='R':\n d['R']+=1\n if s[0]=='C':\n d['C']+=1\n if s[0]=='H':\n d['H']+=1\n\nans=0\nfor i,j,k in combinations('MARCH',3):\n ans+=d[i]*d[j]*d[k]\n\nprint(ans)", "from itertools import combinations\n\nn=int(input())\nd={'M':0,'A':0,'R':0,'C':0,'H':0}\nfor i in range(n):\n s=input()\n if s[0]=='M':\n d['M']+=1\n if s[0]=='A':\n d['A']+=1\n if s[0]=='R':\n d['R']+=1\n if s[0]=='C':\n d['C']+=1\n if s[0]=='H':\n d['H']+=1\n\nans=0\nfor i,j,k in combinations('MARCH',3):\n ans+=d[i]*d[j]*d[k]\n\nprint(ans)"]
['Runtime Error', 'Accepted']
['s976747534', 's850287730']
[9028.0, 9136.0]
[162.0, 164.0]
[308, 344]
p03425
u105124953
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import itertools\nn = int(input())\nlis = [input() for _ in range(n)]\nlis.sort()\nchoice = list(itertools.combinations(range(n), 3))\ncount = 0\nfor ch in choice:\n master = set(['M','A','R','C','H'])\n se = set([lis[ch[0]][0],lis[ch[1]][0],lis[ch[2]][0]])\n if len(se) <=2:\n break\n #print(master,se,master - se)\n if len(master - se) == 2:\n count += 1\nprint(count)", "import collections\nimport itertools\nn = int(input())\nli = []\nfor i in range(n):\n li.append(input()[0])\n\nc = collections.Counter(li)\nc_li = [c['M'],c['A'],c['R'],c['C'],c['H']]\n#print(li,c,c_li)\n\ncount = 0\ncombination = list(itertools.combinations([0,1, 2, 3,4], 3))\nfor co in combination:\n tmp = 1\n for c in co:\n if c_li[c] == 0:\n tmp = 0\n break\n tmp *= c_li[c]\n count += tmp\nprint(count)"]
['Wrong Answer', 'Accepted']
['s962829254', 's926586281']
[1946612.0, 4224.0]
[2235.0, 148.0]
[385, 436]
p03425
u106181248
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['n = int(input())\nans = [0]*5\nx = 1\n\nfor i in range(n):\n s = input()\n if s[0] == "M":\n ans[0] = ans[0] + 1\n if s[0] == "A":\n ans[1] = ans[1] + 1\n if s[0] == "R":\n ans[2] = ans[2] + 1\n if s[0] == "C":\n ans[3] = ans[3] + 1\n if s[0] == "H":\n ans[4] = ans[4] + 1\n\nif ans.count(0) == 5:\n print(0)\nelse:\n for i in ans:\n if i != 0:\n x *= i\n print(x)\nprint(ans)', 'import itertools\n\nn = int(input())\nli = [0]*5\nans = 0\n\nfor i in range(n):\n s = input()\n if s[0] == "M":\n li[0] = li[0] + 1\n if s[0] == "A":\n li[1] = li[1] + 1\n if s[0] == "R":\n li[2] = li[2] + 1\n if s[0] == "C":\n li[3] = li[3] + 1\n if s[0] == "H":\n li[4] = li[4] + 1\n\nfor l in itertools.combinations(li, 3):\n ans += l[0] * l[1] * l[2] \n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s447495930', 's389368526']
[3064.0, 3064.0]
[187.0, 184.0]
[432, 406]
p03425
u109133010
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N=int(input())\nm=0\na=0\nr=0\nc=0\nh=0\nfor _ in range(N):\n s=input()\n if s[0]=="M":\n m+=1\n elif s[0]=="A":\n a+=1\n elif s[0]=="R":\n r+=1\n elif s[0]=="C":\n c+=1\n elif s[0]=="H":\n h+=1\nans=0\nans+=m*a*r\nans+=m*a*c\nans+=m*a*h\nans+=a*r*c\nans+=a*r*h\nans+=r*c*h\nprint(ans)', 'N=int(input())\nm=0\na=0\nr=0\nc=0\nh=0\nfor _ in range(N):\n s=input()\n if s[0]=="M":\n m+=1\n elif s[0]=="A":\n a+=1\n elif s[0]=="R":\n r+=1\n elif s[0]=="C":\n c+=1\n elif s[0]=="H":\n h+=1\nans=0\nans+=m*a*r\nans+=m*a*c\nans+=m*a*h\nans+=m*r*c\nans+=m*r*h\nans+=m*c*h\nans+=a*r*c\nans+=a*r*h\nans+=a*c*h\nans+=r*c*h\nprint(ans)']
['Wrong Answer', 'Accepted']
['s914846930', 's644821321']
[3064.0, 3064.0]
[170.0, 170.0]
[281, 325]
p03425
u113971909
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N= int(input())\nS = ['M','A','R','C','H']\nC = [0]*5\nfor _ in range(N):\n X = (input())[0]\n if X in S:\n C[S.index(X)] += 1\nprint(C)\n\nfrom itertools import permutations, combinations,combinations_with_replacement,product\nL = list(combinations(range(5), 3)) #nCr\nans = 0\nfor i in L:\n ans += C[i[0]]*C[i[1]]*C[i[2]]\nprint(ans)", "N= int(input())\nS = ['M','A','R','C','H']\nC = [0]*5\nfor _ in range(N):\n X = (input())[0]\n if X in S:\n C[S.index(X)] += 1\nfrom itertools import permutations, combinations,combinations_with_replacement,product\nL = list(combinations(range(5), 3)) #nCr\nans = 0\nfor i in L:\n ans += C[i[0]]*C[i[1]]*C[i[2]]\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s741647469', 's736502799']
[3064.0, 3064.0]
[196.0, 193.0]
[329, 319]
p03425
u120810144
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['n = int(input())\n\ns = [input() for i in range(n)]\n\norder = "MARCH"\n\ninitial_arary = [name[0] for name in s]\nnums = [initial_array.count(order[i]) for i in range(len(order))]\n\nans = 0\nfor i in range(0, 5):\n for j in range(i+1, 5):\n for k in range(j+1, 5):\n ans += nums[i] * nums[j] * nums[k]\n \nprint(ans)\n\n', 'n = int(input())\n\ns = [input() for i in range(n)]\n\norder = "MARCH"\n\ninitial_array = [name[0] for name in s]\nnums = [initial_array.count(order[i]) for i in range(len(order))]\n\nans = 0\nfor i in range(0, 5):\n for j in range(i+1, 5):\n for k in range(j+1, 5):\n ans += nums[i] * nums[j] * nums[k]\n \nprint(ans)\n\n']
['Runtime Error', 'Accepted']
['s217564682', 's903131242']
[10520.0, 10520.0]
[134.0, 150.0]
[337, 337]
p03425
u125545880
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['import sys\nimport itertools\n\ninput = sys.stdin.readline\n\ndef main():\n common = common_function()\n N = int(input())\n l = [\'M\', \'A\', \'R\', \'C\', \'H\']\n m = [0]*5\n for _ in range(N):\n S = input()[:-1]\n Shead = S[0]\n for i, s0 in enumerate(l):\n if Shead == s0:\n m[i] += 1\n break\n ll = []\n for i, n in enumerate(m):\n if n >= 1:\n ll.append(l[i])\n if len(ll) <= 2:\n print(0)\n return\n ans = 0\n for i, j, k in itertools.combinations(ll, 3):\n ans += m[l.index(i)] * m[l.index(j)] * m[l.index(k)]\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n', 'import sys\nimport itertools\n\ninput = sys.stdin.readline\n\ndef main():\n N = int(input())\n l = [\'M\', \'A\', \'R\', \'C\', \'H\']\n m = [0]*5\n for _ in range(N):\n S = input()[:-1]\n Shead = S[0]\n for i, s0 in enumerate(l):\n if Shead == s0:\n m[i] += 1\n break\n ll = []\n for i, n in enumerate(m):\n if n >= 1:\n ll.append(l[i])\n if len(ll) <= 2:\n print(0)\n return\n ans = 0\n for i, j, k in itertools.combinations(ll, 3):\n ans += m[l.index(i)] * m[l.index(j)] * m[l.index(k)]\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Accepted']
['s865699900', 's564232495']
[9072.0, 9148.0]
[22.0, 73.0]
[669, 638]
p03425
u133936772
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n=int(input())\nd={'M':0,'A':0,'R':0,'C':0,'H':0}\nfor _ in range(n): d[input()[0]]+=1\nimport itertools as it\nprint(sum(d[s]*d[t]*d[r] for s,t,r in it.combinations('MARCH',3)))", "_,*l=open(0);from itertools import*;print(sum(x*y*z for x,y,z in combinations([sum(c==s[0]for s in l)for c in'MARCH'],3)))"]
['Runtime Error', 'Accepted']
['s884432326', 's258018735']
[3060.0, 9876.0]
[163.0, 77.0]
[174, 122]
p03425
u135116520
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N=int(input())\nS=[list(map(int,input().split())) for i in range(N)]\nm=0\na=0\nr=0\nc=0\nh=0\nfor i in range(N):\n if S[i][0]=="M":\n m+=1\n if S[i][0]=="A":\n a+=1\n if S[i][0]=="R":\n r+=1\n if S[i][0]=="C":\n c+=1\n if S[i][0]=="H":\n h+=1\nprint(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h*a*c*h+r*c*h)', 'N=int(input())\ns=[]\nfor i in range(N):\n S=input()\n s.append(S)\nm=0\na=0\nr=0\nc=0\nh=0\nfor i in range(N):\n if s[i][0]=="M":\n m+=1\n if s[i][0]=="A":\n a+=1\n if s[i][0]=="R":\n r+=1\n if s[i][0]=="C":\n c+=1\n if s[i][0]=="H":\n h+=1\nprint(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)']
['Runtime Error', 'Accepted']
['s027660665', 's413587756']
[3064.0, 9776.0]
[19.0, 196.0]
[313, 310]
p03425
u141574039
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['import itertools\nN=int(input())\nS=list(str(input()) for i in range(N))\nm,a,r,c,h=[0]*5\nans=0\nif S[0]=="M":m+=1\nif S[0]=="A":a+=1\nif S[0]=="R":r+=1\nif S[0]=="C":c+=1\nif S[0]=="H":h+=1\n\nx=[m,a,r,c,h]\nfor i in itertools.combinations(x,3):\n ans+=i[0]*i[1]*i[2]\nprint(ans)', 'import itertools\nN=int(input())\nS=list(str(input()) for i in range(N))\nm,a,r,c,h=[0]*5\nans=0\nfor i in range(len(S)):\n if S[i][0]=="M":m+=1\n if S[i][0]=="A":a+=1\n if S[i][0]=="R":r+=1\n if S[i][0]=="C":c+=1\n if S[i][0]=="H":h+=1\n\nx=[m,a,r,c,h]\nfor i in itertools.combinations(x,3):\n ans+=i[0]*i[1]*i[2]\nprint(ans)']
['Wrong Answer', 'Accepted']
['s634699883', 's639273757']
[9764.0, 9784.0]
[173.0, 207.0]
[268, 317]
p03425
u143212659
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport itertools\n\n\ndef main():\n N = int(input())\n S = [input()[0] for _ in range(N)]\n\n result = []\n for comb in list(itertools.combinations(S, 3)):\n if comb[0] != comb[1] and comb[0] != comb[2] and comb[1] != comb[2]:\n result.append(comb)\n\n print(len(result))\n\n\nif __name__ == "__main__":\n main()\n', '#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom itertools import combinations\n\n\ndef main():\n\n N = int(input())\n\n count = {x: 0 for x in "MARCH"}\n\n for _ in range(N):\n s = input()[0]\n if s in count:\n count[s] += 1\n\n result = 0\n for a, b, c in combinations("MARCH", 3):\n result += count[a] * count[b] * count[c]\n\n print(result)\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s185283466', 's352364069']
[1966288.0, 3060.0]
[2230.0, 160.0]
[381, 421]
p03425
u143509139
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["one = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\nn=int(input())\nfor i in range(n):\n one[input()[0]] += 1\nm,a,r,c,h=one['M'],one['A'],one['R'],one['C'],one['H']\nprint(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)", "one = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\nn=int(input())\nfor i in range(n):\n c=input()[0]\n one[c] = one.get(c,0)+1\nm,a,r,c,h=one['M'],one['A'],one['R'],one['C'],one['H']\nprint(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)"]
['Runtime Error', 'Accepted']
['s799719470', 's563672083']
[3064.0, 3064.0]
[156.0, 176.0]
[220, 238]
p03425
u152638361
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['5\nCHOKUDAI\nRNG\nMAKOTO\nAOKI\nRINGO', 'import collections\nN = int(input())\nS = [input() for i in range(N)]\nprint(S)\nSI = [S[i][0] for i in range(N)]\ncnt = collections.Counter(SI)\nn = [cnt["M"],cnt["A"],cnt["R"],cnt["C"],cnt["H"]]\nans = 0\nfor i in range(3):\n for j in range(i+1,5):\n for k in range(j+1,5):\n ans += n[i]*n[j]*n[k]\nprint(ans)', 'import collections\nN = int(input())\nS = [input() for i in range(N)]\nSI = [S[i][0] for i in range(N)]\ncnt = collections.Counter(SI)\nn = [cnt["M"],cnt["A"],cnt["R"],cnt["C"],cnt["H"]]\nans = 0\nfor i in range(3):\n for j in range(i+1,5):\n for k in range(j+1,5):\n ans += n[i]*n[j]*n[k]\nprint(ans)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s787989405', 's867516766', 's921754541']
[2940.0, 13432.0, 10880.0]
[18.0, 166.0, 152.0]
[32, 318, 311]
p03425
u163320134
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n=int(input())\ncnt=[0]*5\ncheck='MARCH'\nfor i in range(n):\n s=input()\n for j in range(5):\n if s[0]==check[j]:\n cnt[j]+=1\n break\nans=0\nfor i in range(5):\n for j in range(i+1,5):\n for k in range(j+1,5):\n ans+=cnt[i]*cnt[j]*cnt[k]", "n=int(input())\ncnt=[0]*5\ncheck='MARCH'\nfor i in range(n):\n s=input()\n for j in range(5):\n if s[0]==check[j]:\n cnt[j]+=1\n break\nans=0\nfor i in range(5):\n for j in range(i+1,5):\n for k in range(j+1,5):\n ans+=cnt[i]*cnt[j]*cnt[k]\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s522815474', 's487097192']
[3064.0, 3064.0]
[251.0, 258.0]
[250, 261]
p03425
u167681750
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N = int(input())\nS = [input() for i in range(N)]\nmarch = {"M":0, "A":0, "R":0, "C":0, "H":0}\n\nfor i in S:\n if i[0] in march:\n march[i[0]] += 1\n\nans = 0\nfor first, second, third in combinations(march.values(), 3):\n ans += first * second * third\n\nprint(ans)', 'from itertools import combinations\n\nN = int(input())\nS = [input() for i in range(N)]\nmarch = {"M":0, "A":0, "R":0, "C":0, "H":0}\n\nfor i in S:\n if i[0] in march:\n march[i[0]] += 1\n\nans = 0\nfor first, second, third in combinations(march.values(), 3):\n ans += first * second * third\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s497236889', 's107452470']
[9752.0, 9772.0]
[163.0, 157.0]
[268, 304]
p03425
u180058306
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['\nN = int(input())\n\nS = [input() for _ in range(N)]\n\nword = "MARCH"\n\nn = len(word)\n\ndic_initial = dict()\nfor letter in word:\n dic_initial[letter] = 0\n\nfor i in range(N):\n \n if S[i][0] in dic_initial:\n \n dic_initial[S[i][0]] += 1\n\nans = 0\n\nfor p in range(n - 2):\n \n num_p = dic_initial[word[p]]\n \n if num_p == 0:\n continue\n for q in range(p + 1, n - 1):\n num_q = dic_initial[word[q]]\n if num_q == 0:\n continue\n for r in range(q + 1, n):\n ans += num_p * num_q *num_r\n\nprint(ans)', '\nN = int(input())\n\nS = [input() for _ in range(N)]\n\nword = "MARCH"\n\nn = len(word)\n\ndic_initial = dict()\nfor letter in word:\n dic_initial[letter] = 0\n\nfor i in range(N):\n \n if S[i][0] in dic_initial:\n \n dic_initial[S[i][0]] += 1\n\nans = 0\n\nfor p in range(n - 2):\n \n num_p = dic_initial[word[p]]\n \n if num_p == 0:\n continue\n for q in range(p + 1, n - 1):\n num_q = dic_initial[word[q]]\n if num_q == 0:\n continue\n for r in range(q + 1, n):\n num_r = dic_initial[word[r]]\n ans += num_p * num_q * num_r\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s135415430', 's431530066']
[9772.0, 9776.0]
[174.0, 163.0]
[1254, 1296]
p03425
u185896732
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n=int(input())\nm=a=r=c=h=0\nls\nfor i in range(n):\n s=input()\n if s[0]=='M':\n m+=1\n elif a[0]=='A':\n a+=1\n elif a[0]=='R':\n r+=1\n elif a[0]=='C':\n c+=1\n elif a[0]=='H':\n h+=1\nprint(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)", "n=int(input())\nm=a=r=c=h=0\nfor i in range(n):\n s=input()\n if s[0]=='M':\n m+=1\n elif s[0]=='A':\n a+=1\n elif s[0]=='R':\n r+=1\n elif s[0]=='C':\n c+=1\n elif s[0]=='H':\n h+=1\nprint(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)"]
['Runtime Error', 'Accepted']
['s684791579', 's111255317']
[3188.0, 3064.0]
[18.0, 167.0]
[292, 289]
p03425
u190555868
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N = input()\n\nd = {'M':0,'A':0,'R':0,'C':0,'H':0}\n\nfor i in range(N):\n s = input()\n if s[0] in 'MARCH':\n d[s[0]]+=1\n\nv = list(d.values())\nans = 0\n\nfor i in range(5):\n for j in range (i+1,5):\n for k in range (j+1,5):\n ans += v[i]*v[j]*v[k]\n\nprint(ans)", "N = input()\n\nd = {'M':0,'A':0,'R':0,'C':0,'H':0}\n\nfor i in range(N):\n s = input()\n if s[0] in 'MARCH':\n d[s[0]]+=1\n\nv = list(d.values())\nans = 0\n\nfor i in range(5):\n for j in range (i+1,5):\n for k in range (j+1,5):\n ans += v[i]*v[j]*v[k]\n\nprint(ans)", "N = int(input())\n\nd = {'M':0,'A':0,'R':0,'C':0,'H':0}\n\nfor i in range(N):\n s = input()\n if s[0] in 'MARCH':\n d[s[0]]+=1\n\nv = list(d.values())\nans = 0\n\nfor i in range(5):\n for j in range (i+1,5):\n for k in range (j+1,5):\n ans += v[i]*v[j]*v[k]\n\nprint(ans)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s673087159', 's943439673', 's598071925']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 174.0]
[283, 283, 288]
p03425
u212328220
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import itertools\nn = int(input())\nsl = []\n\ndic = {'M':0,'A':0,'R':0,'C':0,'H':0}\nfor i in range(n):\n name = input()\n if name[0] in dic:\n dic[name[0]] += 1\n\nlst = []\nfor com in itertools.combinations(dic.keys(),3):\n lst.append(com)\nprint(lst)\n\nans = 0\nfor v in lst:\n ans += dic[v[0]] * dic[v[1]] * dic[v[2]]\nprint(ans)", "import itertools\nn = int(input())\nsl = []\n\ndic = {'M':0,'A':0,'R':0,'C':0,'H':0}\nfor i in range(n):\n name = input()\n if name[0] in dic:\n dic[name[0]] += 1\n\nlst = []\nfor com in itertools.combinations(dic.keys(),3):\n lst.append(com)\n\nans = 0\nfor v in lst:\n ans += dic[v[0]] * dic[v[1]] * dic[v[2]]\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s600356998', 's524826846']
[3064.0, 3064.0]
[169.0, 174.0]
[336, 325]
p03425
u222634810
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N = int(input())\nM = []\nA = []\nR = []\nC = []\nH = []\n\nfor i in range(N):\n temp = input()\n init_temp = list(temp)\n if 'M' == init_temp[0]:\n M.append(temp)\n elif 'A' == init_temp[0]:\n A.append(temp)\n elif 'R' == init_temp[0]:\n R.append(temp)\n elif 'C' == init_temp[0]:\n C.append(temp)\n elif 'H' == init_temp[0]:\n H.append(temp)\n else:\n pass\n\nM = len(list(set(M)))\nA = len(list(set(A)))\nR = len(list(set(R)))\nC = len(list(set(C)))\nH = len(list(set(H)))\n\nD = [M, A, R, C, H]\n\nA = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2]\nB = [1, 1, 1, 2, 2, 3, 2, 2, 3, 3]\nC = [2, 3, 4, 3, 4, 4, 3, 4, 4, 4]\n\nans = 0.0\n\nfor i in range(10):\n ans += D[A[i]] * D[B[i]] * D[C[i]]\n\nprint(ans)", "N = int(input())\nM = []\nA = []\nR = []\nC = []\nH = []\n\nfor i in range(N):\n temp = input()\n init_temp = list(temp) \n if 'M' == init_temp[0]:\n M.append(temp)\n elif 'A' == init_temp[0]:\n A.append(temp)\n elif 'R' == init_temp[0]:\n R.append(temp)\n elif 'C' == init_temp[0]:\n C.append(temp)\n elif 'H' == init_temp[0]:\n H.append(temp)\n else:\n pass\n\nM = len(list(set(M)))\nA = len(list(set(A)))\nR = len(list(set(R)))\nC = len(list(set(C)))\nH = len(list(set(H)))\n\nD = [M, A, R, C, H]\n\nA = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2]\nB = [1, 1, 1, 2, 2, 3, 2, 2, 3, 3]\nC = [2, 3, 4, 3, 4, 4, 3, 4, 4, 4]\n\nans = 0\n\nfor i in range(10):\n ans += D[A[i]] * D[B[i]] * D[C[i]]\n\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s426747302', 's481008651']
[16020.0, 16016.0]
[261.0, 248.0]
[745, 746]
p03425
u223904637
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n=int(input())\nal=list('MARCH')\nd=[0]*5\nfor i in range(n):\n s=list(input())\n if s[0] in al:\n d[al.index(s[0])]+=1\nop=[[0],[1]]\nfor i in range(4):\n tmp=[]\n for j in op:\n j.append(0)\n tmp.append(j)\n j.pop(-1)\n j.append(1)\n tmp.append(j)\n op=tmp\nk=[]\nfor i in op:\n if sum(i)==3:\n k.append(i)\nans=0\nfor i in k:\n t=1\n for j in range(5):\n if i[j]==1:\n t*=d[j]\n ans+=t\nprint(ans)\n ", "n=int(input())\nal=list('MARCH')\nd=[0]*5\nfor i in range(n):\n s=list(input())\n if s[0] in al:\n d[al.index(s[0])]+=1\nop=['0','1']\nfor i in range(4):\n tmp=[]\n for j in op:\n tmp.append(j+'0')\n tmp.append(j+'1')\n op=tmp\nk=[]\nfor i in op:\n g=list(i)\n c=0\n for j in g:\n if j=='1':\n c+=1\n if c==3:\n k.append(i)\nans=0\nfor i in k:\n t=1\n for j in range(5):\n if i[j]=='1':\n t*=d[j]\n ans+=t\nprint(ans)\n \n"]
['Wrong Answer', 'Accepted']
['s061909641', 's956897979']
[3064.0, 3064.0]
[261.0, 258.0]
[479, 501]
p03425
u226108478
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["if __name__ == '__main__':\n people_count = int(input())\n\n person_name = list()\n\n for person in range(people_count):\n person_name.append(str(input()))\n\n initial_strings = list()\n\n for name in person_name:\n initial_strings.append(name[0])\n\n mod_initial_strings = set(initial_strings)\n\n count = 0\n\n matching_strings = ['M', 'A', 'R', 'C', 'H']\n matching_strings_count = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}\n\n for string in matching_strings:\n if string in mod_initial_strings:\n count += initial_strings.count(string)\n\n for string in initial_strings:\n matching_strings_count[string] += 1\n\n if count >= 3:\n print(matching_strings_count)\n else:\n print(0)\n", "# -*- coding: utf-8 -*-\n\n\n\n\n\ndef count_initial_name(people_count: int) -> dict:\n matching_strings_count = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}\n\n for person in range(people_count):\n initial_name = input()[0]\n\n if initial_name in matching_strings_count.keys():\n matching_strings_count[initial_name] += 1\n\n return matching_strings_count\n\n\ndef count_patterns(matching_strings_count):\n import itertools\n\n patterns = itertools.combinations(matching_strings_count.keys(), 3)\n pattern_count = 0\n\n for a_pattern in patterns:\n pattern_count += matching_strings_count[a_pattern[0]] * \\\n matching_strings_count[a_pattern[1]] * \\\n matching_strings_count[a_pattern[2]]\n return pattern_count\n\n\nif __name__ == '__main__':\n matching_strings_count = count_initial_name(people_count=int(input()))\n\n if sum(matching_strings_count.values()) >= 3:\n print(count_patterns(matching_strings_count))\n else:\n print(0)\n"]
['Runtime Error', 'Accepted']
['s764443138', 's818982608']
[10520.0, 3064.0]
[195.0, 173.0]
[744, 1032]
p03425
u247211039
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N=int(input())\nS=[input() for _ in range(N)]\n\ncnt=[]\nans=0\nfor i in range(N):\n if S[i][0]=='M':\n cnt.append('M')\n elif S[i][0]=='A':\n cnt.append('A')\n elif S[i][0]=='R':\n cnt.append('R')\n elif S[i][0]=='C':\n cnt.append('C')\n elif S[i][0]=='H':\n cnt.append('H')\n \nimport math\nimport itertools\nc_list = list(itertools.combinations(cnt, 3))\n\nfor v in itertools.combinations(cnt, 3):\n print(set(v))\n if len(set(v))==3:\n ans+=1\n\nprint(ans)", "N=int(input())\nS=[input() for _ in range(N)]\ncnt=[0]*N\ncnt2=[]\nflag=0\n\nif len(S)>1:\n for i in range(N):\n if S[i][0]=='M':\n cnt[0]+=1\n elif S[i][0]=='A':\n cnt[1]+=1\n elif S[i][0]=='R':\n cnt[2]+=1\n elif S[i][0]=='C':\n cnt[3]+=1\n elif S[i][0]=='H':\n cnt[4]+=1\n\nfor i in range(N):\n if cnt[i]!=0:\n cnt2.append(cnt[i])\n \nimport math\nimport itertools\nans=0\n\nfor v in itertools.combinations(cnt2, 3):\n ans+=v[0]*v[1]*v[2]\n\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s824196798', 's305623491']
[1869524.0, 16968.0]
[2271.0, 178.0]
[504, 538]
p03425
u257350577
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import itertools\nletters = ['M','A','R','C','H']\nN = int(input())\na = []\ncom_s = []\n\nfor i in range(N):\n x = input()\n if x[0] in letters:\n a.append(x)\n\ncoms = list(itertools.combinations(a,3))\nfor com in coms:\n if com[0][0] != com[1][0] and com[1][0] != com[2][0] and com[2][0] != com[0]com[0]:\n com_s.append(com)\n\nprint(len(com_s))", "N = int(input())\n_M = [] \n_A = [] \n_R = [] \n_C = [] \n_H = [] \n\nfor i in range(N):\n x = input()\n if x[0] == 'M':\n _M.append(x)\n elif x[0] == 'A':\n _A.append(x)\n elif x[0] == 'R':\n _R.append(x)\n elif x[0] == 'C':\n _C.append(x)\n elif x[0] == 'H':\n _H.append(x)\n\nm = len(_M)\na = len(_A)\nr = len(_R)\nc = len(_C)\nh = len(_H)\n\nx = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h\n\nprint(x)\n"]
['Runtime Error', 'Accepted']
['s017946293', 's869765064']
[3060.0, 10208.0]
[17.0, 165.0]
[355, 465]
p03425
u267325300
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['from functools import reduce\nfrom itertools import combinations\nN = int(input())\nS = {"M": [], "A": [], "R": [], "C": [], "H": []}\nfor _ in range(N):\n i = input()\n head = i[0]\n if head == "M":\n S["M"].append(i)\n elif head == "A":\n S["A"].append(i)\n elif head == "R":\n S["R"].append(i)\n elif head == "C":\n S["C"].append(i)\n elif head == "H":\n S["H"].append(i)\nresult = [len(S[head]) for head in list("MARCH") if len(S[head]) != 0]\n\nans = sum([reduce(lambda x, y: x * y, list(combinations(result, 3))[i])\n for i in range(len(result))])\nprint(ans)\n', 'from functools import reduce\nfrom itertools import combinations\nN = int(input())\nS = {"M": set([]), "A": set([]), "R": set([]), "C": set([]), "H": set([])}\nfor _ in range(N):\n i = input()\n head = i[0]\n if head == "M":\n S["M"].add(i)\n elif head == "A":\n S["A"].add(i)\n elif head == "R":\n S["R"].add(i)\n elif head == "C":\n S["C"].add(i)\n elif head == "H":\n S["H"].add(i)\nresult = [len(S[head]) for head in list("MARCH") if len(S[head]) != 0]\n\nans = sum([reduce(lambda x, y: x * y, list(combinations(result, 3))[i])\n for i in range(len(result))])\nprint(ans)\n', 'from functools import reduce\nfrom itertools import combinations\nN = int(input())\nS = {"M": [], "A": [], "R": [], "C": [], "H": []}\nfor _ in range(N):\n i = input()\n head = i[0]\n if head == "M":\n S["M"].append(i)\n elif head == "A":\n S["A"].append(i)\n elif head == "R":\n S["R"].append(i)\n elif head == "C":\n S["C"].append(i)\n elif head == "H":\n S["H"].append(i)\ncounter = [len(S[head]) for head in list("MARCH") if len(S[head]) != 0]\ncombs = list(combinations(counter, 3))\nans = sum([reduce(lambda x, y: x * y, e) for e in combs])\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s122872997', 's908290664', 's924053957']
[10724.0, 14812.0, 10720.0]
[175.0, 203.0, 176.0]
[611, 621, 595]
p03425
u273038590
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['n=int(input())\ns=list(input() for i in range(n))\nm=[]\na=[]\nr=[]\nc=[]\nh=[]\nans=1\nfor i in range(n):\n if s[i][0] == "M" and not s[i] in m:\n m.append(s[i])\n elif s[i][0] == "A" and not s[i] in a:\n a.append(s[i])\n elif s[i][0] == "R" and not s[i] in r:\n r.append(s[i])\n elif s[i][0] == "C" and not s[i] in c:\n c.append(s[i])\n elif s[i][0] == "H" and not s[i] in h:\n h.append(s[i])\nnum=len(m)+len(a)+len(r)+len(c)+len(h)\nif num == 0:\n print(0)\nelse:\n lis = list(len(m),len(a),len(r),len(c),len(h))\n for i in range(5):\n if lis[i]>0:\n ans = ans*lis[i] \n print(ans)', 'import math\nn=int(input())\ns=list(input() for i in range(n))\nm=[]\na=[]\nr=[]\nc=[]\nh=[]\nfor i in range(n):\n if s[i][0] == "M" and not s[i] in m:\n m.append(s[i])\n elif s[i][0] == "A" and not s[i] in a:\n a.append(s[i])\n elif s[i][0] == "R" and not s[i] in r:\n r.append(s[i])\n elif s[i][0] == "C" and not s[i] in c:\n c.append(s[i])\n elif s[i][0] == "H" and not s[i] in h:\n h.append(s[i])\nnum = len(m)+len(a)+len(r)+len(c)+len(h)\nprint(math.factorial(num)/(math.factorial(3)*math.factorial(num)))', 'import math\nn=int(input())\ns=list(input() for i in range(n))\nm=[]\na=[]\nr=[]\nc=[]\nh=[]\nans=1\nfor i in range(n):\n if s[i][0] == "M" and not s[i] in m:\n m.append(s[i])\n elif s[i][0] == "A" and not s[i] in a:\n a.append(s[i])\n elif s[i][0] == "R" and not s[i] in r:\n r.append(s[i])\n elif s[i][0] == "C" and not s[i] in c:\n c.append(s[i])\n elif s[i][0] == "H" and not s[i] in h:\n h.append(s[i])\nnum=len(m)+len(a)+len(r)+len(c)+len(h)\nif num == 0:\n print(0)\nelse:\n lis = list(len(m),len(a),len(r),len(c),len(h))\n ans = ans*lis[i] for i in range(5)\n print(ans)', 'm=[]\na=[]\nr=[]\nc=[]\nh=[]\nans=1\nfor i in range(n):\n if s[i][0] == "M" and not s[i] in m:\n m.append(s[i])\n elif s[i][0] == "A" and not s[i] in a:\n a.append(s[i])\n elif s[i][0] == "R" and not s[i] in r:\n r.append(s[i])\n elif s[i][0] == "C" and not s[i] in c:\n c.append(s[i])\n elif s[i][0] == "H" and not s[i] in h:\n h.append(s[i])\nnum=len(m)+len(a)+len(r)+len(c)+len(h)\nif num == 0:\n print(0)\nelse:\n lis = list(len(m),len(a),len(r),len(c),len(h))\n for i in range(5):\n ans = ans*lis[i] \n print(ans)', 'n=int(input())\ns=list(input() for i in range(n))\nmc=ac=rc=cc=hc=0\ncnt=0\nfor i in range(n):\n if s[i][0] == "M":\n mc+=1\n elif s[i][0] == "A":\n ac+=1\n elif s[i][0] == "R":\n rc+=1\n elif s[i][0] == "C":\n cc+=1\n elif s[i][0] == "H":\n hc+=1\nlis = [mc,ac,rc,cc,hc]\nif sum(lis) == 0:\n print(0)\nelse:\n for i in range(5):\n for j in range(i+1,5):\n for k in range(j+1,5):\n cnt+=lis[i]*lis[j]*lis[k]\n print(cnt)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s105433474', 's408115642', 's464147436', 's598716921', 's531738043']
[10164.0, 10012.0, 3064.0, 3064.0, 9764.0]
[2112.0, 2104.0, 17.0, 17.0, 189.0]
[637, 540, 614, 563, 489]
p03425
u276204978
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import numpy as np\nfrom itertools\nfrom functools import reduce\nfrom collections import defaultdict\n\nN = int(input())\nd = defaultdict(int)\nfor i in range(N):\n c = input()\n if c[0] in ('M', 'A', 'R', 'C', 'H'):\n d[c[0]] += 1\n\nl = len(d)\nif l < 3:\n print(0)\nelse:\n ans = 0\n for l in list(itertools.combinations(d.values(), 3)):\n ans += reduce(np.multiply, l)\n print(ans)", "import numpy as np\nfrom itertools import combinations\nfrom functools import reduce\nfrom collections import defaultdict\n\nN = int(input())\nd = defaultdict(int)\nfor i in range(N):\n c = input()\n if c[0] in ('M', 'A', 'R', 'C', 'H'):\n d[c[0]] += 1\n\nl = len(d)\nif l < 3:\n print(0)\nelse:\n ans = 0\n for l in list(combinations(d.values(), 3)):\n ans += reduce(np.multiply, l)\n print(ans)"]
['Runtime Error', 'Accepted']
['s759112335', 's911270013']
[8756.0, 27108.0]
[21.0, 225.0]
[399, 409]
p03425
u289288647
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N = int(input())\nname = [0]*5\nans = 0\nfor i in range(N):\n a = input()\n if a[0] == 'M': name[0] += 1\n elif a[0] == 'A': name[1] += 1\n elif a[0] == 'R': name[2] += 1\n elif a[0] == 'C': name[3] += 1\n elif a[0] == 'H': name[4] += 1\nif sum(name) < 3:\n print(0)\nelse:\n for i in combinations(name, 3):\n ans += i[0]*i[1]*i[2]\n print(ans)\n\n", "from itertools import combinations\nN = int(input())\nname = [0]*5\nans = 0\nfor i in range(N):\n a = input()\n if a[0] == 'M': name[0] += 1\n elif a[0] == 'A': name[1] += 1\n elif a[0] == 'R': name[2] += 1\n elif a[0] == 'C': name[3] += 1\n elif a[0] == 'H': name[4] += 1\nif sum(name) < 3:\n print(0)\nelse:\n for i in combinations(name, 3):\n ans += i[0]*i[1]*i[2]\n print(ans)\n\n"]
['Runtime Error', 'Accepted']
['s968775339', 's750259471']
[9132.0, 9200.0]
[153.0, 153.0]
[365, 400]
p03425
u301624971
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import itertools\ndef myAnswer(N:int,S:list) -> int:\n ans = 0\n dic = {}\n for s in S:\n if(s[0] in dic.keys()):\n dic[s[0]] += 1\n else:\n dic[s[0]] = 1\n for c in itertools.combinations(dic.values(),3):\n ans += c[0]*c[1]*c[2]\n \n return ans\n\ndef modelAnswer():\n return\ndef main():\n N = int(input())\n S = [input() for _ in range(N)]\n print(myAnswer(N,S[:]))\nif __name__ == '__main__':\n main()", 'import itertools\ndef myAnswer(N:int,S:list) -> int:\n ans = 0\n dic = {"M":0,"A":0,"R":0,"C":0,"H":0}\n for s in S:\n if(s[0] in dic.keys()):\n dic[s[0]] += 1\n for c in itertools.combinations(dic.values(),3):\n ans += c[0]*c[1]*c[2]\n return ans\n\ndef modelAnswer():\n return\ndef main():\n N = int(input())\n S = [input() for _ in range(N)]\n print(myAnswer(N,S[:]))\nif __name__ == \'__main__\':\n main()']
['Wrong Answer', 'Accepted']
['s940624768', 's578471999']
[10540.0, 10540.0]
[168.0, 168.0]
[440, 427]
p03425
u305366205
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["s = [input() for _ in range(n)]\nprefix = ['M', 'A', 'R', 'C', 'H']\ncnt = [0] * 5\nans = 0\nfor i in range(n):\n for j in range(5):\n if s[i][0] == prefix[j]:\n cnt[j] += 1\nfor i in range(2 ** 5):\n flag = [False] * 5\n for j in range(5):\n if (i >> j) & 1:\n flag[j] = True\n if flag.count(True) == 3:\n tmp = 1\n for k in range(5):\n if flag[k]:\n tmp *= cnt[k]\n ans += tmp\nprint(ans)", "n = int(input())\ns = [input() for _ in range(n)]\nprefix = ['M', 'A', 'R', 'C', 'H']\ncnt = [0] * 5\nans = 0\nfor i in range(n):\n for j in range(5):\n if s[i][0] == prefix[j]:\n cnt[j] += 1\nfor i in range(2 ** 5):\n flag = [False] * 5\n for j in range(5):\n if (i >> j) & 1:\n flag[j] = True\n if flag.count(True) == 3:\n tmp = 1\n for k in range(5):\n if flag[k]:\n tmp *= cnt[k]\n ans += tmp\nprint(ans)"]
['Runtime Error', 'Accepted']
['s833970256', 's649200801']
[3064.0, 9752.0]
[17.0, 250.0]
[466, 483]
p03425
u308241789
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["N = int(input())\nA = []\nfor i in range(N):\n A.append(input())\nk = 0\nc = [ 0,0,0,0,0]\nfor i in A:\n if i[0] == 'm':\n c[0] += 1\n if i[0] == 'a':\n c[1] += 1\n if i[0] == 'r':\n c[2] += 1\n if i[0] == 'c':\n c[3] += 1\n if i[0] == 'h':\n c[4] += 1\n\nprint(c)\nif not c.count(0) >= 3:\n k += c[0] * c[1] * c[2] + c[0] * c[1] * c[3] + c[0] * c[1] * c[4] + c[0] * c[2] * c[3] + c[0] * c[2] * c[4] + c[0] * c[3] * c[4] + c[1] * c[2] * c[3] + c[1] * c[2] * c[4] + c[1] * c[3] * c[4] + c[2] * c[3] * c[4] \n\nprint(k)", 'N = int(input())\nA = [i for i in range(N) input()]\nk = 0\nc = [ 0,0,0,0,0]\nfor i in A:\n if i[0] == m:\n c[0] += 1\n if i[0] == a:\n c[1] += 1\n if i[0] == r:\n c[2] += 1\n if i[0] == c:\n c[3] += 1\n if i[0] == h:\n c[4] += 1\n\nif c.count(0) >= 3:\n k += c[0] * c[1] * c[2] + c[0] * c[1] * c[3] + c[0] * c[1] * c[4] + c[0] * c[2] * c[3] + c[0] * c[2] * c[4] + c[0] * c[3] * c[4] + c[1] * c[2] * c[3] + c[1] * c[2] * c[4] + c[1] * c[3] * c[4] + c[2] * c[3] * c[4] \n\nprint(k)', "N = int(input())\nA = []\nfor i in range(N):\n A.append(input())\nk = 0\nc = [ 0,0,0,0,0]\nfor i in A:\n if i[0] == 'M':\n c[0] += 1\n if i[0] == 'A':\n c[1] += 1\n if i[0] == 'R':\n c[2] += 1\n if i[0] == 'C':\n c[3] += 1\n if i[0] == 'H':\n c[4] += 1\n\nprint(c)\nif not c.count(0) >= 3:\n k += c[0] * c[1] * c[2] + c[0] * c[1] * c[3] + c[0] * c[1] * c[4] + c[0] * c[2] * c[3] + c[0] * c[2] * c[4] + c[0] * c[3] * c[4] + c[1] * c[2] * c[3] + c[1] * c[2] * c[4] + c[1] * c[3] * c[4] + c[2] * c[3] * c[4] \n\nprint(k)", "N = int(input())\nA = []\nfor i in range(N):\n A.append(input())\nk = 0\nc = [ 0,0,0,0,0]\nfor i in A:\n if i[0] == 'M':\n c[0] += 1\n if i[0] == 'A':\n c[1] += 1\n if i[0] == 'R':\n c[2] += 1\n if i[0] == 'C':\n c[3] += 1\n if i[0] == 'H':\n c[4] += 1\n\n\nif not c.count(0) >= 3:\n k += c[0] * c[1] * c[2] + c[0] * c[1] * c[3] + c[0] * c[1] * c[4] + c[0] * c[2] * c[3] + c[0] * c[2] * c[4] + c[0] * c[3] * c[4] + c[1] * c[2] * c[3] + c[1] * c[2] * c[4] + c[1] * c[3] * c[4] + c[2] * c[3] * c[4] \n\nprint(k)"]
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s061975952', 's220385003', 's292189147', 's547471288']
[9780.0, 2940.0, 9776.0, 9772.0]
[172.0, 17.0, 185.0, 183.0]
[519, 482, 519, 511]
p03425
u318029285
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N = int(input())\ns = [0] * N\nd = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}\nfor i in range(N):\n s[i] = input()\n if s[i][0] == "M":\n d[\'M\'] += 1\n elif s[i][0] == "A":\n d[\'A\'] += 1\n elif s[i][0] == "R":\n d[\'R\'] += 1\n elif s[i][0] == "C":\n d[\'C\'] += 1\n elif s[i][0] == "H":\n d[\'H\'] += 1\n\ntotal = 1\ncount = 0\ndel_keys = []\nfor k, v in d.items():\n if v == 0:\n del_keys.append(k)\n else:\n total *= v\n count += 1\n\nprint(d)\nfor key in del_keys:\n del d[key]\n\nif count < 3:\n print(0)\n exit()\nelif count == 3:\n print(total)\n exit()\nelif count == 4:\n ans = 0\n for k, v in d.items():\n ans += total / v\n print(int(ans))\n exit()\nelif count == 5:\n ans = 0\n d_lst = list(d)\n for i in range(4):\n for j in range(i+1, 5):\n ans += total / (d_lst[i] * d_lst[j])\n print(int(ans))\n', "from collections import Counter\nfrom itertools import combinations\n\nn = int(input())\ns = [input()[0] for _ in range(n)]\nlc = Counter(s)\nprint(lc)\n\ncon = []\nfor c in 'MARCH':\n if c in lc:\n con.append(lc[c])\n\nans = 0\nfor a, b, c in combinations(con, 3):\n ans += a * b * c\n\nprint(ans)\n", "from collections import Counter\nfrom itertools import combinations\n\nn = int(input())\ns = [input()[0] for _ in range(n)]\nlc = Counter(s)\n\ncon = []\nfor c in 'MARCH':\n if c in lc:\n con.append(lc[c])\n\nans = 0\nfor a, b, c in combinations(con, 3):\n ans += a * b * c\n\nprint(ans)\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s667085785', 's980630678', 's326425579']
[9716.0, 4224.0, 4224.0]
[192.0, 146.0, 140.0]
[898, 295, 285]
p03425
u340781749
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["from collections import Counter\nfrom itertools import combinations\n\nn = int(input())\nl = Counter(input()[0] for _ in range(n))\ncon = [l[c] for c in 'MARCH' if c in l]\nprint(sum(a * b * c) for a, b, c in combinations(con, 3))\n", "from collections import Counter\nfrom itertools import combinations\n\nn = int(input())\nl = Counter(input()[0] for _ in range(n))\ncon = [l[c] for c in 'MARCH' if c in l]\nprint(sum(a * b * c for a, b, c in combinations(con, 3)))\n"]
['Wrong Answer', 'Accepted']
['s191668372', 's269363981']
[3316.0, 3316.0]
[166.0, 161.0]
[225, 225]
p03425
u350049649
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N=int(input())\nS=set()\n\nfor i in range(N):\n s=input()\n if s[0] in [M,A,R,C,H]:\n S.add(s)\n\nL=len(S)\n\nprint(L*(L-1)*(L-2)//6)', "N=int(input())\nS=set()\n\nfor i in range(N):\n s=input()\n if s[0] in ['M','A','R','C','H']:\n S.add(s)\n\nL=len(S)\n\nprint(L*(L-1)*(L-2)//6)\n", "N=int(input())\nchars=['M','A','R','C','H']\ndict={}\nfor c in chars:\n dict[c]=0\n \nans=0\n \nfor i in range(N):\n s=input()\n if (s[0] in chars):\n dict[s[0]]+=1\n\nL=list(dict.values())\n \nfor i in range(2**5):\n usedchars=[]\n for j in range(5):\n if i>>j&1==1:\n usedchars.append(L[j])\n \n if len(usedchars)==3:\n ans+=usedchars[0]*usedchars[1]*usedchars[2]\n\nprint(ans)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s256175522', 's755669638', 's276853698']
[3060.0, 14316.0, 3064.0]
[18.0, 174.0, 173.0]
[128, 139, 383]
p03425
u365858785
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['a=int(input())\nlis=[input()[0] for i in range(a)]\nlis2=[0,0,0,0,0]\ndellist=[]\nfor m in lis:\n if m=="M":\n lis2[0]+=1\n elif m=="A":\n lis2[1]+=1\n elif m=="R":\n lis2[2]+=1\n elif m=="C":\n lis2[3]+=1\n elif m=="H":\n lis2[4]+=1\na=sum(lis2)\nprint(lis2,a)\ndef c3(a):\n return a*(a-1)*(a-2)/6\ndef c2(a):\n return a*(a-1)/2\nans=c3(a)\nfor i in lis2:\n ans=ans-c3(i)-c2(i)*(a-i)\nprint(int(ans))\n ', 'a=int(input())\nlis=[input()[0] for i in range(a)]\nlis2=[0,0,0,0,0]\ndellist=[]\nfor m in lis:\n if m=="M":\n lis2[0]+=1\n elif m=="A":\n lis2[1]+=1\n elif m=="R":\n lis2[2]+=1\n elif m=="C":\n lis2[3]+=1\n elif m=="H":\n lis2[4]+=1\na=sum(lis2)\ndef c3(a):\n return a*(a-1)*(a-2)/6\ndef c2(a):\n return a*(a-1)/2\nans=c3(a)\nfor i in lis2:\n ans=ans-c3(i)-c2(i)*(a-i)\nprint(int(ans))\n ']
['Wrong Answer', 'Accepted']
['s616667859', 's663124775']
[3992.0, 3888.0]
[156.0, 155.0]
[404, 390]
p03425
u367130284
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['from itertools import*;print(sum(p*q*r for p,q,r in combinations([list(s[0]for s in open(0).readlines()).count(s)for s in"MARCH"],3)))', 'import itertools as i,collections as c;print(sum(p*q*r for p,q,r in i.combinations(c.Counter(s[0]*(s[0]in"MARCH")for s in open(0).readlines()[1:]).values(),3)))\n', 'from itertools import*;print(sum(p*q*r for p,q,r in list(combinations([len(list(v))for k,v in groupby(sorted(s[0]for s in open(0).readlines()[1:]))],3))))', 'from itertools import*\nn,*a=open(0).read().split()\nprint(sum(p*q*r for p,q,r in combinations(map([i[0]for i in a].count,"MARCH"),3)))']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s791966041', 's828055897', 's928514879', 's969276548']
[10748.0, 11004.0, 10664.0, 10992.0]
[36.0, 55.0, 56.0, 41.0]
[134, 161, 154, 133]
p03425
u368796742
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['n = int(input())\nl = [0]*5\nfor i in range(n):\n if input()[0] == "M":\n l[0] += 1\n elif input()[0] == "A":\n l[1] += 1\n elif input()[0] == "R":\n l[2] += 1\n elif input()[0] == "C":\n l[3] += 1\n elif input()[0] == "H":\n l[4] += 1\nans = 0\nfor i in range(3):\n for j in range(i+1,4):\n for k in range(j+1,5):\n ans += l[i]*l[j]*l[k]\nprint(ans)\n \n ', 'n = int(input())\nl = [0]*5\nfor i in range(n):\n a = input()\n if a[0] == "M":\n l[0] += 1\n elif a[0] == "A":\n l[1] += 1\n elif a[0] == "R":\n l[2] += 1\n elif a[0] == "C":\n l[3] += 1\n elif a[0] == "H":\n l[4] += 1\n \n \nans = 0\nfor i in range(3):\n for j in range(i+1,4):\n for k in range(j+1,5):\n ans += l[i]*l[j]*l[k]\nprint(ans)\n \n \n']
['Runtime Error', 'Accepted']
['s475500459', 's776933343']
[3064.0, 3064.0]
[161.0, 168.0]
[367, 406]
p03425
u375500286
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['n=int(input())\ns={"M":0,"A":0,"R":0,"C":0,"H":0}\nfor i in range(n):\n v=input()\n if v[0] in s:\n s[v[0]]+=1\nl=s.values()\nsum=0\nfor a in range(5):\n for b in range(a+1,5):\n for c in range(b+1,5):\n sum+=l[a]*l[b]*l[c] \nprint(sum)', 'n=int(input())\ns={"M":0,"A":0,"R":0,"C":0,"H":0}\nfor i in range(n):\n v=input()\n if v[0] in s:\n s[v[0]]+=1\nl=list(s.values())\nprint(l)\nsum=0\nfor a in range(5):\n for b in range(a+1,5):\n for c in range(b+1,5):\n sum+=l[a]*l[b]*l[c] \nprint(sum)\n', 'n=int(input())\n\ns={"M":0,"A":0,"R":0,"C":0,"H":0}\n\n\nfor i in range(n):\n v=input()\n if v[0] in s:\n s[v[0]]+=1\nsum=0\nfor a in s.keys():\n for b in s.keys():\n for c in s.keys():\n if a==b or a==c or b==c:\n continue\n sum+=s[a]*s[b]*s[c]\n \nprint(sum)', 'n=int(input())\ns={"M":0,"A":0,"R":0,"C":0,"H":0}\nfor i in range(n):\n v=input()\n if v[0] in s:\n s[v[0]]+=1\nl=list(s.values())\nans=0\nfor a in range(5):\n for b in range(a+1,5):\n for c in range(b+1,5):\n ans+=l[a]*l[b]*l[c] \nprint(ans)\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s024640891', 's122223341', 's876972281', 's002893175']
[3064.0, 3064.0, 3188.0, 3064.0]
[167.0, 174.0, 173.0, 164.0]
[266, 282, 313, 273]
p03425
u388323466
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["# n = int(input())\n# arr = []\n\n# arr += [list(input())]\nn = 5\narr = [['Z','H'],['Z','N'],['Z','A'],['Z','O'],['Z','I']]\n\nMARCH = [0] * 5 \n \nfor j in range(n):\n if arr[j][0] == 'M':\n MARCH[0] += 1\n elif arr[j][0] == 'A':\n MARCH[1] += 1\n elif arr[j][0] == 'R':\n MARCH[2] += 1\n elif arr[j][0] == 'C':\n MARCH[3] += 1\n elif arr[j][0] == 'H':\n MARCH[4] += 1\n\ndef C(a,b):\n aa = 1\n bb = 1\n for k in range(a-b+1, a+1):\n aa *= k\n for l in range(1, b+1):\n bb *= l\n return int(aa/bb)\n \nans = C(sum(MARCH), 3)\n\nfor m in range(5):\n if MARCH[m] == 2:\n ans -= C(sum(MARCH)-MARCH[m],1)\n elif MARCH[m] >= 3:\n ans -= C(MARCH[m],2) * C(sum(MARCH)-MARCH[m],1)\n ans -= C(MARCH[m],3)\n\nprint(ans)\n ", "n = int(input())\narr = []\nfor i in range(n):\n arr += [list(input())]\n\nMARCH = [0] * 5 \n \nfor j in range(n):\n if arr[j][0] == 'M':\n MARCH[0] += 1\n elif arr[j][0] == 'A':\n MARCH[1] += 1\n elif arr[j][0] == 'R':\n MARCH[2] += 1\n elif arr[j][0] == 'C':\n MARCH[3] += 1\n elif arr[j][0] == 'H':\n MARCH[4] += 1\n\ndef C(a,b):\n aa = 1\n bb = 1\n for k in range(a-b+1, a+1):\n aa *= k\n for l in range(1, b+1):\n bb *= l\n return int(aa/bb)\n \nans = C(sum(MARCH), 3)\n\nfor m in range(5):\n if MARCH[m] == 2:\n ans -= C(sum(MARCH)-MARCH[m],1)\n elif MARCH[m] >= 3:\n ans -= C(MARCH[m],2) * C(sum(MARCH)-MARCH[m],1)\n ans -= C(MARCH[m],3)\n\nprint(ans)\n "]
['Wrong Answer', 'Accepted']
['s948716802', 's341056719']
[3064.0, 20304.0]
[18.0, 316.0]
[820, 748]
p03425
u401686269
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["from collections import defaultdict\nfrom itertools import combinations\n\nN=int(input())\nS=[input() for _ in range(N)]\n\nc = defaultdict(int)\n\nfor i in range(N):\n if S[i][0] in {'M','A','R','C','H'}:\n c[S[i][0]] += 1\n\nif len(c) < 3:\n print(0)\n exit()\n\nif len(c)==3:\n ans=0\n for k in c.keys():\n ans *= c[k]\n print(ans)\n exit()\n\nelse:\n ans = 0\n l = len(c)\n keys = list(c.keys())\n for C in combinations(range(l),3):\n tmp = c[keys[C[0]]]*c[keys[C[1]]]*c[keys[C[2]]]\n ans += tmp\n print(ans)", "from collections import defaultdict\nfrom itertools import combinations\n\nN=int(input())\nS=[input() for _ in range(N)]\n\nc = defaultdict(int)\n\nfor i in range(N):\n if S[i][0] in {'M','A','R','C','H'}:\n c[S[i][0]] += 1\n\nif len(c) < 3:\n print(0)\n exit()\n\nif len(c)==3:\n ans=1\n for k in c.keys():\n ans *= c[k]\n print(ans)\n exit()\n\nelse:\n ans = 0\n l = len(c)\n keys = list(c.keys())\n for C in combinations(range(l),3):\n tmp = c[keys[C[0]]]*c[keys[C[1]]]*c[keys[C[2]]]\n ans += tmp\n print(ans)"]
['Wrong Answer', 'Accepted']
['s289957164', 's332755646']
[16408.0, 16472.0]
[158.0, 149.0]
[506, 506]
p03425
u411923565
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["#60 C - March\nimport collections\nN = int(input())\nS = [input() for _ in range(N)]\nS = [s[0] for s in S if s[0] == 'M' or s[0] == 'A' or s[0] == 'R' or s[0] == 'C' or s[0] == 'H']\n\ncnt = collections.Counter(S)\nn = len(cnt)\n\nans = ((n*(n-1)*(n-2))//(3*2))\nif ans == 1:\n for i in cnt.values():\n if i>=2:\n ans * i\nelse:\n for i in cnt.values():\n if i>=2:\n ans += (n- (((n-1)*(n-2)*(n-3))//(3*2)))*(i-1)\nprint(ans)", "#60 C - March\nimport collections\nimport itertools\nN = int(input())\nS = [input() for _ in range(N)]\nS = [s[0] for s in S if s[0] == 'M' or s[0] == 'A' or s[0] == 'R' or s[0] == 'C' or s[0] == 'H']\n\ncnt = collections.Counter(S)\n\ncomb = itertools.combinations(cnt.keys(),3)\n\nans = 0\nfor a,b,c in comb:\n ans += cnt[a]*cnt[b]*cnt[c]\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s571880291', 's778441072']
[16992.0, 17196.0]
[146.0, 148.0]
[450, 341]
p03425
u413165887
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['from collections import Counter\nn = int(input())\ns = [input() for _ in range(n)]\nname_count = [0 for _ in range(5)]\nfor i in s:\n if i[0] == "M":\n name_count[0] += 1\n elif i[0] == "A":\n name_count[1] += 1\n elif i[0] == "R":\n name_count[2] += 1\n elif i[0] == "C":\n name_count[3] += 1\n elif i[0] == "H":\n name_count[4] += 1\n\nresult = 0\nfor i in range(5):\n result += name_count[i]*name_count[(i+1)%5]*name_count[(i+2)%5]\nprint(result)', 'from collections import Counter\nn = int(input())\ns = [input() for _ in range(n)]\nname_count = [0 for _ in range(5)]\nfor i in s:\n if i[0] == "M":\n name_count[0] += 1\n elif i[0] == "A":\n name_count[1] += 1\n elif i[0] == "R":\n name_count[2] += 1\n elif i[0] == "C":\n name_count[3] += 1\n elif i[0] == "H":\n name_count[4] += 1\n\nresult = 0\nfor s in range(3):\n for t in range(s+1, 4):\n for u in range(t+1, 5):\n result += name_count[s]*name_count[t]*name_count[u]\nprint(result)']
['Wrong Answer', 'Accepted']
['s112658041', 's858277645']
[10112.0, 10108.0]
[175.0, 167.0]
[483, 539]
p03425
u417835834
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["import collections\nN = int(input())\na = ['']*N\nfor i in range(N):\n a[i] = list(input())[0]\nprint(a)\nc_list = [0]*5\nMARCH = ['M','A','R','C','H']\nc_list = [a.count(i) for i in MARCH]\nprint(c_list)\nsummation = 0\nfor i in range(3):\n for j in range(i+1,4):\n for k in range(j+1,5):\n summation += c_list[i]*c_list[j]*c_list[k]\nprint(summation)", "import collections\nN = int(input())\na = ['']*N\nfor i in range(N):\n a[i] = list(input())[0]\nc_list = [0]*5\nMARCH = ['M','A','R','C','H']\nc_list = [a.count(i) for i in MARCH]\nsummation = 0\nfor i in range(3):\n for j in range(i+1,4):\n for k in range(j+1,5):\n summation += c_list[i]*c_list[j]*c_list[k]\nprint(summation)"]
['Wrong Answer', 'Accepted']
['s017613072', 's744396944']
[5616.0, 4084.0]
[222.0, 225.0]
[361, 338]
p03425
u426108351
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N = int(input())\nS = []\nfor i in range(N):\n S.append(input())\nmarch = [0, 0, 0, 0, 0]\n\nfor i in range(N):\n if S[i][0] == "M":\n march[0] += 1\n if S[i][0] == "A":\n march[1] += 1\n if S[i][0] == "R":\n march[2] += 1\n if S[i][0] == "C":\n march[3] += 1\n if S[i][0] == "H":\n march[4] += 1\nans = 0\nprint(march)\nfor i in range(5):\n for j in range(i+1, 5):\n for k in range(j+1, 5):\n ans += march[i] * march[j] * march[k]\nprint(ans)\n', 'N = int(input())\nS = []\nfor i in range(N):\n S.append(input())\nmarch = [0, 0, 0, 0, 0]\n\nfor i in range(N):\n if S[i][0] == "M":\n march[0] += 1\n if S[i][0] == "A":\n march[1] += 1\n if S[i][0] == "R":\n march[2] += 1\n if S[i][0] == "C":\n march[3] += 1\n if S[i][0] == "H":\n march[4] += 1\nans = 0\nprint(march)\nfor i in range(5):\n for j in range(i+1, 5):\n for k in range(j+1, 5):\n ans += march[i] * march[j] * march[k]\nprint(ans)\n', 'N = int(input())\nS = []\nfor i in range(N):\n S.append(input())\nmarch = [0, 0, 0, 0, 0]\n\nfor i in range(N):\n if S[i][0] == "M":\n march[0] += 1\n if S[i][0] == "A":\n march[1] += 1\n if S[i][0] == "R":\n march[2] += 1\n if S[i][0] == "C":\n march[3] += 1\n if S[i][0] == "H":\n march[4] += 1\nans = 0\nfor i in range(5):\n for j in range(i+1, 5):\n for k in range(j+1, 5):\n ans += march[i] * march[j] * march[k]\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s790133078', 's942412057', 's732815511']
[9772.0, 9772.0, 9772.0]
[200.0, 202.0, 193.0]
[495, 495, 482]
p03425
u440129511
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["from itertools import combinations as c\nn=int(input())\ns=[input() for _ in range(n)]\nm=[m1 for m1 in s if s.startswith('M')]\na=[a1 for a1 in s if s.startswith('A')]\nr=[r1 for r1 in s if s.startswith('R')]\nc=[c1 for c1 in s if s.startswith('C')]\nh=[h1 for h1 in s if s.startswith('H')]\nmarch=[len(m),len(a),len(r),len(c),len(h)]\nprint(sum(i*j*k for i, j, k in c(march, 3)))", "from itertools import combinations as c\nn=int(input())\ns=[input() for _ in range(n)]\nmarch=[0]*5\nfor i in range(n):\n if s[i][0]=='M':march[0]+=1\n elif s[i][0]=='A':march[1]+=1\n elif s[i][0]=='R':march[2]+=1\n elif s[i][0]=='C':march[3]+=1\n elif s[i][0]=='H':march[4]+=1\nprint(sum(i*j*k for i, j, k in c(march, 3)))"]
['Runtime Error', 'Accepted']
['s500804036', 's204830307']
[9776.0, 9776.0]
[137.0, 174.0]
[372, 328]
p03425
u444856278
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
['N = int(input())\nS = {"M":0,"A":0,"R":0,"C":0,"H":0}\nfor i in range(N):\n s = input()\n if s[0] in ["M","A","R","C","H"]\n S[s[0]] += 1\n\nprint(S["M"] * S["A"] * (S["R"]+S["C"]+S["H"]) + S["M"] * S["R"] * (S["C"] + S["H"]) + S["M"] * S["C"] * S["H"] + S["A"] * S["R"] * (S["C"] + S["H"]) + S["C"] * S["A"] * S["H"] + S["R"] * S["C"] * S["H"])\n', 'N = int(input())\nS = {"M":0,"A":0,"R":0,"C":0,"H":0}\nfor i in range(N):\n s = input()\n if s[0] in ["M","A","R","C","H"]:\n S[s[0]] += 1\n\nprint(S["M"] * S["A"] * (S["R"] + S["C"] + S["H"])\n + S["M"] * S["R"] * (S["C"] + S["H"])\n + S["M"] * S["C"] * S["H"]\n + S["A"] * S["R"] * (S["C"] + S["H"])\n + S["A"] * S["C"] * S["H"]\n + S["R"] * S["C"] * S["H"])\n']
['Runtime Error', 'Accepted']
['s828931161', 's680705272']
[2940.0, 3064.0]
[17.0, 175.0]
[353, 387]
p03425
u451017206
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n = int(input())\nl = ['M','A','R','C','H']\nm = []\na = []\nr = []\nc = []\nh = []\nfor i in range(n):\n s = input()\n if not s[0] in l: continue\n if s[0] == 'M':\n m.append(s)\n elif s[0] == 'A':\n a.append(s)\n elif s[0] == 'R':\n r.append(s)\n elif s[0] == 'C':\n c.append(s)\n else:\n h.append(s)\n\nn = sum([len(i) for i in [m,a,r,c,h]])\nall = n * (n - 1) * (n - 2) // 6\nprint(r)\nfor t in [m,a,r,c,h]:\n i = len(t)\n if i >= 2:\n k = i * (i -1) // 2\n all -= k*(n-2)\n if i >= 3:\n k = i * (i - 1) * (i - 2) // 6\n all -= k\nprint(all)", "n = int(input())\nl = ['M','A','R','C','H']\nm = []\na = []\nr = []\nc = []\nh = []\nfor i in range(n):\n s = input()\n if not s[0] in l: continue\n if s[0] == 'M':\n m.append(s)\n elif s[0] == 'A':\n a.append(s)\n elif s[0] == 'R':\n r.append(s)\n elif s[0] == 'C':\n c.append(s)\n else:\n h.append(s)\n\nn = sum([len(i) for i in [m,a,r,c,h]])\nall = n * (n - 1) * (n - 2) // 6\nfor t in [m,a,r,c,h]:\n i = len(t)\n if i >= 3:\n k = i * (i - 1) * (i - 2) // 6\n all -= k\n if i >= 2:\n k = i * (i - 1) // 2\n all -= k * (n - i)\nprint(all)\n"]
['Wrong Answer', 'Accepted']
['s433250686', 's569569041']
[10612.0, 10228.0]
[183.0, 180.0]
[606, 603]
p03425
u470542271
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["n = int(input())\ns_ = [input() for i in range(n)]\n\ns_list = [0, 0, 0, 0, 0]\nfor i in range(n):\n if s_[i][0] == 'M':\n s_list[0] += 1\n elif s_[i][0] == 'A':\n s_list[1] += 1\n elif s_[i][0] == 'R':\n s_list[2] += 1\n elif s_[i][0] == 'C':\n s_list[3] += 1\n elif s_[i][0] == 'H':\n s_list[4] += 1\n\nimport math\ncounter = 0\ns_list_nonzero = []\nfor i in range(5):\n if s_list[i] != 0:\n counter += 1\n s_list_nonzero.append(s_list[i])\n\nif counter < 3:\n print(0)\nelif counter == 4:\n print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2] +\n s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[3] +\n s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[3] +\n s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[3])\nelif counter == 5:\n print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2] +\n s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[3] +\n s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[4] +\n s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[3] +\n s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[4] +\n s_list_nonzero[0] * s_list_nonzero[3] * s_list_nonzero[4] +\n s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[3] +\n s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[4] +\n s_list_nonzero[1] * s_list_nonzero[3] * s_list_nonzero[4] +\n s_list_nonzero[2] * s_list_nonzero[3] * s_list_nonzero[4])\n", "n = int(input())\ns_ = [input() for i in range(n)]\n\ns_list = [0, 0, 0, 0, 0]\nfor i in range(n):\n if s_[i][0] == 'M':\n s_list[0] += 1\n elif s_[i][0] == 'A':\n s_list[1] += 1\n elif s_[i][0] == 'R':\n s_list[2] += 1\n elif s_[i][0] == 'C':\n s_list[3] += 1\n elif s_[i][0] == 'H':\n s_list[4] += 1\n\nimport math\ncounter = 0\ns_list_nonzero = []\nfor i in range(5):\n if s_list[i] != 0:\n counter += 1\n s_list_nonzero.append(s_list[i])\n\nif counter < 3:\n print(0)\nelif counter == 3:\n print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2])\nelif counter == 4:\n print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2] +\n s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[3] +\n s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[3] +\n s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[3])\nelif counter == 5:\n print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2] +\n s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[3] +\n s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[4] +\n s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[3] +\n s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[4] +\n s_list_nonzero[0] * s_list_nonzero[3] * s_list_nonzero[4] +\n s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[3] +\n s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[4] +\n s_list_nonzero[1] * s_list_nonzero[3] * s_list_nonzero[4] +\n s_list_nonzero[2] * s_list_nonzero[3] * s_list_nonzero[4])\n"]
['Wrong Answer', 'Accepted']
['s843270487', 's398871270']
[9832.0, 9784.0]
[180.0, 174.0]
[1557, 1645]
p03425
u475675023
2,000
262,144
There are N people. The name of the i-th person is S_i. We would like to choose three people so that the following conditions are met: * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`. * There are no multiple people whose names begin with the same letter. How many such ways are there to choose three people, disregarding order? Note that the answer may not fit into a 32-bit integer type.
["from itertools import combinations\nn=int(input())\ns=[input()[0] for _ in range(n)]\na=[]\nfor i in ['M','A','R','C','H']:\n a+=[s.count(i)]\nprint(a)\nans=0\nfor i in combinations(a,3):\n ans+=i[0]*i[1]*i[2]\nprint(ans)", "from itertools import combinations\nn=int(input())\ns=[input()[0] for _ in range(n)]\na=[]\nfor i in ['M','A','R','C','H']:\n a+=[s.count(i)]\nans=0\nfor i in combinations(a,3):\n ans+=i[0]*i[1]*i[2]\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s410119233', 's321227338']
[3888.0, 3888.0]
[142.0, 141.0]
[213, 204]