Problem:


Score : 300 points

Problem Statement

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.

Constraints

1 \leq N < 10^9

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of the Shichi-Go-San numbers between 1 and N (inclusive).

Sample Input 1

575

Sample Output 1

4

There are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.

Sample Input 2

3600

Sample Output 2

13

There are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.

Sample Input 3

999999999

Sample Output 3

26484



Sample input:
575


Sample output:
4

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0

for i in range(N+1):
 
    thr = str(i).count("3")
    fiv = str(i).count("5")
    sev = str(i).count("7")


    if thr > 0 and fiv > 0 and sev > 0 and len(str(i)) == thr + fiv + sev:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = input()
listed_N = list(N)
counter=0
for i in range(int(N)+1):
    listed_i = list(str(i))
    #for igai in ["0","1","2","4","6","8","9"]:

    if "3" in listed_i and "5" in listed_i and "7" in listed_i:
        if "0"not in listed_i and "1" not in listed_i and "2" not in listed_i and "4" not in listed_i and "6" not in listed_i and "8" not in listed_i and "9" not in listed_i:
            #print(i)
            counter += 1
#if "3" in listed_i and "5" in listed_i and "7" in listed_i:
    
print(counter)

Submission status: Time Limit Exceeded

Solution code:
count=0
n = int(input())
i=1
while i<=n:
  str_i = str(i)
  f7=f5=f3=False
  for j in range(0, len(str_i)):
    if "7" == str_i[j]:
      f7=True
    elif "5" == str_i[j]:
      f5=True
    elif "3" == str_i[j]:
      f3=True
    else:
      break

    if j == len(str_i)-1 and f7 and f5 and f3:
      #print( i )
      count = count+1

  if 3 == i%10:
    i = i+2
  elif 5 == i%10:
    i = i+2
  elif 7 == i%10:
    i = i+6
  else:
    i = i+1

print( count )

Submission status: Time Limit Exceeded

Solution code:
maxN=int(input())
count=0
for a in range(1, int(maxN/2+0.5)):
	tempN=a*2+1
	three=five=seven=False
	for b in range(0,len(str(tempN))):
		tempD=int(str(tempN)[b])
		if tempD==3:
			three=True
		elif tempD==5:
			five=True
		elif tempD==7:
			seven=True
		else:
			three=five=seven=False
			break
	if three and five and seven:
		count=count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = input()
n_int = int(n)
count = 0
i = 0

while 1:
    i = i + 1
    s = set([])
    for j in str(i):
        s.add(int(j))
    if i > n_int:
        break
    elif s == set([3, 5, 7]):
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = input()
n_int = int(n)
count = 0

for i in range(1,n_int+1):
    s = set([])
    for j in str(i):
        s.add(int(j))
    if s == set([3, 5, 7]):
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = input()
n_int = int(n)
count = 0

for i in range(1,n_int+1):
    s = []
    for j in str(i):
        s.append(int(j))
    if set(s) == set([3, 5, 7]):
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
max = int(input())
count=0

for n in range(1, max+1):
	f7=f5=f3=False
	str_n = str(n)
	for i in range(0, len(str_n)):
		if 7 == int(str_n[i]):
			f7=True
		elif 5 == int(str_n[i]):
			f5=True
		elif 3 == int(str_n[i]):
			f3=True
		else:
			break
		
		if i == len(str_n)-1:
			if f7 and f5 and f3:
				count=count+1

print(count)

Submission status: Time Limit Exceeded

Solution code:
max = int(input())
count=0

for n in range(1, max+1):
	f7=False
	f5=False
	f3=False
	str_n = str(n)
	for i in range(0, len(str_n)):
		if "7" == str_n[i]:
			f7=True
		elif "5" == str_n[i]:
			f5=True
		elif "3" == str_n[i]:
			f3=True
		else:
			break
		
		if i == len(str_n)-1:
			if f7 and f5 and f3:
				count=count+1

print(count)

Submission status: Time Limit Exceeded

Solution code:
max = int(input())
count=0

for n in range(1, max+1):
	f7=False
	f5=False
	f3=False
	for i in range(0, len(str(n))):
		if "7" == str(n)[i]:
			f7=True
		elif "5" == str(n)[i]:
			f5=True
		elif "3" == str(n)[i]:
			f3=True
		else:
			break
		
		if i == len(str(n))-1:
			if f7 and f5 and f3:
				count=count+1

