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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03212 | u492605584 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import itertools\nimport copy as cp\nX = int(input())\nX_l = len(str(X))\nn = ['3','5','7']\ncomb = [n]\nall_comb = []\nall_ans = []\nif X < 357:\n print(0)\n\n#print(comb.append('a'))\nfor i in range(X_l - 3):\n tmp_comb = cp.copy(comb)\n for co in tmp_comb:\n for key in n:\n newco = cp.copy(co)\n newco.append(key)\n comb.append(newco)\nfor co in comb:\n for c in itertools.permutations(co, len(co)):\n all_comb.append(c)\n#print(all_comb) \nfor nums in list(set(all_comb)):\n num = int(''.join(nums))\n if num < X:\n print(num)\n all_ans.append(num)\nprint(len(all_ans))\n", "import itertools as t\n\nN = int(input())\n\nL = [ int(''.join(j)) for i in range(10) for j in t.product(['3','5','7'], repeat=i) if '3' in j and '5' in j and '7' in j]\nL = [i for i in L if i <= N]\nprint(len(L))\n"] | ['Wrong Answer', 'Accepted'] | ['s279889778', 's058401008'] | [1052660.0, 4340.0] | [2173.0, 38.0] | [630, 208] |
p03212 | u495678669 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["def dfs(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\nprint(dfs('0'))", "N = int(input())\n\ndef dfs(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\nprint(dfs('0'))"] | ['Runtime Error', 'Accepted'] | ['s192698666', 's934283871'] | [2940.0, 2940.0] | [17.0, 91.0] | [179, 197] |
p03212 | u504836877 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = int(input())\n\nN_str = str(N)\nn = len(N_str)\nnum = 0\nfor i in range(3,n):\n num += (3**i-3*2**i+3)\n\ndef number(x):\n List = []\n X = str(x)\n for i in range(len(X)):\n List.append(int(X[i]))\n a = List.count(3)\n b = List.count(5)\n c = List.count(7)\n if a>=1 and b>=1 and c>=1 and a+b+c==len(X):\n return True\n else:\n return False\n\nif N > 10**7:\n if int(N_str[0]) > 7:\n num += (3**n-3*2**n+3)\n c = N+1\n elif int(N_str[0]) > 5:\n num += (3**n-3*2**n+3)*2//3\n c =6*10**(n-1)+1\n elif int(N_str[0]) > 3:\n num += (3**n-3*2**n+3)//3\n c =4*10**(n-1)+1\n\n\nwhile c <= N:\n if number(c):\n num += 1\n c += 2\n\nprint(num)', 'N = int(input())\n\n\nList = []\nn = len(str(N))\nans = 0\nif n >= 3:\n if n > 3:\n for i in range(2,n-1):\n ans += (3**(i+1)-3*2**(i+1)+3)\n for j in range(n):\n if j == 0:\n List = [3*10**(n-1),5*10**(n-1),7*10**(n-1)]\n else:\n for k in range(3**j):\n num = List.pop(0)\n List.append(num+3*10**(n-j-1))\n List.append(num+5*10**(n-j-1))\n List.append(num+7*10**(n-j-1))\n for l in range(len(List)):\n if List[l] <= N:\n s = str(List[l])\n if "3" in s and "5" in s and "7" in s:\n ans += 1\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s740256758', 's838220353'] | [3064.0, 3828.0] | [2104.0, 68.0] | [711, 646] |
p03212 | u518042385 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n1=int(input())\nl1=len(str(n1))\ncount=0\ndef count1(n):\n l=len(str(n))-1\n l2=int(str(n)[0])\n if int(str(n)[0])>=8:\n return 3*(3**l+3-3*(2**l))\n elif int(str(n)[0])==7:\n return count(n-7*(10**(l-1)))+2*(3**l+3-3*(2**l))\n elif l2==6:\n return 2*(3**l+3-3*(2**l))\n elif l2==5:\n return count(n-5*(10**(l-1)))+(3**l+3-3*(2**l))\n elif l2==4:\n return (3**l+3-3*(2**l))\n elif l2==3:\n return count(n-3*(10**(l-1)))\n else:\n return 0\n \n \nif l1<3:\n print(0)\nelse:\n if l1>=4:\n for i in range(3,l1):\n c+=3**i+3-3*(2**i)\n print(c+count1(n1))\n ', 'from collections import deque\nn=int(input())\nnum=0\nl=["3","5","7"]\nq=deque(["3","5","7"])\ncount=0\nwhile q:\n a=q.popleft()\n for i in l:\n if int(i+a)<n:\n count+=1\n q.append(i+a)\nprint(count)', 'num=int(input())\ndef dfs(n):\n if n>num:\n return 0\n else:\n w=str(n)\n if w=="0":\n w=""\n if "3" in w and "7" in w and "5" in w:\n ret=1\n else:\n ret=0\n for i in "357": \n ret+=dfs(int(i+w))\n return ret\nprint(dfs(0))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s017386144', 's414554835', 's361486326'] | [3064.0, 2940.0, 3060.0] | [18.0, 17.0, 67.0] | [574, 199, 254] |
p03212 | u521866787 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["def dfs(s):\n if int(s)>n:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\n\nprint(dfs('0'))\n", "n = int(input())\n\ndef dfs(s):\n if int(s)>n:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\n\nprint(dfs('0'))\n"] | ['Runtime Error', 'Accepted'] | ['s488575769', 's919657170'] | [2940.0, 2940.0] | [17.0, 90.0] | [179, 197] |
p03212 | u533885955 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = int(input())\ni = 1\ncount = 0\nif N >= 777777777:\n while i <= N:\n I = str(i)\n I = list(I)\n if I.count("3")>0 and I.count("5")>0 and I.count("7"):\n if I.count("0")==0 and I.count("1")==0 and I.count("2")==0 and I.count("4")==0 and I.count("6")==0 and I.count("8")==0 and I.count("9")==0:\n count+=1\n i+=1\n else:\n i+=1\n else:\n i+=1\n print(count)\nelse:\n print(26484)', " N = int(input())\n\n def dfs(s): \n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n ret += dfs(s + c)\n return ret\n\n print(dfs('0'))", "N = int(input())\ndef dfs(s): \nif int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0'))", "N = int(input())\ndef dfs(s): \n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0'))", 'N = int(input())\ndef shichi(n):\n if int(n) > N:\n return 0\n ret=1 if all(n.count(c)>0 for c in "753") else 0\n for c in "753":\n ret += shichi(n+c)\n return ret\nprint(shichi("0"))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s013086347', 's096638549', 's681535474', 's804888770', 's121585177'] | [3064.0, 2940.0, 2940.0, 3060.0, 2940.0] | [2104.0, 18.0, 18.0, 20.0, 93.0] | [479, 260, 263, 275, 201] |
p03212 | u545368057 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['\n\nimport sys\nsys.setrecursionlimit(100000)\nN = 999999999\n\n\ncnt = 0\ndef dfs(v):\n global cnt\n \n \n num = "753"\n \n for n in num:\n next_v = v + n\n \n \n if int(next_v) >= N: continue\n \n dfs(next_v)\n if "3" in next_v and "5" in next_v and "7" in next_v:\n cnt += 1\n\ndfs("")\nprint(cnt)', 'N = int(input())\ndef dfs(s): \n if int(s) > N:\n print("invalid ",s)\n return 0\n print("valid ",s)\n ret = 1 if all(s.count(c) > 0 for c in \'753\') else 0 \n for c in \'753\':\n ret += dfs(s+c) \n return ret\n\nprint(dfs(\'0\')) ', 'N = int(input())\ndef dfs(s): \n if int(s) > N:\n print("invalid ",s)\n return 0\n print("valid ",s)\n cnt = 1 if all(s.count(c) > 0 for c in \'753\') else 0 \n for c in \'753\':\n cnt += dfs(s+c) \n return cnt\ndfs("0")', '\n\nimport sys\nsys.setrecursionlimit(100000)\nN = int(input())\n\n\ncnt = 0\ndef dfs(v):\n global cnt\n \n \n num = "753"\n \n for n in num:\n next_v = v + n\n \n \n if int(next_v) > N: continue\n \n dfs(next_v)\n if "3" in next_v and "5" in next_v and "7" in next_v:\n cnt += 1\n\ndfs("")\nprint(cnt)\t'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s650957252', 's973335081', 's989831785', 's619991606'] | [3060.0, 5048.0, 5048.0, 3060.0] | [53.0, 190.0, 208.0, 49.0] | [713, 367, 358, 716] |
p03212 | u548545174 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\nans = 0\n\ndef dfs(s):\n if int(s) > N:\n return\n\n if s.count('7') and s.count('5') and s.count('3'):\n cnt += 1\n \n dfs(s + '7')\n dfs(s + '5')\n dfs(s + '3')\n\ndfs('')\n\nprint(ans)", "N = int(input())\nans = 0\n\ndef dfs(s):\n global ans\n if int(s) > N:\n return\n\n if all(s.count(c) for c in '753'):\n ans += 1\n \n dfs(s + '7')\n dfs(s + '5')\n dfs(s + '3')\n\ndfs('0')\n\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s448161978', 's136841131'] | [3060.0, 3060.0] | [19.0, 87.0] | [221, 221] |
p03212 | u551351897 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\ndef dfs(s):\n if int(s) > N:\n return 0\n if all(s.count(c) > 0 for c in '753'):\n ret = 1\n else:\n ret = 0\n for c in '753':\n ret += dfs(s+c)\n\nprint(dfs('0'))", "N = int(input())\ndef dfs(s):\n if int(s) > N:\n return 0\n if all(s.count(c) > 0 for c in '753'):\n ret = 1\n else:\n ret = 0\n for c in '753':\n ret += dfs(s+c)\n\treturn ret\n \nprint(dfs('0'))\n", "N = int(input())\ndef dfs(s):\n if int(s) > N:\n return 0\n if all(s.count(c) > 0 for c in '753'):\n ret = 1\n else:\n ret = 0\n for c in '753':\n ret += dfs(s+c)\n return ret\n\nprint(dfs('0'))"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s676785816', 's709446352', 's771193982'] | [3056.0, 2940.0, 2940.0] | [19.0, 18.0, 92.0] | [210, 225, 225] |
p03212 | u556326496 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\n\ndef dfs(s):\n if int(s) > N:\n return 0\n else:\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret = dfs(s + c)\n return ret\n\nprint(dfs('0'))\n", "N = int(input())\n\ndef dfs(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret = dfs(s + c)\n return ret\n\nprint(dfs('0'))\n", "N = int(input())\n\ndef dfs(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s + c)\n return ret\n\nprint(dfs('0'))\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s319041261', 's443720142', 's987040626'] | [2940.0, 2940.0, 2940.0] | [91.0, 85.0, 93.0] | [226, 200, 201] |
p03212 | u558242240 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["s = input()\nl = len(s)\nn = int(s)\nans = 0\nimport itertools\nfor li in range(3, l+1):\n for i in itertools.product([7, 5, 3], repeat=li):\n if len(set(i)) == 3:\n ans += 1\n num = int(''.join(map(str, i)))\n if num > n:\n continue\nprint(ans)", "s = input()\nl = len(s)\nn = int(s)\nans = 0\nimport itertools\nfor li in range(3, l+1):\n for i in itertools.product([7, 5, 3], repeat=li):\n if len(set(i)) != 3:\n continue\n num = int(''.join(map(str, i)))\n if num <= n:\n ans += 1\n\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s765442985', 's879477332'] | [3188.0, 3060.0] | [95.0, 86.0] | [279, 281] |
p03212 | u561236114 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = 10#int(input())\ncnt = 0\n\ndef rec(pref):\n\tglobal cnt\n\tif pref <= n:\n\t\tcnt += 1\n\t\tfor d in {3, 5, 7}:\n\t\t\trec(pref * 10 + d)\n\n\nrec(0)\nprint(cnt - 1)\n', 'cnt = 0\nn = int(input())\ncnt = 0\n\ndef rec(int pref):\n\tif pref <= n:\n\t\tcnt += 1\n\t\tfor d in {3, 5, 7}:\n\t\t\trec(pref * 10 + d)\n\n\nrec(0)\nprint(cnt - 1)\n', 'n = int(input())\ncnt = 0\n\ndef rec(pref):\n\tglobal cnt\n\tif pref <= n:\n\t\tcnt += 1\n\t\tfor d in {3, 5, 7}:\n\t\t\trec(pref * 10 + d)\n\n\nrec(0)\nprint(cnt - 1)\n', "n = int(input())\ncnt = 0\n\ndef rec(pref):\n\tglobal cnt\n\tif pref <= n:\n\t\ts = str(pref)\n\t\tif '3' in s and '5' in s and '7' in s:\n\t\t\t#print(pref)\n\t\t\tcnt += 1\n\t\tfor d in {3, 5, 7}:\n\t\t\trec(pref * 10 + d)\n\n\nrec(0)\nprint(cnt)\n"] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s120714774', 's442071142', 's599759002', 's907739287'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 41.0, 51.0] | [150, 147, 147, 217] |
p03212 | u562935282 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['from copy import deepcopy\n\n\ndef mk_array(init_val, *args):\n args = args[::-1]\n res = [init_val for _ in range(args[0])]\n for arg in args[1:]:\n res = [deepcopy(res) for _ in range(arg)]\n return res\n\n\nN = int(input())\ne = [0 for _ in range(N + 1)]\n\nfor i in range(2, N + 1):\n for j in range(2, i + 1):\n while i % j == 0:\n e[j] += 1\n i //= j\n\ncounts = list(filter(lambda x: x > 0, e))\nprim_count = len(counts)\ncounts = [0] + counts \ndp = mk_array(0, prim_count + 1, 75 + 1)\ndp[0][1] = 1\n\nfor i in range(1, prim_count + 1):\n for j in range(1, 75 + 1):\n for k in range(min(counts[i], 75 // j - 1) + 1):\n dp[i][j * (k + 1)] += dp[i - 1][j]\n\nprint(dp[prim_count][75])\n', "def main():\n from collections import deque\n\n N = int(input())\n\n dq = deque([0])\n cnt = 0\n while dq:\n x = dq.popleft()\n if all(c in str(x) for c in '357'):\n cnt += 1\n for k in (3, 5, 7):\n nx = x * 10 + k\n if nx <= N:\n dq.append(nx)\n print(cnt)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s016025732', 's417917366'] | [523388.0, 4084.0] | [2125.0, 70.0] | [749, 370] |
p03212 | u569742427 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import itertools\nN= input()\nNumber=int(N)\ncount=[]\nx=0\nn=3\ncount=0\ndef check (S):\n S=str(S)\n if S.count('3')!=0 and S.count('5')!=0 and S.count('7')!=0 and int(S)<=Number:\n print(S)\n return 1\n\ndef dfs(x):\n global count\n if check(x)==1:\n count+=1\n if x<=Number:\n dfs(10*x+3)\n dfs(10*x+5)\n dfs(10*x+7)\n\n\ndfs(0)\nprint(count)\n", "1 N = int(input())\n2\n3 def dfs(s): \n4 if int(s) > N:\n5 return 0\n6 ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n7 for c in '753':\n8 ret += dfs(s + c)\n9 return ret\n10\n11 print(dfs('0')) \n", "import itertools\nN= input()\nNumber=int(N)\ncount=[]\nx=0\nn=3\ncount=0\ndef check (S):\n S=str(S)\n if S.count('3')!=0 and S.count('5')!=0 and S.count('7')!=0 and int(S)<=Number:\n return 1\n\ndef dfs(x):\n global count\n if check(x)==1:\n count+=1\n if x<=Number:\n dfs(10*x+3)\n dfs(10*x+5)\n dfs(10*x+7)\n\n\ndfs(0)\nprint(count)\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s000713541', 's038990800', 's510238016'] | [3476.0, 2940.0, 3064.0] | [152.0, 18.0, 135.0] | [379, 364, 362] |
p03212 | u570018655 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = int(input())\ncount = 0\nfor i in range(n):\n str_n = str(n)\n str_n.replace("7", "").replace("5", "").replace("3", "")\n if not str_n:\n count += 1\nprint(count)', "N = int(input())\n\ndef dfs(s): \n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n ret += dfs(s + c)\n return ret\n\nprint(dfs('0'))\n"] | ['Wrong Answer', 'Accepted'] | ['s892913557', 's245798219'] | [3060.0, 2940.0] | [2104.0, 92.0] | [175, 284] |
p03212 | u571750848 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["X=int(input())\ndef momo(s)\nif int(s)>N:\n return 0\n\nnagi=1 if all(s.count(c)>0 for c in '753') else 0\n for c in '753':\n nagi+=momo(s+c)\n return nagi\nprint(momo('0'))", "X=int(input())\ndef momo(s)\nif int(s)>X:\n return 0\n \nnagi=1 if all(s.count(c)>0 for c in '753') else 0\n for c in '753':\n nagi+=momo(s+c)\n return nagi\nprint(momo('0'))", "X=int(input())\ndef momo(s):\n if int(s)>X:\n return 0\n nagi=1 if all(s.count(c)>0 for c in '753') else 0\n for c in '753':\n nagi+=momo(s+c)\n return nagi\nprint(momo('0'))"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s532600565', 's719985398', 's789426701'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 93.0] | [172, 173, 176] |
p03212 | u580404776 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N=int(input())\nans=0\ndef dfs(cur,use):\n global ans\n if cur>N: return\n if use==0b111:ans+=1\n dfs(cur*10+7,use | 0b001)\n dfs(cur*10+5,use | 0b010)\n dfs(cur*10+3,use | 0b100)\n return print(cur)\n\ndfs(0,0)\nprint(ans)\n ', 'N=int(input())\nans=0\ndef dfs(cur,use):\n global ans\n if cur>N: return\n if use==0b111:ans+=1\n dfs(cur*10+7,use | 0b001)\n dfs(cur*10+5,use | 0b010)\n dfs(cur*10+3,use | 0b100)\n\ndfs(0,0)\nprint(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s013064929', 's803312669'] | [3464.0, 3060.0] | [59.0, 48.0] | [241, 219] |
p03212 | u583276018 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = int(input())\ni=1\nsum=0\nnum = []\nfor i in range(1,1000000000):\n while i>0:\n amari = i % 10\n if(amari != 3 or amari != 5 or amari != 7):\n break\n i = int(i / 10) \n num.append(i)\nj = 0\nwhile num[j] <= n:\n sum += num[j]\n j += 1\nprint(sum)\n', "n = int(input())\nother = ['0', '1', '2', '4', '6', '8', '9']\ndef dfs(sss):\n if(int(sss) > n):\n return 0\n r = 1 if(sss == all(s.count(c) > 0 for c in '753')) else 0\n for c in '357':\n r += dfs(sss+c)\n return r\nprint(dfs('0'))", "n = int(input())\ndef dfs(sss):\n if(int(sss) > n):\n return 0\n r = 1 if(all(sss.count(c) > 0 for c in '753')) else 0\n for c in '357':\n r += dfs(sss+c)\n return r\nprint(dfs('0'))"] | ['Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s134257257', 's994752046', 's713831638'] | [357948.0, 3060.0, 3060.0] | [2127.0, 17.0, 92.0] | [259, 233, 184] |
p03212 | u584174687 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import itertools\n\nnumber_str = '999999999'\nnumber_int = int(number_str)\n\ncount = 0\n\n\nlength = len(number_str)\n\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ndef calc_pre(leng_pre):\n global count\n count += pow(3, leng_pre) + 3 - 3 * pow(2, leng_pre)\n\ndef calc_all(length):\n global count\n l = ['3', '5', '7']\n pre_data = set()\n for v in itertools.combinations_with_replacement(l, length):\n # print(v)\n if'3' in v and '5' in v and '7' in v:\n for vv in itertools.permutations(list(v), length):\n aaa = int(''.join(list(vv)))\n if aaa < number_int:\n if aaa not in pre_data:\n # print(aaa)\n count += 1\n pre_data.add(aaa)\n else:\n break\n\nif length > 3:\n for i in range(3, length):\n calc_pre(i)\n\ncalc_all(length)\n\nprint(count)\n\n# print(pow(2, 3))", "\nans = 0\n\ndef check(num_str):\n for i in ['7', '5', '3']:\n if i not in num_str:\n return 0\n return 1\n\ndef make_data(num, num_str):\n global ans\n if num < int(num_str):\n return\n if check(num_str):\n ans += 1\n\n make_data(num, num_str + '7')\n make_data(num, num_str + '5')\n make_data(num, num_str + '3')\n\n\ndef main():\n num = int(input())\n make_data(num, '0')\n\n global ans\n print(ans)\n\n\nif __name__ == '__main__':\n main()"] | ['Time Limit Exceeded', 'Accepted'] | ['s061261643', 's151105267'] | [3316.0, 3064.0] | [2104.0, 59.0] | [1004, 484] |
p03212 | u588633699 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["def add(a):\n\tif int(a)>n:\n\t\treturn 0\n\telse:\n\t\tans = 0\n\t\ta = '' if int(a)==0 else a\n\t\tif a.find('3')>-1 and a.find('5')>-1 and a.find('7')>-1:\n\t\t\tans+=1\n\t\tfor i in [3,5,7]:\n\t\t\tans+=add(a+str(i))\n\t\treturn ans\n\nn = int(input())\nprint(add(''))\n", "def add(a):\n\tif int(a)>n:\n\t\treturn 0\n\telse:\n\t\tans = 0\n\t\ta = '' if int(a)==0 else a\n\t\tif a.find('3')>-1 and a.find('5')>-1 and a.find('7')>-1:\n\t\t\tans+=1\n\t\tfor i in [3,5,7]:\n\t\t\tans+=add(a+str(i))\n\t\treturn ans\n\nn = int(input())\nprint(add('0'))\n"] | ['Runtime Error', 'Accepted'] | ['s889193340', 's590463960'] | [3060.0, 3060.0] | [18.0, 99.0] | [240, 241] |
p03212 | u593063683 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["Num753 = {7, 5, 3}\n\ndef getDigitList(n):\n list = []\n while n>0:\n list.append(n%10)\n n //= 10\n list.reverse()\n if list==[]: list = [0]\n return list\n\ndef getDigitSet(n):\n nSet = set([])\n while n>0:\n nSet.add(n%10)\n n //= 10\n if nSet=={}: nSet = {0}\n return nSet\n\n\nS = input()\nnum = int(S)\ncount = 0\nfor i in range(357, num):\n nSet = set(getDigitSet(i))\n# if len(nSet)!=3: continue\n# is753 = True\n# for d in nSet:\n# if not (d in Num753):\n# is753 = False \n# break\n if nSet==Num753: \n print(i,end=', ')\n count += 1\nprint(count) ", '\nSet753 = {7, 5, 3}\nList753 = [7, 5, 3]\n\nN = int(input())\n\ndef getDigitList(n):\n list = []\n while n>0:\n list.append(n%10)\n n //= 10\n list.reverse()\n if list==[]: list = [0]\n return list\n\ndef gen(n):\n if n>N: return []\n else:\n d = getDigitList(n)\n #print(d) #\n if set(d)==Set753: \n result = [n]\n else:\n result = []\n for a in List753: result += gen(n*10+a)\n return result\n \nresult = gen(0)\n#print(result) #\nprint(len(result)) '] | ['Wrong Answer', 'Accepted'] | ['s216263996', 's629321346'] | [3064.0, 4324.0] | [2104.0, 110.0] | [636, 552] |
p03212 | u606878291 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["from itertools import product\n\nN = int(input())\n\n_357 = {'3', '5', '7'}\n\nans = 0\nfor r in range(3, len(str(N)) + 1):\n for numbers in product(('3', '5', '7'), repeat=r):\n if set(numbers) == _357 and int(''.join(numbers)) <= N:\n print(''.join(numbers))\n ans += 1\n\nprint(ans)\n", "from itertools import product\n\nN = int(input())\n\n_357 = {'3', '5', '7'}\n\nans = 0\nfor r in range(3, len(str(N)) + 1):\n for numbers in product(('3', '5', '7'), repeat=r):\n if set(numbers) == _357 and int(''.join(numbers)) <= N:\n ans += 1\n\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s911531927', 's452790904'] | [9236.0, 9160.0] | [57.0, 48.0] | [305, 269] |
p03212 | u607563136 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['from itertools import product\n\nn = input()\n\nif int(n) < 100:\n print(0)\n\nelse:\n ans = 0\n\n for i in range(3,len(n)+1):\n s = list(product("753",repeat=i))\n for combi in s:\n n_s = "".join(combi)\n if int(n_s) > int(n):\n continue\n if ("7" in combi) and ("5" in combi) and ("3" in combi):\n ans += 1\n \n\tprint(ans)\n', 'from itertools import product\n\nn = input()\n\nif int(n) < 100:\n print(0)\n\nelse:\n ans = 0\n\n for i in range(3,len(n)+1):\n s = list(product("753",repeat=i))\n for combi in s:\n n_s = "".join(combi)\n if int(n_s) > int(n):\n continue\n if ("7" in combi) and ("5" in combi) and ("3" in combi):\n ans += 1\n \n print(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s966733988', 's947087176'] | [8976.0, 12112.0] | [23.0, 55.0] | [395, 398] |
p03212 | u614734359 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["from itertools import product\nn = int(input())\n\nans = 0\n\nfor i in range(3,len(str(n))+1):\n for p in product('753',repeat=i):\n if n >= int(''.join(list(p))) and all(list(p).count(c) > 0 for c in '753': ans += 1\n\nprint(ans)", "from itertools import product\nn = int(input())\n\nans = 0\n\nfor i in range(3,len(str(n))+1):\n for p in product('753',repeat=i):\n if n >= int(''.join(list(p))) and all(list(p).count(c) > 0 for c in '753'): ans += 1\n\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s679955294', 's874740547'] | [2940.0, 3060.0] | [17.0, 94.0] | [231, 232] |
p03212 | u620846115 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = input()\nfrom itertools import product\nfrom collectins import Counter\nsum = 0\nfor i in range(len(n)-2):\n for j in list(product("753", repeat=i+3)):\n if int(\'\'.join(j)) <= int(n) and len(Counter(j))==3:\n sum+=1\nprint(sum)', 'n = input()\nfrom itertools import product\nfrom collectins import Counter\nsum = 0\nfor i in range(len(n)-2):\n for j in product("753", repeat=i+3):\n if int(\'\'.join(j)) <= int(n) and len(Counter(j))==3:\n sum+=1\nprint(sum)', 'n = input()\nfrom itertools import product\nsum = 0\nfor i in range(len(n)-2):\n for j in list(product("753", repeat=i+3)):\n if int(\'\'.join(j)) <= int(n) and len(set(j))==3:\n sum+=1\nprint(sum)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s363115642', 's907433710', 's644200446'] | [9124.0, 9124.0, 11568.0] | [24.0, 28.0, 58.0] | [232, 226, 197] |
p03212 | u626337957 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\n\ndef search(keta, num):\n if keta == 0:\n if int(num) <= N:\n return 1\n else:\n return 0\n else:\n return search(keta-1, num + '0') + search(keta-1, num + '3') + search(keta-1, num + '5') + search(keta-1, num + '7')\n\nketa = len(str(N))\n\nans = search(keta, '')\nprint(ans)", "N = int(input())\n\ndef search(keta, num):\n if keta == 0:\n if '0' in str(int(num)):\n return 0\n elif int(num) <= N:\n return 1\n else:\n return 0\n else:\n return search(keta-1, num + '0') + search(keta-1, num + '3') + search(keta-1, num + '5') + search(keta-1, num + '7')\n\nketa = len(str(N))\n\nans = search(keta, '')\nprint(ans)\n", "N = int(input())\n\ndef search(keta, num):\n if keta == 0:\n if '0' in str(int(num)):\n return 0\n elif '3' in num and '5' in num and '7' in num:\n if int(num) <= N:\n return 1\n else:\n return 0\n else:\n return 0\n else:\n return search(keta-1, num + '0') + search(keta-1, num + '3') + search(keta-1, num + '5') + search(keta-1, num + '7')\n\nketa = len(str(N))\n\nans = search(keta, '')\nprint(ans)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s089043231', 's550590670', 's093418839'] | [3060.0, 3060.0, 3064.0] | [153.0, 199.0, 208.0] | [302, 349, 430] |
p03212 | u626881915 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = int(input())\nl = [True]*(10**9+1)\ncount = 0\nstack = [3, 5, 7]\ndef check(n, k):\n s = str(n)\n if "3" in s and "5" in s and "7" in s:\n return True\n else:\n return False\nwhile len(stack)>0:\n now = stack.pop()\n if l[now]:\n l[now] = False\n if check(now):\n count += 1\n if now < n:\n stack.append(now*10+3)\n stack.append(now*10+5)\n stack.append(now*10+7)\n stack.append(3*10**len(str(now))+now)\n stack.append(5*10**len(str(now))+now)\n stack.append(7*10**len(str(now))+now)\nprint(count)\n ', 'n = int(input())\ncount = 0\nstack = [0]\ndef check(n):\n s = str(n)\n if "3" in s and "5" in s and "7" in s:\n return True\n else:\n return False\nwhile len(stack)>0:\n now = stack.pop()\n if check(now) and now <= n:\n count += 1\n if now < n:\n stack.append(now*10+3)\n stack.append(now*10+5)\n stack.append(now*10+7)\nprint(count)\n \n'] | ['Runtime Error', 'Accepted'] | ['s907161536', 's125338291'] | [3064.0, 3060.0] | [17.0, 96.0] | [540, 348] |
p03212 | u628538573 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = int(input())\ndef counter(num1, num2):\n\tif num2 == "0":\n\t\tnum21 = "3"\n\t\tnum22 = "5"\n\t\tnum23 = "7"\n\t\treturn counter(num1, num21) + counter(num1, num22) + counter(num1, num23)\n\telif int(num2) > num1:\n\t\treturn 0\n\telse:\n\t\tresult = 0\n\t\tnum21 = "3" + num2\n\t\tnum22 = "5" + num2\n\t\tnum23 = "7" + num2\n\t\tif "3" in num21 and "5" in num21 and "7" in num21 and int(num21) <= num1:\n\t\t\tresult += 1\n\t\t\tprint(num21)\n\t\tif "3" in num22 and "5" in num22 and "7" in num22 and int(num22) <= num1:\n\t\t\tresult += 1\n\t\t\tprint(num22)\n\t\tif "3" in num23 and "5" in num23 and "7" in num23 and int(num23) <= num1:\n\t\t\tresult += 1\n\t\t\tprint(num23)\n\t\treturn counter(num1, num21) + counter(num1, num22) + counter(num1, num23) + result\n\nprint(counter(n, "0"))', 'n = int(input())\ndef counter(num1, num2):\n\tif num2 == "0":\n\t\tnum21 = "3"\n\t\tnum22 = "5"\n\t\tnum23 = "7"\n\t\treturn counter(num1, num21) + counter(num1, num22) + counter(num1, num23)\n\telif int(num2) > num1:\n\t\treturn 0\n\telse:\n\t\tresult = 0\n\t\tnum21 = "3" + num2\n\t\tnum22 = "5" + num2\n\t\tnum23 = "7" + num2\n\t\tif "3" in num21 and "5" in num21 and "7" in num21 and int(num21) <= num1:\n\t\t\tresult += 1\n\t\tif "3" in num22 and "5" in num22 and "7" in num22 and int(num22) <= num1:\n\t\t\tresult += 1\n\t\tif "3" in num23 and "5" in num23 and "7" in num23 and int(num23) <= num1:\n\t\t\tresult += 1\n\t\treturn counter(num1, num21) + counter(num1, num22) + counter(num1, num23) + result\n\nprint(counter(n, "0"))'] | ['Wrong Answer', 'Accepted'] | ['s354169209', 's231260207'] | [3448.0, 3064.0] | [97.0, 79.0] | [724, 676] |
p03212 | u629538480 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import itertools\nN = int(input())\ncount = 0\nfor i in range(3, len(str(N)) + 1):\n for j in itertools.product('753', repeat=i):\n if int(''.join(j)) =< N and '3' in str(j) and '5'in str(j) and '7' in str(j):\n count += 1\n\nprint(count)\n", "N = int(f.input())\ncount = 0\n\nfor i in range(len(str(N))):\n for j in range(3 * (10**i), 4 * (10**i)):\n if j > N:\n break\n if '0' not in str(j) and '1' not in str(j) and '2' not in str(j) and '4' not in str(j) and '6' not in str(\n j) and '8' not in str(j) and '9' not in str(j) and('7' in str(j) and '5' in str(j) and '3' in str(j)):\n print(j)\n count += 1\n for j in range(5 * (10**i), 6 * (10**i)):\n if j > N:\n break\n\n if '0' not in str(j) and '1' not in str(j) and '2' not in str(j) and '4' not in str(j) and '6' not in str(\n j) and '8' not in str(j) and '9' not in str(j) and('7' in str(j) and '5' in str(j) and '3' in str(j)):\n print(j)\n count += 1\n\n for j in range(7 * (10**i), 8 * (10**i)):\n if j > N:\n break\n if '0' not in str(j) and '1' not in str(j) and '2' not in str(j) and '4' not in str(j) and '6' not in str(\n j) and '8' not in str(j) and '9' not in str(j) and('7' in str(j) and '5' in str(j) and '3' in str(j)):\n print(j)\n count += 1\n else:\n continue\n break\n\nprint(count)\n\n\n", "import itertools\nN = int(input())\ncount = 0\nfor i in range(3, len(str(N)) + 1):\n for j in itertools.product('753', repeat=i):\n if int(''.join(j)) <= N and '3' in str(j) and '5'in str(j) and '7' in str(j):\n count += 1\n\nprint(count)\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s976697865', 's997162364', 's366274212'] | [8960.0, 9168.0, 9132.0] | [26.0, 23.0, 104.0] | [252, 1194, 252] |
p03212 | u652656291 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["ans = 0\nn = int(input())\nfor i in range(n):\n s = str(i)\n if s.count('7')+s.count('5')+s.count('3') == int(s):\n ans += 1\nprint(ans)\n", "ans = 0\nn = int(input())\nif n < 357:\n print(0)\nelse:\n for i in range(n):\n s = str(i)\n if s.count('7')+s.count('5')+s.count('3') == len(s):\n ans += 1\nprint(ans)\n", "ans = 0\nfor i in range(n+1):\n s = str(input())\n if s.count('7')+s.count('5')+s.count('3') == int(s):\n ans += 1\nprint(ans)\n", "ans = 0\nfor i in range(n+1):\n s = list(str(input()))\n if s.count('7')+s.count('5')+s.count('3') == int(s):\n ans += 1\nprint(ans)", "N = int(input())\ndef dfs(s): \n return 0\nret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n ret += dfs(s + c)\n return ret\nprint(dfs('0')) ", "ans = 0\nfor i in range(n+1):\n s = str(i)\n if s.count('7')+s.count('5')+s.count('3') == int(s):\n ans += 1\nprint(ans)\n", "N = int(input())\ndef dfs(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0')) "] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s160298154', 's273977802', 's523769975', 's893400594', 's915050485', 's934382885', 's711296489'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0] | [2104.0, 17.0, 18.0, 17.0, 18.0, 18.0, 93.0] | [136, 171, 127, 132, 355, 121, 185] |
p03212 | u655975843 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import collections\n\nn = int(input())\ncount = 0\n\nfor i in range(1, n + 1):\n\tc = collections.Counter(list(str(i)))\n\tif len(c.keys()) == 3:\n\t\tprint(c)\n\t\tif (c['3'] != 0) and (c['5'] != 0) and (c['7'] != 0):\n\t\t\tcount += 1\nprint(count)", "n = int(input())\ncount = 0\n\ndef dfs(s):\n\tif int(s) > n:\n\t\treturn 0\n\tif all(s.count(c) > 0 for c in '357'):\n\t\tcount = 1\n\telse:\n\t\tcount = 0\n\tcount += dfs(s + '3')\n\tcount += dfs(s + '5')\n\tcount += dfs(s + '7')\n\treturn count\n\nprint(dfs('0'))"] | ['Wrong Answer', 'Accepted'] | ['s780368939', 's597829372'] | [4460.0, 3060.0] | [2104.0, 89.0] | [230, 237] |
p03212 | u663014688 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input)\n\ndef dfs(s):\n\n if int(s) > N:\n return 0\n \n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s + c)\n return ret\n\nprint(dfs('0'))\n", "N = int(input())\n\ndef dfs(s):\n\n if int(s) > N:\n return 0\n \n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s + c)\n return ret\n\nprint(dfs('0'))\n"] | ['Runtime Error', 'Accepted'] | ['s238102261', 's417154362'] | [2940.0, 3060.0] | [17.0, 93.0] | [280, 282] |
p03212 | u667024514 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['def to3(x,n):\n if (int(x/n)):\n return to3(int(x/n),n) + str(x%n)\n return str(x%n)\nch = ["3","5","7"]\nans = 0\nfor i in range(3 ** len(str(num))+1):\n s = to3(i,3)\n for u in range(len(str(num))-len(s)+2):\n if u > 0:\n s = "0" + s\n k1 = 0\n k2 = 0\n k3 = 0\n ss = ""\n for j in range(len(s)):\n if s[j] == "0":k1 = 1\n elif s[j] == "1":k2 = 1\n else: k3 = 1\n ss += ch[int(s[j])]\n if k1 and k2 and k3 and int(ss) <= num:ans += 1\nprint(ans)', 'num = int(input())\ndef to3(x,n):\n if (int(x/n)):\n return to3(int(x/n),n) + str(x%n)\n return str(x%n)\nch = ["3","5","7"]\nans = 0\nfor i in range(3 ** len(str(num))+1):\n s = to3(i,3)\n for u in range(len(str(num))-len(s)+2):\n if u > 0:\n s = "0" + s\n k1 = 0\n k2 = 0\n k3 = 0\n ss = ""\n for j in range(len(s)):\n if s[j] == "0":k1 = 1\n elif s[j] == "1":k2 = 1\n else: k3 = 1\n ss += ch[int(s[j])]\n if k1 and k2 and k3 and int(ss) <= num:ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s935937836', 's828748776'] | [3064.0, 3064.0] | [17.0, 446.0] | [479, 498] |
p03212 | u677440371 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["n = int(input())\n\ncount = 0\ndef dfs(x):\n global count\n if int(x) > n:\n return 0\n \n for i in ('753'):\n dfs(x+i)\n \n check = True\n for j in ('753'):\n if x.find(j) == -1:\n check = False\n if check:\n count += 1\n \n return count\ndfs('0')", "n = int(input())\n\ncount = 0\ndef dfs(x):\n global count\n if int(x) > n:\n return 0\n \n for i in ('753'):\n dfs(x+i)\n \n check = True\n for j in ('753'):\n if x.find(j) == -1:\n check = False\n if check:\n count += 1\n \n return count\nprint(dfs('0'))"] | ['Wrong Answer', 'Accepted'] | ['s262756753', 's947664767'] | [2940.0, 3060.0] | [73.0, 77.0] | [303, 310] |
p03212 | u686036872 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = int(input())\n\ndef f(x):\n if int(x) > N:\n return 0\n else:\n if all(x.count(j) >= 1 for j in [3, 5, 7]):\n ans = 1\n for i in [3, 5, 7]:\n ans += f(x+i) \n return ans \n\nprint(f("0"))', 'from itertools import product\n\nN = int(input())\nans = 0\nfor i in product("357", repeat=N):\n x = "".join(i)\n if 357 <= int(x) <= N and len(set(x)) = 3:\n ans += 1\nprint(ans)', 'N = int(input())\n\ndef f(x):\n if int(x) > N:\n return 0\n else:\n if all(x.count(j) >= 1 for j in ["3", "5", "7"]):\n ans = 1\n else:\n ans = 0\n for i in ["3", "5", "7"]:\n ans += f(x+i) \n return ans \n\nprint(f("0"))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s160254821', 's944555615', 's909757548'] | [3060.0, 2940.0, 3060.0] | [17.0, 18.0, 101.0] | [245, 184, 291] |
p03212 | u732061897 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import sys\n\nsys.setrecursionlimit(10 ** 9)\nN = input()\nN_len = len(N)\n'''\n75333\n'''\n\n\n# t = []\n\n\ndef dfs(a, depth):\n if depth == N_len:\n if int(a) <= int(N) and a.count('3') > 0 \\\n and a.count('5') > 0 and a.count('7') > 0 and str(int(a)).count('0') == 0:\n t.append(a)\n return 1\n else:\n return 0\n\n ret1 = dfs(a + '0', depth + 1)\n ret2 = dfs(a + '3', depth + 1)\n ret3 = dfs(a + '5', depth + 1)\n ret4 = dfs(a + '7', depth + 1)\n return ret1 + ret2 + ret3 + ret4\n\n\nans = dfs('', 0)\nprint(ans)\n# print(t)\n", "S = input()\n\n\n\nN = len(S)\nlist375 =['3','5','7']\nif N < 3:\n print(0)\n exit(0)\n\nfor i in range(N + 1):\n if i ==0:\n continue\n else:\n targetList = list375[:]\n for l in targetList:\n print(l)\n list375.append(l + '3')\n list375.append(l + '5')\n list375.append(l + '7')\n\nresult = [i for i in list(set(list375)) if int(i) < int(S) and i.count('3') !=0 and i.count('5') !=0 and i.count('7') !=0]\n#print(result)\nprint(len(result))\n\n\n'''\ndef judge753():\n if keta[0] < 3:\n return 0\n if keta[0] < 5:\n if keta[1] < 3:\n return 0\n if keta[1] < 5:\n if keta[2] < 5:\n return 0\n if keta[2] < 7:\n return 1\n return 2\n if keta[1] < 7:\n \n return sum[len(S)-1]\n if keta[0] < 7:\n if keta[1] < 3:\n return sum[len(S)-1] + sum[len(S)-2]\n if keta[1] < 5:\n if keta[2] < 5:\n \n return sum[len(S)-1]\n \nprint(min(absList))\n'''\n", "import sys\n\nsys.setrecursionlimit(10 ** 9)\nN = input()\nN_len = len(N)\n'''\n75333\n'''\n\n\n# t = []\n\n\ndef dfs(a, depth):\n if depth == N_len:\n if int(a) <= int(N) and a.count('3') > 0 \\\n and a.count('5') > 0 and a.count('7') > 0 and str(int(a)).count('0') == 0:\n return 1\n else:\n return 0\n\n ret1 = dfs(a + '0', depth + 1)\n ret2 = dfs(a + '3', depth + 1)\n ret3 = dfs(a + '5', depth + 1)\n ret4 = dfs(a + '7', depth + 1)\n return ret1 + ret2 + ret3 + ret4\n\n\nans = dfs('', 0)\nprint(ans)\n# print(t)\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s708243836', 's984837603', 's283419294'] | [9076.0, 66584.0, 9196.0] | [32.0, 403.0, 296.0] | [580, 1242, 556] |
p03212 | u736729525 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['from itertools import product\n\n# 10 ** 9\nl753 = []\nfor i in range(3, 10):\n l = [\'753\'] * i\n for s in product(*l):\n if \'7\' in s and \'3\' in s and \'5\' in s:\n l753.append(int("".join(s)))\nsorted(l753)\nN = int(input())\ncount = 0\nfor i in l753:\n if i > N:\n break\n count += 1\nprint(count)\n\n', 'from itertools import product\n\n# 10 ** 9\nl753 = []\nfor i in range(3, 10):\n l = [\'753\'] * i\n for s in product(*l):\n if \'7\' in s and \'3\' in s and \'5\' in s:\n l753.append(int("".join(s)))\nl753 = sorted(l753)\nN = int(input())\ncount = 0\nfor i in l753:\n if i > N:\n break\n count += 1\nprint(count)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s286385619', 's691660332'] | [4212.0, 4312.0] | [41.0, 41.0] | [320, 327] |
p03212 | u738898077 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = int(input())\ndef dfs(now_s,digit,n,ans_sum):\n ans = 0\n if len(now_s)<digit:\n for i in ["3","5","7"]:\n now_s.append(i)\n if "3" in now_s and "5" in now_s and "7" in now_s and eval("".join(now_s)) <= n:\n ans = 1\n print(now_s)\n return(ans+dfs(now_s,digit,n,ans_sum))\n return ans_sum\n\nnow_s = []\nls_753 = [0,0,0]\ndigit = len(str(n))\nans = 0\nprint(dfs(now_s,digit,n,ans))\n', 'def dfs(n,a,s):\n global ans\n temp = int(s)\n if temp > n:\n return\n if "7" in s and "5" in s and "3" in s and n>=temp:\n ans += 1\n for i in a:\n dfs(n,a,s+i)\nans = 0\na = ["7","5","3"]\nn = int(input())\ns = "0"\ndfs(n,a,s)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s366850528', 's679018445'] | [3064.0, 3064.0] | [17.0, 57.0] | [449, 262] |
p03212 | u747087681 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n/* TLEだった orz \nint main() {\n ll N; cin >> N;\n ll val = 357, cnt = 0;\n while (N >= val) {\n string s = to_string(val);\n bool three=false,five=false,seven=false,ok=true;\n for(int i=0; i < s.size(); i++) {\n if(s[i]==\'3\')three=true;\n else if(s[i]==\'5\')five=true;\n else if(s[i]==\'7\')seven=true;\n else ok = false;\n }\n if(three&&five&&seven&&ok){\n cnt++;\n //cout<<"s = "<<s<<endl;\n //printf("cnt=%d\\n",cnt);\n }\n val++;\n }\n cout << cnt << endl;\n} \n*/\nint N, ans;\nvoid dfs(ll x,bool flag3,bool flag5,bool flag7) {\n if(x > N) {\n return ;\n }\n if(flag3 && flag5 && flag7) {\n ans++;\n }\n dfs(x*10+3, true, flag5, flag7);\n dfs(x*10+5, flag3, true, flag7);\n dfs(x*10+7, flag3, flag5, true);\n}\nint main() {\n cin >> N;\n dfs(0,0,0,0);\n cout << ans << endl;\n}', "N = int(input())\n\ndef dfs(s):\n if int (s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\n\nprint(dfs('0'))"] | ['Runtime Error', 'Accepted'] | ['s211827280', 's567683174'] | [2940.0, 2940.0] | [17.0, 93.0] | [916, 199] |
p03212 | u750378652 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["n=int(input())\nimport bisect\nimport itertools\nans=[]\nnum=[]\nfor i in range(3,l+1):\n m=list(itertools.product(x, repeat=i))\n num.extend(m)\nfor i in range(len(num)):\n y=num[i]\n if '3' in y and '5' in y and '7' in y:\n number=''\n for j in range(len(y)):\n number+=y[j]\n ans.append(int(number))\nans.sort()\nprint(bisect.bisect_left(ans, n))", "n=int(input())\nimport bisect\nimport itertools\nl=len(str(n))\nans=[]\nnum=[]\nfor k in range(3,l+1):\n m=list(itertools.product(x, repeat=k))\n num.extend(m)\nfor i in range(len(num)):\n y=num[i]\n if '3' in y and '5' in y and '7' in y:\n number=''\n for j in range(len(y)):\n number+=y[j]\n ans.append(int(number))\nans.sort()\nprint(bisect.bisect_left(ans, n))", "n=int(input())\nimport bisect\nimport itertools\nl=len(str(n))\nans=[]\nnum=[]\nx=['3', '5', '7']\nfor k in range(3,l+1):\n m=list(itertools.product(x, repeat=k))\n num.extend(m)\nfor i in range(len(num)):\n y=num[i]\n if '3' in y and '5' in y and '7' in y:\n number=''\n for j in range(len(y)):\n number+=y[j]\n ans.append(int(number))\nans.sort()\nprint(bisect.bisect_right(ans, n))"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s615500283', 's676815092', 's201405768'] | [3064.0, 3064.0, 8052.0] | [18.0, 18.0, 99.0] | [377, 391, 410] |
p03212 | u751758346 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = int(input())\nprint([n for n in range(N) if(str(n) in "7" and str(n) in "5" and str(n) in "3")])', 'N = int(input())\n\ndef dfs(n, is3, is5, is7):\n if(n > N): \n return 0\n ans = 0\n if(is3 and is5 and is7): ans += 1\n ans += dfs(n * 10 + 3, True, is5, is7)\n ans += dfs(n * 10 + 5, is3, True, is7)\n ans += dfs(n * 10 + 7, is3, is5, True)\n return ans\n\nif __name__ == "__main__":\n print(dfs(0, False, False, False))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s189142192', 's404835578'] | [2940.0, 3064.0] | [2104.0, 40.0] | [99, 340] |
p03212 | u758411830 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\n\ndef cnt(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '357') else 0\n for c in '357':\n ret += cnt(s+c)\n return ret\n\ncnt('0')", "N = int(input())\n\ndef cnt(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '357') else 0\n for c in '357':\n ret += cnt(s+c)\n return ret\n\npritn(cnt('0'))", "N = int(input())\n\ndef cnt(s):\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '357') else 0\n for c in '357':\n ret += cnt(s+c)\n return ret\n\nprint(cnt('0'))"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s501016878', 's935980890', 's461921741'] | [2940.0, 2940.0, 3064.0] | [93.0, 17.0, 95.0] | [191, 198, 198] |
p03212 | u761471989 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = int(input())\n\ni = 357\ncount = 0\nif 357 <= N:\n while(1):\n flag = 0\n flag7 = 0\n flag5 = 0\n flag3 = 0\n\n for j,s in enumerate(str(i)):\n if s != "7" and s != "5" and s != "3":\n flag = 1\n i += 10 ** (len(str(i)) - j - 1)\n break\n if s == "7":\n flag7 = 1\n elif s == "5":\n flag5 = 1\n elif s == "3":\n flag3 = 1\n if flag == 0 and flag7 == 1 and flag5 == 1 and flag3 == 1:\n count += 1\n print(str(i))\n if flag == 0:\n i += 1\n if N <= i:\n break\n\nprint(count)', 'N = int(input())\n\ni = 357\ncount = 0\nif 357 <= N:\n while(1):\n print(i)\n flag = 0\n flag7 = 0\n flag5 = 0\n flag3 = 0\n for j,s in enumerate(str(i)):\n if s != "7" and s != "5" and s != "3":\n flag = 1\n i += 10 ** (len(str(i)) - j - 1)\n break\n if s == "7":\n flag7 = 1\n elif s == "5":\n flag5 = 1\n elif s == "3":\n flag3 = 1\n if flag == 0 and flag7 == 1 and flag5 == 1 and flag3 == 1:\n count += 1\n if flag == 0:\n i += 1\n if N <= i:\n break\n\nprint(count)', 'N = int(input())\n\ni = 357\ncount = 0\nif 357 <= N:\n while(1):\n print(i)\n flag = 0\n flag7 = 0\n flag5 = 0\n flag3 = 0\n for j,s in enumerate(str(i)):\n if s != "7" and s != "5" and s != "3":\n flag = 1\n i += 10 ** (len(str(i)) - j - 1)\n break\n if s == "7":\n flag7 = 1\n elif s == "5":\n flag5 = 1\n elif s == "3":\n flag3 = 1\n if flag == 0 and flag7 == 1 and flag5 == 1 and flag3 == 1:\n count += 1\n if flag == 0:\n i += 1\n if N < i:\n break\n\nprint(count)', 'N = int(input())\n\ni = 357\ncount = 0\nif 357 <= N:\n while(1):\n flag = 0\n flag7 = 0\n flag5 = 0\n flag3 = 0\n for j,s in enumerate(str(i)):\n if s != "7" and s != "5" and s != "3":\n flag = 1\n i += 10 ** (len(str(i)) - j - 1)\n break\n if s == "7":\n flag7 = 1\n elif s == "5":\n flag5 = 1\n elif s == "3":\n flag3 = 1\n if flag == 0 and flag7 == 1 and flag5 == 1 and flag3 == 1:\n count += 1\n if flag == 0:\n i += 1\n if N < i:\n break\n\nprint(count)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s025971526', 's031191026', 's196748236', 's163015194'] | [3392.0, 4496.0, 4496.0, 3188.0] | [437.0, 527.0, 617.0, 421.0] | [684, 674, 673, 656] |
p03212 | u764956288 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\n\ndef dfs(s):\n if int(s) > N:\n return 0\n r = 1 if all([i in s for i in '357']) else 0\n for c in '357':\n r += dfs(s+c)\n return r\n\nreturn(dfs('0'))", "N = int(input())\n \ndef dfs(s):\n if int(s) > N:\n return 0\n r = 1 if all([i in s for i in '357']) else 0\n for c in '357':\n r += dfs(s+c)\n return r\n\nprint(dfs('0'))"] | ['Runtime Error', 'Accepted'] | ['s054187217', 's858864017'] | [2940.0, 2940.0] | [18.0, 77.0] | [187, 187] |
p03212 | u767664985 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['from heapq import heappush, heappop, heapify\nfrom itertools import product\n\nN = int(input())\n\nq = ["3", "5", "7"]\nans = 0\nwhile q:\n now = q.pop(0)\n if int(now) <= N:\n for i in ("3", "5", "7"):\n q.append(i + now)\n q.append(now + i)\n if len(set(now)) == 3:\n ans += 1\n\nprint(ans)\n', 'from heapq import heapify, heappush, heappop\n\nN = int(input())\n\nqueue = [3, 5, 7]\nheapify(queue)\n\nans = 0\nwhile (queue):\n now = heappop(queue)\n ans += 1\n for i in (3, 5, 7):\n if now*10 + i <= N:\n heappush(queue, now*10 + i)\n\nprint(ans)\n', 'from heapq import heappush, heappop\nfrom itertools import permutations\n\nN = int(input())\n\nqueue = []\n\n\nfor c in permutations([3, 5, 7]):\n heappush(queue, c[0]*100 + c[1]*10 + c[2])\n\nans = 0\nwhile (queue):\n now = heappop(queue)\n if now <= N:\n print(now)\n ans += 1\n for i in (3, 5, 7):\n heappush(queue, now*10 + i) # 357 -> 3573\n heappush(queue, now + i*pow(10, len(str(now)))) # 357 -> 3357\n\nprint(ans)\n', 'N = int(input())\n\nq = ["3", "5", "7"]\nans = 0\nwhile q:\n now = q.pop(0)\n if int(now) <= N:\n for c in ("3", "5", "7"):\n q.append(now + c)\n if len(set(now)) == 3:\n ans += 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s202308566', 's772480936', 's981734980', 's354947640'] | [20284.0, 3820.0, 86064.0, 7332.0] | [2105.0, 53.0, 2109.0, 858.0] | [330, 263, 473, 224] |
p03212 | u780475861 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\n\ndef dfs(s): \n if int(s) > N:\n \treturn 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n \tret += dfs(s + c)\n\treturn ret\n\nprint(dfs('0')) \n", "N = int(input())\n\ndef dfs(s): \n if int(s) > N:\n \treturn 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n \tret += dfs(s + c)\n return ret\n\nprint(dfs('0')) \n"] | ['Runtime Error', 'Accepted'] | ['s940885785', 's592258734'] | [2940.0, 3060.0] | [17.0, 92.0] | [355, 356] |
p03212 | u781262926 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["n = int(input())\nA = set()\nfor x in product('753_', repeat=9):\n s = ''.join(x)\n s = s.replace('_', '')\n if '7' in s and '5' in s and '3' in s and int(s) <= n:\n A.add(s)\nprint(len(A))", "n = int(input())\nB = []\ndef dfs(A):\n x = int(''.join(A))\n if x <= n:\n if '7' in A and '5' in A and '3' in A:\n B.append(x)\n dfs(A + ['7'])\n dfs(A + ['5'])\n dfs(A + ['3'])\n\ndfs(['0'])\nprint(len(B))"] | ['Runtime Error', 'Accepted'] | ['s974262475', 's189344232'] | [3060.0, 4072.0] | [18.0, 86.0] | [198, 214] |
p03212 | u788068140 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['import itertools\n\n\nn = int(input())\n\ndef calculate(n,length):\n count = 0\n for i in itertools.product([3,5,7],repeat=length):\n if isValid(i) == False:\n continue\n sum = 0\n print(i)\n for j in range(length):\n sum = sum + i[j] * 10 ** j\n if sum <= n:\n count = count + 1\n\n return count\n\ndef isValid(n):\n dict = {}\n for s in n:\n if dict.get(s) == None:\n dict.__setitem__(s,1)\n else:\n dict.__setitem__(s,dict.get(s) + 1)\n\n s1 = dict.get(3) != None and dict.get(3) > 0\n s2 = dict.get(5) != None and dict.get(5) > 0\n s3 = dict.get(7) != None and dict.get(7) > 0\n\n return s1 and s2 and s3\n\nlength = len(str(n))\n\nresult = 0\nfor i in range(3,length+1):\n result = result + calculate(n,i)\n\nprint(result)\n\n', 'import itertools\n\n\nn = int(input())\n\ndef calculate(n,length):\n count = 0\n for i in itertools.product([3,5,7],repeat=length):\n if isValid(i) == False:\n continue\n sum = 0\n for j in range(length):\n sum = sum + i[j] * 10 ** j\n if sum <= n:\n count = count + 1\n\n return count\n\ndef isValid(n):\n dict = {}\n for s in n:\n if dict.get(s) == None:\n dict.__setitem__(s,1)\n else:\n dict.__setitem__(s,dict.get(s) + 1)\n\n s1 = dict.get(3) != None and dict.get(3) > 0\n s2 = dict.get(5) != None and dict.get(5) > 0\n s3 = dict.get(7) != None and dict.get(7) > 0\n\n return s1 and s2 and s3\n\nlength = len(str(n))\n\nresult = 0\nfor i in range(3,length+1):\n result = result + calculate(n,i)\n\nprint(result)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s750305354', 's568923129'] | [3828.0, 3064.0] | [268.0, 210.0] | [824, 807] |
p03212 | u798316285 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n=int(input())\ndef dsf(s):\n if int(s)>n:\n return0\n else:\n if all(s.count(c)>0 for c in "753"):\n x=1\n else:\n x=0\n for c in "753":\n x+=dsf(s+c)\n return x\nprint(dsf("0"))', 'n=int(input())\ndef dsf(s):\n if int(s)>n:\n return 0\n else:\n if all(s.count(c)>0 for c in "753"):\n x=1\n else:\n x=0\n for c in "753":\n x+=dsf(s+c)\n return x\nprint(dsf("0"))\n'] | ['Runtime Error', 'Accepted'] | ['s629851347', 's882772334'] | [3056.0, 2940.0] | [18.0, 92.0] | [199, 201] |
p03212 | u799065076 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N=int(input())\n\ndef dfs(i,count):\n if i!="":\n if int(i)>=N:\n return count\n if "3" in i and "5" in i and "7" in i:\n count+=1\n count=dfs("3"+i,count)\n count=dfs("5"+i,count)\n count=dfs("7"+i,count)\n return count\n \ndfs("",0)', 'N=int(input())\n\ndef dfs(i,count):\n if i!="":\n if int(i)>N:\n return count\n if "3" in i and "5" in i and "7" in i:\n count+=1\n count=dfs("3"+i,count)\n count=dfs("5"+i,count)\n count=dfs("7"+i,count)\n return count\n \nprint(dfs("",0))'] | ['Wrong Answer', 'Accepted'] | ['s506368974', 's784610628'] | [3064.0, 3060.0] | [54.0, 57.0] | [265, 271] |
p03212 | u802341442 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["\nn = int(input())\n\ndef depth_first_search(s):\n if int(s) > n:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n #print(c)\n print(s + c)\n ret += depth_first_search(s + c)\n print(ret)\n return ret\n\nprint(depth_first_search('0'))", "\nn = int(input())\n\ndef depth_first_search(s):\n if int(s) > n:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n #print(c)\n #print(s + c)\n ret += depth_first_search(s + c)\n #print(ret)\n return ret\n\nprint(depth_first_search('0'))"] | ['Wrong Answer', 'Accepted'] | ['s757828544', 's195171576'] | [9196.0, 9172.0] | [123.0, 75.0] | [304, 306] |
p03212 | u814781830 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\nret = 0\na = ['3','5','7']\nfor i in range(357, N+1):\n t = list(set(str(i))).sort()\n if t == a:\n ret += 1\nprint(ret)", "N = int(input())\nret = 0\na = ['3','5','7']\ni = 357\nwhile i < N+1:\n\tt = list(set(str(i)))\n\tt.sort()\n\tif t == a:\n\t\tret += 1\n\ti += 2\n\tif str(i)[-1] == '7':\n\t\ti += 4\nprint(ret)\n", "N = int(input())\nret = 0\na = ['3','5','7']\nfor i in range(357, N+1):\n t = list(set(str(i)))\n if t == a:\n ret += 1\nprint(ret)", 'N = int(input())\ncnt = 0\ndef dfs(n, cnt):\n if int(n) > N:\n return cnt\n if n.count("3") >= 1 and n.count("5") >= 1 and n.count("7") >= 1:\n cnt += 1\n\n for i in ("3","5","7"):\n cnt = max(cnt, dfs(n+i, cnt))\n return cnt\n\nprint(dfs("0", 0))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s295014505', 's311707054', 's900814358', 's999082829'] | [2940.0, 2940.0, 2940.0, 3060.0] | [2104.0, 2104.0, 2104.0, 79.0] | [144, 173, 137, 268] |
p03212 | u815659544 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['S = input()\nans = 999\n\nfor i in range(len(S)-2):\n x = int(S[i:i+3])\n\n if abs(x-753) < ans:\n ans = abs(x-753)\n\nprint(ans)', "N = int(input())\n\ndef dfs(s):\n\n if int(s) > N:\n return 0\n\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n\n for c in '753':\n ret += dfs(s + c)\n \n return ret\n\nprint(dfs('0'))\n"] | ['Wrong Answer', 'Accepted'] | ['s341924529', 's014862474'] | [3060.0, 2940.0] | [17.0, 91.0] | [133, 210] |
p03212 | u836737505 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import itertools\nn = int(input())\nl = [3,7,5]\nc = 0\nfor i in range(3,10):\n for j in itertools.product(l, repeat=i):\n if set(j) == 3 and int(''.join(map(str,j))) <= n:\n c += 1\nprint(c)", "import itertools\nn = int(input())\nl = [3,7,5]\nc = 0\nfor i in range(3,10):\n for j in itertools.product(l, repeat=i):\n if len(set(j)) == 3 and int(''.join(map(str,j))) <= n:\n c += 1\nprint(c)"] | ['Wrong Answer', 'Accepted'] | ['s336180379', 's919882432'] | [3060.0, 3060.0] | [32.0, 86.0] | [204, 209] |
p03212 | u837286475 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['\nn, x = map(int,input().split())\n\ndef rec(lv,ls):\n if lv == 0:\n return [1]\n else:\n ret = rec(lv-1,ls)\n for i in range(0,len(ret) -1):\n if ret[i]>0 and ret[i+1]>0:\n ret[i+1] += ret[i]\n ret[i] = 0 #deleted tag\n\n while 0 != ret.count(0):\n ret.remove(0)\n return [-1,*ret,1,*ret,-1]\n\n#print( rec(n, list()) )\n\n\ncount = 0\nfor e in rec(n, list() ):\n abs_e = abs(e)\n\n if x == 0:\n break\n\n if x>=abs_e:\n x -= abs_e\n count += e if e>0 else 0\n else:\n count += x if e>0 else 0\n x = 0\n #print(x," ",count)\n\nprint(count)\n', '\n# post-placed for\n# counter for counter in iterator\n# \n\n#Shiti Go San\ndef sgs(s:str)->bool:\n return True if all( s.count(c)>0 for c in "753") else False\n\n\n\n\n\nn = int( input() )\n\n\ndef recursive(s:str)->int:\n if n < int(s):\n return 0\n\n ret = 1 if sgs(s) else 0\n\n for x in "753":\n ret += recursive( s + x )\n \n return ret\n\nprint( recursive(\'0\') )'] | ['Runtime Error', 'Accepted'] | ['s883939192', 's756737697'] | [3064.0, 3060.0] | [17.0, 95.0] | [650, 375] |
p03212 | u842388336 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['from itertools import permutations\ntarget = [3,5,7]\n\nclear_list = combinations(target, 4)\nprint(clear_list)', "from itertools import product\ntarget = ['3','5','7']\n\nn=int(input())\ntmp=n\nketa=0\nwhile tmp!=0:\n tmp//=10\n keta+=1\ncheck_list = []\nfor i in range(1,keta+1):\n tmp=[]\n for _ in range(i):\n tmp.append(target.copy())\n tmp_product = list(product(*tmp))\n check_list+=[int(''.join(nums)) for nums in tmp_product]\ncheck_list = sorted(check_list)\n\ncnt=0\nfor i in check_list:\n if i <= n:\n tmp = set([w for w in str(i)])\n if len(tmp)==3:\n cnt+=1\n else:\n break\nprint(cnt)\n"] | ['Runtime Error', 'Accepted'] | ['s208993295', 's103017385'] | [9084.0, 13592.0] | [28.0, 75.0] | [107, 486] |
p03212 | u842964692 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\ndef dfs(s): \n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0')) \n", "N = int(input())\ndef dfs(s): \nreturn 0\nret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n ret += dfs(s + c)\n return ret\nprint(dfs('0')) \n", "N = int(input())\ndef dfs(s): \nif int(s) > N:\n\treturn 0\nret = 1 if all(s.count(c) > 0 for c in '753') else 0 \nfor c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0')) \n", "n=int(input())\n \ndef dfs(s):\n if int(s)>n:\n return 0\n cnt=1 if all(s.count(i)>0 for i in '753') else 0\n for j in '753':\n cnt+=dfs(s+j)\n return cnt\n \nprint(dfs('0'))"] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s029016473', 's201005129', 's486508223', 's681554360'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 93.0] | [360, 354, 347, 175] |
p03212 | u845333844 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["n=int(input())\ndef dfs(s):\n if int(s) > N:\n return 0\n if all(s.count(c) > 0 for c in '753'):\n ret=1\n else:\n ret=0 \n for c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0'))", "n=int(input())\nans=0\nif n<10**8:\n if n%2==0:\n for i in range(1,n-1,2):\n sum3=0\n sum5=0\n sum7=0\n x=str(i)\n l=len(x)\n for j in range(l):\n if x[j]=='3':\n sum3 += 1\n elif x[j]=='5':\n sum5 += 1\n elif x[j]=='7':\n sum7 += 1\n if (sum3 + sum5 + sum7 == l) and (sum3>0) and(sum5>0) and (sum7>0):\n ans+=1\n else:\n for i in range(1,n,2):\n sum3=0\n sum5=0\n sum7=0\n x=str(i)\n l=len(x)\n for j in range(l):\n if x[j]=='3':\n sum3 += 1\n elif x[j]=='5':\n sum5 += 1\n elif x[j]=='7':\n sum7 += 1\n if (sum3+sum5+sum7==l) and (sum3>0) and(sum5>0) and (sum7>0):\n ans+=1\nprint(ans)\nelse:\nprint(0)\n", "n=int(input())\ndef dfs(s):\n if int(s) > n:\n return 0\n if all(s.count(c) > 0 for c in '753'):\n ret=1\n else:\n ret=0 \n for c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0'))"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s634661829', 's847112315', 's090134923'] | [3056.0, 3064.0, 2940.0] | [18.0, 18.0, 94.0] | [230, 764, 230] |
p03212 | u853185302 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['import itertools\ndef calc_num(S,S_len):\n \tresult = 0;\n l = [3,5,7];\n i = 3;\n while i <= S_len\n \tfor v in itertools.product(l,repeat=i):\n \tif int("".join(map(str,v))) <= S and list(srt(v) & set(l)) == l;\n \t\tresult = result + 1;\n i = i + 1;\n return result\n \nS = list(map(int,input()))\nS_len = len(S)\nS = int("".join(map(str, S)));\nresult = calc_num(S,S_len);\nprint(result)', 'import itertools\ndef calc_num(S,S_len):\n result = 0;\n l = [3,5,7];\n i = 3;\n while i <= S_len\n \tfor v in itertools.product(l,repeat=i):\n \t\tif int("".join(map(str,v))) <= S and list(srt(v) & set(l)) == l;\n \tresult = result + 1;\n i = i + 1;\n return result\n \nS = list(map(int,input()))\nS_len = len(S)\nS = int("".join(map(str, S)));\nresult = calc_num(S,S_len);\nprint(result)', 'import itertools\ndef calc_num(S,S_len):\n result = 0;\n l = [3,5,7];\n i = 3;\n while i <= S_len\n \tfor v in itertools.product(l,repeat=i):\n if int("".join(map(str,v))) <= S and list(srt(v) & set(l)) == l;\n result = result + 1;\n i = i + 1;\n return result\n \nS = list(map(int,input()))\nS_len = len(S)\nS = int("".join(map(str, S)));\nresult = calc_num(S,S_len);\nprint(result)', 'import itertools\nn = int(input())\ntarget = ["7","5","3"]\nc = 0\nfor i in range(1,len(str(n))+1):\n for p in list(itertools.product(target,repeat=i)):\n if int("".join(list(p))) <= n and len(set(p))==3: c += 1\nprint(c)\n '] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s434471942', 's702501969', 's857514649', 's361349960'] | [2940.0, 2940.0, 2940.0, 6260.0] | [18.0, 18.0, 18.0, 62.0] | [410, 388, 388, 223] |
p03212 | u860002137 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['import sys\nsys.setrecursionlimit(10**6)\n\nN = int(input())\nV = [3, 5, 7]\n\nli = []\n\n\ndef rec(curr, use):\n if curr > N:\n return cnt\n if use == 0b111:\n li.append(curr)\n for i, b in enumerate(V):\n rec(curr * 10 + b, use | max(1, i * 2))\n\n\nrec(0, 0)\n\nprint(len(li))', 'import sys\nsys.setrecursionlimit(10**6)\n\nN = int(input())\nV = [3, 5, 7]\n\nli = []\n\n\ndef rec(curr, use):\n if curr > N:\n return\n if use == 0b111:\n li.append(curr)\n for i, b in enumerate(V):\n rec(curr * 10 + b, use | max(1, i * 2))\n\n\nrec(0, 0)\n\nprint(len(li))'] | ['Runtime Error', 'Accepted'] | ['s952191841', 's139554007'] | [3064.0, 4008.0] | [18.0, 65.0] | [289, 285] |
p03212 | u861466636 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["n = int(input())\ndef dfs(s):\n if int(s) > n:\n return 0\n ret = 1 if all([s.count(c) for c in '753']) else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\nprint(ret('0'))", "n = int(input())\ndef dfs(s):\n if int(s) > n:\n return 0\n ret = 1 if all([s.count(c) > 0 for c in '753']) else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\nprint(ret('0'))", "s = set(['7', '5', '3'])\nprint(sum((1 for i in range(1, n+1) if set(str(i)) == s)))", "n = int(input())\ndef dfs(s):\n if int(s) > n:\n return 0\n ret = 1 if all([s.count(c) > 0 for c in '753']) else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\nprint(dfs('0'))"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s509383502', 's653953380', 's687731372', 's864506334'] | [3064.0, 3060.0, 2940.0, 3060.0] | [18.0, 18.0, 17.0, 94.0] | [178, 182, 83, 182] |
p03212 | u864197622 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['S = input()\nm = 999\nfor i in range(len(S)-2):\n a = int(S[i:i+3])-753\n if abs(a)<m:\n m = abs(a)\nprint(m)', 'N = int(input())\n\nL = ["3","5","7"]\nA = [L]\nfor i in range(8):\n B = []\n for a in A[i]:\n for l in L:\n B.append(a+l)\n A.append(B)\nc = 0\nfor i in range(9):\n for a in A[i]:\n if "3" in a and "5" in a and "7" in a:\n if int(a) <= N:\n c += 1\n \nprint(c)\n'] | ['Wrong Answer', 'Accepted'] | ['s850375057', 's960251831'] | [2940.0, 5228.0] | [18.0, 37.0] | [116, 319] |
p03212 | u867320886 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | [' ', 'from itertools import product\nn=int(input())\nans = 0\nfor i in range(3,len(str(n))+1):\n for num in product((\'3\',\'5\',\'7\'),repeat=i):\n if len(set(num)) == 3 and int("".join(num)) <= n:\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s270993272', 's159871657'] | [2940.0, 3060.0] | [17.0, 45.0] | [1, 223] |
p03212 | u880466014 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = input()\nN_ = len(N)\nA = N_ * N_ - 1 * N_ - 2\n\nif int(N) < 357:\n print(0)\nelif int(N[0]) < 2:\n A = N_ - 1 * N_ - 2 * N_ - 3\nelif int(N[0]) == 3 or int(N[0]) == 4:\n A = N_ - 1 * N_ - 2\nelif int(N[0]) == 5 int(N[0]) == 6:\n A = 2 * N_ -1 * N_ -2\nelif int(N[0]) >= 7:\n A = N_ * N_ - 1 * N_ - 2\n \n\nprint(A)\n', "N = int(input())\n\ndef dfs(s):\n if int(s) > N: \n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\u3000\n for c in '753':\n ret += dfs(s+c)\n return ret\n\nprint(dfs('0'))\u3000", "N = int(input())\n \ndef dfs(s):\n if int(s) > N: \n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s+c)\n return ret\n \nprint(dfs('0'))"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s007262923', 's439022310', 's472591238'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 95.0] | [311, 300, 185] |
p03212 | u882359130 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = input()\n\nl = len(N)\nans = 0\n\nfor n in range(1, 4**l):\n n4 = ""\n while n > 0:\n mod = n % 4\n n4 = str(mod) + n4\n n //= 4\n \n if "0" in n4:\n continue\n \n if ("1" in n4) and ("2" in n4) and ("3" in n4):\n n4_10 = ""\n for i in range(len(n4)):\n if n4[i] == "1":\n n4_10 = n4_10 + "7"\n elif n4[i] == "2":\n n4_10 = n4_10 + "5"\n else:\n n4_10 = n4_10 + "3"\n if int(n4_10) =< int(N):\n ans += 1\n\nprint(ans)', 'N = input()\n\nl = len(N)\nans = 0\n\nfor n in range(1, 4**l):\n n4 = ""\n while n > 0:\n mod = n % 4\n n4 = str(mod) + n4\n n //= 4\n \n if "0" in n4:\n continue\n \n if ("1" in n4) and ("2" in n4) and ("3" in n4):\n n4_10 = ""\n for i in range(len(n4)):\n if n4[i] == "1":\n n4_10 = n4_10 + "7"\n elif n4[i] == "2":\n n4_10 = n4_10 + "5"\n else:\n n4_10 = n4_10 + "3"\n if int(n4_10) <= int(N):\n ans += 1\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s946264494', 's632657951'] | [3064.0, 3064.0] | [18.0, 1193.0] | [593, 593] |
p03212 | u918601425 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['text=input()\nN=len(text)\nhigh=int(text[0])\nans=0\nif high>6:\n ans=3**N-3*(2**N)+3\nelif high>4:\n ans=2*(3**(N-1))+2**(N+1)+2\nelif high>2:\n ans=3**(N-1)-2**N+1\nelse:\n ans=3**(N-1)-3*(2**(N-1))+3\nfor i in range(1,N):\n ans+=3**i-3*(2**i)+3\nprint(ans)', "X=input()\nlst = [int(s) for s in list(X)]\nN=len(lst)\nX=int(X)\nans=0\n\nfor i in range(3,N):\n ans+=(3**i-3*(2**i)+3)\n\nls=[7,5,3]\nfor i in range(1,N):\n ls_3=[10*s+3 for s in ls]\n ls_5=[10*s+5 for s in ls]\n ls_7=[10*s+7 for s in ls]\n ls=ls_3+ls_5+ls_7\n \ndef judge(n):\n if n>X:\n return 0\n else:\n if(('3' in str(n))and('5' in str(n))and('7' in str(n))):\n return 1\n else:\n return 0\nfor t in ls:\n ans+=judge(t)\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s340214863', 's694485067'] | [3064.0, 4340.0] | [17.0, 36.0] | [250, 513] |
p03212 | u923662841 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n=input()\nn_int = int(n)\n\nif n_int<357:\n print(0)\nelse:\n counter__ = 0\n for k in range(3 ,len(n)+1):\n counter__ += recursive_f([])\n def recursive_f(A):\n if len(A) == k:\n A_ = int("".join(map(str,A)))\n counter = 0\n if len(set(A)) == 3 and A_ <= n_int:\n counter += 1\n return counter\n counter_ = 0\n for i in [3,5,7]:\n A.append(i)\n counter_ += recursive_f(A)\n A.pop()\n return counter_\n \nprint(counter__)', 'n=input() # str 575\nn_int = int(n) # int 575\n\nif n_int<357:\n print(0)\nelse:\n counter__ = 0\n for k in range(3 ,len(n)+1):\n counter__ += recursive_f([])\n\n def recursive_f(A):\n if len(A) == k: \n A_ = int("".join(map(str,A))) \n counter = 0\n # print(A_)\n if len(set(A)) == 3 and A_ <= n_int:\n counter += 1\n return counter\n\n counter_ = 0\n\n for i in [3,5,7]:\n A.append(i)\n counter_ += recursive_f(A)\n A.pop()\n\n return counter_\n \nprint(counter__)', 'n=input()\nn_int = int(n)\n\nif n_int<357:\n print(0)\nelse:\n counter__ = 0\n for k in range(3 ,len(n)+1):\n counter__ += recursive_f([])\n\n def recursive_f(A):\n if len(A) == k: \n A_ = int("".join(map(str,A))) \n counter = 0\n # print(A_)\n if len(set(A)) == 3 and A_ <= n_int:\n counter += 1\n return counter\n\n counter_ = 0\n\n for i in [3,5,7]:\n A.append(i)\n counter_ += recursive_f(A)\n A.pop()\n\n return counter_\n \nprint(counter__)', 'N = int(input())\ndef dfs(s):\n if int(s)>N:\n return 0\n ret = 1 if all(s.count(c)>0 for c in "753") else 0\n for c in "753":\n ret += dfs(s+c)\n return ret\nprint(dfs("0"))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s691255062', 's734661076', 's995418458', 's525030587'] | [3064.0, 3064.0, 3064.0, 9200.0] | [17.0, 17.0, 18.0, 79.0] | [493, 709, 578, 192] |
p03212 | u927764913 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = int(input())\na = len(str(n))\nlst = [[3,5,7]]\ntfs = [3,5,7]\nfor i in range(1,a):\n l = []\n for v in lst[i-1]:\n for t in tfs:\n l.append(int(str(v) + str(t)))\n lst.append(l)\ns = 0\nfor l in lst:\n for v in l:\n if is753(v) and v <= n:\n s+=1\nprint(s)', 'def is753(n):\n if n % 10 != 3 and n % 10 != 5 and n % 10 !=7:\n return False\n exist3 = False\n exist5 = False\n exist7 = False\n a = str(n)\n for i in range (len(a)):\n x = n % 10\n if x == 3 :\n exist3 = True\n elif x == 5 :\n exist5 = True\n elif x == 7 :\n exist7 = True\n else :\n return False\n n = n // 10\n if exist3 and exist5 and exist7:\n return True\n else :\n return False\n\nn = int(input())\na = len(str(n))\nlst = [[3,5,7]]\ntfs = [3,5,7]\nfor i in range(1,a):\n l = []\n for v in lst[i-1]:\n for t in tfs:\n l.append(int(str(v) + str(t)))\n lst.append(l)\ns = 0\nfor l in lst:\n for v in l:\n if is753(v) and v <= n:\n s+=1\nprint(s)'] | ['Runtime Error', 'Accepted'] | ['s386265079', 's909783149'] | [4220.0, 4308.0] | [42.0, 108.0] | [294, 792] |
p03212 | u932868243 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import itertools\nimport collections\nn=int(input())\nl=len(str(n))\ncnt=0\nif l<3:\n print(0)\n exit()\nfor i in range(3,l):\n for k in itertools.product(['7','5','3'],repeat=i):\n j=int(''.join(k))\n c=collections.Counter(k)\n cv=c.values()\n if all(vv!=0 for vv in cv) and j<=n:\n cnt+=1\nprint(cnt)", "import itertools\nimport collections\nn=int(input())\nl=len(str(n))\ncnt=0\nif l<3:\n print(0)\n exit()\nfor i in range(3,l+1):\n for k in itertools.product(['7','5','3'],repeat=i):\n j=int(''.join(k))\n c=collections.Counter(k)\n cv=c.values()\n if all(vv!=0 for vv in cv) and j<=n:\n cnt+=1\nprint(cnt)", 'n=int(input())\nl=len(str(n))', "import itertools\nimport collections\nn=int(input())\nl=len(str(n))\ncnt=0\nif l<3:\n print(0)\n exit()\nfor i in range(3,l+1):\n for k in itertools.product(['7','5','3'],repeat=i):\n j=int(''.join(k))\n k=list(k)\n x=k.count('7')\n y=k.count('5')\n z=k.count('3')\n if all(vv!=0 for vv in [x,y,z]) and j<=n:\n cnt+=1\nprint(cnt)"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s204643843', 's537296404', 's864620017', 's247576826'] | [3316.0, 3316.0, 2940.0, 3444.0] | [93.0, 253.0, 17.0, 89.0] | [307, 309, 28, 338] |
p03212 | u934868410 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["n = int(input())\n\ndef bfs(s):\n if int(s) >= n:\n return 0\n return ('3' in s and '5' in s and '7' in s) + bfs(s+'3') + bfs(s+'5') + bfs(s+'7')\n\nprint(bfs(''))", "n = int(input())\n \ndef bfs(s):\n if int(s) > n:\n return 0\n return ('3' in s and '5' in s and '7' in s) + bfs(s+'3') + bfs(s+'5') + bfs(s+'7')\n \nprint(bfs('0'))"] | ['Runtime Error', 'Accepted'] | ['s330074407', 's625219922'] | [2940.0, 2940.0] | [17.0, 51.0] | [161, 163] |
p03212 | u941753895 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef I(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\n# 10 -> n\ndef ten2n(a,n):\n x=a//n\n y=a%n\n if x:\n return ten2n(x,n)+str(y)\n return str(y)\n\ndef main():\n n=I()\n\n l=[]\n for i in range(pow(4,10)):\n l.append(ten2n(i,4).replace('3','7').replace('2','5').replace('1','3'))\n\n cnt=0\n for x in l:\n if int(x)<=n:\n if '3' in x and '5' in x and '7' in x and '0' not in x:\n cnt+=1\n else:\n break\n\n return cnt\n\nprint(main())\n", "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef I(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\n# 10 -> n\ndef ten2n(a,n):\n x=a//n\n y=a%n\n if x:\n return ten2n(x,n)+str(y)\n return str(y)\n\ndef main():\n n=I()\n\n l=[]\n for i in range(pow(4,9)):\n l.append(ten2n(i,4).replace('3','7').replace('2','5').replace('1','3'))\n\n cnt=0\n for x in l:\n if int(x)<=n:\n if '3' in x and '5' in x and '7' in x and '0' not in x:\n cnt+=1\n else:\n break\n\n return cnt\n\nprint(main())\n"] | ['Time Limit Exceeded', 'Accepted'] | ['s833260343', 's786766193'] | [42844.0, 24156.0] | [2106.0, 1117.0] | [677, 676] |
p03212 | u944643608 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\ndef dfs(s): \nreturn 0\nret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n ret += dfs(s + c)\n return ret\nprint(dfs('0')) \n", "N = int(input())\ndef dfs(s):\n if int(s) > N :\n return 0\n if all(s.count(c)>0 for c in '753'):\n ret = 1\n else:\n ret = 0\n for c in '753':\n ret += dfs(s+c)\n return ret\nprint(dfs('0'))\n"] | ['Runtime Error', 'Accepted'] | ['s275081313', 's993079881'] | [2940.0, 2940.0] | [17.0, 94.0] | [354, 198] |
p03212 | u945181840 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import itertools\n\nN = input()\nl = ['3', '5', '7']\nd = len(N)\nN = int(N)\n\nif N - 357 < 0:\n print(0)\n exit()\n\n\naa = 0\nfor i in range(3, d):\n aa += 3 ** (d - 1) - 3 * (2 ** (d - 1) - 2) - 3\n\n\na = [i for i in itertools.combinations_with_replacement(l, d)]\nb = [i for i in a if len(set(i)) == 3]\nc = []\nfor k in b:\n temp = [i for i in itertools.permutations(k)]\n temp = list(set(temp))\n for j in temp:\n c.append(''.join(j))\n\ncount = 0\nfor i in c:\n if int(i) <= N:\n count += 1\n print(i)\nprint(aa + count)", "import itertools\n\nN = input()\nl = ['3', '5', '7']\nd = len(N)\nN = int(N)\naa = 0\n\nif N - 357 < 0:\n print(0)\n exit()\nif N > 777777777:\n for i in range(3, d + 1):\n aa += 3 ** i - 3 * (2 ** i - 2) - 3\n print(aa)\n exit()\n\n\nfor i in range(3, d):\n aa += 3 ** i - 3 * (2 ** i - 2) - 3\n\n\na = [i for i in itertools.combinations_with_replacement(l, d)]\nb = [i for i in a if len(set(i)) == 3]\nc = []\ncount = 0\nfor k in b:\n temp = list(set([i for i in itertools.permutations(k)]))\n print('here')\n for j in temp:\n if int(''.join(j)) <= N:\n count += 1\n\nprint(aa + count)", "N = input()\nl = ['3', '5', '7']\nL = ['3', '5', '7']\ntemp = []\nd = len(N)\nN = int(N)\n\n\nif N - 357 < 0:\n print(0)\n exit()\n\n\na = 0\nfor i in range(3, d):\n a += 3 ** i - 3 * (2 ** i - 2) - 3\n\n\nfor k in range(d - 1):\n for i in L:\n for j in l:\n temp.append(i + j)\n L.clear()\n L.extend(temp)\n temp.clear()\nL = [i for i in L if '3' in i and '5' in i and '7' in i]\n\ncount = 0\nfor i in L:\n if int(i) <= N:\n count += 1\nprint(a + count)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s046690652', 's589814028', 's177645193'] | [51168.0, 50272.0, 4980.0] | [2107.0, 2108.0, 32.0] | [591, 652, 508] |
p03212 | u945200821 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['import itertools\nimport math\n\n\ndef main():\n n = int(input())\n \n count_753 = 0\n max_digits = math.ceil(math.log10(n))\n cand_753 = (3, 5, 7)\n \n for digits in range(3, max_digits):\n for dig_753 in itertools.product(cand_753, repeat=digits):\n number_str = "".join(dig_753)\n \n if "7" in number_str and "5" in number_str and "3" in number_str and int(number_str) <= n:\n count_753 += 1\n \n print(count_753)\n\nif __name__ == "__main__":\n main()\n', 'import itertools\nimport math\n\n\ndef main():\n n = int(input())\n \n count_753 = 0\n max_digits = int(math.log10(n)) + 2\n cand_753 = ("3", "5", "7")\n \n for digits in range(3, max_digits):\n for dig_753 in itertools.product(cand_753, repeat=digits):\n number_str = "".join(dig_753)\n \n if "7" in number_str and "5" in number_str and "3" in number_str and int(number_str) <= n:\n count_753 += 1\n \n print(count_753)\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s947763011', 's408220858'] | [3064.0, 3060.0] | [18.0, 35.0] | [470, 474] |
p03212 | u945228737 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["# import sys\n\n\nfrom collections import deque\nfrom decorator import stop_watch\n\n\n@stop_watch\ndef solve(N):\n dq = deque([(3, [1, 0, 0]), (5, [0, 1, 0]), (7, [0, 0, 1])])\n ans = 0\n while dq:\n num, check = dq.popleft()\n if num > N:\n break\n if sum(check) == 3:\n ans += 1\n for i in (3, 5, 7):\n new_num = num * 10 + i\n if new_num > N:\n break\n new_check = check.copy()\n if i == 3:\n new_check[0] = 1\n elif i == 5:\n new_check[1] = 1\n elif i == 7:\n new_check[2] = 1\n dq.append((new_num, new_check))\n print(ans)\n\n\nif __name__ == '__main__':\n N = int(input())\n solve(N)\n\n # # test\n # from random import randint\n # from func import random_str\n # solve()\n", "# import sys\n\n\nfrom collections import deque\n\n\n# from decorator import stop_watch\n#\n#\n# @stop_watch\ndef solve(N):\n dq = deque([(3, {3: 1, 5: 0, 7: 0}),\n (5, {3: 0, 5: 1, 7: 0}),\n (7, {3: 0, 5: 0, 7: 1})])\n ans = 0\n while dq:\n num, check = dq.popleft()\n if num > N:\n break\n if sum(check.values()) == 3:\n ans += 1\n for i in (3, 5, 7):\n new_num = num * 10 + i\n if new_num > N:\n break\n new_check = check.copy()\n new_check[i] = 1\n dq.append((new_num, new_check))\n print(ans)\n\n\nif __name__ == '__main__':\n N = int(input())\n solve(N)\n\n # # test\n # from random import randint\n # from func import random_str\n # solve()\n"] | ['Runtime Error', 'Accepted'] | ['s306433166', 's875474454'] | [10816.0, 15624.0] | [40.0, 53.0] | [904, 837] |
p03212 | u945460548 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['# coding: utf-8\n# Your code here!\nimport itertools\nx = int(input())\nl = [3, 5, 7]\n\nh = itertools.combinations_with_replacement(l, 4)\n\ncnt = 0\nfor v in itertools.combinations_with_replacement(l, 4):\n if (3 in v and 5 in v and 7 in v):\n if v < x:\n cnt += 1\n\nh_list = list(itertools.combinations_with_replacement(l, 4))\n\nprint (cnt)', 'import itertools\nx = int(input())\nl = [3, 5, 7]\n\n\ncnt = 0\nfor i in range(2, len(str(x))+1):\n for v in itertools.combinations_with_replacement(l, i):\n #print(v)\n if (3 in v and 5 in v and 7 in v):\n num = ""\n for text in v:\n num += str(text)\n anagram_list = [\'\'.join(v) for v in itertools.permutations(num)]\n anagram_list = list(set(anagram_list))\n print (anagram_list)\n for hoge in anagram_list:\n if int(hoge) < x:\n cnt += 1\n #print(hoge)\n\nprint (cnt)', "N = int(input())\n\ndef dfs(s): \n\tif int(s) > N:\n\t\treturn 0\n\tret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n\tfor c in '753':\n\t\tret += dfs(s + c)\n\treturn ret\n\nprint(dfs('0')) \n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s378951214', 's689054856', 's152162373'] | [3064.0, 30704.0, 2940.0] | [18.0, 2105.0, 93.0] | [350, 602, 350] |
p03212 | u953110527 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['n = input()\nt = ["3","5","7"]\nfor i in range(8):\n s = []\n for j in t:\n s.append(j+"3")\n s.append(j+"5")\n s.append(j+"7")\n t += s\nt = set(t)\nt = list(t)\nt.sort()\ncount = 0\nfor i in range(len(t)):\n if len(t[i]) > len(n):\n break\n if int(t[i]) > int(n):\n continue\n if \'3\' in t[i] and \'5\' in t[i] and \'7\' in t[i]:\n count+=1\nprint(count)', 'n = input()\nt = ["3","5","7"]\nfor i in range(8):\n s = []\n for j in t:\n s.append(j+"3")\n s.append(j+"5")\n s.append(j+"7")\n t += s\nt = set(t)\nt = list(t)\nt.sort()\ncount = 0\nfor i in range(len(t)):\n if len(t[i]) > len(n):\n continue\n if int(t[i]) > int(n):\n continue\n if \'3\' in t[i] and \'5\' in t[i] and \'7\' in t[i]:\n count+=1\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s257495116', 's850455835'] | [20076.0, 20076.0] | [109.0, 115.0] | [391, 394] |
p03212 | u961595602 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['# -*- coding: utf-8 -*-\nfrom sys import stdin\nimport IPython\n\nd_in = lambda: int(stdin.readline()) # N = d_in()\n\ncand = [0, 3, 5, 7]\nN = d_in()\n\n\ndef check_count(count):\n if count[3] > 0 and count[5] > 0 and count[7] > 0:\n return True\n else:\n return False\n\n\ndef search(flag, nonzero, str_n, count):\n \n if len(str_n) == 0:\n if check_count(count):\n return 1\n else:\n return 0\n elif check_count(count) and (not flag):\n return 3**(len(str_n))\n elif not flag:\n ans = 0\n for i in cand:\n if nonzero and i == 0:\n continue\n next_count = count.copy()\n next_count[i] += 1\n zeroflag = nonzero or (i != 0)\n ans += search(False, zeroflag, str_n[1:], next_count)\n return ans\n else:\n next_n = int(str_n[0])\n ans = 0\n for i in cand:\n if nonzero and i == 0:\n continue\n next_count = count.copy()\n if i > next_n:\n break\n elif i == 0:\n zeroflag = nonzero\n ans += search(False, zeroflag, str_n[1:], next_count)\n elif i == next_n:\n next_count[i] += 1\n ans += search(True, True, str_n[1:], next_count)\n else:\n next_count[i] += 1\n ans += search(False, True, str_n[1:], next_count)\n return ans\n\n\nstr_N = list(str(N))\ncand_count = {0: 0, 3: 0, 5: 0, 7: 0}\nprint(search(True, False, str_N, cand_count))\n# IPython.embed()\n', '# -*- coding: utf-8 -*-\nfrom sys import stdin\n\nd_in = lambda: int(stdin.readline()) # N = d_in()\n\ncand = [0, 3, 5, 7]\nN = d_in()\n\n\ndef check_count(count):\n if count[3] > 0 and count[5] > 0 and count[7] > 0:\n return True\n else:\n return False\n\n\ndef search(flag, nonzero, str_n, count):\n \n if len(str_n) == 0:\n if check_count(count):\n return 1\n else:\n return 0\n elif check_count(count) and (not flag):\n return 3**(len(str_n))\n elif not flag:\n ans = 0\n for i in cand:\n if nonzero and i == 0:\n continue\n next_count = count.copy()\n next_count[i] += 1\n zeroflag = nonzero or (i != 0)\n ans += search(False, zeroflag, str_n[1:], next_count)\n return ans\n else:\n next_n = int(str_n[0])\n ans = 0\n for i in cand:\n if nonzero and i == 0:\n continue\n next_count = count.copy()\n if i > next_n:\n break\n elif i == 0:\n zeroflag = nonzero\n ans += search(False, zeroflag, str_n[1:], next_count)\n elif i == next_n:\n next_count[i] += 1\n ans += search(True, True, str_n[1:], next_count)\n else:\n next_count[i] += 1\n ans += search(False, True, str_n[1:], next_count)\n return ans\n\n\nstr_N = list(str(N))\ncand_count = {0: 0, 3: 0, 5: 0, 7: 0}\nprint(search(True, False, str_N, cand_count))\n'] | ['Runtime Error', 'Accepted'] | ['s467911479', 's317584476'] | [3064.0, 3064.0] | [19.0, 26.0] | [1810, 1777] |
p03212 | u961674365 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["def f4(n):\n s=0\n d=1\n q=0\n while n>0:\n s+=d*(n%4)\n d*=10\n n=n//4\n return s\n\nn=input()\nd=len(n)\nif d>3 and n[0:2] in ['11','12','21','22']:\n d-=1\n n='7'*d\nans=0\nm=''\nfor i in range(d):\n x=n[i]\n if x in '12':\n m+='0'\n elif x in '34':\n m+='1'\n elif x in '56':\n m+='2'\n else:\n m+='3'\nans=0\nfor i in range(1,1+int(m,4)):\n l=[x for x in str(f4(i))]\n l=list(set(l))\n if len(l)==3 and 6==int(l[0])+int(l[1])+int(l[2]):\n ans+=1\n\nprint(m,ans)", "def f4(n):\n s=0\n d=1\n q=0\n while n>0:\n s+=d*(n%4)\n d*=10\n n=n//4\n return s\n\nn=input()\nd=len(n)\nif d>3 and n[0] in ['1','2']:\n d-=1\n n='7'*d\nans=0\nm=''\nfor i in range(d):\n x=n[i]\n if x in '12':\n m+='0'\n elif x in '34':\n m+='1'\n elif x in '56':\n m+='2'\n else:\n m+='3'\nans=0\nfor i in range(1,1+int(m,4)):\n l=[x for x in str(f4(i))]\n l=list(set(l))\n if len(l)==3 and 6==int(l[0])+int(l[1])+int(l[2]):\n ans+=1\n\nprint(m,ans)", "from collections import deque\n\nn = int(input())\nq = deque(['3','5','7'])\nans = 0\nl = []\nwhile True:\n v = q.popleft()\n if int(v) >= n:\n if int(v) == n and ('3' in v and '5' in v and '7' in v):\n ans += 1\n print(ans)\n exit() \n if '3' in v and '5' in v and '7' in v:\n ans += 1\n l.append(int(v))\n q.append(v+'3')\n q.append(v+'5')\n q.append(v+'7')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s438353080', 's921162691', 's487938727'] | [3064.0, 3192.0, 8684.0] | [1184.0, 1169.0, 61.0] | [471, 457, 405] |
p03212 | u963915126 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["import sys\n\nn = int(input())\nsys.setrecursionlimit(10**10)\n\n\n\ndef count(num):\n if num > n:\n return 0\n fl = 0\n s = str(num)\n if '3' in s and '5' in s and '7' in s:\n fl = 1\n\n return fl + count(num*10+3) + count(num*10+5) + count(num*10+7)\n\n\nprint(count(0))", "import sys\n\nn = int(input())\nsys.setrecursionlimit(2*10**9+1)\n\n\ndef count(num):\n if num > n:\n return 0\n fl = 0\n s = str(num)\n if '3' in s and '5' in s and '7' in s:\n fl = 1\n\n return fl + count(num*10+3) + count(num*10+5) + count(num*10+7)\n\n\nprint(count(0))"] | ['Runtime Error', 'Accepted'] | ['s687944702', 's082684807'] | [3060.0, 3060.0] | [17.0, 43.0] | [283, 285] |
p03212 | u973840923 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ["N = int(input())\n\ndef dfs(s): \n print(s)\n if int(s) > N:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0 \n for c in '753':\n ret += dfs(s + c)\n return ret\n\nprint(dfs('0')) ", "N = int(input())\n\ncnt = 0\ndef dfs(n):\n global cnt\n if len(n) >= 11:\n return 0\n for s in '357':\n dfs(n+s)\n if int(n) <= N and '3' in n and '5' in n and '7' in n:\n cnt += 1\n return cnt\n\nprint(dfs('0'))"] | ['Wrong Answer', 'Accepted'] | ['s154224123', 's718770758'] | [4132.0, 2940.0] | [156.0, 52.0] | [386, 235] |
p03212 | u983918956 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['N = input()\ndef rec(list1,list2,initial,time):\n for e in list1:\n for b in [0,1,2,3]:\n if b == 0:\n e_copy = e\n list2.append(e_copy)\n elif b == 1:\n e_copy = e + "3"\n list2.append(e_copy)\n elif b == 2:\n e_copy = e + "5"\n list2.append(e_copy)\n elif b == 3:\n e_copy = e + "7"\n list2.append(e_copy)\n list1.clear()\n \n if initial + 1 >= time :\n return list2\n else:\n return rec(list2,list1,initial + 1, time)\nl1 = ["3","5","7"]\nl2 = []\nresult = rec(l1,l2,0,len(N)-2)\nresult = [int(e) for e in result if e.count("3")*e.count("5")*e.count("7") >= 1]\nresult = list(set(result))\nresult.sort()\ncount = 0\nfor e in result:\n if int(N) < e:\n break\n count += 1\nprint(count)', 'N = int(input())\nans = 0\ndef dfs(s):\n if int(s) <= N and len(set(s)) >= 3:\n global ans\n ans += 1\n\n if len(s) == 9:\n return\n dfs(s + "7")\n dfs(s + "5")\n dfs(s + "3")\n\ndfs("7")\ndfs("5")\ndfs("3")\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s228678312', 's048172732'] | [8352.0, 3060.0] | [71.0, 45.0] | [903, 240] |
p03212 | u993642190 | 2,000 | 1,048,576 | You are given an integer N. Among the integers between 1 and N (inclusive), how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear. | ['def is_753(s) :\n\tif (s.find("0") > -1) :\n\t\treturn False\n\telif (s.find("1") > -1) :\n\t\treturn False\n\telif (s.find("2") > -1) :\n\t\treturn False\n\telif (s.find("4") > -1) :\n\t\treturn False\n\telif (s.find("6") > -1) :\n\t\treturn False\n\telif (s.find("8") > -1) :\n\t\treturn False\n\telif (s.find("9") > -1) :\n\t\treturn False\n\treturn True\n\nN = int(input())\ncount = 0\n# index = 0\n\nfor i in range(N+1) :\n\ts = str(i)\n\tif (is_753(s)) :\n\t\tcount += 1\n\nprint(count)', 'import math\ndef is_753(s) :\n\t\n\tif ("0" in s) :\n\t\treturn False\n\telif ("1" in s) :\n\t\treturn False\n\telif ("2" in s) :\n\t\treturn False\n\telif ("4" in s) :\n\t\treturn False\n\telif ("6" in s) :\n\t\treturn False\n\telif ("8" in s) :\n\t\treturn False\n\telif ("9" in s) :\n\t\treturn False\n\t\n\tif ("7" in s and "5" in s and "3" in s) :\n\t\treturn True\n\t\n\treturn False\n\ndef hoge(s) :\n\tfor i in range(len(s)) :\n\t\tif (s[i] != "3" and s[i] != "5" and s[i] != "7") :\n\t\t\treturn int(math.pow(10, len(s) - (i+1)))\n\n\treturn 0\n\ndef main() :\n\tN = int(input())\n\tcount = 0\n\tindex = 356\n\t\n\tif (N < 357) :\n\t\tprint("0")\n\t\treturn\n\n\twhile index <= N :\n\t\ts = str(index)\n\t\ta = hoge(s)\n\t\tif (a != 0) :\n\t\t\tindex += a\n\t\t\tcontinue\t\t\n\t\t\n\t\tif (is_753(s)) :\n\t\t\tcount += 1\n\t\t\n\t\tindex += 1\n\t\n\tprint(count)\n\n\nmain()'] | ['Wrong Answer', 'Accepted'] | ['s842479366', 's526661481'] | [3188.0, 3064.0] | [2104.0, 296.0] | [440, 758] |
p03213 | u021548497 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['n = int(input())\nprime_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\ndivider_list = []\nfor i in range(1,n+1):\n while i > 1:\n for j in prime_list:\n if i % j == 0:\n divider_list.append(j)\n i = i // j\n break\n else:\n continue\ndivider_dic = {}\nfor k in divider_list:\n if k in divider_dic:\n divider_dic[k] = divider_dic[k] + 1\n else:\n divider_dic[k] = 1\n\nkey_list = []\nfor k in divider_dic:\n key_list.append(divider_dic[k])\na, b, c, d, e = 0, 0, 0, 0, 0\nfor k in key_list:\n if k == 1:\n continue\n elif k < 4:\n a += 1\n elif k < 14:\n b += 1\n elif k < 24:\n c += 1\n elif k < 74:\n d += 1\n else:\n e += 1\n\ndef nCr(n, r):\n if n < r:\n return 0\n r = min(r, n - r)\n if r == 0: return 1;\n if r == 1: return n;\n numerator = [n - r + i + 1 for i in range(r)]\n denominator = [i + 1 for i in range(r)]\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1: \n result *= numerator[k]\n return result\nprint(key_list)\nprint(a, b, c, d, e)\nans = int(a*nCr(b+c+d+e,2)+nCr(b+c+d+e,2)*(b+c+d+e-2)+b*(c+d+e)+(c+d+e)*(c+d+e-1)+(a+b+c)*(d+e)+(d+e)*(d+e-1)+e)\nprint(ans)', 'n = int(input())\nprime_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\ndivider_list = []\nfor i in range(1,n+1):\n while i > 1:\n for j in prime_list:\n if i % j == 0:\n divider_list.append(j)\n i = i // j\n break\n else:\n continue\ndivider_dic = {}\nfor k in divider_list:\n if k in divider_dic:\n divider_dic[k] = divider_dic[k] + 1\n else:\n divider_dic[k] = 1\n\nkey_list = []\nfor k in divider_dic:\n key_list.append(divider_dic[k])\na, b, c, d, e = 0, 0, 0, 0, 0\nfor k in key_list:\n if k == 1:\n continue\n elif k < 4:\n a += 1\n elif k < 14:\n b += 1\n elif k < 24:\n c += 1\n elif k < 74:\n d += 1\n else:\n e += 1\n\ndef nCr(n, r):\n if n < r:\n return 0\n r = min(r, n - r)\n if r == 0: return 1;\n if r == 1: return n;\n numerator = [n - r + i + 1 for i in range(r)]\n denominator = [i + 1 for i in range(r)]\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1: \n result *= numerator[k]\n return result\n\nans = int(a*nCr(b+c+d+e,2)+nCr(b+c+d+e,2)*(b+c+d+e-2)+b*(c+d+e)+(c+d+e)*(c+d+e-1)+(a+b+c)*(d+e)+(d+e)*(d+e-1)+e)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s691997362', 's694963321'] | [3192.0, 3192.0] | [18.0, 18.0] | [1567, 1531] |
p03213 | u026788530 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['n=int(input())\n\ne=[0 for i in range(n)]\nfor i in range(2,n):\n for j in range(2,i):\n if i==1:\n break\n while i%j==0:\n i//=j\n e[j]+=1\n\ndef num(k):\n ret=0\n for i in range(n):\n if e[i]>=k:\n ret += 1\nprint(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2)', 'n=int(input())\ne=[0 for i in range(n+1)]\nfor i in range(2,n+1):\n for j in range(2,i+1):\n if i==1:\n break\n while i%j==0:\n i//=j\n e[j]+=1\n\ndef num(k):\n ret=0\n for i in range(n):\n if e[i]>=k-1:\n ret += 1\n return ret\nprint(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2)'] | ['Runtime Error', 'Accepted'] | ['s809618193', 's756054843'] | [3064.0, 3064.0] | [18.0, 17.0] | [334, 354] |
p03213 | u029169777 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['from collections import Counter\n\ndef get_factors(x):\n retlist = []\n for i in range(2, int(x**0.5) + 3):\n while x % i == 0:\n retlist.append(i)\n x = x // i\n if x!=1:\n retlist.append(x)\n return retlist\n\nN=int(input())\n\ncnt=Counter()\nfor i in range(N):\n a=get_factors(i+1)\n acounter=Counter(a)\n cnt=cnt+acounter\nvalues,counts=zip(*cnt.most_common())\nans=0\nfive=0\nthree=0\nsevfou=0\ntwofou=0\nfourteen=0\nfor c in counts:\n if c>=74:\n sevfou+=1\n if c>=24:\n twofou+=1\n if c>=14:\n fourteen+=1\n if c>=4:\n five+=1\n if c>=2:\n three+=1\nans+=(five*(five-1)/2)*(three-2)\nans+=(fourteen*(five-1))\nans+=(twofou*(three-1))\nans+=(sevfou)\nprint(ans)', 'from collections import Counter\n\ndef get_factors(x):\n retlist = []\n for i in range(2, int(x**0.5) + 3):\n while x % i == 0:\n retlist.append(i)\n x = x // i\n if x!=1:\n retlist.append(x)\n return retlist\n\nN=int(input())\n\nif N==1:\n print(0)\n exit()\n\ncnt=Counter()\nfor i in range(N):\n a=get_factors(i+1)\n acounter=Counter(a)\n cnt=cnt+acounter\nvalues,counts=zip(*cnt.most_common())\nans=0\nfive=0\nthree=0\nsevfou=0\ntwofou=0\nfourteen=0\nfor c in counts:\n if c>=74:\n sevfou+=1\n if c>=24:\n twofou+=1\n if c>=14:\n fourteen+=1\n if c>=4:\n five+=1\n if c>=2:\n three+=1\nans+=(five*(five-1)/2)*(three-2)\nans+=(fourteen*(five-1))\nans+=(twofou*(three-1))\nans+=(sevfou)\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s985604583', 's221281880'] | [3316.0, 3436.0] | [23.0, 23.0] | [695, 730] |
p03213 | u059210959 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['# encoding:utf-8\nimport copy\nimport random\nimport bisect \nimport fractions \nimport math\nimport sys\nimport bisect\nimport collections\n\nmod = 10**9+7\nsys.setrecursionlimit(mod) \n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\nN = int(input())\n\n\ndef factorint(N):\n\n table = []\n while(N > 1):\n for i in range(2,N+1):\n if N%i == 0:\n while N%i == 0:\n N = N//i\n table.append(i)\n break\n # print(table_)\n return table\n\nl = []\nfor n in range(1,N+1):\n l += factorint(n)\n# print(l)\nc = collections.Counter(l)\n# print(c)\nc[1] = 0\nans = 0\ncom = {74:0,24:0,4:0,2:0,14:0}\nfor key in c.keys():\n if c[key] >= 74:\n com[74] = +1\n if c[key] >= 24:\n com[24] = +1\n if c[key] >= 14:\n com[14] += 1\n if c[key] >= 4:\n com[4] += 1\n if c[key] >= 2:\n com[2] += 1\nprint(com)\nans += com[74]\nans += com[24] * (com[2] - com[24])\nans += com[14] * (com[14] - com[2])\nif com[4] >= 2:\n ans += com[4] * (com[4] - 1)//2 * (com[2] - 2)\nprint(ans)\n', '# encoding:utf-8\nimport copy\nimport random\nimport bisect \nimport fractions \nimport math\nimport sys\nimport bisect\nimport collections\n\nmod = 10**9+7\nsys.setrecursionlimit(mod) \n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\nN = int(input())\n\n\ndef factorint(N):\n\n table = []\n while(N > 1):\n for i in range(2,N+1):\n if N%i == 0:\n while N%i == 0:\n N = N//i\n table.append(i)\n break\n return table\n\nl = []\nfor n in range(1,N+1):\n l += factorint(n)\nc = collections.Counter(l)\ncom = {74:0,24:0,14:0,4:0,2:0}\n# print(c)\nfor key in c.keys():\n if c[key] >= 74:\n com[74] += 1\n if c[key] >= 24:\n com[24] += 1\n if c[key] >= 14:\n com[14] += 1\n if c[key] >= 4:\n com[4] += 1\n if c[key] >= 2:\n com[2] += 1\n# print(com)\nans = 0\nans += com[74]\nans += com[24] * (com[2] - 1)\nans += com[14] * (com[4] - 1)\nans += com[4] * (com[4] - 1)* (com[2] - 2) //2\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s972838473', 's265836367'] | [5584.0, 6344.0] | [45.0, 54.0] | [1208, 1138] |
p03213 | u062459048 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['n = int(input())\n\nl = [0]*(n+1)\nfor i in range(2, n+1):\n cur = i\n for j in range(2, i+1):\n while cur % j == 0:\n cur //= j\n l[j] == 1\n\ndef num(s):\n return len(list(filter(lambda x: x >= m-1, l)))\n\nprint(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+(num(5)*(num(5)-1)*(num(3)-2))//2)\n', 'n = int(input())\n\nl = [0]*(n+1)\nfor i in range(2, n+1):\n cur = i\n for j in range(2, i+1):\n while cur % j == 0:\n cur //= j\n l[j] == 1\n\ndef num(s):\n return len(list(filter(lambda x: x >= m-1, l)))\n\nprint(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)\n', 'n = int(input())\n\nl = [0]*(n+1)\nfor i in range(2, n+1):\n cur = i\n for j in range(2, i+1):\n while cur % j == 0:\n cur //= j\n l[j] == 1\n\ndef num(s):\n return len(list(filter(lambda x: m-1 =< x, l)))\n\nprint(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+(num(5)*(num(5)-1)*(num(3)-2))//2)\n', 'n = int(input())\n\nl = [0]*(n+1)\nfor i in range(2, n+1):\n cur = i\n for j in range(2, i+1):\n while cur % j == 0:\n cur //= j\n l[j] == 1\n\ndef num(s):\n return len(list(filter(lambda x: m-1 > x, l)))\n\nprint(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+(num(5)*(num(5)-1)*(num(3)-2))//2)', 'n = int(input())\n\nl = [0]*(n+1)\nfor i in range(2, n+1):\n cur = i\n for j in range(2, i+1):\n while cur % j == 0:\n cur //= j\n l[j] += 1\n\ndef num(s):\n return len(list(filter(lambda x: x >= s-1, l)))\n\nprint(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s081984879', 's182695952', 's463265868', 's609597089', 's550816607'] | [3064.0, 3060.0, 2940.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0, 18.0, 19.0] | [299, 297, 299, 297, 297] |
p03213 | u093041722 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['# from collections import Counter\nfrom copy import deepcopy\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\nN = int(input())\nprime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\ndp = [[0] * 26 for _ in range(N)]\nif N == 1:\n print(0)\nelse:\n for i in range(1,N):\n dp[i] = deepcopy(dp[i-1])\n temp = Counter(prime_factorize(i+1))\n for x in temp.items():\n if len(prime_factorize(x[0])) == 1:\n dp[i][prime.index(x[0])] += x[1]\n four = 0\n two = 0\n fourteen = 0\n twenty_four = 0\n seventy_four = 0\n for j in range(25):\n if dp[i][j] >= 74:\n seventy_four += 1\n twenty_four += 1\n fourteen += 1\n four += 1\n two += 1\n elif dp[i][j] >= 24:\n twenty_four += 1\n fourteen += 1\n four += 1\n two += 1\n elif dp[i][j] >= 14:\n fourteen += 1\n four += 1\n two += 1\n elif dp[i][j] >= 4:\n four += 1\n two += 1\n elif dp[i][j] >= 2:\n two += 1\n dp[i][25] = ((four*(four-1))//2) * (two-2) + twenty_four * (two-1) + fourteen * (four-1) + seventy_four\n print(dp[N-1][25])', 'from collections import Counter\nfrom copy import deepcopy\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\nN = int(input())\nprime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\ndp = [[0] * 26 for _ in range(N)]\nif N == 1:\n print(0)\nelse:\n for i in range(1,N):\n dp[i] = deepcopy(dp[i-1])\n temp = Counter(prime_factorize(i+1))\n for x in temp.items():\n if len(prime_factorize(x[0])) == 1:\n dp[i][prime.index(x[0])] += x[1]\n four = 0\n two = 0\n fourteen = 0\n twenty_four = 0\n seventy_four = 0\n for j in range(25):\n if dp[i][j] >= 74:\n seventy_four += 1\n twenty_four += 1\n fourteen += 1\n four += 1\n two += 1\n elif dp[i][j] >= 24:\n twenty_four += 1\n fourteen += 1\n four += 1\n two += 1\n elif dp[i][j] >= 14:\n fourteen += 1\n four += 1\n two += 1\n elif dp[i][j] >= 4:\n four += 1\n two += 1\n elif dp[i][j] >= 2:\n two += 1\n dp[i][25] = ((four*(four-1))//2) * (two-2) + twenty_four * (two-1) + fourteen * (four-1) + seventy_four\n print(dp[N-1][25])'] | ['Runtime Error', 'Accepted'] | ['s740030271', 's437477137'] | [9332.0, 9572.0] | [25.0, 36.0] | [1598, 1596] |
p03213 | u094191970 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['from itertools import permutations\n\nn=int(input())\nnp=factorial(n)\np_list=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\n\nans=[]\nfor s,t,u in permutations(p_list,3):\n num1=(s**4)*(t**4)*(u**2)\n num2=(s**14)*(t**4)\n num3=(s**24)*(t**2)\n num4=s**74\n for z in [num1,num2,num3,num4]:\n if np%z==0:\n ans.append(z)\n\nprint(len(set(ans)))', 'from collections import Counter\nfrom itertools import permutations\n\nn=int(input())\n\ndef factorization(n):\n p=2\n fcr=[]\n while p*p<=n:\n while n%p==0:\n fcr.append(p)\n n//=p\n p+=1\n if n>1:\n fcr.append(n)\n return fcr\n\n\nfcr_l=[]\nfor i in range(1,n+1):\n fcr=factorization(i)\n fcr_l+=fcr\n\n\nc=Counter(fcr_l)\nfcr_st=set(fcr_l)\n\nans=[]\nfor p,q,r in permutations(fcr_st,3):\n if c[p]>=74:\n ans.append(p**74)\n if c[p]>=24 and c[q]>=2:\n ans.append((p**24)*(q**2))\n if c[p]>=14 and c[q]>=4:\n ans.append((p**14)*(q**4))\n if c[p]>=4 and c[q]>=4 and c[r]>=2:\n ans.append((p**4)*(q**4)*(r**2))\n\nprint(len(set(ans)))'] | ['Runtime Error', 'Accepted'] | ['s072149076', 's592777464'] | [3064.0, 9464.0] | [18.0, 41.0] | [392, 672] |
p03213 | u099566485 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['n=int(input())\nf=[]\nw=[0,0,0,0,0]\nfor i in range(2,n+1):\n c=0\n r=int(i**0.5)\n for j in range(2,r+2):\n while i%j==0:\n c+=1\n i=i//j\n if c!=0:\n f.append([j,c])\n c=0\n if i!=1:\n f.append([i,1])\nf.sort()\nd=[]\nans=0\ncou=f[0][1]\nfor i in range(1,len(f)):\n if f[i][0]==f[i-1][0]:\n cou+=f[i][1]\n else:\n d.append(cou)\n cou=1\nd.append(cou)\n\nfor i in d:\n for j,num in enumerate([2,4,14,24,74]):\n if i>=num:\n w[j]+=1\nprint(w)\nprint(w[4]+w[3]*(w[0]-1)+w[2]*(w[1]-1)+w[1]*(w[1]-1)*(w[0]-2)//2)', 'n=int(input())\nf=[]\nw=[0,0,0,0,0]\nfor i in range(2,n+1):\n c=0\n r=int(i**0.5)\n for j in range(2,r+2):\n while i%j==0:\n c+=1\n i=i//j\n if c!=0:\n f.append([j,c])\n c=0\n if i!=1:\n f.append([i,1])\nf.sort()\nd=[]\nans=0\nif n!=1:\n cou=f[0][1]\n for i in range(1,len(f)):\n if f[i][0]==f[i-1][0]:\n cou+=f[i][1]\n else:\n d.append(cou)\n cou=1\n d.append(cou)\n\n for i in d:\n for j,num in enumerate([2,4,14,24,74]):\n if i>=num:\n w[j]+=1\n ans=w[4]+w[3]*(w[0]-1)+w[2]*(w[1]-1)+w[1]*(w[1]-1)*(w[0]-2)//2\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s494213449', 's609893392'] | [3188.0, 3064.0] | [20.0, 19.0] | [602, 662] |
p03213 | u102126195 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['def D():\n N = int(input())\n tmplist = [0 for i in range(N + 1)]\n for i in range(1, N + 1):\n key = i\n for j in range(2, key + 1):\n while i % j == 0:\n tmplist[j] += 1\n i /= j\n ans = 0\n anslist = []\n for p in range(N + 1):\n if tmplist[p] + 1 >= 75:\n anslist.append(pow(p, 74))\n for q in range(N + 1):\n if p != q and tmplist[p] + 1 >= 25 and tmplist[q] + 1 >= 3:\n anslist.append(pow(p, 24) * pow(q, 2))\n if p != q and tmplist[p] + 1 >= 15 and tmplist[q] + 1 >= 5:\n anslist.append(pow(p, 14) * pow(q, 4))\n for r in range(N + 1):\n if p != q and q != r and r != p and tmplist[p] + 1 >= 5 and tmplist[q] + 1 >= 5 and tmplist[r] + 1 >= 3:\n anslist.append(pow(p, 4) * pow(q, 4) * pow(r, 2))\n anslist.sort()\n ans = 1\n for i in range(1, len(anslist)):\n if anslist[i] != anslist[i - 1]:\n ans += 1\n print(ans)\n\nD()', 'def D():\n N = int(input())\n numberlist = [0 for i in range(N + 1)]\n for i in range(1, N + 1):\n tmp = i\n for j in range(2, i + 1):\n while tmp % j == 0:\n numberlist[j] += 1\n tmp /= j\n anslist = []\n for p in range(N + 1):\n if numberlist[p] + 1 >= 75:\n anslist.append(pow(p, 74))\n for q in range(N + 1):\n if p != q and numberlist[p] + 1 >= 15 and numberlist[q] + 1 >= 5:\n anslist.append(pow(p, 14) * pow(q, 4))\n if p != q and numberlist[p] + 1 >= 25 and numberlist[q] + 1 >= 3:\n anslist.append(pow(p, 24) * pow(q, 2))\n for r in range(N + 1):\n if p != q and q != r and r != p and numberlist[p] + 1 >= 5 and numberlist[q] + 1 >= 5 and numberlist[r] + 1 >= 3:\n anslist.append(pow(p, 4) * pow(q, 4) * pow(r, 2))\n ans = 1\n anslist.sort()\n for i in range(1, len(anslist)):\n if anslist[i] != anslist[i - 1]:\n ans += 1\n if len(anslist) == 0:\n ans = 0\n print(ans)\nD()'] | ['Wrong Answer', 'Accepted'] | ['s395173632', 's949630247'] | [3064.0, 3064.0] | [163.0, 165.0] | [1025, 1086] |
p03213 | u102960641 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['n = int(input())\nd = []\ne = [0,0,0,0,0]\nf = [74,24,14,4,2]\nfor i in prime_list:\n a = n\n b = 0\n c = 1\n while a // (i**c) > 0:\n b += a // (i**c)\n c += 1\n else:\n d.append(b)\ncount = 0\nlen_d = len(d)-1\nfor k in f:\n for i,j in enumerate(d):\n if j < k:\n e[count] = i\n count += 1\n break\n elif i == len_d:\n e[count] = i+1\n count += 1\n break\n\n\nprint(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))\n', 'd = []\ne = [0,0,0,0,0]\nf = [74,24,14,4,2]\nfor i in prime_list:\n a = n\n b = 0\n c = 1\n while a // (i**c) > 0:\n b += a // (i**c)\n c += 1\n else:\n d.append(b)\ncount = 0\nlen_d = len(d)-1\nfor k in f:\n for i,j in enumerate(d):\n if j < k:\n e[count] = i\n count += 1\n break\n elif i == len_d:\n e[count] = i+1\n count += 1\n break\n\n\nprint(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))', 'n = int(input())\nprime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]\nd = []\ne = [0,0,0,0,0]\nf = [74,24,14,4,2]\nfor i in prime_list:\n a = n\n b = 0\n c = 1\n while a // (i**c) > 0:\n b += a // (i**c)\n c += 1\n else:\n d.append(b)\ncount = 0\nlen_d = len(d)-1\nfor k in f:\n for i,j in enumerate(d):\n if j < k:\n e[count] = i\n count += 1\n break\n elif i == len_d:\n e[count] = i+1\n count += 1\n break\n\n\n\nprint(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s840291010', 's883284944', 's675745392'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 19.0] | [454, 436, 511] |
p03213 | u127499732 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ["def is_prime(n):\n d = n - 1\n d = d // (d & -d)\n L = [2, 7, 61] if n < 1 << 32 else [2, 3, 5, 7, 11, 13, 17] if n < 1 << 48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]\n for a in L:\n t = d\n y = pow(a, t, n)\n if y == 1:\n continue\n while y != n - 1:\n y = y * y % n\n if y == 1 or t == n - 1: return 0\n t <<= 1\n return 1\n\n\ndef prime_factor(n):\n if n == 1:\n return {1: 1}\n\n pf = dict()\n r = list(range(2, n + 1))\n\n while n != 1:\n x = r[0]\n cnt = 0\n while n % x == 0:\n n = n // x\n cnt += 1\n if cnt > 0:\n pf[x] = cnt\n r = list(filter(lambda y: y % x != 0, r))\n\n return pf\n\n\ndef main():\n from fractions import factorial as f\n from collections import defaultdict\n n = int(input())\n d = defaultdict(int)\n for i in range(1, n + 1):\n p = prime_factor(i)\n for k, v in p.items():\n d[k] += v\n \n f2_, f4_, f14_, f24_, f74_ = 0, 0, 0, 0, 0\n for i in d.values():\n if i >= 2:\n f2_ += 1\n if i >= 4:\n f4_ += 1\n if i >= 14:\n f14_ += 1\n if i >= 24:\n f24_ += 1\n if i >= 74:\n f74_ += 1\n\n ans = f74_ + f24_ * (f2_ - 1) + f14_ * (f4_ - 1) + f4_ * (f4_ - 1) * (f2_ - 2) // 2\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "def is_prime(n):\n d = n - 1\n d = d // (d & -d)\n L = [2, 7, 61] if n < 1 << 32 else [2, 3, 5, 7, 11, 13, 17] if n < 1 << 48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]\n for a in L:\n t = d\n y = pow(a, t, n)\n if y == 1:\n continue\n while y != n - 1:\n y = y * y % n\n if y == 1 or t == n - 1: return 0\n t <<= 1\n return 1\n\n\ndef prime_factor(n):\n if n == 1:\n return {1: 1}\n\n pf = dict()\n r = list(range(2, n + 1))\n\n while n != 1:\n x = r[0]\n cnt = 0\n while n % x == 0:\n n = n // x\n cnt += 1\n if cnt > 0:\n pf[x] = cnt\n r = list(filter(lambda y: y % x != 0, r))\n\n return pf\n\n\ndef main():\n from collections import defaultdict\n n = int(input())\n d = defaultdict(int)\n for i in range(1, n + 1):\n p = prime_factor(i)\n for k, v in p.items():\n d[k] += v\n \n f2_, f4_, f14_, f24_, f74_ = 0, 0, 0, 0, 0\n for i in d.values():\n if i >= 2:\n f2_ += 1\n if i >= 4:\n f4_ += 1\n if i >= 14:\n f14_ += 1\n if i >= 24:\n f24_ += 1\n if i >= 74:\n f74_ += 1\n\n ans = f74_ + f24_ * (f2_ - 1) + f14_ * (f4_ - 1) + f4_ * (f4_ - 1) * (f2_ - 2) // 2\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s627755126', 's101026503'] | [5204.0, 3316.0] | [36.0, 24.0] | [1425, 1384] |
p03213 | u135204039 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['import math\nN = int(input())\n\ndef make_prime_list(num):\n if num < 2:\n return []\n\n \n prime_list = [i for i in range(num + 1)]\n prime_list[1] = 0 \n num_sqrt = math.sqrt(num)\n \n\n for prime in prime_list:\n if prime == 0:\n continue\n if prime > num_sqrt:\n break\n\n for non_prime in range(2 * prime, num+1, prime):\n prime_list[non_prime] = 0\n\n return [prime for prime in prime_list if prime != 0]\n\nprime_list = make_prime_list(N)\ne = len(prime_list)*[0]\n\ndef num(m):\n return len(list(filter(lambda x: x>=m-1, e)))\n\nfor i in range(N):\n cur = i + 2\n for index,j in enumerate(prime_list):\n while cur % j == 0:\n e[index] += 1\n cur //= j\nprint(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)\n +num(5) * (num(5) -1 ) * (num(3) - 2) //2)', "N = int(input())\ne = [0] * N\nfor i in range(N):\n cur = i + 2\n for j in range(2, i + 3):\n while cur % j == 0:\n e[j-2] += 1\n cur //= j\n\n def num(m):\n return len(list(filter(lambda x: x>=m-1, e)))\n\n print('#' + str(N+1) + ':' + str(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)\n +num(5) * (num(5) -1 ) * (num(3) - 2) //2))", '%%timeit\n\nimport math\nN = 100\n\ndef make_prime_list(num):\n if num < 2:\n return []\n\n \n prime_list = [i for i in range(num + 1)]\n prime_list[1] = 0 \n num_sqrt = math.sqrt(num)\n \n\n for prime in prime_list:\n if prime == 0:\n continue\n if prime > num_sqrt:\n break\n\n for non_prime in range(2 * prime, num+1, prime):\n prime_list[non_prime] = 0\n\n return [prime for prime in prime_list if prime != 0]\n\nprime_list = make_prime_list(100)\ne = len(prime_list)*[0]\n\nfor i in range(N):\n cur = i + 2\n for index,j in enumerate(prime_list):\n while cur % j == 0:\n e[index] += 1\n cur //= j\nprint(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)\n +num(5) * (num(5) -1 ) * (num(3) - 2) //2)', 'import math\nN = int(input())\n\ndef make_prime_list(num):\n if num < 2:\n return []\n\n \n prime_list = [i for i in range(num + 1)]\n prime_list[1] = 0 \n num_sqrt = math.sqrt(num)\n \n\n for prime in prime_list:\n if prime == 0:\n continue\n if prime > num_sqrt:\n break\n\n for non_prime in range(2 * prime, num+1, prime):\n prime_list[non_prime] = 0\n\n return [prime for prime in prime_list if prime != 0]\n\nprime_list = make_prime_list(100)\ne = len(prime_list)*[0]\n\ndef num(m):\n return len(list(filter(lambda x: x>=m-1, e)))\n\nfor i in range(N):\n cur = i + 2\n for index,j in enumerate(prime_list):\n while cur % j == 0:\n e[index] += 1\n cur //= j\nprint(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)\n +num(5) * (num(5) -1 ) * (num(3) - 2) //2)', 'import math\nN = int(input())\n\ndef make_prime_list(num):\n if num < 2:\n return []\n\n \n prime_list = [i for i in range(num + 1)]\n prime_list[1] = 0 \n num_sqrt = math.sqrt(num)\n \n\n for prime in prime_list:\n if prime == 0:\n continue\n if prime > num_sqrt:\n break\n\n for non_prime in range(2 * prime, num+1, prime):\n prime_list[non_prime] = 0\n\n return [prime for prime in prime_list if prime != 0]\n\nprime_list = make_prime_list(100)\ne = len(prime_list)*[0]\n\nfor i in range(N):\n cur = i + 2\n for index,j in enumerate(prime_list):\n while cur % j == 0:\n e[index] += 1\n cur //= j\nprint(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)\n +num(5) * (num(5) -1 ) * (num(3) - 2) //2)', 'import math\nN = int(input())\n\ndef make_prime_list(num):\n if num < 2:\n return []\n\n \n prime_list = [i for i in range(num + 1)]\n prime_list[1] = 0 \n num_sqrt = math.sqrt(num)\n \n\n for prime in prime_list:\n if prime == 0:\n continue\n if prime > num_sqrt:\n break\n\n for non_prime in range(2 * prime, num+1, prime):\n prime_list[non_prime] = 0\n\n return [prime for prime in prime_list if prime != 0]\n\nprime_list = make_prime_list(N+1)\ne = len(prime_list)*[0]\n\ndef num(m):\n return len(list(filter(lambda x: x>=m-1, e)))\n\nfor i in range(N+1):\n cur = i + 2\n for index,j in enumerate(prime_list):\n while cur % j == 0:\n e[index] += 1\n cur //= j\nprint(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)\n +num(5) * (num(5) -1 ) * (num(3) - 2) //2)', 'N = int(input())\ne = [0] * (N+1)\nfor i in range(2, N+1):\n cur = i\n for j in range(2, i+1):\n while cur % j == 0:\n e[j] += 1\n cur //= j\n\ndef num(m):\n return len(list(filter(lambda x: x>=m-1, e)))\n\nprint(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)\n +num(5) * (num(5) -1 ) * (num(3) - 2) //2)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s163387100', 's337962869', 's797552717', 's882036139', 's927840784', 's960874506', 's148214730'] | [3064.0, 3064.0, 2940.0, 3064.0, 3188.0, 3064.0, 3064.0] | [19.0, 41.0, 19.0, 18.0, 19.0, 20.0, 19.0] | [922, 399, 862, 924, 861, 926, 341] |
p03213 | u136090046 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['import collections\nimport itertools\n\nyakusuu = {}\nfor j in range(2, 101):\n I = j\n s = 0\n R = int(I)\n L = []\n while s == 0:\n for i in range(2, R + 1):\n if I % i == 0:\n I = I / i\n if I == 1:\n s = 1\n L.append(i)\n break\n if len(L) == 1:\n yakusuu[R] = [R]\n else:\n yakusuu[R] = L\n\nn = int(input())\n\ncnt = 0\n\nfor num in range(1, n + 1):\n tmp = []\n if n == 1:\n print(0)\n exit()\n for i in range(2, num + 1):\n tmp += yakusuu[i]\ntmp = dict(collections.Counter(tmp))\ntmp_array = sorted(list(tmp.keys()))\nprint(tmp_array)\n\ncnt = 0\n\nfor i in tmp_array:\n if tmp[i] >= 74:\n cnt += 1\n\nfor i in tmp_array:\n for j in tmp_array:\n if i == j:\n continue\n elif (tmp[i] >= 14 and tmp[j] >= 4) or (tmp[i] >= 4 and tmp[j] >= 14):\n cnt += 1\n\nfor i in tmp_array:\n for j in tmp_array:\n if i == j:\n continue\n elif (tmp[i] >= 24 and tmp[j] >= 2) or (tmp[i] >= 2 and tmp[j] >= 24):\n cnt += 1\n\nres_array = list(itertools.combinations(tmp_array, 3))\nfor i, j, k in res_array:\n if (tmp[i] >= 2 and tmp[j] >= 4 and tmp[k] >= 4) or \\\n (tmp[i] >= 4 and tmp[j] >= 2 and tmp[k] >= 4) or \\\n (tmp[i] >= 4 and tmp[j] >= 4 and tmp[k] >= 2):\n cnt += 1\nprint(cnt)\n', 'import collections\nimport itertools\n\nyakusuu = {}\nfor j in range(2, 101):\n I = j\n s = 0\n R = int(I)\n L = []\n while s == 0:\n for i in range(2, R + 1):\n if I % i == 0:\n I = I / i\n if I == 1:\n s = 1\n L.append(i)\n break\n if len(L) == 1:\n yakusuu[R] = [R]\n else:\n yakusuu[R] = L\n\nn = int(input())\n\ncnt = 0\n\nfor num in range(1, n + 1):\n tmp = []\n if n == 1:\n print(0)\n exit()\n for i in range(2, num + 1):\n tmp += yakusuu[i]\n\ntmp = dict(collections.Counter(tmp))\ntmp_array = sorted(list(tmp.keys()))\n\ncnt = 0\n\nfor i in tmp_array:\n if tmp[i] >= 74:\n cnt += 1\n\nfor i in tmp_array:\n for j in tmp_array:\n if i == j:\n continue\n elif tmp[i] >= 14 and tmp[j] >= 4:\n cnt += 1\n\nfor i in tmp_array:\n for j in tmp_array:\n if i == j:\n continue\n elif tmp[i] >= 24 and tmp[j] >= 2:\n cnt += 1\n\nres_array = list(itertools.combinations(tmp_array, 3))\nfor i in range(len(tmp_array)):\n for j in range(len(tmp_array)):\n for k in range(j+1, len(tmp_array)):\n if (j == i) or (i == k): continue\n if tmp[tmp_array[i]] >= 2 and tmp[tmp_array[j]] >= 4 and tmp[tmp_array[k]] >= 4:\n cnt += 1\n\nprint(cnt)\n'] | ['Wrong Answer', 'Accepted'] | ['s850689790', 's105401699'] | [3444.0, 3444.0] | [24.0, 26.0] | [1399, 1366] |
p03213 | u160244242 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['import math\nprime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]\n\nM = N\nfac_lst = []\nfor i in prime:\n count = 0\n M = N\n while M % i == 0:\n M = M // i\n count += 1\n fac_lst.append(count)\n \ncount0, count1, count2, count3, count4 = 0, 0, 0, 0,0\nfor i in fac_lst:\n if i >= 74:\n count0 += 1\n count1 += 1\n count2 += 1\n count3 += 1\n count4 += 1\n elif i >= 24:\n count1 += 1\n count2 += 1\n count3 += 1\n count4 += 1\n elif i >= 14:\n count2 += 1\n count3 += 1\n count4 += 1\n elif i >= 4:\n count3 += 1\n count4 += 1\n elif i >= 2:\n count4 += 1\ncount_lst = [count0, count1, count2, count3, count4]\n\nans0 = count_lst[0]\nans1 = count_lst[1] * (count_lst[4] - 1)\nans2 = count_lst[2] * (count_lst[3] - 1)\nans3 = (count_lst[3]*(count_lst[3]-1) // 2) * (count_lst[4] - 2)\nif ans1 < 0:\n ans1 = 0\nif ans2 < 0:\n ans2 = 0\nif ans3 < 0:\n ans3 = 0\nprint(ans0+ans1+ans2+ans3)', 'import math\nprime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]\n\nn = int(input())\nN = math.factorial(n)\n\nM = N\nfac_lst = []\nfor i in prime:\n count = 0\n M = N\n while M % i == 0:\n M = M // i\n count += 1\n fac_lst.append(count)\n \ncount0, count1, count2, count3, count4 = 0, 0, 0, 0,0\nfor i in fac_lst:\n if i >= 74:\n count0 += 1\n count1 += 1\n count2 += 1\n count3 += 1\n count4 += 1\n elif i >= 24:\n count1 += 1\n count2 += 1\n count3 += 1\n count4 += 1\n elif i >= 14:\n count2 += 1\n count3 += 1\n count4 += 1\n elif i >= 4:\n count3 += 1\n count4 += 1\n elif i >= 2:\n count4 += 1\ncount_lst = [count0, count1, count2, count3, count4]\n\nans0 = count_lst[0]\nans1 = count_lst[1] * (count_lst[4] - 1)\nans2 = count_lst[2] * (count_lst[3] - 1)\nans3 = (count_lst[3]*(count_lst[3]-1) // 2) * (count_lst[4] - 2)\nif ans1 < 0:\n ans1 = 0\nif ans2 < 0:\n ans2 = 0\nif ans3 < 0:\n ans3 = 0\nprint(ans0+ans1+ans2+ans3)'] | ['Runtime Error', 'Accepted'] | ['s360191167', 's497855348'] | [3064.0, 3192.0] | [18.0, 18.0] | [1027, 1067] |
p03213 | u177411511 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['import sys\nfrom collections import deque\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn = ni()\npr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]\narr = [0] * 5\nnum = 1\nfor i in range(1, n+1):\n num *= i\nfor n in pr:\n tmp = num\n ct = 0\n while True:\n if tmp % n == 0:\n ct += 1\n tmp //= n\n else:\n break\n if ct >= 74:\n arr[0] += 1\n if ct >= 24:\n arr[1] += 1\n elif ct >= 14:\n arr[2] += 1\n elif ct >= 4:\n arr[3] += 1\n elif ct >= 2:\n arr[4] += 1\nprint(*arr)\nans = 0\nif arr[0] == 1:\n ans += 1\nif sum(arr[0:2]) >= 1:\n ans += ((sum(arr[0:2]) * (sum(arr) - 1)))\nif sum(arr[0:3]) >= 1:\n ans += ((sum(arr[0:3]) * (sum(arr[0:4]) - 1)))\nif sum(arr[0:4]) >= 2 and arr[4] >= 1:\n s = sum(arr[0:4])\n ans += (s * (s-1) * (s-2) // 2)\n ans += (arr[4] * s * (s-1) // 2)\nprint(ans)', 'import sys\nfrom collections import deque\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn = ni()\npr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]\narr = [0] * 5\nnum = 1\nfor i in range(1, n+1):\n num *= i\nfor n in pr:\n tmp = num\n ct = 0\n while True:\n if tmp % n == 0:\n ct += 1\n tmp //= n\n else:\n break\n if ct >= 74:\n arr[0] += 1\n elif ct >= 24:\n arr[1] += 1\n elif ct >= 14:\n arr[2] += 1\n elif ct >= 4:\n arr[3] += 1\n elif ct >= 2:\n arr[4] += 1\nans = 0\nif arr[0] == 1:\n ans += 1\nif sum(arr[:2]) >= 1:\n ans += ((sum(arr[0:2]) * (sum(arr) - 1)))\nif sum(arr[:3]) >= 1:\n ans += ((sum(arr[0:3]) * (sum(arr[:4]) - 1)))\nif sum(arr[:4]) >= 2 and arr[4] >= 1:\n s = sum(arr[:4])\n ans += (s * (s-1) * (s-2) // 2)\n ans += (arr[4] * s * (s-1) // 2)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s668538946', 's162383325'] | [3444.0, 3316.0] | [25.0, 21.0] | [1011, 996] |
p03213 | u197300773 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['N=int(input())\ndiv=[0]*(N+1)\n\nfor i in range(1,N+1):\n j=2\n while i!=1:\n if i%j==0:\n i//=j\n div[j]+=1\n else: j+=1\n\nprint(div)\n\na,b,c,d,e=0,0,0,0,0\nfor i in range(N+1):\n if div[i]>74: e+=1\n if div[i]>24:\n a+=1\n b+=1\n c+=1\n d+=1\n elif div[i]>14: \n a+=1\n b+=1\n c+=1\n elif div[i]>=4:\n a+=1\n b+=1\n elif div[i]>=2:\n a+=1\n\n\n\nprint(a,b,c,d,e)\n\nif a<3 or b<2: print(0)\nelse:\n ans=b*(b-1)*(a-2)//2\n ans+=d*(a-1)\n ans+=c*(b-1)\n ans+=e\n print(ans)', 'N=int(input())\ndiv=[0]*(N+1)\n\nfor i in range(1,N+1):\n j=2\n while i!=1:\n if i%j==0:\n i//=j\n div[j]+=1\n else: j+=1\n\na,b,c,d,e=0,0,0,0,0\nfor i in range(N+1):\n if div[i]>=74:\n a+=1\n b+=1\n c+=1\n d+=1\n e+=1\n elif div[i]>=24:\n a+=1\n b+=1\n c+=1\n d+=1\n elif div[i]>=14: \n a+=1\n b+=1\n c+=1\n elif div[i]>=4:\n a+=1\n b+=1\n elif div[i]>=2:\n a+=1\n\nif a<3 or b<2: print(0)\nelse:\n ans=b*(b-1)*(a-2)//2\n ans+=d*(a-1)\n ans+=c*(b-1)\n ans+=e\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s359220777', 's009373910'] | [3064.0, 3064.0] | [19.0, 18.0] | [576, 609] |
p03213 | u225388820 | 2,000 | 1,048,576 | You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many _Shichi-Go numbers_ (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. | ['import numpy as np\nn=int(input())\nd=[0]*101\ndef factorization(n):\n temp = n\n for i in range(2, int(n**0.5)+1):\n if temp%i==0:\n while temp%i==0:\n d[i]+=1\n temp //= i\n if temp!=1:\n d[temp]+=1\ndef cnt(k):\n return len(d[d>=k])\nfor i in range(2,n+1):\n factorization(i)\nd=np.array(list(d.values()))\nprint(cnt(74)+cnt(24)*(cnt(2)-1)+cnt(14)*(cnt(4)-1)+cnt(4)*(cnt(4)-1)*(cnt(2)-2)//2)', 'import numpy as np\nn=int(input())\nd=np.zeros(101)\ndef factorization(n):\n temp = n\n for i in range(2, int(n**0.5)+1):\n if temp%i==0:\n while temp%i==0:\n d[i]+=1\n temp //= i\n if temp!=1:\n d[temp]+=1\ndef cnt(k):\n return len(d[d>=k])\nfor i in range(2,n+1):\n factorization(i)\nprint(cnt(74)+cnt(24)*(cnt(2)-1)+cnt(14)*(cnt(4)-1)+cnt(4)*(cnt(4)-1)*(cnt(2)-2)//2)'] | ['Runtime Error', 'Accepted'] | ['s024363603', 's919539499'] | [12484.0, 12512.0] | [151.0, 151.0] | [447, 424] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.