Buggy python submission (verdict: Time Limit Exceeded):
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)


Fixed submission:
n = int(input())
def dfs(s):
        if int(s) > n:
                return 0
        ret = 0
        if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
            ret = 1
        for c in '753':
                ret += dfs(s + c)
        return ret
print(dfs('0'))

Buggy python submission (verdict: Time Limit Exceeded):
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)

Fixed submission:
n = int(input())
def dfs(s):
        if int(s) > n:
                return 0
        ret = 0
        if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
            ret = 1
        for c in '753':
                ret += dfs(s + c)
        return ret
print(dfs('0'))

Buggy python submission (verdict: Time Limit Exceeded):
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)


Fixed submission:
n = int(input())
def dfs(s):
        if int(s) > n:
                return 0
        ret = 0
        if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
            ret = 1
        for c in '753':
                ret += dfs(s + c)
        return ret
print(dfs('0'))

Buggy python submission (verdict: Time Limit Exceeded):
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))


Fixed submission:
n = int(input())
def dfs(s):
        if int(s) > n:
                return 0
        ret = 0
        if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
            ret = 1
        for c in '753':
                ret += dfs(s + c)
        return ret
print(dfs('0'))

Buggy python submission (verdict: Time Limit Exceeded):
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))


Fixed submission:
n = int(input())
def dfs(s):
        if int(s) > n:
                return 0
        ret = 0
        if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
            ret = 1
        for c in '753':
                ret += dfs(s + c)
        return ret
print(dfs('0'))

Buggy python submission (verdict: Time Limit Exceeded):
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))


Fixed submission:
n = int(input())
def dfs(s):
        if int(s) > n:
                return 0
        ret = 0
        if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
            ret = 1
        for c in '753':
                ret += dfs(s + c)
        return ret
print(dfs('0'))