print(count)

Submission status: Time Limit Exceeded

Solution code:
max = int(input())
count=0

for n in range(1, max+1):
	f7=False
	f5=False
	f3=False
	for i in range(0, len(str(n))):
		if "7" != str(n)[i] and "5" != str(n)[i] and "3" != str(n)[i]:
			break
		if "7" == str(n)[i]:
			f7=True
		if "5" == str(n)[i]:
			f5=True
		if "3" == str(n)[i]:
			f3=True
		
		if i == len(str(n))-1:
			if f7 and f5 and f3:
				count=count+1

print(count)

Submission status: Time Limit Exceeded

Solution code:
def main():
    """
    1 <= N  <= 10^9

    七五三数とは以下の条件を満たす正の整数
    十進法で表記したとき、
    数字 7, 5, 3 がそれぞれ 1回以上現れ、これら以外の数字は現れない
    """
    N = int(input())

    ans = f(N)
    print(ans)


def f(N):
    """
    Nの桁数がdのとき、d-1桁の数で753数であれば満たす
    上記d-1桁の753数に対して、
    753のそれぞれの数について
    桁追加をして、それがN以下であれば良い

    もっと簡単に考える
    d桁のとき並べる数字は3種類とその桁を使わないときに0埋めすると考えられる
    よって、並べ方の最大は (3+1)^9 = 262,144
        実際は実装上 349,525
    """
    d = len(str(N))
    ans = run_perm(N, d, [0, 3, 5, 7])
    # ans = TLE(N)

    return ans


def run_perm(N, d, types):
    """
    全列挙: TLE, 文字列処理がダメ

    http://www.geisya.or.jp/~mwm48961/kou3/onajimono1.htm
    による並べ方をやろうとしたけど断念
    """
    from collections import Counter
    a = [0] * d
    # nth = 0

    def perm(N, i, d, ans):
        # nonlocal nth
        # nth += 1

        if i == d:
            s = "".join(str(x) for x in a).lstrip("0")
            c = Counter(s)
            if c["0"] == 0 and \
                c["7"] >= 1 and \
                c["5"] >= 1 and \
                c["3"] >= 1 and \
                    int(s) <= N:

                ans += 1

            return ans

        for t in types:
            a[i] = t
            ans = perm(N, i+1, d, ans)

        return ans

    ans = perm(N, 0, d, 0)
    # print(nth)

    return ans


def TLE(N):
    ans = 0
    for i in range(357, N + 1):
        s = str(i)
        c7, c5, c3 = s.count("7"), s.count("5"), s.count("3")
        if len(s) == c7 + c5 + c3 and \
                c7 >= 1 and c5 >= 1 and c3 >= 1:
            ans += 1

    return ans


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lis = [sorted(set((str(i)))) for i in range(357, N+1)]
print(lis.count(['3', '5', '7']))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count=0
if N>777777777:
  N = 7777777777
for i in range(333,N+1):
  X = str(i)
  a3 = X.count("3")
  a5 = X.count("5")
  a7 = X.count("7")
  if(a3>0 and a5>0 and a7>0 and a3+a5+a7==len(X)):
    count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N=input()
a=0
for i in range(1,int(N)+1,2):
    j=str(i)
    if "3"in j and "5"in j and "7"in j:
        if len(j)==j.count("3")+j.count("5")+j.count("7"):
            a+=1
print(a)

Submission status: Time Limit Exceeded

Solution code:
a=int(input())

count=0
c=[]
for i in range(1,a+1):
	if str(3) in str(i) and str(5) in str(i) and str(7) in str(i):
		i=str(i).replace("0","")
		i=str(i).replace("1","")
		i=str(i).replace("2","")
		i=str(i).replace("4","")
		i=str(i).replace("6","")
		i=str(i).replace("8","")
		i=str(i).replace("9","")
		if i not in c:
			c.append(i)
			count=count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
i=input("")
i=int(i)
q=0
k=0
j=[]
for k in range(0,i+1) :
    j.clear()
    while k>0 :
        j.append(k%10)
        k //= 10


    if 0 not in j and 1  not in j and 2  not in j and 4  not in j  and 6  not in j and 8  not in j and 9  not in j not in j:
        if 3 in j and 5 in j and 7 in j :
            q=q+1


print(q)

Submission status: Time Limit Exceeded

