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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03210 | u977605150 | 2,000 | 1,048,576 | _Shichi-Go-San_ (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? | ['i = int(input())\n\nif i == 3 or i == 5 or i == 7:\n print("Yes")\nelse:\n print("No")', 'i = int(input())\n\nif i == 3 or i == 5 or i == 7:\n print("YES")\nelse:\n print("NO")'] | ['Wrong Answer', 'Accepted'] | ['s924991221', 's270320590'] | [9156.0, 9124.0] | [27.0, 24.0] | [83, 87] |
p03210 | u981931040 | 2,000 | 1,048,576 | _Shichi-Go-San_ (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? | ['N = int(input())\n#print("Yes") if N == 7 or N == 5 or N == 3 else print("No")\nif N == 7 or N == 5 or N == 3:\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\nprint("Yes") if N == 7 or N == 5 or N == 3 else print("No")', 'N = int(input())\nprint("YES") if N == 7 or N == 5 or N == 3 else print("NO")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s118946708', 's168795844', 's801415876'] | [2940.0, 2940.0, 2940.0] | [20.0, 17.0, 18.0] | [148, 76, 76] |
p03210 | u985443069 | 2,000 | 1,048,576 | _Shichi-Go-San_ (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? | [" X = int(input())\n if X in [7, 5, 3]:\n print ('YES')\n else:\n print ('NO')", "X = input()\nif X in [5, 7, 3]:\n print ('YES')\nelse:\n print ('NO')", "X = int(input())\nif X in [5, 7, 3]:\n print ('YES')\nelse:\n print ('NO')"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s618493798', 's864168513', 's092776179'] | [2940.0, 2940.0, 2940.0] | [19.0, 19.0, 17.0] | [92, 67, 72] |
p03210 | u987039273 | 2,000 | 1,048,576 | _Shichi-Go-San_ (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? | ['koman = int(input())\nif koman==7 or koman==5 or koman==3:\n print("Yes")\nelse :\n print("No")', 'koman = int(input())\nif koman==7 or koman==5 or koman==3:\n print("YES")\nelse :\n print("NO")'] | ['Wrong Answer', 'Accepted'] | ['s598748539', 's994013017'] | [9024.0, 8972.0] | [24.0, 26.0] | [97, 97] |
p03210 | u989281149 | 2,000 | 1,048,576 | _Shichi-Go-San_ (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? | ['age=int(input())\nif age==3,5,7:\n print"YES"\nelse :\n print(\'NO\')', "age=int(input())\nif age==3,5,7:\n print('YES')\nelse :\n print('NO')", 'age=int(input())\nif age==3,5,7:\n print("YES")\nelse :\n print(\'NO\')', "age=int(input())\nif age==3:\n print ('YES')\nelif age==5:\n print ('YES')\nelif age==7:\n print ('YES')\nelse :\n print('NO')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s284336559', 's464592874', 's775900751', 's668158014'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [65, 67, 67, 122] |
p03210 | u993461026 | 2,000 | 1,048,576 | _Shichi-Go-San_ (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? | ['X = int(input())\nprint("YES" if X == 3 and X==5 and X==7 else "NO")', 'X = int(input())\nprint("YES" if X==3 or X==5 or X==7 else "NO")'] | ['Wrong Answer', 'Accepted'] | ['s320568129', 's230587964'] | [2940.0, 2940.0] | [17.0, 19.0] | [67, 63] |
p03210 | u994521204 | 2,000 | 1,048,576 | _Shichi-Go-San_ (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? | ["a=int(input())\nif a==(3 or 5 or 7):\n print('Yes')\nelse:\n print('No')", "if int(input())==(3 or 5 or 7):\n print('Yes')\nelse:\n print('No')", "a=int(input())\nif a==3 or a==5 or a==7:\n print('Yes')\nelse:\n print('No')", "a=int(input())\nif a==3 or a==5 or a==7:\n print('YES')\nelse:\n print('NO')"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s395824972', 's451195430', 's802432690', 's006572110'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [70, 66, 74, 74] |
p03212 | u007550226 | 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 as it\nN=int(input())\nd=0\nfor i in range(3,10):\n for c in sorted(list(it.product('753',repeat=i))):\n if int(''.join(c))>N:exit(0)\n if len(set(c))==3:d+=1\nprint(d)", "import itertools as it\nN=int(input())\nd=0\nfor i in range(3,10):\n for c in sorted(list(it.product('753',repeat=i))):\n if int(''.join(c))>N:\n print(d)\n exit(0)\n if len(set(c))==3:d+=1\nprint(d)"] | ['Wrong Answer', 'Accepted'] | ['s186215108', 's601183329'] | [6388.0, 6388.0] | [54.0, 53.0] | [195, 229] |
p03212 | u011062360 | 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, q = 0, ["3", "5", "7"]\n\nwhile q:\n p = q.pop()\n for s in ["3", "5", "7"]:\n t = p + s\n if int(t) <= n:\n q.append(str(t))\n if list(set(list(t))) == ["3", "5", "7"]:\n ans += 1\n\nprint(ans)', 'n = int(input())\nans = 0\nlist_N = [["3", "5", "7"]]\n\nfor i in range(2, 10):\n d = []\n for a in list_N[-1]:\n for b in ["3", "5", "7"]:\n k = b + a\n if n >= int(k) and "3" in k and "5" in k and "7" in k:\n ans += 1\n d.append(k)\n list_N.append(d)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s795110654', 's254207272'] | [9208.0, 11180.0] | [85.0, 45.0] | [262, 316] |
p03212 | u013408661 | 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()\nx=[0,3,5,7]\np=[]\nfor c1 in x:\n for c2 in x:\n for c3 in x:\n for c4 in x:\n for c5 in x:\n for c6 in x:\n for c7 in x:\n for c8 in x:\n for c9 in x:\n line=[c1,c2,c3,c4,c5,c6,c7,c8,c9]\n sum_=0\n if line.count(7)>0 and line.count(3)>0 and line.count(5)>0:\n for i in range(9):\n sum_+=line[i]*10**i\n p.append(sum_)\np.sort()\nfor i in range(len(p)):\n if p[i]>n:\n print(i)', 'n=int(input())\nx=[0,3,5,7]\np=[]\nflag=True\nflag2=True\nfor c1 in x:\n for c2 in x:\n for c3 in x:\n for c4 in x:\n for c5 in x:\n for c6 in x:\n for c7 in x:\n for c8 in x:\n for c9 in x:\n line=[c1,c2,c3,c4,c5,c6,c7,c8,c9]\n sum_=0\n if line.count(7)>0 and line.count(3)>0 and line.count(5)>0:\n for i in range(9):\n if flag==False and line[i] in [3,5,7]:\n flag2=False\n break\n if line[i]==0:\n flag=False\n sum_+=line[i]*10**i\n if flag2==False:\n flag=True\n flag2=True\n continue\n p.append(sum_)\n flag=True\np.sort()\nfor i in range(len(p)):\n if p[i]>n:\n print(i)\n exit()\nprint(i+1)'] | ['Runtime Error', 'Accepted'] | ['s851690834', 's090176738'] | [12048.0, 4128.0] | [1126.0, 805.0] | [545, 955] |
p03212 | u013629972 | 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 main():\n\xa0 \xa0 global results, S\n\xa0 \xa0 S = int(input())\n\xa0 \xa0 S_str = str(S)\n\xa0 \xa0 results = []\n\xa0 \xa0 for i in range(len(S_str)):\n\xa0 \xa0 \xa0 \xa0 digits = len(S_str) - i\n\xa0 \xa0 \xa0 \xa0 if digits < 3:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 break\n\n\xa0 \xa0 \xa0 \xa0 bfs(digits, '')\n\n\xa0 \xa0 print(len(results))\n\n\ndef bfs(i, s):\n\xa0 \xa0 \n\xa0 \xa0 if i == 0:\n\xa0 \xa0 \xa0 \xa0 if int(s) <= S and len(set(s)) == 3:\n\xa0 \xa0 \xa0 \xa0 \xa0 \xa0 results.append(s)\n\xa0 \xa0 \xa0 \xa0 return\n\xa0 \xa0 i -= 1\n\xa0 \xa0 bfs(i, s + '3')\n\xa0 \xa0 bfs(i, s + '5')\n\xa0 \xa0 bfs(i, s + '7')\n\n\nif __name__ == '__main__':\n\xa0 \xa0 main()", "def main():\n global result, S\n S = int(input())\n result = 0\n bfs(0, '')\n print(result)\n\n\ndef bfs(i, s):\n global result, S\n if s != '' and int(s) <= S and len(set(s)) == 3:\n result += 1\n if i == len(str(S)):\n return\n i += 1\n bfs(i, s + '3')\n bfs(i, s + '5')\n bfs(i, s + '7')\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s638192594', 's670305073'] | [2940.0, 3060.0] | [18.0, 55.0] | [562, 364] |
p03212 | u015993380 | 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 search(s, n):\n if int(s) > n:\n return 0\n ans = 0 if s == '0' else 1\n for c in '753':\n ans += search(s+c,n)\n return ans\n\nN = int(input())\nprint(search('0',N))\n ", "def getSpecialNum(x, n):\t\n\tif int(x) > n:\n\t\treturn 0\n\tans = 0\n\tif x.count('3') > 0 and x.count('5') > 0 and x.count('7') > 0:\n\t\tans = 1\n\tans += getSpecialNum(x+'3',n)\n\tans += getSpecialNum(x+'5',n)\n\tans += getSpecialNum(x+'7',n)\n\treturn ans\nN = int(input())\nprint(getSpecialNum('0',N))\n"] | ['Wrong Answer', 'Accepted'] | ['s428825362', 's974549597'] | [3060.0, 3060.0] | [58.0, 67.0] | [176, 286] |
p03212 | u016901717 | 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 des(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', '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\n\n'] | ['Runtime Error', 'Accepted'] | ['s168582075', 's154632202'] | [2940.0, 2940.0] | [17.0, 97.0] | [195, 223] |
p03212 | u017415492 | 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())\nnum=[3,5,7]\n#a[0]=3,a[1]=5,a[7]=5\nans=[3,5,7]\nansw=[]\nfor i1 in range(3):\n for i2 in range(3):\n for i3 in range(3):\n a=set([i1,i2,i3])\n if len(a)>2:\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])))\n for i4 in range(3):\n a=set([i1,i2,i3,i4])\n if len(a)>2:\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i4])))\n for i5 in range(3):\n a=set([i1,i2,i3,i4,i5])\n if len(a)>2:\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i5])+str(num[i4])))\n for i6 in range(3):\n a=set([i1,i2,i3,i4,i5,i6])\n if len(a)>2:\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i6])+str(num[i5])+str(num[i4])))\n for i7 in range(3):\n a=set([i1,i2,i3,i4,i5,i6,i7])\n if len(a)>2:\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i7])+str(num[i6])+str(num[i5])+str(num[i4])))\n for i8 in range(3):\n a=set([i1,i2,i3,i4,i5,i6,i7,i8])\n if len(a)>2:\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i8])+str(num[i7])+str(num[i6])+str(num[i5])+str(num[i4])))\n for i9 in range(3):\n a=set([i1,i2,i3,i4,i5,i6,i7,i8,i9])\n if len(a)>2:\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i9])+str(num[i8])+str(num[i7])+str(num[i6])+str(num[i5])+str(num[i4])))\nansw.sort()\nleft=0\nright=len(answ)\nwhile right-left>1:\n mid=(left+right)//2\n \n if n<answ[mid]:\n right=mid\n else:\n left=mid\nif 357>left:\n print(0)\nelse:\n print(left+1)\n \n ', 'n=int(input())\n\ndef dfs(s):\n if s!="" and int(s)>n:\n return 0\n \n if len(set(list(s)))<3:\n ret=0\n else:\n ret=1\n \n for i in "753":\n ret+=dfs(s+i)\n \n return ret\n\nprint(dfs(""))'] | ['Wrong Answer', 'Accepted'] | ['s034716035', 's521017452'] | [9960.0, 9176.0] | [105.0, 69.0] | [1755, 193] |
p03212 | u022979415 | 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\ndef main():\n N = int(input())\n result = 0\n numbers = ["3", "5", "7"]\n for i in range(3, len(str(N)) + 1):\n for p in product(numbers, repeat=i):\n flag = True\n tmp = "".join(p)\n for n in numbers:\n if n in tmp:\n continue\n else:\n flag = False\n if flag:\n if int(tmp) <= N:\n print(int(tmp), flag)\n result += 1\n print(result)\n\n\nif __name__ == \'__main__\':\n main()', 'from itertools import product\n\n\ndef main():\n n = input()\n numbers = [\'3\', \'5\', \'7\']\n length = len(n)\n answer = 0\n for i in range(3, length + 1):\n for new_num in product(numbers, repeat=i):\n if not all(x in new_num for x in numbers):\n continue\n elif int("".join(new_num)) <= int(n):\n answer += 1\n print(answer)\n\n\nif __name__ == \'__main__\':\n main()\n\n'] | ['Wrong Answer', 'Accepted'] | ['s604755295', 's455537298'] | [3608.0, 3060.0] | [78.0, 58.0] | [577, 428] |
p03212 | u029000441 | 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 ret += dfs(s + c)\n return ret\nprint(dfs('0')) \n\n\n\n", "import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nfrom collections import Counter, deque\nfrom collections import defaultdict\nfrom itertools import combinations, permutations, accumulate, groupby, product\nfrom bisect import bisect_left,bisect_right\nfrom heapq import heapify, heappop, heappush\nfrom math import floor, ceil,sqrt\nfrom operator import itemgetter\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\ndef LI2(): return [int(input()) for i in range(n)]\ndef MXI(): return [[LI()]for i in range(n)]\ndef printns(x): print('\\n'.join(x))\ndef printni(x): print('\\n'.join(list(map(str,x))))\ninf = 10**17\nmod = 10**9 + 7\n#s=input().rstrip()\n\nN = 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 \n for c in '753':\n ret += dfs(s + c)\n return ret\nprint(dfs('0')) \n\n\n"] | ['Runtime Error', 'Accepted'] | ['s935466595', 's997784689'] | [2940.0, 3316.0] | [17.0, 98.0] | [518, 1252] |
p03212 | u030879708 | 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 as t;N=input();X=[];for i in range(9):X+=list(t.product('357',repeat=i));print(sum(len(set(i))>2and int(''.join(i))<=int(N)for i in X))", "import itertools as t;N=input();X=[]\nfor i in range(10):X+=list(t.product('357',repeat=i))\nprint(sum(len(set(i))>2and int(''.join(i))<=int(N)for i in X))"] | ['Runtime Error', 'Accepted'] | ['s215833610', 's337330443'] | [2940.0, 7028.0] | [18.0, 56.0] | [152, 153] |
p03212 | u044952145 | 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\nbase = ["3", "5", "7"]\nnums = ["3", "5", "7"]\ntemp = []\nx = 0\n\nwhile 1:\n for num in nums[(3**x)-1:]:\n for b in base:\n temp.append(b + num)\n nums.extend(temp)\n \n x += 1\n if int(temp[-1]) > 10**9:\n break\n temp = []\n\ntarget = []\nfor n in set(nums):\n if "7" in n and "5" in n and "3" in n:\n target.append(int(n))\n\ncount = 0\ntarget.sort()\nfor n in target.:\n if int(n) < N:\n count += 1\n\nprint(count)', 'N = int(input())\n\nbase = ["3", "5", "7"]\nnums = ["3", "5", "7"]\ntemp = []\nx = 0\n\nwhile 1:\n for num in nums[(3**x)-1:]:\n for b in base:\n temp.append(b + num)\n nums.extend(temp)\n \n x += 1\n if int(temp[-1]) > 10**9:\n break\n temp = []\n\ntarget = []\nfor n in set(nums):\n if "7" in n and "5" in n and "3" in n:\n target.append(int(n))\n\ncount = 0\nfor n in target:\n if n <= N:\n count += 1\n\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s521487917', 's306633258'] | [3064.0, 35068.0] | [17.0, 181.0] | [474, 455] |
p03212 | u050698451 | 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 = len(str(N))\nans = 0\nif l < 3:\n\tpass\nelse:\n\tS = []\n\tfor k in range(3,l+1):\n\t\tS += list(itertools.product(['3', '5', '7'], repeat=k))\n\tprint(S)\n\tfor i in range(len(S)):\n\t\tnum = ''\n\t\tfor t in range(len(S[i])):\n\t\t\tnum = num + S[i][t]\n\t\t# print(num)\n\t\tif '3' in num:\n\t\t\tif '5' in num:\n\t\t\t\tif '7' in num:\n\t\t\t\t\tif int(num) <= N:\n\t\t\t\t\t\tprint(num)\n\t\t\t\t\t\tans += 1\nprint(ans)\n", "import itertools\nN = int(input())\nl = len(str(N))\nans = 0\nif l < 3:\n\tpass\nelse:\n\tS = []\n\tfor k in range(3,l+1):\n\t\tS += list(itertools.product(['3', '5', '7'], repeat=k))\n\t# print(S)\n\tfor i in range(len(S)):\n\t\tnum = ''\n\t\tfor t in range(len(S[i])):\n\t\t\tnum = num + S[i][t]\n\t\t# print(num)\n\t\tif '3' in num:\n\t\t\tif '5' in num:\n\t\t\t\tif '7' in num:\n\t\t\t\t\tif int(num) <= N:\n\t\t\t\t\t\t# print(num)\n\t\t\t\t\t\tans += 1\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s115947894', 's232672023'] | [10836.0, 7028.0] | [151.0, 107.0] | [403, 407] |
p03212 | u062459048 | 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 dts(s):\n if int(s) > n:\n return 0\n if ret = 1 if all(s.count(_) for _ in '753') else 0\n for i in '753':\n ret += dts(s+i)\n return ret\n \ndts('0')", "n = int(input())\n\ndef dts(s):\n if int(s) > n:\n return 0\n ret = 1 if all(s.count(_) for _ in '753') else 0\n for i in '753':\n ret += dts(s+i)\n return ret\n \nprint(dts('0'))\n"] | ['Runtime Error', 'Accepted'] | ['s924229914', 's373392135'] | [2940.0, 2940.0] | [18.0, 91.0] | [176, 181] |
p03212 | u063052907 | 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\nimport itertools\nN = input()\nans = 0\n\nfor i in range(3, len(N)+1):\n for ptn in itertools.product((3,5,7), repeat=i):\n if (3 not in ptn) or (5 not in ptn) or (7 not in ptn):\n continue\n a = int("".join(list(map(str, ptn))))\n if a <= N:\n ans += 1\nprint(ans)', '# coding: utf-8\nimport itertools\nN = int(input())\nans = 0\n\nfor i in range(3, len(str(N))+1):\n for ptn in itertools.product((3,5,7), repeat=i):\n if (3 not in ptn) or (5 not in ptn) or (7 not in ptn):\n continue\n a = int("".join(list(map(str, ptn))))\n if a <= N:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s632475657', 's684166210'] | [3064.0, 3060.0] | [18.0, 82.0] | [316, 326] |
p03212 | u063896676 | 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\nimport time\n\nN = int(input())\n\nall_num_list = []\nnums = ["3", "5", "7"]\n\nprint(all_num_list)\n\nfor a in nums:\n for b in nums:\n for c in nums:\n all_num_list.append(a+b+c)\n for d in nums:\n all_num_list.append(a+b+c+d)\n for e in nums:\n all_num_list.append(a+b+c+d+e)\n for f in nums:\n all_num_list.append(a+b+c+d+e+f)\n for g in nums:\n all_num_list.append(a + b + c + d + e + f+g)\n for h in nums:\n all_num_list.append(a + b + c + d + e + f + g+h)\n for i in nums:\n all_num_list.append(a+b+c+d+e+f+g+h+i)\n\ncnt = 0\nfor num in all_num_list:\n if int(num) <= N and "3" in num and "5" in num and "7" in num:\n print(num)\n cnt += 1\n\nprint(cnt)', '# -*- coding: utf-8 -*-\n\nimport time\n\nN = int(input())\n\nall_num_list = []\nnums = ["3", "5", "7"]\n\nfor a in nums:\n for b in nums:\n for c in nums:\n all_num_list.append(a+b+c)\n for d in nums:\n all_num_list.append(a+b+c+d)\n for e in nums:\n all_num_list.append(a+b+c+d+e)\n for f in nums:\n all_num_list.append(a+b+c+d+e+f)\n for g in nums:\n all_num_list.append(a + b + c + d + e + f+g)\n for h in nums:\n all_num_list.append(a + b + c + d + e + f + g+h)\n for i in nums:\n all_num_list.append(a+b+c+d+e+f+g+h+i)\n\ncnt = 0\nfor num in all_num_list:\n if int(num) <= N and "3" in num and "5" in num and "7" in num:\n cnt += 1\n\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s872133564', 's284304494'] | [5624.0, 5232.0] | [66.0, 48.0] | [967, 927] |
p03212 | u077291787 | 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. | ['# ABC114C - 755\nn = input()\ndigit = len(n)\nans = 0\nfor i in range(1, digit):\n ans += len([i for i in itertools.product("357", repeat=i) if len(set(i)) == 3])\ntup = tuple(i for i in n)\nlst = [i for i in itertools.product("357", repeat=digit) if len(set(i)) == 3] + [tup]\nlst.sort()\nans += lst.index(tup)\nprint(ans)', '# ABC114C - 755\ndef shichi_go_san(s="0"):\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 += shichi_go_san(s + c)\n return ret\n\n\nn = int(input())\nprint(shichi_go_san())'] | ['Runtime Error', 'Accepted'] | ['s639974535', 's199922942'] | [3064.0, 2940.0] | [18.0, 92.0] | [316, 247] |
p03212 | u079543046 | 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()\nans = 10000\nfor i in range (len(n)-2):\n if abs(int(n[i]+n[i+1]+n[i+2]))<ans:\n ans =abs(int(n[i]+n[i+1]+n[i+2]))\nprint(ans)\n ', 'n = int(input())\ndp = ["3"]\nbrk = False\nfor i in range(n):\n if brk == True:\n break\n for c in "357":\n if int(dp[i]+c)>n:\n brk = True\n break\n dp.append(dp[i]+c)\n \ndp2 = ["5"]\nbrk = False\nfor i in range(n):\n if brk == True:\n break\n for c in "357":\n if int(dp2[i]+c)>n:\n brk = True\n break\n dp2.append(dp2[i]+c)\n\ndp3 = ["7"]\nbrk = False\nfor i in range(n):\n if brk == True:\n break\n for c in "357":\n if int(dp3[i]+c)>n:\n brk = True\n break\n dp3.append(dp3[i]+c)\n\ndp = dp+dp2+dp3\ncount = 0\nfor i in range(len(dp)):\n if all(dp[i].count(c) for c in "753"):\n count += 1\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s746693262', 's774067899'] | [3064.0, 5464.0] | [18.0, 72.0] | [153, 734] |
p03212 | u095756391 | 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\n\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 \nprint(dfs('0'))", "N = int(input())\n\n\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'] | ['s973398057', 's188621927'] | [3056.0, 2940.0] | [18.0, 92.0] | [207, 221] |
p03212 | u099450021 | 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. | ["Ns = input()\nN = int(Ns)\nNl = len(Ns)\nret = 0\ndef doit(t, f , s, now):\n if t + f + s == 0:\n if int(now) <= N:\n ret += 1\n return\n if t > 0:\n doit(t - 1, f, s, now + str(3)) \n if f > 0:\n doit(t, f - 1, s, now + str(5)) \n if s > 0:\n doit(t, f, s - 1, now + str(7)) \n \nfor seven in range(1, Nl - 1):\n for five in range(1, Nl - seven):\n least = Nl - seven - five\n for three in range(1, least + 1):\n doit(three, five, seven, '')\n\nprint(ret)\n", "Ns = input()\nN = int(Ns)\nNl = len(Ns)\nret = 0\ndef doit(t, f , s, now):\n global ret\n if t + f + s == 0:\n if int(now) <= N:\n ret += 1\n return\n if t > 0:\n doit(t - 1, f, s, now + str(3)) \n if f > 0:\n doit(t, f - 1, s, now + str(5)) \n if s > 0:\n doit(t, f, s - 1, now + str(7)) \n \nfor seven in range(1, Nl - 1):\n for five in range(1, Nl - seven):\n least = Nl - seven - five\n for three in range(1, least + 1):\n doit(three, five, seven, '')\n\nprint(ret)\n"] | ['Runtime Error', 'Accepted'] | ['s363098221', 's106997896'] | [3064.0, 3064.0] | [18.0, 74.0] | [524, 539] |
p03212 | u102126195 | 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 C3():\n tmp = []\n import copy\n\n for i in range(9):\n tmp.append([])\n tmp[i].append(3 * pow(10, i))\n tmp[i].append(5 * pow(10, i))\n tmp[i].append(7 * pow(10, i))\n\n tmp2 = [copy.copy(tmp[0])]\n for i in range(1, 9):\n tmp2.append([])\n for j in range(3):\n k = 0\n while True:\n if len(tmp2[i - 1]) <= k:\n break\n tmp2[i].append(tmp[i][j] + tmp2[i - 1][k])\n k += 1\n tmp3 = ', 'def C3():\n N = int(input())\n def make_list(s):\n S = [s]\n if int(s) <= N:\n S.extend(make_list(s + "3"))\n S.extend(make_list(s + "5"))\n S.extend(make_list(s + "7"))\n return S\n\n datalist = make_list("0")\n\n ans = 0\n for i in datalist:\n s = 0\n f = 0\n t = 0\n for j in list(i):\n print(j)\n if j == "7":\n s = 1\n if j == "5":\n f = 1\n if j == "3":\n t = 1\n if s + f + t == 3 and int(i) <= N:\n ans += 1\n print(ans)\nC3()', 'def C3():\n N = int(input())\n def make_list(s):\n S = [s]\n if int(s) <= N:\n S.extend(make_list(s + "3"))\n S.extend(make_list(s + "5"))\n S.extend(make_list(s + "7"))\n return S\n\n datalist = make_list("0")\n\n ans = 0\n for i in datalist:\n s = 0\n f = 0\n t = 0\n for j in list(i):\n if j == "7":\n s = 1\n if j == "5":\n f = 1\n if j == "3":\n t = 1\n if s + f + t == 3 and int(i) <= N:\n ans += 1\n print(ans)\nC3()\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s179504426', 's905437857', 's011057060'] | [3064.0, 11840.0, 9808.0] | [16.0, 628.0, 222.0] | [513, 613, 593] |
p03212 | u103902792 | 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()\nn = int(s)\nl = len(s)\n\ndp = [[] for _ in range(l+1)]\ndp[0].append('')\n\nfor i in range(l):\n for e in dp[i]:\n dp[i+1].append(e+'3')\n dp[i+1].append(e+'5')\n dp[i+1].append(e+'7')\nans = 0\nfor i in range(min(3,l),l):\n for e in dp[i]:\n if '3' in e and '5' in e and '7' in e and int(e) <= n:\n ans += 1\nprint(ans)\n", "s = input()\nn = int(s)\nl = len(s)\n\ndp = [[] for _ in range(l+1)]\ndp[0].append('')\n\nfor i in range(l):\n for e in dp[i]:\n dp[i+1].append(e+'3')\n dp[i+1].append(e+'5')\n dp[i+1].append(e+'7')\nans = 0\n\nfor i in range(min(3,l+1),l+1):\n for e in dp[i]:\n if '3' in e and '5' in e and '7' in e and int(e) <= n:\n ans += 1\n \nprint(ans)\n\n"] | ['Wrong Answer', 'Accepted'] | ['s222286923', 's646610633'] | [5228.0, 5228.0] | [28.0, 39.0] | [337, 350] |
p03212 | u111365362 | 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()\ndigit = len(n)\na753 = 0\na75 = 0\na73 = 0\na53 = 0\nnow = 0\ni = digit - 1\n# now + i = digit - 1\nwhile now < digit:\n tmp = int(n[i])\n add = 3 ** now\n sun = (3 ** (now+1) - 3) // 2\n add2 = 2 ** now\n sun2 = 2 ** (now+1) - 2\n if tmp == 8 or tmp == 9:\n a753 = sun + 3 * add\n a75 = sun2 + 2 * add2\n a73 = sun2 + 2 * add2\n a53 = sun2 + 2 * add2\n elif tmp == 7:\n a753 += 3 * add\n a75 += 2 * add2\n a73 += 2 * add2\n a53 = sun2 + 2 * add2\n elif tmp == 6:\n a753 = sun + 2 * add\n a75 = sun2 + 1 * add2\n a73 = sun2 + 1 * add2\n a53 = sun2 + 2 * add2\n elif tmp == 5:\n a753 += 2 * add\n a75 += 1 * add2\n a73 = sun2 + 1 * add2\n a53 += 2 * add2\n elif tmp == 4:\n a753 = sun + 1 * add\n a75 = sun2 + 0 * add2\n a73 = sun2 + 1 * add2\n a53 = sun2 + 1 * add2\n elif tmp == 3:\n a753 += 1 * add\n a75 = sun2 + 0 * add2\n a73 += 1 * add2\n a53 += 1 * add2\n elif tmp == 2 or tmp == 1:\n a753 = sun + 0 * add\n a75 = sun2 + 0 * add2\n a73 = sun2 + 0 * add2\n a53 = sun2 + 0 * add2\n a = 3 * now - 3\n now += 1\n i -= 1\nall1 = (10 ** digit - 1) // 9\na = 3 * digit\nif int(n) < 7 * all1:\n a -= 1\nif int(n) < 5 * all1:\n a -= 1\nif int(n) < 3 * all1:\n a -= 1\nprint(a753,a75,a73,a53,a)\nprint(a753 - a75 - a73 - a53 +a)', 'n = input()\ndigit = len(n)\na753 = 0\na75 = 0\na73 = 0\na53 = 0\nnow = 0\ni = digit - 1\n# now + i = digit - 1\nwhile now < digit:\n tmp = int(n[i])\n add = 3 ** now\n sun = (3 ** (now+1) - 3) // 2\n add2 = 2 ** now\n sun2 = 2 ** (now+1) - 2\n if tmp == 8 or tmp == 9:\n a753 = sun + 3 * add\n a75 = sun2 + 2 * add2\n a73 = sun2 + 2 * add2\n a53 = sun2 + 2 * add2\n elif tmp == 7:\n a753 += 3 * add\n a75 += 2 * add2\n a73 += 2 * add2\n a53 = sun2 + 2 * add2\n elif tmp == 6:\n a753 = sun + 2 * add\n a75 = sun2 + 1 * add2\n a73 = sun2 + 1 * add2\n a53 = sun2 + 2 * add2\n elif tmp == 5:\n a753 += 2 * add\n a75 += 1 * add2\n a73 = sun2 + 1 * add2\n a53 += 2 * add2\n elif tmp == 4:\n a753 = sun + 1 * add\n a75 = sun2 + 0 * add2\n a73 = sun2 + 1 * add2\n a53 = sun2 + 1 * add2\n elif tmp == 3:\n a753 += 1 * add\n a75 = sun2 + 0 * add2\n a73 += 1 * add2\n a53 += 1 * add2\n else:\n a753 = sun + 0 * add\n a75 = sun2 + 0 * add2\n a73 = sun2 + 0 * add2\n a53 = sun2 + 0 * add2\n a = 3 * now - 3\n now += 1\n i -= 1\nall1 = (10 ** digit - 1) // 9\na = 3 * digit\nif int(n) < 7 * all1:\n a -= 1\nif int(n) < 5 * all1:\n a -= 1\nif int(n) < 3 * all1:\n a -= 1\n#print(a753,a75,a73,a53,a)\nprint(a753 - a75 - a73 - a53 +a)'] | ['Wrong Answer', 'Accepted'] | ['s623139982', 's817117917'] | [3188.0, 3188.0] | [18.0, 20.0] | [1280, 1260] |
p03212 | u118642796 | 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 = []\nnum753.append([0,0,0,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2\n]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\n\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if int(N[i])==3:\n check3 = True\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])<5:\n break\n if int(N[i])==5:\n check5 = True\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])<7:\n break\n if int(N[i])==7:\n check7 = True\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n break\nelse:\n if check3 and check5 and check7:\n ans += 1\n\nprint(ans)', 'num753 = []\nnum753.append([0,0,0,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2\n]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\n\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if int(N[i])==3:\n check3 = True\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])<5:\n break\n if int(N[i])==5:\n check5 = True\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])<7:\n break\n if int(N[i])==7:\n check7 = True\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n break\n\nprint(ans)', 'num753 = []\nnum753.append([1,1,1,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2\n]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\n\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if int(N[i])==3:\n check3 = True\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])<5:\n break\n if int(N[i])==5:\n check5 = True\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])<7:\n break\n if int(N[i])==7:\n check7 = True\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n break\nelse:\n if check3 and check5 and check7:\n ans += 1\n\nprint(ans)', 'num753 = []\nnum753.append([0,0,0,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\n\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if int(N[i])==3:\n check3 = True\n if i==len(N)-1 and check7 and check5 and check3:\n ans += 1\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])<5:\n break\n if int(N[i])==5:\n check5 = True\n if i==len(N)-1 and check7 and check5 and check3:\n ans += 1\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])<7:\n break\n if int(N[i])==7:\n check7 = True\n if i==len(N)-1 and check7 and check5 and check3:\n ans += 1\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n break\nelse:\n if check3 and check5 and check7:\n ans += 1\n\nprint(ans)\n', 'num753 = []\nnum753.append([0,0,0,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+nu\nm753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2\n]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\n\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if int(N[i])==3:\n check3 = True\n if i==len(N)-1 and check7 and check5 and check3:\n ans += 1\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])<5:\n break\n if int(N[i])==5:\n check5 = True\n if i==len(N)-1 and check7 and check5 and check3:\n ans += 1\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])<7:\n break\n if int(N[i])==7:\n check7 = True\n if i==len(N)-1 and check7 and check5 and check3:\n ans += 1\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n break\nelse:\n if check3 and check5 and check7:\n ans += 1\n\nprint(ans)\n', 'num753 = []\nnum753.append([0,0,0,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+nu\nm753[i][4]*2,num753[i][1]+num753[i][2\n]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\n\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])==3:\n check3 = True\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if int(N[i])<5:\n break\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])==5:\n check5 = True\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if int(N[i])<7:\n break\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n if int(N[i])==7:\n check7 = True\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n break\n\nprint(ans)', 'num753 = []\nnum753.append([0,0,0,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+nu\nm753[i][4]*2,num753[i][1]+num753[i][2\n]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])==3:\n check3 = True\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if int(N[i])<5:\n break\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])==5:\n check5 = True\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if int(N[i])<7:\n break\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n if int(N[i])==7:\n check7 = True\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n break\n\nprint(ans)\n', 'num753 = []\nnum753.append([0,0,0,0,0,0,0]) #3,5,7,35,37,57,357\nnum753.append([1,1,1,0,0,0,0])\n\nfor i in range(1,10):\n num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])\n\nN = input()\n\nans = 0\nfor i in range(len(N)):\n ans += num753[i][6]\n\ncheck3 = False\ncheck5 = False\ncheck7 = False\nfor i in range(len(N)):\n if int(N[i])<3:\n break\n if int(N[i])==3:\n if i==len(N)-1:\n if check5 and check7:\n ans += 1\n check3 = True\n continue\n ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]\n if check5:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]\n if check7:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]\n if check5 and check7:\n ans += num753[len(N)-i-1][0]\n if int(N[i])<5:\n break\n if int(N[i])==5:\n if i==len(N)-1:\n if check5 and check7:\n ans += 1\n if check3 and check7:\n ans += 1\n check5 = True\n continue\n ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]\n if check7:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]\n if check3 and check7:\n ans += num753[len(N)-i-1][1]\n if int(N[i])<7:\n break\n if int(N[i])==7:\n if i==len(N)-1:\n if check5 and check7:\n ans += 1\n if check3 and check7:\n ans += 1\n if check3 and check5:\n ans += 1\n check7 = True\n continue\n ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]\n if check3:\n ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]\n if check5:\n ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]\n if check3 and check5:\n ans += num753[len(N)-i-1][2]\n break\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s265890553', 's274003107', 's384386567', 's487785514', 's514574007', 's694270534', 's906775389', 's414278663'] | [3192.0, 3192.0, 3192.0, 3192.0, 2940.0, 3060.0, 3060.0, 3284.0] | [19.0, 18.0, 18.0, 20.0, 17.0, 18.0, 18.0, 18.0] | [1657, 1597, 1657, 1891, 1893, 1598, 1598, 2021] |
p03212 | u119655368 | 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())\nsft(n, "", "3")\nsft(n, "", "5")\nsft(n, "", "7")\nle = []\nfor i in range(len(l)):\n c3 = str(l[i]).count("3")\n c5 = str(l[i]).count("5")\n c7 = str(l[i]).count("7")\n if c3 > 0 and c5 > 0 and c7 > 0:\n le.append(l[i])\nprint(len(list(set(le))))', 'def sft(n, num, add):\n int_sft = int(num+add)\n if int_sft > n:\n return True\n else:\n l.append(int_sft)\n sft(n, num+add, "3")\n sft(n, num+add, "5")\n sft(n, num+add, "7")\n\nl=[]\nn = int(input())\nsft(n, "", "3")\nsft(n, "", "5")\nsft(n, "", "7")\nle = []\nfor i in range(len(l)):\n c3 = str(l[i]).count("3")\n c5 = str(l[i]).count("5")\n c7 = str(l[i]).count("7")\n if c3 > 0 and c5 > 0 and c7 > 0:\n le.append(l[i])\nprint(len(list(set(le))))'] | ['Runtime Error', 'Accepted'] | ['s848354005', 's800873718'] | [3064.0, 7088.0] | [17.0, 102.0] | [273, 491] |
p03212 | u136869985 | 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;\n\nint n;\nint lim;\nvector<string> A;\n\nvoid f(int digitNum, string s){ \n vector<bool> J(3, false);\n for(int i = 0; i < s.size(); i++){\n if(s[i] == \'3\') J[0] = true;\n if(s[i] == \'5\') J[1] = true;\n if(s[i] == \'7\') J[2] = true;\n }\n int idx = find(J.begin(), J.end(), false) - J.begin();\n if(idx == 3){\n A.push_back(s);\n }\n if(digitNum == lim){\n return;\n }\n f(digitNum + 1, s + \'3\');\n f(digitNum + 1, s + \'5\');\n f(digitNum + 1, s + \'7\');\n return;\n}\n\nint main(){\n cin.tie(0);\n ios::sync_with_stdio(false);\n\n cin >> n;\n \n lim = to_string(n).length();\n \n if(lim < 3){\n cout << 0 << endl;\n return 0;\n }\n\n f(0, "");\n\n vector<int> B(A.size());\n for(int i = 0; i < A.size(); i++){\n B[i] = stoi(A[i]);\n }\n\n sort(B.begin(), B.end());\n\n int idx = lower_bound(B.begin(), B.end(), n) - B.begin();\n\n cout << idx + (B[idx] == n) << endl;\n\n return 0;\n}', 'A = []\nstr = "357"\nlim = 11\n\ndef dfs(bef, sz):\n if sz + 1 == lim:\n return\n for i in str:\n t = bef + i\n A.append(t)\n dfs(t, sz + 1)\n\ndef main():\n n = int(input())\n\n dfs("", 0)\n\n ans = 0\n\n for a in A:\n q = False\n w = False\n e = False\n for i in a:\n if i == \'3\':\n q = True\n elif i == \'5\':\n w = True\n elif i == \'7\':\n e = True\n if q and w and e: \n ai = int(a)\n if ai <= n:\n ans += 1\n\n print(ans)\n\nmain()'] | ['Runtime Error', 'Accepted'] | ['s935518766', 's102141798'] | [3064.0, 15180.0] | [18.0, 111.0] | [1016, 601] |
p03212 | u148540382 | 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()\na = "357"\ncount357 = ["3", "5", "7"]\ni = 0\nwhile int(count357[-1]) <= int(n):\n for j in range(3):\n count357.append(str(int(count357[i])*10 + int(count357[j])))\n if int(count357[-1]) > int(n):\n break\n i += 1\ncount357.pop(-1)\ncount = 0\nfor i in range(len(count357)):\n for j in range(len(a)):\n if a[j] not in count357[i]:\n continue\n else:\n count += 1\n\nprint(count)', 'n = input()\ncount357 = ["3", "5", "7"]\ni = 0\nwhile int(count357[-1]) <= int(n):\n for j in range(3):\n count357.append(str(int(count357[i])*10 + int(count357[j])))\n if int(count357[-1]) > int(n):\n break\n i += 1\ncount357.pop(-1)\ncount = 0\nfor i in range(len(count357)):\n count += 1 if "3" in count357[i] and "5" in count357[i] and "7" in count357[i] else 0\n\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s049391823', 's798606203'] | [5156.0, 5156.0] | [92.0, 76.0] | [435, 401] |
p03212 | u156931988 | 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 gen_753(l,li=["7","5","3"]):\n if l == 1:\n return li\n new_li = []\n for cand in li:\n new_li.extend([cand + "7",cand + "5",cand + "3"])\n return gen_753(l-1,new_li)\n\nnum_str = input()\nl = len(num_str)\nnum = int(num_str)\ncan_l = [int(num) for num in gen_753(l)]\ncount = sum([num >= i for i in can_l ])', 'def gen_753(l,li=["7","5","3"]):\n if l == 1:\n return li\n new_li = []\n for cand in li:\n new_li.extend([cand + "7",cand + "5",cand + "3"])\n return gen_753(l-1,new_li)\n\nnum_str = input()\nl = len(num_str)\nnum = int(num_str)\ncan_l = [int(num) for num in gen_753(l) if len(set(list(num))) == 3]\ncount = [i for i in can_l if i <= num]\nprint(count)', 'def gen_753(l,li=["7","5","3"]):\n if l == 1:\n return li\n new_li = []\n for cand in li:\n new_li.extend([cand + "7",cand + "5",cand + "3"])\n return gen_753(l-1,new_li)\n\nnum_str = input()\nl = len(num_str)\nnum_ = int(num_str)\ntemp = []\nfor num in range(3,l+1):\n temp.extend(gen_753(num))\ncan_l = [int(num) for num in temp if len(set(list(num))) == 3]\ncount = sum([i <= num_ for i in can_l])\nprint(count)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s326649792', 's677366818', 's887306341'] | [5272.0, 5272.0, 6420.0] | [27.0, 42.0, 51.0] | [326, 366, 427] |
p03212 | u160224209 | 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 collections import deque\nn = int(input())\nnum753 = set()\nq = deque([3,5,7])\n\n\nwhile q:\n\n \n x = q.pop()\n\n \n if x <= 10**9:\n\n \n num753.add(x)\n\n \n q.append(x*10+3)\n q.append(x*10+5)\n q.append(x*10+7)\ncount = 0\n\n\nfor i in num753:\n if i <= n:\n lst = list(str(i))\n print(lst)\n if "3" in lst and "5" in lst and "7" in lst:\n count += 1\n \nprint(count)', 'from collections import deque\nn = int(input())\nnum753 = set()\nq = deque([3,5,7])\n\n\nwhile q:\n\n \n x = q.pop()\n\n \n if x <= 10**9:\n\n \n num753.add(x)\n\n \n q.append(x*10+3)\n q.append(x*10+5)\n q.append(x*10+7)\ncount = 0\n\n\nfor i in num753:\n if i <= n:\n lst = list(str(i))\n if "3" in lst and "5" in lst and "7" in lst:\n count += 1\n\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s152490389', 's208802928'] | [7660.0, 6640.0] | [138.0, 80.0] | [711, 680] |
p03212 | u160244242 | 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())\nn = len(str(N))\n\ndef count_753(n):\n if n == 3:\n return (6, 18, 3)\n else:\n num_753 = count_753(n-1)[0] * 3 + count_753(n-1)[1]\n num_75 = count_753(n-1)[1] * 2 + count_753(n-1)[2] * 2\n return (num_753, num_75, 3)\n\nif n <= 2:\n print(0)\nelse:\n count = 0\n for i in range(3, n+1):\n count += count_753(i)[0]\n #print('count :', count)\n\n for i in itertools.product(['7', '5', '3'], repeat=n):\n if len(set(i)) <= 2:\n continue\n s = 0\n for j,k in zip(range(n), reversed(range(n))):\n s += int(i[j]) * (10**k)\n if s > N:\n count -= 1\n \n print(count)", "import itertools\n\nN = int(input())\nn = len(str(N))\n\ndef count_753(n):\n if n == 3:\n return (6, 18, 3)\n else:\n num_753 = count_753(n-1)[0] * 3 + count_753(n-1)[1]\n num_75 = count_753(n-1)[1] * 2 + count_753(n-1)[2] * 2\n return (num_753, num_75, 3)\n\nif n <= 2:\n print(0)\nelse:\n count = 0\n for i in range(3, n+1):\n count += count_753(i)[0]\n #print('count :', count)\n\n for i in itertools.product(['7', '5', '3'], repeat=n):\n if len(set(i)) <= 2:\n continue\n s = 0\n for j,k in zip(range(n), reversed(range(n))):\n s += int(i[j]) * (10**k)\n if s > N:\n count -= 1\n \n print(count)"] | ['Runtime Error', 'Accepted'] | ['s723545884', 's467763505'] | [3064.0, 3064.0] | [19.0, 150.0] | [674, 692] |
p03212 | u163449343 | 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())\ns = "0357"\nans = []\nfor a in s:\n for b in s:\n for c in s:\n for d in s:\n for e in s:\n for f in s:\n for g in s:\n for h in s:\n for i in s:\n for j in s:\n for k in s:\n o = int(a+b+c+d+e+f+g+h+i+j+k)\n if set(str(o)) == {"3","5","7"}:\n if o > n:\n break\n else:\n ans.append(o)\nprint(len(ans))\n ', 'import itertools\nn = input()\nans = 0\nfor i in range(3, len(n)+1):\n ans += len([f for f in itertools.product("357", repeat=i) if len(set(f)) == 3 and int("".join(f)) <= int(n)])\n\nprint(ans)\n'] | ['Time Limit Exceeded', 'Accepted'] | ['s675460513', 's170668633'] | [3944.0, 5876.0] | [2104.0, 48.0] | [838, 192] |
p03212 | u172035535 | 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\ninput = sys.stdin.readline\nN = int(input())\n\ndef f(i,ans):\n if int(i) > N:\n return ans\n i = str(i)\n for a in A:\n ans += f(i+a,ans)-ans\n return ans\n\nans = 0\nA = '357'\nprint(f(0,0))", "N = input()\n\ndef f(s):\n if int(s) > int(N):\n return 0\n for t in '3','5','7':\n if all(['3' in s,'5' in s,'7' in s]):\n ans.append(1)\n f(s+t)\n\nans=[]\nf('0')\nprint(sum(ans)//3)"] | ['Wrong Answer', 'Accepted'] | ['s429623188', 's669389320'] | [3060.0, 3736.0] | [61.0, 102.0] | [216, 210] |
p03212 | u185354171 | 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\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 = 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'] | ['s729360392', 's297044243'] | [3056.0, 3064.0] | [18.0, 93.0] | [280, 285] |
p03212 | u187233527 | 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 ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in s:\n ret += dfs(s + c)\n return ret\n\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\n\nprint(dfs('0'))"] | ['Runtime Error', 'Accepted'] | ['s639787401', 's233902727'] | [4720.0, 3060.0] | [78.0, 96.0] | [180, 184] |
p03212 | u191635495 | 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\nprint(math.factorial(5))', "s = input()\nn = int(s)\ndg = len(s)\n\nall_list = []\n\nfor i in '753':\n for j in '753':\n for k in '753':\n all_list.append(''.join([i,j,k]))\n\nfor i in range(4,dg+1):\n add_list = []\n for c in '753':\n add_list += [''.join(c+e) for e in all_list]\n all_list += add_list\n\nall_list = set(all_list)\nres = sum([True for _ in all_list if set(list(_))=={'7','5','3'} and int(_) <= n])\nprint(res)\n\n"] | ['Wrong Answer', 'Accepted'] | ['s063868673', 's297020273'] | [2940.0, 13848.0] | [18.0, 127.0] | [36, 419] |
p03212 | u192154323 | 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 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'))", "from collections import Counter\nn = int(input())\nans = 0\ndef dfs(A):\n if A and int(A) > n:\n return\n if len(A) >= 3:\n c = Counter(A)\n is753 = True\n for i in ['7','5','3']:\n if c[i] < 1:\n is753 = False\n if is753:\n global ans \n ans += 1\n for nex in ['7','5','3']:\n A += nex\n dfs(A)\n A = A[:-1]\ndfs('')\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s658045505', 's196085624'] | [2940.0, 9316.0] | [89.0, 113.0] | [197, 422] |
p03212 | u194894739 | 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**5)\nN = int(input())\n\ndef rec(num, use, cnt):\n if num > N:\n return cnt-1\n\n if (use == 0b111):\n cnt += 1\n\n return rec(num*10+7, use | 0b100, cnt)\\\n + rec(num*10+5, use | 0b010, cnt)\\\n + rec(num*10+3, use | 0b001, cnt)\n\nprint(rec(0,0,0))\n', "import sys\nsys.setrecursionlimit(10**5)\nN = int(input())\n\ndef rec(num='0',cnt=0):\n if int(num) > N:\n return cnt\n\n if '7' in num and '5' in num and '3' in num:\n cnt += 1\n\n return rec('7'+num, cnt) + rec('5'+num, cnt) + rec('3'+num, cnt)\n\nprint(rec())\n", 'import sys\nsys.setrecursionlimit(10**5)\nN = int(input())\n\ndef rec(num, use, cnt):\n if num > N:\n return cnt\n\n if (use == 0b111):\n cnt += 1\n\n return rec(num*10+7, use | 0b100, cnt)\\\n + rec(num*10+5, use | 0b010, cnt)\\\n + rec(num*10+3, use | 0b001, cnt)\n\nprint(rec(0,0,0))\n', "import sys\nsys.setrecursionlimit(10**5)\nN = int(input())\n\ndef rec(num ,cnt=0):\n if int(num) > N:\n return cnt\n\n if '7' in num and '5' in num and '3' in num:\n cnt += 1\n\n return rec('7'+num, cnt) + rec('5'+num, cnt) + rec('3'+num, cnt)\n\nprint(rec('7')+rec('5')+rec('3'))\n", 'import sys\nsys.setrecursionlimit(10**5)\nN = int(input())\n\ndef rec(num, use, cnt):\n if num > N:\n return cnt\n\n if (use == 0b111):\n cnt = 1\n\n return rec(num*10+7, use | 0b100, cnt)\\\n + rec(num*10+5, use | 0b010, cnt)\\\n + rec(num*10+3, use | 0b001, cnt)\n\nprint(rec(0,0,0))\n', "N = int(input())\n\nans = 0\np = [0]\nwhile p:\n k = p.pop()\n if k > N:\n continue\n if '7' in str(k) and '5' in str(k) and '3' in str(k):\n ans += 1\n p.extend([k*10+3, k*10+5, k*10+7])\n", 'import sys\nsys.setrecursionlimit(10**5)\nN = int(input())\n\ndef rec(num, use, cnt):\n if num > N:\n return cnt\n\n if (use == 0b111):\n cnt += 1\n\n return rec(num*10+7, use | 0b100, cnt)\\\n + rec(num*10+5, use | 0b100, cnt)\\\n + rec(num*10+3, use | 0b100, cnt)\n\nprint(rec(0,0,0))\n', 'import sys\nsys.setrecursionlimit(10**5)\nN = int(input())\n\ndef rec(num, use):\n if num > N:\n return 0\n\n i = 0\n if (use == 0b111):\n i = 1\n\n return rec(num*10+7, use | 0b100)\\\n + rec(num*10+5, use | 0b010)\\\n + rec(num*10+3, use | 0b001)\\\n + i\n\nprint(rec(0,0))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s219494990', 's293715750', 's537136340', 's570777640', 's583229221', 's719142293', 's812968642', 's496693616'] | [2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 3064.0, 3060.0, 3060.0] | [41.0, 29.0, 38.0, 58.0, 38.0, 73.0, 39.0, 38.0] | [311, 273, 309, 291, 308, 204, 307, 306] |
p03212 | u197955752 | 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 = [0] + [int(x) for x in list(input())] \nprint(N)\n\ndef dfs(L):\n global N\n if len(L) == len(N):\n if L.count(7) > 0 and L.count(5) > 0 and L.count(3) > 0:\n return 1\n else:\n return 0\n\n i = len(L) - 1 \n ans = 0\n if L[i] == N[i]: \n next = []\n if i == 0: \n for j in [0, 3, 5, 7]:\n if j <= N[i + 1]:\n next.append(j)\n else:\n for j in [3, 5, 7]:\n if j <= N[i + 1]:\n next.append(j)\n elif L[i] == 0:\n next = [0, 3, 5, 7]\n else:\n next = [3, 5, 7]\n\n for j in next:\n ans += dfs(L + [j])\n\n return ans\n\nprint(dfs([0]))', 'N = [int(x) for x in list(input())] \n\ndef dfs(L):\n global N\n if len(L) == len(N):\n if L.count(7) > 0 and L.count(5) > 0 and L.count(3) > 0:\n return 1\n else:\n return 0\n\n ans = 0\n if len(L) == 0 or L[-1] == 0:\n ans += dfs(L + [0])\n for j in [3, 5, 7]:\n ans += dfs(L + [j])\n return ans\n\nprint(dfs([]))', 'def dfs(L):\n global N, ans\n ret = 0\n if all([L.count(i) for i in ["3", "5", "7"]]):\n ret += 1\n for j in ["3", "5", "7"]:\n if int(L + j) <= int(N):\n ret += dfs(L + j)\n return ret\n\nN = input()\nprint(dfs(\'\'))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s481641271', 's513647576', 's776250398'] | [3064.0, 3064.0, 3060.0] | [55.0, 54.0, 105.0] | [829, 400, 245] |
p03212 | u200785298 | 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. | ["#!/usr/bin/env python3\nimport sys\nfrom pprint import pprint\n\n\n# Digit DP\ndef solve(N: int):\n s = str(N + 1)\n n = len(s)\n \n dp = [[[[[[0 for _ in range(2)] for _ in range(2)] for _ in range(2)] for _ in range(2)] for _ in range(2)] for _ in range(n + 1)]\n dp[0][0][0][0][0][0] = 1\n for i in range(0, n):\n for smaller in range(2):\n for started in range(2):\n for i1 in range(2):\n for i2 in range(2):\n for i3 in range(2):\n for nex in [0, 3, 5, 7]:\n if not smaller and nex > int(s[i]):\n #print(i, nex)\n continue\n if started and nex == 0:\n continue\n \n #print(dp[0][0][0][0][0][0])\n #if not (smaller | nex < int(s[i])):\n # print(' --- ')\n # print(i, smaller, started, i1, i2, i3, nex, int(s[i]), nex < int(s[i]))\n # print(smaller, nex < int(s[i]))\n # print(smaller or nex < int(s[i]))\n # print(' --- ')\n\n #dp[i + 1][smaller or nex < int(s[i])][started or nex > 0][i1 or nex == 3][i2 or nex == 5][i3 or nex == 7] += \\\n dp[i + 1][smaller | nex < int(s[i])][started | nex > 0][i1 | nex == 3][i2 | nex == 5][i3 | nex == 7] += \\\n dp[i][smaller][started][i1][i2][i3]\n #pprint(dp[i])\n #print()\n ret = dp[n][1][1][1][1][1]\n #pprint(dp[n])\n print(ret)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n solve(N)\n\nif __name__ == '__main__':\n main()\n", "#!/usr/bin/env python3\nimport sys\nfrom pprint import pprint\n\n\n# Digit DP\ndef solve(N: int):\n s = str(N + 1)\n n = len(s)\n \n dp = [[[[[[0 for _ in range(2)] for _ in range(2)] for _ in range(2)] for _ in range(2)] for _ in range(2)] for _ in range(n + 1)]\n dp[0][0][0][0][0][0] = 1\n for i in range(0, n):\n for smaller in range(2):\n for started in range(2):\n for i1 in range(2):\n for i2 in range(2):\n for i3 in range(2):\n for nex in [0, 3, 5, 7]:\n if not smaller and nex > int(s[i]):\n #print(i, nex)\n continue\n if started and nex == 0:\n continue\n \n #print(dp[0][0][0][0][0][0])\n #if not (smaller | nex < int(s[i])):\n # print(' --- ')\n # print(i, smaller, started, i1, i2, i3, nex, int(s[i]), nex < int(s[i]))\n # print(smaller, nex < int(s[i]))\n # print(smaller or nex < int(s[i]))\n # print(' --- ')\n\n \n dp[i + 1][smaller or nex < int(s[i])][started or nex > 0][i1 or nex == 3][i2 or nex == 5][i3 or nex == 7] += \\\n dp[i][smaller][started][i1][i2][i3]\n #pprint(dp[i])\n #print()\n ret = dp[n][1][1][1][1][1]\n #pprint(dp[n])\n print(ret)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n solve(N)\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s957527497', 's179899429'] | [3572.0, 3572.0] | [24.0, 24.0] | [2149, 2149] |
p03212 | u201463102 | 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 as itt\n\nN = input()\n\ndef check(snum):\n three = snum.count("3")\n five = snum.count("5")\n seven = snum.count("7")\n if (three == 0 or five == 0 or seven == 0) or (int(snum) > int(N)): return False\n else: return True\n\nC = ["3", "5", "7"] #choice\ndigit = len(N)\ncnt = 0\nfor d in range(3, digit+1): \n L = list(itt.product(C, repeat=d))\n for l in L:\n gen = "".join(l)\n if check(gen):\n print(gen)\n cnt += 1\n\nprint(cnt)', 'import sys\nn = input()\ncnt = 0\nfor i in range(int(n)):\n three = str(i).count("3")\n five = str(i).count("5")\n seven = str(i).count("7")\n if three == 0 or five == 0 or seven == 0:\n pass\n elif len(str(i)) != three + five + seven:\n pass\n else:\n print(i)\n cnt += 1\n\nprint(cnt)', 'import itertools as itt\n\nN = input()\n\ndef check(snum):\n three = snum.count("3")\n five = snum.count("5")\n seven = snum.count("7")\n if (three == 0 or five == 0 or seven == 0) or (int(snum) > int(N)): return False\n else: return True\n\nC = ["3", "5", "7"] #choice\ndigit = len(N)\ncnt = 0\nfor d in range(3, digit+1): \n L = list(itt.product(C, repeat=d))\n for l in L:\n gen = "".join(l)\n if check(gen):\n #print(gen)\n cnt += 1\n\nprint(cnt)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s438569555', 's860047359', 's087923934'] | [6848.0, 3064.0, 6756.0] | [83.0, 2104.0, 65.0] | [513, 317, 514] |
p03212 | u212328220 | 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\nfrom collections import Counter\nimport bisect\nN = int(input())\n\nlst = ['3','5','7']\nanslst = set()\nfor i in range(1,10):\n for v in itertools.product(lst,repeat=i):\n x = Counter(str(v))\n if x['7'] >= 1 and x['5'] >= 1 and x['3'] >= 1:\n anslst.add(int(''.join(v)))\n\nindex = bisect.bisect_left(list(anslst), N)\nprint(index)\n", "import itertools\nfrom collections import Counter\nimport bisect\nN = int(input())\n\nlst = ['3','5','7']\nanslst = []\nfor i in range(1,10):\n for v in itertools.product(lst,repeat=i):\n x = Counter(str(v))\n if x['7'] >= 1 and x['5'] >= 1 and x['3'] >= 1:\n anslst.append(int(''.join(v)))\nanslst.sort()\nindex = bisect.bisect_right(list(anslst), N)\nprint(index)\n"] | ['Wrong Answer', 'Accepted'] | ['s903417819', 's663845360'] | [12388.0, 10600.0] | [150.0, 149.0] | [366, 380] |
p03212 | u217086212 | 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())\ncombi = []\nl = []\ncount = 0\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\nprint(dfs('0'))\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'))"] | ['Runtime Error', 'Accepted'] | ['s704720749', 's188061275'] | [3060.0, 2940.0] | [19.0, 94.0] | [239, 196] |
p03212 | u219607170 | 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 = len(str(N))\n\ndef make753(num, l, list753):\n if l == 0:\n if '3' in num and '5' in num and '7' in num and int(num) <= N:\n print(int(num))\n list753.append(int(num))\n else:\n make753(num + '3', l-1, list753)\n make753(num + '5', l-1, list753)\n make753(num + '7', l-1, list753)\n return list753\n\nL = []\nfor l in range(3, l+1):\n L += make753('', l, [])\nprint(len(L))", "N = int(input())\nl = len(str(N))\n\ndef make753(num, l, list753):\n if l == 0:\n if '3' in num and '5' in num and '7' in num and int(num) <= N:\n list753.append(int(num))\n else:\n make753(num + '3', l-1, list753)\n make753(num + '5', l-1, list753)\n make753(num + '7', l-1, list753)\n return list753\n\nL = []\nfor l in range(3, l+1):\n L += make753('', l, [])\nprint(len(L))"] | ['Wrong Answer', 'Accepted'] | ['s995563152', 's391501610'] | [4784.0, 4328.0] | [71.0, 41.0] | [440, 412] |
p03212 | u221345507 | 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())\ns=['0','3','5','7']\nmust = ['3','5','7']\ncount = 0\nfor i_9 in range (4):\n for i_8 in range (4):\n for i_7 in range (4):\n for i_6 in range (4):\n for i_5 in range (4):\n for i_4 in range (4):\n for i_3 in range (4):\n for i_2 in range (4):\n for i_1 in range (4):\n num =s[i_9]+s[i_8]+s[i_7]+s[i_6]+s[i_5]+s[i_4]+s[i_3]+s[i_2]+s[i_1]\n num = int(''.join(list(map(str,num))))\n if (num<=N) & ('0' not in list(str(num))) & ('3' in list(str(num))) & ('5' in list(str(num))) & ('7' in list(str(num))) :\n count +=1\n \ncount", "N = int(input())\ns=['0','3','5','7']\nmust = ['3','5','7']\ncount = 0\nfor i_9 in range (4):\n for i_8 in range (4):\n for i_7 in range (4):\n for i_6 in range (4):\n for i_5 in range (4):\n for i_4 in range (4):\n for i_3 in range (4):\n for i_2 in range (4):\n for i_1 in range (4):\n num =s[i_9]+s[i_8]+s[i_7]+s[i_6]+s[i_5]+s[i_4]+s[i_3]+s[i_2]+s[i_1]\n num = int(''.join(list(map(str,num))))\n if (num<=N) & ('0' not in list(str(num))) & ('3' in list(str(num))) & ('5' in list(str(num))) & ('7' in list(str(num))) :\n count +=1\n \nprint(count)\n"] | ['Wrong Answer', 'Accepted'] | ['s344681229', 's030542789'] | [3192.0, 3064.0] | [1489.0, 1517.0] | [843, 851] |
p03212 | u222668979 | 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\ntfs = set()\nfor i in range(1,10):\n tfs |= set(product(['3', '5', '7'], repeat=i))\n\ncnt = 0\nfor l in tfs:\n if ('3' in l) and ('5' in l) and ('7' in l): \n num = int(''.join(l))\n if num <= n:\n print(num)\n cnt += 1\nprint(cnt)\n", "from itertools import product\n\nn = int(input())\n\ntfs = set()\nfor i in range(1,10):\n tfs |= set(product(['3', '5', '7'], repeat=i))\n\ncnt = 0\nfor l in tfs:\n if ('3' in l) and ('5' in l) and ('7' in l):\n num = int(''.join(l))\n if num <= n:\n cnt += 1\nprint(cnt)\n"] | ['Wrong Answer', 'Accepted'] | ['s609683394', 's222249368'] | [16552.0, 16552.0] | [70.0, 65.0] | [313, 289] |
p03212 | u243312682 | 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. | ["cnt = 0\n\ndef main():\n n = int(input())\n m = len(str(n))\n nl = len(str(n))\n\n def cal(A):\n l = len(A) - 1\n ans = 0\n for idx, i in enumerate(A):\n ans += i*10**(l - idx)\n return ans\n\n def dfs(A):\n global cnt\n if len(A) == m:\n if len(list(set(A) & set([3, 5, 7]))) == 3:\n if (cal(A)) <= n:\n print(cal(A))\n cnt += 1\n return\n for i in (3, 5, 7):\n A.append(i)\n dfs(A)\n A.pop()\n for m in range(nl+1):\n dfs([])\n print(cnt)\n\nif __name__ == '__main__':\n main()", "cnt = 0\n\ndef main():\n n = int(input())\n m = len(str(n))\n nl = len(str(n))\n\n def cal(A):\n l = len(A) - 1\n ans = 0\n for idx, i in enumerate(A):\n ans += i*10**(l - idx)\n return ans\n\n def dfs(A):\n global cnt\n if len(A) == m:\n if len(list(set(A) & set([3, 5, 7]))) == 3:\n if (cal(A)) <= n:\n # print(cal(A))\n cnt += 1\n return\n for i in (3, 5, 7):\n A.append(i)\n dfs(A)\n A.pop()\n for m in range(nl+1):\n dfs([])\n print(cnt)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s612924999', 's297945969'] | [3392.0, 3064.0] | [288.0, 167.0] | [648, 650] |
p03212 | u253681061 | 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 ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n for c in '753':\n print(s+c)\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', 'Accepted'] | ['s313122921', 's225703333'] | [4152.0, 2940.0] | [174.0, 93.0] | [218, 199] |
p03212 | u274080981 | 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 if s.count('3') > 0 and s.count('5') > 0 and s.count('7') > 0:\n cnt = 1\n else:\n cnt = 0\n cnt += dfs(s + '3')\n cnt += dfs(s + '5')\n cnt += dfs(s + '7')\n return cnt\n \n \nprint(dfs('0'))", "n = int(input())\n \ndef dfs(s):\n\n if int(s) > n:\n return 0\n if s.count('3') > 0 and s.count('5') > 0 and s.count('7') > 0:\n cnt = 1\n else:\n cnt = 0\n cnt += dfs(s + '3')\n cnt += dfs(s + '5')\n cnt += dfs(s + '7')\n return cnt\n \n \nprint(dfs('0'))"] | ['Wrong Answer', 'Accepted'] | ['s562796778', 's272679402'] | [4136.0, 3060.0] | [115.0, 66.0] | [295, 283] |
p03212 | u284363684 | 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. | ["\nif N < 357:\n print(0)\nelse:\n cnt = 1\n for n in range(358, N + 1):\n if set(str(n)) == set(['7', '5', '3']):\n cnt += 1\n print(cnt)", '# input\nN = int(input())\n\n\nif N < 357:\n print(0)\nelse:\n max_dig = len(str(N))\n dig = 3\n sgs_nuns = []\n sgs = set(["7", "5", "3"])\n str_join = "".join\n for n in range(3, max_dig + 1):\n sgs_nuns += [\n str_join(n)\n for n in product(["7", "5", "3"], repeat=n)\n if set(str_join(n)) == sgs and int(str_join(n)) <= N\n ]\n\n cnt = len(sgs_nuns)\n print(cnt)', 'from itertools import product\n\n# input\nN = int(input())\n\n\nif N < 357:\n print(0)\nelse:\n max_dig = len(str(N))\n dig = 3\n sgs_nuns = []\n sgs = {"7", "5", "3"}\n str_join = "".join\n for n in range(3, max_dig + 1):\n sgs_nuns += [\n str_join(n)\n for n in product(["7", "5", "3"], repeat=n)\n if set(str_join(n)) == sgs and int(str_join(n)) <= N\n ]\n\n cnt = len(sgs_nuns)\n print(cnt)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s197300155', 's833646098', 's522479351'] | [2940.0, 3064.0, 5188.0] | [18.0, 18.0, 51.0] | [166, 427, 453] |
p03212 | u293403071 | 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# Recursion!\ndef detector(str):\n # Stop the operation if the number is bigger than n.\n if int(str) > n:\n return 0\n else:\n count = 0\n # Add 7, 5, or 3 after the number. \n # Eliminate numbers that do not consist of only 3, 5, and 7.\n for i in "753":\n count += detector(str+i)\n # Check if the number has all 3, 5, and 7.\n if "3" not in str or "5" not in str or "7" not in str:\n return count\n else:\n return count += 1\n# Start from 0 and do the operation until the number exceeds n.\ndetector("0")', 'n = int(input())\n# Recursion!\ndef detector(str):\n # Stop the operation if the number is bigger than n.\n if int(str) > n:\n return 0\n else:\n count = 0\n # Add 7, 5, or 3 after the number. \n # Eliminate numbers that do not consist of only 3, 5, and 7.\n for i in "753":\n count += detector(str+i)\n # Check if the number has all 3, 5, and 7.\n if "3" not in str or "5" not in str or "7" not in str:\n return count\n else:\n return count + 1\n# Start from 0 and do the operation until the number exceeds n.\nprint(detector("0"))'] | ['Runtime Error', 'Accepted'] | ['s509023753', 's184242209'] | [2940.0, 2940.0] | [18.0, 63.0] | [550, 556] |
p03212 | u298297089 | 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\nfrom itertools import product\nN = input()\nn = int(N)\nans = 0\nfor i in range(len(N)+1):\n for s in product(["3","5","7"],repeat=i):\n if int("".join(s)) <= n and "3" in s and "5" in s and "7" in s:\n ans += 1\nprint(ans)\n', "n = int(input())\ns = '753'\n\nstack = ['']\ncnt = 0\nwhile stack:\n t = stack.pop()\n for c in s:\n u = t + c\n if int(u) <= n:\n if '7' in u and '5' in u and '3' in u:\n # print(u)\n cnt += 1\n stack.append(u)\nprint(cnt)\n"] | ['Runtime Error', 'Accepted'] | ['s871153307', 's507571930'] | [3064.0, 3060.0] | [19.0, 68.0] | [295, 282] |
p03212 | u303037478 | 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 \n if all(s.count(c)>0 for c in "753"):\n ret=1\n else:\n ret=0\n\n for c in "753":\n ret+=dfs(s+c)\n return ret\n\ndfs("0")', 'N=int(input())\n\ndef dfs(s):\n if int(s)>N:\n return 0\n \n if all(s.count(c)>0 for c in "753"):\n ret=1\n else:\n ret=0\n\n for c in "753":\n ret+=dfs(s+c)\n return ret\n\nprint(dfs("0"))'] | ['Wrong Answer', 'Accepted'] | ['s933211377', 's056811978'] | [2940.0, 2940.0] | [94.0, 94.0] | [213, 220] |
p03212 | u306865094 | 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\nprint(1)', "s = int(input())\n\nimport numpy as np\nimport itertools\ncandess = []\ncnt = 0\n\nfor i in range(3, 10):\n candes = list((itertools.product([3,5,7], repeat=i)))\n for cande in candes:\n if (3 in cande) and (5 in cande) and (7 in cande) and \\\n (int(''.join(map(str, cande)))) <= s:\n cnt += 1\nprint(cnt)"] | ['Wrong Answer', 'Accepted'] | ['s577286929', 's714541395'] | [3060.0, 15592.0] | [17.0, 213.0] | [25, 323] |
p03212 | u311636831 | 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=999999999\nl=len(str(N))\n\ndef calc(st):\n st=str(st)\n if(len(st)>l):return 0\n t=calc(st+"3")\n f=calc(st+"5")\n s=calc(st+"7")\n o=0\n if(st.find("7")>=0 and st.find("5")>=0 and st.find("3")>=0 and int(st)<=N):\n o=1\n return (t+f+s+o)\n\nprint(calc(str()))\n\n\n\n\n\n', 'N=int(input())\nl=len(str(N))\n\ndef calc(st):\n st=str(st)\n if(len(st)>l):return 0\n t=calc(st+"3")\n f=calc(st+"5")\n s=calc(st+"7")\n o=0\n if(st.find("7")>=0 and st.find("5")>=0 and st.find("3")>=0 and int(st)<=N):\n o=1\n return (t+f+s+o)\n\nprint(calc(str()))\n\n\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s806950175', 's311352514'] | [3060.0, 3064.0] | [69.0, 67.0] | [286, 289] |
p03212 | u315485238 | 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\nprint(3**N - 3*(2**N - 2) - 3)', "import itertools\nN=int(input())\n\nanswer = 0\nfor n in range(1,10):\n for l in itertools.product(['7','3','5'], repeat=n):\n if '7' in l and '5' in l and '3' in l:\n answer += (int(''.join(l))<=N)\n\nprint(answer)\n"] | ['Wrong Answer', 'Accepted'] | ['s606749201', 's957289886'] | [10396.0, 3060.0] | [2104.0, 41.0] | [48, 216] |
p03212 | u317493066 | 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):\n if int(s) > n:\n return 0\n if all(s.count(c) > 0 for c in '753'):\n result = 1\n else:\n result = 0\n for c in '753':\n print(s + c)\n result += dfs(s + c, n)\n\n return result\n\n\ndef main():\n n = int(input())\n\n print(dfs('0', n))\n\n\nif __name__ == '__main__':\n main()\n", "def dfs(s, n):\n if int(s) > n:\n return 0\n if all(s.count(c) > 0 for c in '753'):\n result = 1\n else:\n result = 0\n for c in '753':\n result += dfs(s + c, n)\n\n return result\n\n\ndef main():\n n = int(input())\n print(dfs('0', n))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s350038147', 's034006390'] | [9148.0, 9120.0] | [100.0, 75.0] | [333, 311] |
p03212 | u323045245 | 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())\nfrom itertools import product\nans = 0\nfor i in range(1, 11):\n for p in product("357", repeat=i):\n v = "".join(p)\n if "3" in v and "5" in v and "7" in v and int("".join(p)) <= N:\n ans += 1\nprint(ans)', 'n = int(input())\nfrom itertools import product\nans = 0\nfor i in range(1, 11):\n for p in product("357", repeat=i):\n v = "".join(p)\n if "3" in v and "5" in v and "7" in v and int("".join(p)) <= n:\n ans += 1\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s817314797', 's512782687'] | [3060.0, 3060.0] | [17.0, 96.0] | [227, 228] |
p03212 | u328131364 | 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())\nnum_list = ["3", "5", "7"]\ncount = 0\n\nfor i in range(2,10):\n for t in product(num_list, repeat=i):\n check = t.count("3")*t.count("5").t.count("7")\n \n if int("".join(t)): <= N and check:\n count += 1\n\nprint(count)', 'from itertools import product\n\nN = int(input())\nnum_list = ["3", "5", "7"]\ncount = 0\n\nfor i in range(2,10):\n for t in product(num_list, repeat=i):\n check = t.count("3")*t.count("5")*t.count("7")\n if int("".join(t)): <= N and check:\n count += 1\n\nprint(count)', 'from itertools import product\n\nN = int(input())\nnum_list = ["3", "5", "7"]\ncount = 0\n\nfor i in range(2,10):\n for t in product(num_list, repeat=i):\n check = t.count("3")*t.count("5").t.count("7")\n if int("".join(t)): <= N and check:\n count += 1\n\nprint(count)', 'N = int(input())\ncount = 0\n\nfor i in range(357, N+1):\n\n i_str = str(i)\n\n if i_str[-1] != "3" or i_str[-1] != "5" or i_str[-1] != "7":\n continue\n \n thr = i_str.count("3")\n fiv = i_str.count("5")\n sev = i_str.count("7")\n\n\n if len(i_str) == thr + fiv + sev:\n if thr > 0:\n if fiv > 0:\n if sev > 0: \n count += 1\n\nprint(count)', 'from itertools import product\n\nN = int(input())\nnum_list = ["3", "5", "7"]\ncount = 0\n\nfor i in range(3, 10):\n for t in (product(num_list, repeat=i)):\n check = t.count("3")*t.count("5")*t.count("7")\n if int("".join(t)) <= N and check:\n count += 1\n\n\nprint(count)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s304306833', 's553444826', 's791507001', 's876591593', 's278252433'] | [3068.0, 2940.0, 2940.0, 3064.0, 3060.0] | [17.0, 17.0, 18.0, 2104.0, 56.0] | [294, 285, 285, 398, 288] |
p03212 | u328510800 | 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 \n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n \n return sum((dfs(s+c) for c in '753'))\n\nprint(dfs('0'))", "N = int(input())\n\ndef dfs(s):\n \n if len(s) > 0 and int(s) > N:\n return 0\n \n \n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n \n return ret + sum((dfs(s+c) for c in '753'))\n\nprint(dfs(''))"] | ['Wrong Answer', 'Accepted'] | ['s660433831', 's275194632'] | [9084.0, 9124.0] | [85.0, 88.0] | [259, 255] |
p03212 | u329709276 | 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\nn = input()\nif(int(n)<357):\n print(0)\n exit()\n\nans = 0\n\nfor i in range(3,len(n)+1):\n if len(n) == i:\n for v in itertools.product(['3','5','7'],repeat=i):\n if '3' in v and '5' in v and '7' in v:\n if int(''.join(v)) <= int(n):\n print(v)\n ans += 1\n else:\n ans += 3 ** i - 2 ** i * 3 + 3\nprint(ans)", "import itertools\nimport math\n\nn = input()\nif(int(n)<357):\n print(0)\n exit()\n\nans = 0\n\nfor i in range(3,len(n)+1):\n if len(n) == i:\n for v in itertools.product(['3','5','7'],repeat=i):\n if '3' in v and '5' in v and '7' in v:\n if int(''.join(v)) <= int(n):\n ans += 1\n else:\n ans += 3 ** i - 2 ** i * 3 + 3\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s881790359', 's334486894'] | [3828.0, 3064.0] | [71.0, 39.0] | [414, 385] |
p03212 | u337626942 | 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 f(s):\n if int(s) > n:\n return 0 \n if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:\n cnt += 1\n else:\n cnt += f(s + "3")\n cnt += f(s + "5")\n cnt += f(s + "7")\n \nprint(cnt)\n \n ', 'n = int(input())\ndef f(s):\n if int(s) > n:\n return 0 \n if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:\n \tcnt = 1\n else:\n \tcnt = 0\n cnt += f(s + "3")\n cnt += f(s + "5")\n cnt += f(s + "7")\n return cnt\n \nresult = f("0")\nprint(result)'] | ['Runtime Error', 'Accepted'] | ['s867374751', 's303621032'] | [2940.0, 3064.0] | [17.0, 66.0] | [243, 271] |
p03212 | u339503988 | 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\n\ndef dfs(s):\n if int(s) > n:\n return 0\n ret = 1 if all(s.count > 0 for c in '753') else 0\n for c in '753':\n ret += dfs(s + c)\n return ret\n\n\nprint(dfs('0'))\n", "n = int(input())\n\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\n\nprint(dfs('0'))\n"] | ['Runtime Error', 'Accepted'] | ['s633600507', 's689555707'] | [2940.0, 3060.0] | [18.0, 92.0] | [200, 203] |
p03212 | u339550873 | 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. | ["#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\n\ndef dfs(s):\n if int(s) > 0:\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\n", '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\nls = [x+1 for x in range(N)]\ncandidates = [str(x) for x in ls if "7" in str(x) and "5" in str(x) and "3" in str(x))\ncount = 0\nfor _ in range len(candidates):\n candlist = list(candidates)\n ls2 = [x for x in candlist if x != 7 and x != 5 and x != 3]\n if ls2 is False:\n count += 1\n\nprint(count)\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\nls = [x+1 for x in range(N)]\ncandidates = [str(x) for x in ls if "7" in str(x) and "5" in str(x) and "3" in str(x)]\ncount = 0\nfor _ in range (len(candidates)):\n candlist = list(candidates)\n ls2 = [x for x in candlist if x != "7" and x != "5"and x != "3"]\n if ls2 is False:\n count += 1\n\nprint(count)\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\nls = [x+1 for x in range(N)]\ncandidates = [str(x) for x in ls if "7" in str(x) and "5" in str(x) and "3" in str(x))\ncount = 0\nfor _ in range len(candidates):\n candlist = list(candidates)\n ls2 = [x for x in candlist if x != "7" and x != "5"and x != "3"]\n if ls2 is False:\n count += 1\n\nprint(count)\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\ncount = 0\nfor i in range (N):\n num = str(i+1)\n ls = list(num)\n ls2 = [x for x in ls if int(x) != 7 and int(x) != 5 and int(x) !=3]\n if ls2 is False and "7" in num and "5" in num and "3" in num:\n count += 1\n\nprint(count)\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\nls = [x+1 for x in range(N)]\ncandidates = [str(x) for x in ls if "7" in str(x) and "5" in str(x) and "3" in str(x)]\ncount = 0\nfor _ in range len(candidates):\n candlist = list(candidates)\n ls2 = [x for x in candlist if x != "7" and x != "5"and x != "3"]\n if ls2 is False:\n count += 1\n\nprint(count)\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\ncount = 0\nfor i in range (N):\n num = str(i+1)\n ls = list(num)\n ls2 = [x for x in ls if int(x) != 7 and int(x) != 5 and int(x) !=3]\n if ls2 is False:\n count += 1\n\nprint(count)\n', "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = 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\n"] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s248136699', 's285812707', 's405475579', 's424528211', 's533768437', 's621033918', 's941750029', 's547167523'] | [2940.0, 2940.0, 1277976.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 2189.0, 18.0, 2104.0, 17.0, 2104.0, 92.0] | [250, 373, 380, 378, 304, 378, 259, 250] |
p03212 | u347813515 | 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 \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 return ret\n\nprint(dfs(''))", "N = int(input())\n\ndef dfs(s):\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 return ret\n\nprint(dfs('0'))"] | ['Runtime Error', 'Accepted'] | ['s857122845', 's205979227'] | [3060.0, 2940.0] | [17.0, 99.0] | [323, 324] |
p03212 | u352499693 | 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 collections import deque\nn = int(input())\nq = deque()\nq.append('')\nres = set()\nwhile q:\n m = q.pop_front()\n for c in '357':\n if int(m+c) > n: continue\n q.append(m+c)\n for c in '357':\n if c not in m: break\n else:\n res.add(m)\nprint(len(res))", "from collections import deque\nn = int(input())\nq = deque()\nq.append('')\nres = set()\nwhile q:\n m = q.popleft()\n for c in '357':\n if int(m+c) > n: continue\n q.append(m+c)\n for c in '357':\n if c not in m: break\n else:\n res.add(m)\nprint(len(res))\n"] | ['Runtime Error', 'Accepted'] | ['s716663433', 's718211386'] | [3444.0, 7768.0] | [99.0, 72.0] | [284, 283] |
p03212 | u353241315 | 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 f(s):\n t=s\n num=0\n ten=1\n L=[0,0,0,1]\n while t!=0:\n a=t%3\n if a==0:\n num+=3*ten\n L[0]=1\n elif a==1:\n num+=5*ten\n L[1]=1\n elif a==2:\n num+=7*ten\n L[2]=1\n ten*=10\n t=t//3\n return num,L\nans=0\nfor i in range(1,3**9):\n num,L=f(i)\n if num<=N and L==[1,1,1,1]:\n ans+=1\n #print(num)\nprint(ans)', "from itertools import product\n\nif __name__ == '__main__':\n N = int(input())\n count = 0\n digits = len(str(N))\n \n for n in range(1, digits+1):\n\n for t in product('357', repeat=n):\n num = ''.join(t)\n if int(num) <= N:\n if '3' in num and '5' in num and '7' in num:\n count += 1\n print(count)\n "] | ['Wrong Answer', 'Accepted'] | ['s582270262', 's485125249'] | [3064.0, 3064.0] | [81.0, 39.0] | [450, 380] |
p03212 | u355865104 | 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\ndef solve():\n\n N = int(input())\n num = str(N)\n\n ans = []\n dig = len(num)\n for x in range(dig):\n com = []\n com.append((\'\', \'3\', \'5\', \'7\'))\n for y in range(x):\n com.append((\'3\', \'5\', \'7\'))\n ans.append(com)\n\n temp = [list(itertools.product(*k)) for k in ans]\n\n tempanswer = [j for i in temp for j in i if (j.count(\n \'3\') >= 1 and j.count(\'5\') >= 1 and j.count(\'7\') >= 1)]\n\n answer = [int("".join(y)) for y in tempanswer if int("".join(y)) < N]\n res = list(set(answer))\n print(len(answer))\n print(answer)\n\n\nsolve()', 'import itertools\nif __name__ == \'__main__\':\n \n N = input()\n n = int(N)\n count = 0\n for i in range(0, len(N)):\n\n temp = itertools.product(["3", "5", "7"], repeat=i+1)\n for j in temp:\n s = "".join(j)\n \n if ("3" in s and "5" in s and "7" in s and int(s) <= n):\n count += 1\n \n print(count)'] | ['Wrong Answer', 'Accepted'] | ['s714792955', 's577043725'] | [12296.0, 3060.0] | [82.0, 40.0] | [608, 320] |
p03212 | u358051561 | 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\nli = []\nfor v in itertools.product('0357', repeat=len(N)):\n a = ''\n for w in v:\n a = a + w\n li.append(a)\n\nli2 = []\nfor v in li:\n if '3' in v and '5' in v and '7' in v and int(v) <= int(N):\n v = v.replace('0', '')\n li2.append(v)\n else: pass\nprint(len(set(li2)))", "N = input()\nimport itertools\nli = []\nfor v in itertools.product('0357', repeat=len(N)):\n a = ''\n for w in v:\n a = a + w\n li.append(a)\n\nli2 = []\nfor v in li:\n if '3' in v and '5' in v and '7' in v and int(v) <= int(N):\n v = v.replace('0', '')\n li2.append(v)\n else: pass\nprint(len(set(li2)))"] | ['Runtime Error', 'Accepted'] | ['s274660703', 's927345212'] | [3060.0, 36756.0] | [18.0, 660.0] | [309, 325] |
p03212 | u363768711 | 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 abc(s):\n t = all('3' in s, '5' in s, '7' in s)\n if len(s) < len(n):\n return abc(s+'3') + abc(s+'5') + abc(s+'7') + t\n elif s <= n:\n return t\n else:\n return 0\nprint(abc(''))", "n = int(input())\n\ndef dfs(s):\n if int(s) > n:\n return 0\n if all(s.count(c)>0 for c in '753'):\n t = 1\n else:\n t = 0\n for c in '753':\n t += dfs(s+c)\n return t\n\nprint(dfs('0'))"] | ['Runtime Error', 'Accepted'] | ['s618455729', 's179387472'] | [3060.0, 2940.0] | [19.0, 92.0] | [207, 190] |
p03212 | u363992934 | 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_str = input()\nn = int(n_str)\ndigit = len(n_str)\ntop = int(n_str[0])\n\ndef calc_add(digit):\n return (3 ** (digit) - ((2 ** (digit)) * 2) + 1) if digit >= 2 else 0 \n\nanswer = 0\nif(digit > 3):\n for(pre_digit) in range(3, digit):\n answer += calc_add(pre_digit - 1) * 3\n\nadd = calc_add(digit - 1)\nprint("left:{} add:{}".format(answer, add))\nif(top > 3):\n \n answer += add\nif(top > 5):\n \n answer += add\nif(top > 7):\n \n answer += add\n\nif (top == 3 or top == 5 or top == 7):\n \n for number in range(top * (10 ** (digit - 1)), n):\n count3 = 0\n count5 = 0\n count7 = 0\n for num in str(number):\n if(int(num) == 3):\n count3 += 1\n elif(int(num) == 5):\n count5 += 1\n elif(int(num) == 7):\n count7 += 1 \n else:\n break\n else:\n if(count3 != 0 and count5 != 0 and count7 != 0):\n print("num:{}".format(number))\n answer += 1\nprint (answer)', 'n_str = input()\nn = int(n_str)\ndigit = len(n_str)\ntop = int(n_str[0])\n\ndef calc_add(digit):\n return (3 ** (digit) - ((2 ** (digit)) * 2) + 1) if digit >= 2 else 0 \n\nanswer = 0\nif(digit > 3):\n for(pre_digit) in range(3, digit):\n answer += calc_add(pre_digit - 1) * 3\n\nadd = calc_add(digit - 1)\nif(top > 3):\n \n answer += add\nif(top > 5):\n \n answer += add\nif(top > 7):\n \n answer += add\n\nif (top == 3 or top == 5 or top == 7):\n \n \n chk_list = []\n char_list = ["3", "5", "7"]\n counter = 0\n while True:\n string = str(top)\n cp_counter = counter\n for index in reversed(range(0, (digit - 1))):\n string += char_list[(cp_counter // (3 ** (index)))]\n cp_counter -= (3 ** (index)) * (cp_counter // (3 ** (index)))\n if int(string) <= n:\n chk_list.append(tuple(string))\n counter += 1\n if counter >= 3 ** (digit - 1):\n break\n \n for string_number in chk_list:\n count3 = 0\n count5 = 0\n count7 = 0\n for num in string_number:\n if(int(num) == 3):\n count3 += 1\n elif(int(num) == 5):\n count5 += 1\n elif(int(num) == 7):\n count7 += 1 \n else:\n break\n else:\n if(count3 != 0 and count5 != 0 and count7 != 0):\n answer += 1\nprint (answer)'] | ['Wrong Answer', 'Accepted'] | ['s786879009', 's462759459'] | [3444.0, 3828.0] | [2104.0, 120.0] | [1186, 1619] |
p03212 | u366959492 | 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 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("0")\n', 'n=int(input())\ndef dfs(x):\n if int(x)>n:\n return 0\n c=1 if all(x.count(l)>0 for l in "753") else 0\n for i in "753":\n c+=dfs(x+i)\n return c\nprint(dfs("0"))\n'] | ['Wrong Answer', 'Accepted'] | ['s726079065', 's829286098'] | [2940.0, 2940.0] | [18.0, 94.0] | [184, 181] |
p03212 | u366963613 | 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 numpy as np\nfrom collections import deque\nfrom collections import defaultdict\nimport heapq\nimport collections\nimport itertools\nimport bisect\n\nMAX_LIM = 10**9\nN = (input())\nketa = len(N)\nN = int(N)\n\nprint(pow(3, 9))\nketa_lis = {1: [3, 5, 7], 2: [], 3: [],\n 4: [], 5: [], 6: [], 7: [], 8: [], 9: []}\nfor i in range(1, keta):\n times = pow(10, i)\n for tmp in keta_lis[i]:\n for num in [3, 5, 7]:\n keta_lis[i+1].append(tmp + times*num)\nans = []\nfor keta in keta_lis.keys():\n ans.extend(keta_lis[keta])\nans = np.array(sorted(ans))\nans = ans[357 <= ans]\nans = ans[ans <= N]\ncount = 0\nfor ans_ in ans:\n if (('3' in str(ans_)) and ('5' in str(ans_)) and ('7' in str(ans_))):\n # print(ans_)\n count += 1\nprint(count)\n\n# print(ans[357 <= ans])\n", "import numpy as np\nfrom collections import deque\nfrom collections import defaultdict\nimport heapq\nimport collections\nimport itertools\nimport bisect\n\nMAX_LIM = 10**9\nN = (input())\nketa = len(N)\nN = int(N)\n\n# print(pow(3, 9))\nketa_lis = {1: [3, 5, 7], 2: [], 3: [],\n 4: [], 5: [], 6: [], 7: [], 8: [], 9: []}\nfor i in range(1, keta):\n times = pow(10, i)\n for tmp in keta_lis[i]:\n for num in [3, 5, 7]:\n keta_lis[i+1].append(tmp + times*num)\nans = []\nfor keta in keta_lis.keys():\n ans.extend(keta_lis[keta])\nans = np.array(sorted(ans))\nans = ans[357 <= ans]\nans = ans[ans <= N]\ncount = 0\nfor ans_ in ans:\n if (('3' in str(ans_)) and ('5' in str(ans_)) and ('7' in str(ans_))):\n # print(ans_)\n count += 1\nprint(count)\n\n# print(ans[357 <= ans])\n"] | ['Wrong Answer', 'Accepted'] | ['s078428831', 's155661010'] | [13900.0, 13928.0] | [407.0, 408.0] | [793, 795] |
p03212 | u367130284 | 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()\nc=[0,0,6,36,150,540,1806,5796,18150]\nb=len(list(a for a in itertools.product(["3","5","7"],repeat=len(n))if len(set(a))==3 and int("".join(a))<int(n)))\nprint(sum(c[:l-1])+b)', '\nn=int(input())\n\n\n\ndef dfs(s):\n ans=0\n if int(s)>n:\n return 0\n else:\n ans+=all(map(s.count,"357"))\n for i in "357":\n ans+=dfs(s+i)\n return ans\nprint(dfs("0"))'] | ['Runtime Error', 'Accepted'] | ['s187145804', 's587176587'] | [5364.0, 3060.0] | [40.0, 79.0] | [200, 202] |
p03212 | u368780724 | 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 prf(m):\n pf = {}\n for i in range(2,int(m**0.5)+1):\n while m % i == 0:\n pf[i] = pf.get(i,0)+1\n m //= i\n if m>1:pf[m] = 1\n return pf\nimport bisect\nfrom collections import defaultdict\nPr = defaultdict(lambda: -1)\n\nm = int(input())\nfor i in range(1,m+1):\n j = prf(i)\n for k, l in j.items():\n Pr[k] -= l\nA = list(Pr.values())\na = dict() \nfor i in [3,5,15,25,75]:\n a[i] = bisect.bisect_right(A,-i)\nprint(a[3]*a[5]*(a[5]-1)//2+(a[15]-a[5])*(a[5]-1)+(a[3]-1)*a[25]+a[75]) ', "import bisect\nN = int(input())\nS = set([7,5,3])\nfor i in range(8):\n for j in S.copy():\n for k in [7,5,3]:\n S.add(10*j+k)\nT = []\nfor i in S:\n if str(i).count('3') and str(i).count('5') and str(i).count('7'):\n T.append(i)\nT.sort()\nprint(bisect.bisect_right(T,N))"] | ['Wrong Answer', 'Accepted'] | ['s247875827', 's984380808'] | [4284.0, 6920.0] | [2104.0, 71.0] | [525, 291] |
p03212 | u371409687 | 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())\ntmp=2\nans=0\nFlag=True\nwhile Flag:\n tmp+=1\n iterator=product(range(3),repeat=tmp)\n for idxs in iterator:\n num=''.join(map(str,idxs))\n num753=str(num).replace('0', '3').replace('1', '5').replace('2', '7')\n if '7' in num753 and '5' in num753 and '3' in num753:\n if int(num753)<=n:\n ans+=1\n else:\n Flag=False\n break\nprint(ans)", "from itertools import product\nn=int(input())\ntmp=2\nans=0\nFlag=True\nwhile Flag:\n tmp+=1\n iterator=product(range(3),repeat=tmp)\n for idxs in iterator:\n num=''.join(map(str,idxs))\n num753=str(num).replace('0', '3').replace('1', '5').replace('2', '7')\n if '7' in num753 and '5' in num753 and '3' in num753:\n if int(num753)<=n:\n ans+=1\n else:\n Flag=False\n break\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s363149785', 's921241584'] | [9208.0, 9236.0] | [27.0, 89.0] | [434, 464] |
p03212 | u371467115 | 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 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 retunr cnt\n \nprint(dfs('0')", "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'))"] | ['Runtime Error', 'Accepted'] | ['s636387267', 's654271862'] | [2940.0, 2940.0] | [18.0, 93.0] | [173, 174] |
p03212 | u379959788 | 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())\nn = str(N)\nketa = len(n)\n\n\n\ndp = [[[[[0] * 2 for _ in range(2)] for __ in range(2)] for ___ in range(2)] for ____ in range(keta+1)]\ndp[0][0][0][0][0] = 1\n\n\nfor d in range(keta):\n now_digit = int(n[d])\n for i in range(10):\n if i == 3:\n if i < now_digit:\n dp[d+1][1][1][0][0] += dp[d][0][1][0][0] + dp[d][0][0][0][0] + dp[d][1][1][0][0] + dp[d][1][0][0][0]\n dp[d+1][1][1][1][0] += dp[d][0][1][1][0] + dp[d][0][0][1][0] + dp[d][1][1][1][0] + dp[d][1][0][1][0]\n dp[d+1][1][1][0][1] += dp[d][0][1][0][1] + dp[d][0][0][0][1] + dp[d][1][1][0][1] + dp[d][1][0][0][1]\n dp[d+1][1][1][1][1] += dp[d][0][1][1][1] + dp[d][0][0][1][1] + dp[d][1][1][1][1] + dp[d][1][0][1][1]\n elif i == now_digit:\n dp[d+1][1][1][0][0] += dp[d][1][1][0][0] + dp[d][1][0][0][0] \n dp[d+1][1][1][1][0] += dp[d][1][1][1][0] + dp[d][1][0][1][0] \n dp[d+1][1][1][0][1] += dp[d][1][1][0][1] + dp[d][1][0][0][1] \n dp[d+1][1][1][1][1] += dp[d][1][1][1][1] + dp[d][1][0][1][1] \n \n dp[d+1][0][1][0][0] += dp[d][0][1][0][0] + dp[d][0][0][0][0] \n dp[d+1][0][1][1][0] += dp[d][0][1][1][0] + dp[d][0][0][1][0] \n dp[d+1][0][1][0][1] += dp[d][0][1][0][1] + dp[d][0][0][0][1] \n dp[d+1][0][1][1][1] += dp[d][0][1][1][1] + dp[d][0][0][1][1] \n else:\n dp[d+1][1][1][0][0] += dp[d][1][1][0][0] + dp[d][1][0][0][0] \n dp[d+1][1][1][1][0] += dp[d][1][1][1][0] + dp[d][1][0][1][0] \n dp[d+1][1][1][0][1] += dp[d][1][1][0][1] + dp[d][1][0][0][1] \n dp[d+1][1][1][1][1] += dp[d][1][1][1][1] + dp[d][1][0][1][1] \n elif i == 5:\n if i < now_digit:\n dp[d+1][1][0][1][0] += dp[d][0][0][1][0] + dp[d][0][0][0][0] + dp[d][1][0][1][0] + dp[d][1][0][0][0]\n dp[d+1][1][0][1][1] += dp[d][0][0][1][1] + dp[d][0][0][0][1] + dp[d][1][0][1][1] + dp[d][1][0][0][1]\n dp[d+1][1][1][1][0] += dp[d][0][1][1][0] + dp[d][0][1][0][0] + dp[d][1][1][1][0] + dp[d][1][1][0][0]\n dp[d+1][1][1][1][1] += dp[d][0][1][1][1] + dp[d][0][1][0][1] + dp[d][1][1][1][1] + dp[d][1][1][0][1]\n elif i == now_digit:\n dp[d+1][1][0][1][0] += dp[d][1][0][1][0] + dp[d][1][0][0][0]\n dp[d+1][1][0][1][1] += dp[d][1][0][1][1] + dp[d][1][0][0][1]\n dp[d+1][1][1][1][0] += dp[d][1][1][1][0] + dp[d][1][1][0][0]\n dp[d+1][1][1][1][1] += dp[d][1][1][1][1] + dp[d][1][1][0][1]\n\n dp[d+1][0][0][1][0] += dp[d][0][0][1][0] + dp[d][0][0][0][0] \n dp[d+1][0][0][1][1] += dp[d][0][0][1][1] + dp[d][0][0][0][1] \n dp[d+1][0][1][1][0] += dp[d][0][1][1][0] + dp[d][0][1][0][0] \n dp[d+1][0][1][1][1] += dp[d][0][1][1][1] + dp[d][0][1][0][1] \n else:\n dp[d+1][1][0][1][0] += dp[d][1][0][1][0] + dp[d][1][0][0][0] \n dp[d+1][1][0][1][1] += dp[d][1][0][1][1] + dp[d][1][0][0][1] \n dp[d+1][1][1][1][0] += dp[d][1][1][1][0] + dp[d][1][1][0][0] \n dp[d+1][1][1][1][1] += dp[d][1][1][1][1] + dp[d][1][1][0][1] \n elif i == 7:\n if i < now_digit:\n dp[d+1][1][0][0][1] += dp[d][0][0][0][1] + dp[d][0][0][0][0] + dp[d][1][0][0][1] + dp[d][1][0][0][0]\n dp[d+1][1][0][1][1] += dp[d][0][0][1][1] + dp[d][0][0][1][0] + dp[d][1][0][1][1] + dp[d][1][0][1][0]\n dp[d+1][1][1][0][1] += dp[d][0][1][0][1] + dp[d][0][1][0][0] + dp[d][1][1][0][1] + dp[d][1][1][0][0]\n dp[d+1][1][1][1][1] += dp[d][0][1][1][1] + dp[d][0][1][1][0] + dp[d][1][1][1][1] + dp[d][1][1][1][0]\n elif i == now_digit:\n dp[d+1][1][0][0][1] += dp[d][1][0][0][1] + dp[d][1][0][0][0] \n dp[d+1][1][0][1][1] += dp[d][1][0][1][1] + dp[d][1][0][1][0] \n dp[d+1][1][1][0][1] += dp[d][1][1][0][1] + dp[d][1][1][0][0] \n dp[d+1][1][1][1][1] += dp[d][1][1][1][1] + dp[d][1][1][1][0] \n \n dp[d+1][0][0][0][1] += dp[d][0][0][0][1] + dp[d][0][0][0][0] \n dp[d+1][0][0][1][1] += dp[d][0][0][1][1] + dp[d][0][0][1][0] \n dp[d+1][0][1][0][1] += dp[d][0][1][0][1] + dp[d][0][1][0][0] \n dp[d+1][0][1][1][1] += dp[d][0][1][1][1] + dp[d][0][1][1][0] \n else:\n dp[d+1][1][0][0][1] += dp[d][1][0][0][1] + dp[d][1][0][0][0] \n dp[d+1][1][0][1][1] += dp[d][1][0][1][1] + dp[d][1][0][1][0] \n dp[d+1][1][1][0][1] += dp[d][1][1][0][1] + dp[d][1][1][0][0] \n dp[d+1][1][1][1][1] += dp[d][1][1][1][1] + dp[d][1][1][1][0] \n else:\n pass\nprint(dp)\nprint(dp[-1][1][1][1][1] + dp[-1][0][1][1][1])', '# ABC114\n\nN = int(input())\ndef dfs(num, use):\n if num > N:\n return 0\n cnt = 1 if use == 0b111 else 0\n cnt += dfs(num*10 + 3, use | 0b001)\n cnt += dfs(num*10 + 5, use | 0b010)\n cnt += dfs(num*10 + 7, use | 0b100)\n return cnt\nans = dfs(0, 0)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s124036023', 's172365343'] | [4084.0, 3060.0] | [20.0, 39.0] | [5164, 275] |
p03212 | u385244248 | 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. | ['print("")', 'import sys\nimport math\nimport string\nimport fractions\nimport random\nfrom operator import itemgetter\nimport itertools\nfrom collections import deque\nimport copy\nimport heapq\nimport bisect\n\nMOD = 10 ** 9 + 7\nINF = float(\'inf\')\ninput = lambda: sys.stdin.readline().strip()\n\nN = int(input())\n\n\ndef answer(info, ans):\n if max(ans) > N:\n return ans\n info2 = []\n for i in info:\n for l in ["3", "5", "7"]:\n info2.append(int(str(i) + l))\n ans += info2\n return answer(info2, ans)\n\n\na = sorted(list(set(answer([3, 5, 7], [3, 5, 7]))))\nnum = 0\nfor i in range(len(a)):\n if a[i] > N:\n print(num)\n break\n elif all(str(a[i]).count(d) > 0 for d in "753"):\n num += 1\n'] | ['Wrong Answer', 'Accepted'] | ['s151068621', 's528175717'] | [2940.0, 15572.0] | [17.0, 165.0] | [9, 715] |
p03212 | u395816772 | 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()\nans =0\n\n \nif len(n) < 3:\n ans = 0\nelif len(n) == 3:\n con = []\n for i in range(len(n)-2):\n con.append(3)\n con.append(5)\n con.append(7)\n p_list = list(itertools.permutations(con, len(n)))\n\nelse:\n if int('7'*len(n)) <= int(n):\n ans = 3**(len(n))- 3*2**(len(n)) + 3\n elif int('3'*len(n)) > int(n):\n ans = 0\n else:\n con = []\n for i in range(len(n)):\n con.append(0)\n con_num = []\n for i in range(3**len(n)):\n con[-1] +=1\n for j in range(len(n)-1,0,-1):\n if con[j] == 3:\n con[j-1] +=1\n con[j] = 0\n if con[0] == 0:\n b = '3'\n elif con[0] == 1:\n b= '5'\n elif con[0] == 2:\n b = '7'\n for j in range(1,len(n)):\n if con[j] == 0:\n a = '3'\n elif con[j] == 1:\n a = '5'\n elif con[j] == 2:\n a = '7'\n b += a\n c = list(b)\n if c.count('3') != 0 and c.count('5') != 0 and c.count('7') != 0 and len(b) == len(n):\n con_num.append(int(b))\n for i in range(len(con_num)):\n if int(n) >= con_num[i]:\n ans +=1\n for i in range(3,len(n)):\n ans += 3**(i)- 3*2**(i) + 3\n \n\nprint(ans)", "import itertools\n\nn = input()\nans =0\n\n \nif len(n) < 3:\n ans = 0\n\nelse:\n if int('7'*len(n)) <= int(n):\n ans = 3**(len(n))- 3*2**(len(n)) + 3\n elif int('3'*len(n)) > int(n):\n ans = 0\n else:\n con = []\n for i in range(len(n)):\n con.append(0)\n con_num = []\n for i in range(3**len(n)):\n con[-1] +=1\n for j in range(len(n)-1,0,-1):\n if con[j] == 3:\n con[j-1] +=1\n con[j] = 0\n if con[0] == 0:\n b = '3'\n elif con[0] == 1:\n b= '5'\n elif con[0] == 2:\n b = '7'\n for j in range(1,len(n)):\n if con[j] == 0:\n a = '3'\n elif con[j] == 1:\n a = '5'\n elif con[j] == 2:\n a = '7'\n b += a\n c = list(b)\n if c.count('3') != 0 and c.count('5') != 0 and c.count('7') != 0 and len(b) == len(n):\n con_num.append(int(b))\n for i in range(len(con_num)):\n if int(n) >= con_num[i]:\n ans +=1\n for i in range(3,len(n)):\n ans += 3**(i)- 3*2**(i) + 3\n \n\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s521416884', 's108193784'] | [9740.0, 9892.0] | [121.0, 118.0] | [1440, 1258] |
p03212 | u397531548 | 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()\na=0\nif 10**(len(N)-1)*5+1>int(N)>10**(len(N)-1)*3+1:\n for i in range(10**(len(N)-1)*3+1,int(N)+1,2):\n j=str(i)\n if "3"in j and "5"in j and "7"in j:\n if len(j)==j.count("3")+j.count("5")+j.count("7"):\n a+=1\n a+=3**(len(N)-1)-3*2**(len(N)-1)+3\nelif 10**(len(N)-1)*7+1>int(N)>10**(len(N)-1)*5+1:\n for i in range(10**(len(N)-1)*5+1,int(N)+1,2):\n j=str(i)\n if "3"in j and "5"in j and "7"in j:\n if len(j)==j.count("3")+j.count("5")+j.count("7"):\n a+=1\n a+=2*3**(len(N)-1)-5*2**(len(N)-1)+15\nelif 10**(len(N)-1)*7+1<int(N):\n for i in range(10**(len(N)-1)*7+1,int(N)+1,2):\n j=str(i)\n if "3"in j and "5"in j and "7"in j:\n if len(j)==j.count("3")+j.count("5")+j.count("7"):\n a+=1\n a+=3*3**(len(N)-1)-7*2**(len(N)-1)+21\nelif int(N)<10**(len(N)-1)*3+1:\n for i in range(10**(len(N)-1)+1,int(N)+1,2):\n j=str(i)\n if "3"in j and "5"in j and "7"in j:\n if len(j)==j.count("3")+j.count("5")+j.count("7"):\n a+=1\n a+=3**(len(N)-1)-3*2**(len(N)-1)+3\nprint(a)', "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', 'Accepted'] | ['s973465273', 's631395186'] | [3192.0, 3060.0] | [2104.0, 95.0] | [1130, 195] |
p03212 | u398846051 | 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())\nli = ['']\nso = 0\nfor _ in range(9):\n l = len(li)\n for i in range(so, l):\n li.append(li[i] + '3')\n li.append(li[i] + '5')\n li.append(li[i] + '7')\n so = l\ncnt = 0\nfor x in li:\n if int(x) <= N and 3 in x and 5 in x and 7 in x:\n cnt += 1\nprint(cnt)", "N = int(input())\nli = ['']\nso = 0\nfor _ in range(9):\n l = len(li)\n for i in range(so, l):\n li.append(li[i] + '3')\n li.append(li[i] + '5')\n li.append(li[i] + '7')\n so = l\ncnt = 0\nfor x in li:\n if int(x) <= N and '3' in x and '5' in x and '7' in x:\n cnt += 1\nprint(cnt)", "N = int(input())\nli = ['']\nso = 0\nfor _ in range(9):\n l = len(li)\n for i in range(so, l):\n li.append(li[i] + '3')\n li.append(li[i] + '5')\n li.append(li[i] + '7')\n so = l\ncnt = 0\nfor x in li:\n if '3' in x and '5' in x and '7' in x and int(x) <= N:\n cnt += 1\nprint(cnt)"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s045032023', 's986400905', 's600071496'] | [5236.0, 5236.0, 5236.0] | [25.0, 25.0, 37.0] | [277, 283, 283] |
p03212 | u405660020 | 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\nfor i in range(3, 10):\n for s in product('357', repeat=i):\n if len(set(s)) < 3:\n continue\n 753num = int(''.join(s))\n if 753num> n:\n break\n ans += 1\nprint(ans)\n", "from itertools import product\nn=int(input())\n\nans = 0\nfor i in range(3, 10):\n for s in product('357', repeat=i):\n if len(set(s)) < 3:\n continue\n num = int(''.join(s))\n if num > n:\n break\n ans += 1\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s845568680', 's973995894'] | [2940.0, 3060.0] | [17.0, 47.0] | [267, 262] |
p03212 | u411858517 | 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 = int(input())\n\nnumber = [7, 5, 3]\n\nans = 0\nfor i in range(10):\n for conv in itertools.product(number, repeat=i+1):\n \n tmp = 0\n for j in range(len(conv)):\n tmp += conv[j] * 10 ** (len(conv) - j - 1)\n \n \n if ((3 in conv) and (5 in conv) and (7 in conv)) and tmp =< N:\n ans += 1\n \n \nprint(ans)', 'import itertools\n\nN = int(input())\n\nnumber = [7, 5, 3]\n\nans = 0\nfor i in range(10):\n for conv in itertools.product(number, repeat=i+1):\n \n tmp = 0\n for j in range(len(conv)):\n tmp += conv[j] * 10 ** (len(conv) - j - 1)\n \n \n if ((3 in conv) and (5 in conv) and (7 in conv)) and tmp <= N:\n ans += 1\n \n \nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s049210765', 's743465413'] | [2940.0, 3064.0] | [17.0, 522.0] | [400, 400] |
p03212 | u416758623 | 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(cur, a, b, c):\n if cur == n:\n return 0\n ret = 1 if all(s.count(c)) > 0 for c in "753") else 0\n for i in "753":\n ret += dfs(s+c)\n return ret\nprint(dfs("0"))', "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\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', 'Wrong Answer', 'Accepted'] | ['s649441688', 's955414116', 's566050569'] | [2940.0, 4196.0, 2940.0] | [17.0, 164.0, 97.0] | [206, 215, 202] |
p03212 | u432333240 | 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 numpy as np\nN = input(N)\ndigit = len(N)\nans = 0\nif int(N) < 357:\n print(ans)\nelse:\n for i in range(3, len(N)):\n ans += 3**i - 3 * 2**i + 3\n print(ans)\n for v in itertools.product('753', repeat=digit):\n if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):\n ans +=1\n print(ans)", "import itertools\nimport numpy as np\nN = input(N)\ndigit = len(N)\nans = 0\nif int(N) < 357:\n print(ans)\nelse:\n for i in range(3, len(N)):\n ans += 3**i - 3 * 2**i + 3\n for v in itertools.product('753', repeat=digit):\n if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):\n ans +=1\n print(ans)", "import itertools\nimport numpy as np\nN = input()\ndigit = len(N)\nans = 0\nif int(N) < 357:\n print(ans)\nelse:\n for i in range(3, len(N)):\n ans += 3**i - 3 * 2**i + 3\n for v in itertools.product('753', repeat=digit):\n if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):\n ans +=1\n print(ans)\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s432485614', 's907777476', 's241092186'] | [21644.0, 12648.0, 12420.0] | [305.0, 150.0, 186.0] | [349, 334, 334] |
p03212 | u433515605 | 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 copy\nN = int(input())\n\nketa = len(str(N))\n\nl = ['3', '5', '7']\nkotae = set()\nkotae.add('0')\n\nfor i in range(keta):\n print('i={}'.format(i))\n kari = copy.copy(kotae)\n for m in kari:\n print(m)\n for n in l:\n k = m + n\n if int(k) <= N:\n kotae.add(k)\n\ncount = 0\nfor s in kotae:\n count += 1 if all(s.count(c) > 0 for c in '753') else 0\n\nprint(count)", "#%%\nimport copy\nN = int(input())\n\nketa = len(str(N))\n\nl = ['3', '5', '7']\nkotae = set()\nkotae.add('0')\n\nfor i in range(keta):\n kari = copy.copy(kotae)\n for m in kari:\n for n in l:\n k = m + n\n if int(k) <= N:\n kotae.add(k)\n\ncount = 0\nfor s in kotae:\n count += 1 if all(s.count(c) > 0 for c in '753') else 0\n\nprint(count)\n"] | ['Wrong Answer', 'Accepted'] | ['s172338702', 's380017005'] | [8224.0, 8048.0] | [94.0, 85.0] | [482, 442] |
p03212 | u437727817 | 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. | ['limit = input()\n\n\n\ndef dfs(s):\n\tif int(s)>limit:\n\t\treturn 0\n\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\nprint(dfs("0"))\n', 'limit = int(input())\n\n\n\ndef dfs(s):\n\tif int(s)>limit:\n\t\treturn 0\n\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\nprint(dfs("0"))\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s815803057', 's099844096'] | [2940.0, 2940.0] | [17.0, 92.0] | [176, 183] |
p03212 | u449473917 | 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\na=[0]*n\naa=0\nfor i in range(n):\n b=set(list(str(i)))\n if len(b)==3:\n if b.count("7")>0 and b.count("5")>0 and b.count("3")>0:\n aa+=1\n a[i]+=aa\n\n\nprint(a[n-1])', 'from itertools import product\nn = int(input())\ncnt = 0\nfor i in range(3,10):\n for m in product(["3","5","7"],repeat = i):\n if "3" in m and "5" in m and "7" in m and int("".join(m))<=n:\n cnt += 1\nprint(cnt)'] | ['Runtime Error', 'Accepted'] | ['s101041543', 's446261123'] | [295028.0, 3060.0] | [2111.0, 42.0] | [201, 226] |
p03212 | u449863068 | 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())\nans = 0\nfor i in range(1, 10):\n for x in itertools.product("753", repeat=i):\n s= \'\'.join(x)\n if int(s) > N: continue\n if \'3\' not in s: continue\n if \'5\' not in s: continue\n if \'7\' not in s: continue\n print(s)\n ans += 1\nprint(ans)', 'import itertools\nN = int(input())\nans = 0\nfor i in range(1, 10):\n for x in itertools.product("753", repeat=i):\n s= \'\'.join(x)\n if int(s) > N: continue\n if \'3\' not in s: continue\n if \'5\' not in s: continue\n if \'7\' not in s: continue\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s420078139', 's554907688'] | [3520.0, 3064.0] | [58.0, 41.0] | [284, 271] |
p03212 | u450983668 | 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, res):\n if int(s) > N:\n return\n res = +all((t in s)for t in '753')\n for i in '753':\n res += dfs(s+i, res)\n return res\n\nprint(dfs('0', 0))", "N = int(input())\n\ndef dfs(s, res):\n if int(s) > N:\n return 0\n res = +all((t in s)for t in '753')\n for i in '753':\n res += dfs(s+i, res)\n return res\n\nprint(dfs('0', 0))"] | ['Runtime Error', 'Accepted'] | ['s353705147', 's020291625'] | [3060.0, 3060.0] | [18.0, 80.0] | [175, 177] |
p03212 | u455642216 | 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. | ["= int(input())\ndef f(x):\n if int(x) >N:\n return 0\n if x.count('3')>0 and x.count('5')>0 and x.count('7')>0:\n z = 1\n z=0\n z +=f(x+'3')\n z +=f(x+'5')\n z +=f(x+'7')\n return z\nprint(f('0'))", "N= int(input())\ndef f(x):\n if int(x) >N:\n return 0\n if x.count('3')>0 and x.count('5')>0 and x.count('7')>0:\n z = 1\n z=0\n z +=f(x+'3')\n z +=f(x+'5')\n z +=f(x+'7')\n return z\nprint(f('0'))\n", "N= int(input())\ndef f(x):\n z=0\n if int(x) >N:\n return 0\n if x.count('3')>0 and x.count('5')>0 and x.count('7')>0:\n z = 1\n z +=f(x+'3')\n z +=f(x+'5')\n z +=f(x+'7')\n return z\nprint(f('0'))\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s352251304', 's372633052', 's222714571'] | [2940.0, 3060.0, 3060.0] | [17.0, 68.0, 67.0] | [220, 222, 222] |
p03212 | u463655976 | 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()\nNlen = len(N)\nN = int(N)\n\ndef f(i, n, T, F, S):\n if i >= Nlen:\n return 1 if n <= N and T > 0 and F > 0 and S > 0 else 0\n n *= 10\n cnt = 0\n if n == 0:\n cnt += f(i+1, n, T , F , S )\n cnt += f(i+1, n+3, T+1, F , S )\n cnt += f(i+1, n+5, T , F+1, S )\n cnt += f(i+1, n+7, T , F , S+1)\n\nprint(f(0, 0, 0, 0, 0))\n', 'N = input()\nNlen = len(N)\nN = int(N)\n\ndef f(i, n, T, F, S):\n if i >= Nlen:\n return 1 if n <= N and T > 0 and F > 0 and S > 0 else 0\n n *= 10\n cnt = 0\n if n == 0:\n cnt += f(i+1, n, T , F , S )\n cnt += f(i+1, n+3, T+1, F , S )\n cnt += f(i+1, n+5, T , F+1, S )\n cnt += f(i+1, n+7, T , F , S+1)\n return cnt\n\nprint(f(0, 0, 0, 0, 0))'] | ['Runtime Error', 'Accepted'] | ['s239236040', 's938435892'] | [3064.0, 3064.0] | [18.0, 33.0] | [338, 350] |
p03212 | u466143662 | 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())\n\nketa=len(str(n))\nhako=[]\nfor i in range(3,keta+1):\n for c in list(itertools.product(["7","5","3"],repeat=i)):\n if len(set(c))==3:\n a=int("".join(c))\n hako.append(a)\nif n in hako:\n hako.sort()\n k=hako.index(n)\n b=hako[:k]\n print(len(b)) \nelse:\n hako.append(n)\n hako.sort()\n k=hako.index(n)\n b=hako[:k]\n print(int(len(b))+1)', 'import itertools\nn=int(input())\n\nketa=len(str(n))\nhako=[]\nfor i in range(3,keta+1):\n for c in list(itertools.product(["7","5","3"],repeat=i)):\n if len(set(c))==3:\n a=int("".join(c))\n hako.append(a)\nif n in hako:\n hako.sort()\n k=hako.index(n)\n b=hako[:k]\n print(len(b)+1) \nelse:\n hako.append(n)\n hako.sort()\n k=hako.index(n)\n b=hako[:k]\n print(int(len(b)))'] | ['Wrong Answer', 'Accepted'] | ['s824373695', 's161842660'] | [7284.0, 7284.0] | [53.0, 52.0] | [414, 414] |
p03212 | u489762173 | 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 collections import defaultdict\np_y = defaultdict(set)\n\nN,M = map(int,input().split())\nPY = [[int(x) for x in input().split()] for _ in range(M)]\nfor p,y in PY:\n p_y[p].add(y)\n\ndef set_rank(retu):\n return {x:i for i,x in enumerate(sorted(retu), 1)}\n\np_y = {p:set_rank(retu) for p,retu in p_y.items()}\nfor p,y in PY:\n print('{:06g}{:06g}'.format(p,p_y[p][y]))", "import sys\nsys.setrecursionlimit(10**9)\n\ndef stgsn(N, maked_num, now_num):\n if now_num != '':\n if int(now_num) > N:\n return\n\n maked_num.append(now_num)\n\n stgsn(N, maked_num, now_num + '7')\n\n stgsn(N, maked_num, now_num + '5')\n\n stgsn(N, maked_num, now_num + '3')\n\n return maked_num\n\n\ndef main():\n N = int(input())\n\n\n maked_num = []\n now_num = ''\n\n maked_num = stgsn(N, maked_num, now_num)\n\n ans = [s for s in maked_num if '3' in s and '5' in s and '7' in s]\n print(len(ans))\n\n\nmain()"] | ['Runtime Error', 'Accepted'] | ['s551562863', 's248458497'] | [3316.0, 5388.0] | [27.0, 54.0] | [383, 541] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.