Solution code:
import collections
import sys
input = sys.stdin.readline
N = int(input())
n = N + 1
ans = 0
for i in range(357,n):
    if "5" in list(str(i)) and "7" in list(str(i)) and "3" in list(str(i)):
        c = collections.Counter(list(str(i)))
        if int(c['3'] + c['5'] + c['7']) == int(len(list(str(i)))):
            ans = ans + 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())

# ここで、七五三数とは以下の条件を満たす正の整数です。
# 十進法で表記したとき、数字 7, 5, 3 がそれぞれ 1 回以上現れ、これら以外の数字は現れない。

ans = 0
for i in range(1, N + 1):
    i = str(i)
    if ("3" in i) and ("5" in i) and ("7"in i):
        if ("1" not in i) and ("2" not in i) and ("4" not in i) and ("6" not in i) and ("8" not in i) and ("9" not in i) and ("0" not in i):
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
for i in range(N+1):
    nums = list(str(i))
    cnt_3 = 0
    cnt_5 = 0
    cnt_7 = 0
    can_answer = True
    for j in range(len(nums)):
        if nums[j] == '3':
            cnt_3 += 1
        elif nums[j] == '5':
            cnt_5 += 1
        elif nums[j] == '7':
            cnt_7 += 1
        else:
            can_answer = False

    if can_answer and cnt_3 > 0 and cnt_5 > 0 and cnt_7 > 0:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
N=int(stdin.readline().rstrip())
cnt=0
for i in range(N+1):
    if set(list(str(i)))=={"3","5","7"}:
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys

N = int(input())
ans = set(["3","5","7"])
cnt = 0

if N > 777777753:
    print("26484")
    sys.exit()

for i in range(357,N+1,2):
    list = [i for i in str(i)]
    s = set(list)
    if s == ans:
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = input()
length = len(N)
jogai = 0
ans = 0

def check(number):
    three = 0
    five = 0
    seven = 0
    for i in range(len(str(number))):
        if str(number)[i:i+1] == '3':
            three += 1
        elif str(number)[i:i+1] == '5':
            five += 1
        elif str(number)[i:i+1] == '7':
            seven += 1
        else:
            return False
    if three >= 1 and five >= 1 and seven >= 1:
        return True
    else:
        return False

if int(N) <= int('7'*length):
    if int(N)%2 == 0:
        for l in range(int(int(N)/2), int(int('7'*length)/2)):
            if check(2*l+1):
                jogai += 1
    elif int(N)%2 == 1:
        for l in range(int((int(N)+1)/2),int(int('7'*length)/2)):
            if check(2*l+1):
                jogai +=1

    

for i in range(1,length+1):
    ans += 3**i-3*2**i+3

print(ans-jogai)

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations, product

def t2v(t):
  ten = len(t) - 1
  res = 0
  for i in t:
    res += int(i) * (10 ** ten)
    ten -= 1
  return res

def plus753(t):
  return t + ('7', '5', '3')

def fold(t):
  res = ''
  for c in t:
    res += c
  return res

def generate(k):
  free = k - 3
  l = list(map(fold, map(plus753, product('753', repeat=free))))
  res = []
  for t in l:
    res += set(map(int, (map(''.join, permutations(t, k)))))
  return list(set(res))



n = int(input())

cnt = 0
f = False
for keta in range(3, 9):
  pp = generate(keta)
  pp.sort()
  for p in pp:
    if p > n:
      f = True
      break
    cnt += 1
  
  if f:
    break

print(cnt)
#print(t2v(('7', '5', '3')))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for i in range(1, N+1):
  x = str(i)
  if '1' not in x and '2' not in x and '4' not in x and '6' not in x and '8' not in x and '9' not in x and '0' not in x and '3' in x and '5' in x and '7' in x:
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
N = int(input())

ans = 0
if N <= 356:
    print(ans)
    exit()

if N >= 777777754:
    N = 777777753

for i in range(357,N+1,2):
    st = str(i)
    if ("0" in st) or ("1" in st) or ("2" in st) or ("4" in st) or ("6" in st) or ("8" in st) or ("9" in st):
        continue
    if ("3" in st) and ("5" in st) and ("7" in st):
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import math
a = int(input())
c = str(a)
b = 0

keta = int (math.log10(a) + 1)
list = []
if a >= 357:
    count = 0
    for i in range(3, keta):
        c = 1
        b = 3
        for j in range(0, i):
            c *= 3
            b *= 2
        list.append(c - b +3)
    start = pow(10, keta - 1) * 3
 
    for i in range(start, a + 1):
        flg3 = 0
        flg5 = 0
        flg7 = 0
        for j in range(0, keta):
            if (str(i)[j] == "3"):
                flg3 = 1
            elif (str(i)[j] == "5"):
                flg5 = 1
            elif (str(i)[j] == "7"):
                flg7 = 1
            else:
                break
            if (j == keta - 1 and flg3 == 1 and flg5 == 1 and flg7 == 1):
                count += 1
    b = count + sum(list)
print(b)

Submission status: Time Limit Exceeded

Solution code:
import itertools

number_str = '999999999'
number_int = int(number_str)

count = 0


length = len(number_str)



def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def calc_pre(leng_pre):
    global count
    count += pow(3, leng_pre) + 3 -  3 * pow(2, leng_pre)

def calc_all(length):
    global count
    l = ['3', '5', '7']
    pre_data = set()
    for v in itertools.combinations_with_replacement(l, length):
        # print(v)
        if'3' in v and '5' in v and '7' in v:
            for vv in itertools.permutations(list(v), length):
                aaa = int(''.join(list(vv)))
                if aaa < number_int:
                    if aaa not in pre_data:
                        # print(aaa)
                        count += 1
                        pre_data.add(aaa)
                else:
                    break

if length > 3:
    for i in range(3, length):
        calc_pre(i)

calc_all(length)

print(count)

# print(pow(2, 3))

Submission status: Time Limit Exceeded

Solution code:
a = input()
count = 0
for i in range(int(a)+1):
  b = str(i)
  if "1" in b or "2" in b or "4" in b or "6" in b or "8" in b or "9" in b or "0" in b:
     aaa = None
  else:
    if "3" in b and "5" in b and "7" in b:
      count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
i = 1
count = 0
if N <= 777777777:
    while i <= N:
        I = str(i)
        I = list(I)
        if I.count("3")>0 and I.count("5")>0 and I.count("7")>0:
            if I.count("0")+I.count("1")+I.count("2")+I.count("4")+I.count("6")+I.count("8")+I.count("9")==0:
                count+=1
                i+=2
            else:
                i+=2
        else:
            i+=2
    print(count)
else:
    print(26484)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = 0
for i in range(n+1):
    if (str(i).count('7') + str(i).count('5') + str(i).count('3')) == len(str(i)) and '7' in str(i) and '5' in str(i) and '3' in str(i):
        a = a + 1
print(a)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = 0
for i in range(n+1):
    if (str(i).count('7') + str(i).count('5') + str(i).count('3')) == len(str(i)):
        if '7' in str(i) and '5' in str(i) and '3' in str(i):
            a = a+1
print(a)

Submission status: Time Limit Exceeded

Solution code:
N = input()
counter = 0

for i in range(1, int(N)+1):
  if 357<= i and i <= 777777753:
    a = str(i)
    if '7' in a and a != '':
      a = a.replace('7', '')
      if '3' in a and a != '':
        a = a.replace('3', '')
        if a != '':
          a = a.replace('5', '')
          if a == '':
            counter += 1
print(counter)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = 0
for i in range(n+1):
    if (str(i).count('7') + str(i).count('5') + str(i).count('3')) == len(str(i)):
        if '7' in str(i):
            if '5' in str(i):
                if '3' in str(i):
                    a = a+1
print(a)

Submission status: Time Limit Exceeded

Solution code:
N = input()
length = len(N)
jogai = 0
ans = 0

def check(number):
    three = 0
    five = 0
    seven = 0
    for i in range(len(str(number))):
        if str(number)[i:i+1] == '3':
            three += 1
        elif str(number)[i:i+1] == '5':
            five += 1
        elif str(number)[i:i+1] == '7':
            seven += 1
        else:
            return False
    if three >= 1 and five >= 1 and seven >= 1:
        return True
    else:
        return False

if int(N) <= int('7'*length):
    for l in range(int(N)+1, int('7'*length)+1):
        if check(l):
            jogai += 1

for i in range(length+1):
    ans += 3**i-3*2**i+3

print(ans-jogai-1)

Submission status: Time Limit Exceeded

Solution code:
N = input()
counter = 0

for i in range(1, int(N)+1):
  a = str(i)
  if '7' in a and a != '':
    a = a.replace('7', '')
    if '3' in a and a != '':
      a = a.replace('3', '')
      if a != '':
        a = a.replace('5', '')
        if a == '':
          counter += 1
print(counter)

Submission status: Time Limit Exceeded

Solution code:
s = int(input())
n = list(str(s))
l = len(n)
c = 0
for i in range(300,s+1):
    L = list(str(i))
    for j in range(len(L)):
        L[j] = int(L[j])
    if all([3 in L,5 in L,7 in L]) and not(any([0 in L,1 in L,2 in L,4 in L,6 in L,8 in L,9 in L])):
        c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
array = []
for i in range(n+1):
    if (str(i).count('7') + str(i).count('5') + str(i).count('3')) == len(str(i)):
        if '7' in str(i):
            if '5' in str(i):
                if '3' in str(i):
                    array.append(i)
print(len(array))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
array = []
for i in range(n+1):
    if '7' in str(i):
        if '5' in str(i):
            if '3' in str(i):
                if (str(i).count('7') + str(i).count('5') + str(i).count('3')) == len(str(i)):
                    array.append(i)
print(len(array))

Submission status: Time Limit Exceeded

Solution code:
N=int(raw_input())

sum = 0
#flag = 0
sample = set(['7', '5', '3'])

for i in range(3,N+1,10):
#    flag = 0
#    print str(i)

    nums = set(list(str(i)))

    if sample.issubset(nums) and len(nums.difference(sample)) == 0:
#        print i
        sum += 1
for i in range(5,N+1,10):
#    flag = 0
#    print str(i)

    nums = set(list(str(i)))

    if sample.issubset(nums) and len(nums.difference(sample)) == 0:
#        print i
        sum += 1
for i in range(7,N+1,10):
#    flag = 0
#    print str(i)

    nums = set(list(str(i)))

    if sample.issubset(nums) and len(nums.difference(sample)) == 0:
#        print i
        sum += 1


print sum

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
for i in range(357,n+1):
    a = str(i)
    if (a[0] == '3' or a[0] == '5' or a[0] == '7') and ('3' in a and '5' in a and '7' in a):
        sa = set(a)
        if len(sa) == 3 and '3' in sa and '5' in sa and '7' in sa:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
cnt = 0
n = 357
l = int(input())+1
while n<l:
    #print(n)
    s = str(n)

    ok = False
    for i in "0124689":
        if i in s:
            ok = True
            break

    if ok:
        #print(s)
        if s[0] == '1':
            n += 2*(10**(len(s)-1))
        elif s[0] == '4' or s[0] == '6':
            n += 10**(len(s)-1)
        else:
            n+=2
        continue
        
    if '3' in s and '5' in s and '7' in s:
        #print(s)
        cnt += 1
        
    n+=2
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
i = 1
count = 0
if N <= 777777777:
    while i <= N:
        I = str(i)
        I = list(I)
        if I.count("3")>0 and I.count("5")>0 and I.count("7"):
            if I.count("0")==0 and I.count("1")==0 and I.count("2")==0 and I.count("4")==0 and I.count("6")==0 and I.count("8")==0 and I.count("9")==0:
                count+=1
                i+=1
            else:
                i+=1
        else:
            i+=1
    print(count)
else:
    print(26484)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=0
scount=False
fcount=False
tcount=False
flag=True
for i in range(357,N+1,2):
    S=str(i)
    Slen=len(S)
    for f in range(Slen):
        if (S[f]=="7"):
            scount=True
        elif(S[f]=="5"):
            fcount=True
        elif(S[f]=="3"):
            tcount=True
        else:
            flag=False
            break


    if flag and scount and fcount and tcount:
        ans=ans+1
    scount=False
    fcount=False
    tcount=False
    flag=True

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
array = []
for i in range(n+1):
    if str(i).count("3") > 0:
        if str(i).count("5") > 0:
            if str(i).count("7") > 0:
                if (str(i).count("3") + str(i).count("5") + str(i).count("7")) == len(str(i)):
                    array.append(i)
print(len(array))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
for i in range(N + 1):
    if "5" in list(str(i)) and "7" in list(str(i)) and "3" in list(str(i)):
        a = list(str(i)).count("3")
        b = list(str(i)).count("5")
        c = list(str(i)).count("7")
        if int(a+b+c) == int(len(list(str(i)))):
            ans = ans + 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
i = 1
count = 0
while i <= N:
    I = str(i)
    I = list(I)
    if I.count("3")>0 and I.count("5")>0 and I.count("7"):
        if I.count("0")==0 and I.count("1")==0 and I.count("2")==0 and I.count("4")==0 and I.count("6")==0 and I.count("8")==0 and I.count("9")==0:
            count+=1
            i+=1
        else:
            i+=1
    else:
        i+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
from collections import deque
ini = [357,375,537,573,753,735]
cnt_set = set()
ini = deque(list(map(str, ini)))

cnt = 0
while ini:
    i = int(ini.popleft())
    if i > N or i >int(1e9):
        continue
    else:
        if i not in cnt_set:
            cnt += 1
            cnt_set.add(i)
    i = str(i)
    for r in list("357"):
        for j in range(len(i)):
            ini.append(i[:j]+r+i[j:])
        
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list_753 = []
for i in range(1, n+1):
    i = str(i)
    a3 = 0
    a5 = 0
    a7 = 0
    aelse = 0
    for s in i:
        if s == '3':
            a3 += 1
        elif s == '5':
            a5 += 1
        elif s == '7':
            a7 += 1
        else:
            aelse += 1
    if a3>0 and a5>0 and a7>0 and aelse == 0:
        list_753.append(i)
print(len(list_753))

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
n=input()
count=0
for i in range(357,int(n)+1,2):
    c=Counter(str(i))
    if len(c.keys())==3:
        if c['3'] and c['5'] and c['7']:
            count +=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
from math import factorial
def ncm(n,m):
    return factorial(n)//factorial(m)//factorial(n-m)
from itertools import permutations
ans=0
n=int(input())
for num3 in range(1,11):
    for num5 in range(1,11):
        for num7 in range(1,11):
            if int("3"*num3+"5"*num5+"7"*num7)>n:
                continue
            elif int("7"*num7+"5"*num5+"3"*num3)<n:
                ans+=ncm(num7+num5+num3,num7)*ncm(num5+num3,num5)
            else:
                tmp=set()
                for i in permutations(list("7"*num7+"5"*num5+"3"*num3)):
                    tmp.add(int("".join(i)))
                for i in tmp:
                    if i<=n:
                        ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = "0357"
ans = []
for a in s:
    for b in s:
        for c in s:
            for d in s:
                for e in s:
                    for f in s:
                        for g in s:
                            for h in s:
                                for i in s:
                                    for j in s:
                                        for k in s:
                                            o = int(a+b+c+d+e+f+g+h+i+j+k)
                                            if set(str(o)) == {"3","5","7"}:
                                                if o > n:
                                                    break
                                                else:
                                                    ans.append(o)
print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
X = 0
for i in range(356, N+1):
	A = str(i)
	if A.count('3') > 0 and A.count('5') > 0 and A.count('7') > 0 and A.count('1')== 0 and A.count('2')== 0 and A.count('4')== 0 and A.count('6')== 0 and A.count('8')== 0 and A.count('9')== 0 and A.count('0')== 0:
		X = X+1
print(X)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def is_753(x):
    number = [ele for ele in str(x)]
    seven = False
    five = False
    three = False

    while '7' in number:
        seven = True
        number.remove('7')
    if not seven:
        return False

    while '5' in number:
        five = True
        number.remove('5')
    if not five:
        return False

    while '3' in number:
        three = True
        number.remove('3')
    if not three:
        return False

    if number:
        return False
    else:
        return True

count = 0

for i in range(100, n+1):
    if is_753(i):
        count+=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# 755

N = int(input().strip())

def is753_(n):
  targets = ['7','5','3']
  has7 = False
  has5 = False
  has3 = False
  """
  十進法で表記したとき、数字 7, 5, 3 がそれぞれ 1 回以上現れ、これら以外の数字は現れない。
  """
  nums = str(n)
  for i in nums:
    if i not in targets:
      return False
    elif not has7 or not has5 or not has3:
      if i == '7':
        has7 = True
      elif i == '5':
        has5 = True
      elif i == '3':
        has3 = True
  return has7 and has5 and has3

def is753(n):
  targets = [7,5,3]
  has7 = False
  has5 = False
  has3 = False
  """
  十進法で表記したとき、数字 7, 5, 3 がそれぞれ 1 回以上現れ、これら以外の数字は現れない。
  """
  while True:
    i = n%10
    if i in targets:
      return False
    elif not has7 or not has5 or not has3:
      if i == 7:
        has7 = True
      elif i == 5:
        has5 = True
      elif i == 3:
        has3 = True
    if n < 10:
      #break
      return has7 and has5 and has3
    n = int(n/10)
  return has7 and has5 and has3

#nums = range(1, N+1)
nums = range(357, N+1)
#"""
ans = list(filter(is753_, nums))
print(len(ans))
"""
n = 0
for i in nums:
  if is753(i):
    n += 1
print(n)
"""

Submission status: Time Limit Exceeded

Solution code:
n=str(input())
ans = 0
for i in range(int(n)+1):
    if not str(i).replace("3","").replace("5","").replace("7",""):
        if (str(i).count("3") != 0) and (str(i).count("5") != 0) and (str(i).count("7") != 0):
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = set(["3","5","7"])
cnt = 0

for i in range(N+1):
    list = [i for i in str(i)]
    s = set(list)
    sorted(s)
    if s == ans:
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=0
for i in range(357,N+1,2):
    S=str(i)
    if ("7" in S)and("5" in S)and("3" in S):
        S=S.replace("7","")
        S=S.replace("5","")
        S=S.replace("3","")
        if len(S)==0:
            ans=ans+1


print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
cnt = 0
for i in range(357, N+1):
    c = 0
    T = str(i)
    if T.find('3') == -1:
        continue
    else:
        c += T.count('3')
    if T.find('5') == -1:
        continue
    else:
        c += T.count('5')
    if T.find('7') == -1:
        continue
    else:
        c += T.count('7')
    if c == len(T):
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0

for i in range(n + 1):
    if "3" in str(i) and \
            "5" in str(i) and \
            "7" in str(i) and \
            "1" not in str(i) and \
            "2" not in str(i) and \
            "4" not in str(i) and \
            "6" not in str(i) and \
            "8" not in str(i) and \
            "9" not in str(i) and \
            "0" not in str(i):
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def is_753(x):
    number = [ele for ele in str(x)]
    if '7' in number and '5' in number and '3' in number:
        while '7' in number:
            number.remove('7')
        while '5' in number:
            number.remove('5')
        while '3' in number:
            number.remove('3')
    else:
        return False

    if number:
        return False
    else:
        return True

count = 0

for i in range(100, n+1):
    if is_753(i):
        count+=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
cnt = 0
for i in range(1, N + 1):
    a = list(str(i))
    if "1" in a or "2" in a or "4" in a or "6" in a or "8" in a or "9" in a or "0" in a:
        continue
    if a.count("3") >= 1 and a.count("5") >= 1and a.count("7") >= 1:
        cnt += 1
    
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
m = 0
l = [0]*11

for i in range(357,n+1) :
   s = str(i)

   for j in range(1,11) :
      l[j] = s.count(str(j))

   if l[3]*l[5]*l[7] > 0 and l[3]+l[5]+l[7]==len(s) :
      m += 1

print(m)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=0
for i in range(357,N+1,2):
    S=str(i)
    if ("7" in S)and("5" in S)and("3" in S)and ("1" not in S)and ("2" not in S)and ("4" not in S)and ("6" not in S)and ("8" not in S)and ("9" not in S)and ("0" not in S):
        ans=ans+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=0
for i in range(357,N+1,2):
    S=str(i)
    if ("7" in S)and("5" in S)and("3" in S)and ("1" not in S)and ("2" not in S)and ("4" not in S)and ("6" not in S)and ("8" not in S)and ("9" not in S)and ("0" not in S):

                ans=ans+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0

for i in range(n):
    number = i+1
    three = 0
    five = 0
    seven = 0
    other = 0
    for j in range(len(str(number))):
        w = int(str(number)[j])
        if w == 3:
            three += 1
        elif w == 5:
            five += 1
        elif w == 7:
            seven += 1
        else:
            other += 1
            break
    if three > 0 and five > 0 and seven > 0 and other == 0:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())

def check(i):
	s = str(i)
	f3 = False
	f5 = False
	f7 = False
	for c in s:
		if c is '3':
			f3 = True
		elif c is '5':
			f5 = True
		elif c is '7':
			f7 = True
		else:
			return False
	return f3 & f5 & f7

t = 0
for i in range(1,N+1):
	if check(i):
		t+=1
print(t)