CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
counter = 0
list = ['3','5','7']
ok = []
for a in list:
    for b in list:
        for c in list:
            ok.append(a+b+c)
            for d in list:
                ok.append(a+b+c+d)
                for e in list:
                    ok.append(a+b+c+d+e)
                    for f in list:
                        ok.append(a+b+c+d+e+f)
                        for g in list:
                            ok.append(a+b+c+d+e+f+g)
                            for h in list:
                                ok.append(a+b+c+d+e+f+g+h)
                                for i in list:
                                    ok.append(a+b+c+d+e+f+g+h+i)
                                    for j in list:
                                        ok.append(a+b+c+d+e+f+g+h+i+j)

okk = []
for _ in ok:
    x3 = _.count('3')
    x5 = _.count('5')
    x7 = _.count('7')
    if x3>0 and x5>0 and x7>0:
        okk.append(_)
fin = [int(_) for _ in okk]
fin.sort()
for _ in fin:
    if _ > N:
        print((fin.index(_)))
        break


# Optimized solution
N = int(eval(input()))
counter = 0
list = ['3','5','7']
ok = []
for a in list:
    for b in list:
        for c in list:
            ok.append(a+b+c)
            for d in list:
                ok.append(a+b+c+d)
                for e in list:
                    ok.append(a+b+c+d+e)
                    for f in list:
                        ok.append(a+b+c+d+e+f)
                        for g in list:
                            ok.append(a+b+c+d+e+f+g)
                            for h in list:
                                ok.append(a+b+c+d+e+f+g+h)
                                for i in list:
                                    ok.append(a+b+c+d+e+f+g+h+i)
                                    for j in list:
                                        ok.append(a+b+c+d+e+f+g+h+i+j)

sub = []
for _ in ok:
    x3 = _.count('3')
    x5 = _.count('5')
    x7 = _.count('7')
    if x3>0 and x5>0 and x7>0:
        sub.append(_)
fin = [int(_) for _ in sub]
fin.sort()
for _ in fin:
    if _ > N:
        print((fin.index(_)))
        break
# Original solution
ans = 0


def dfs(n, f1, f2, f3):
    if N < n:
        return

    global ans
    ans += 1 if f1 and f2 and f3 else 0

    dfs(n * 10 + 7, True, f2, f3)
    dfs(n * 10 + 5, f1, True, f3)
    dfs(n * 10 + 3, f1, f2, True)


N = int(eval(input()))

dfs(0, False, False, False)

print(ans)


# Optimized solution
def f(n, f1, f2, f3):
    ret = 0

    def dfs(n, f1, f2, f3):
        if N < n:
            return 0

        nonlocal ret
        ret += 1 if f1 and f2 and f3 else 0

        dfs(n * 10 + 7, True, f2, f3)
        dfs(n * 10 + 5, f1, True, f3)
        dfs(n * 10 + 3, f1, f2, True)

        return ret

    return dfs(n, f1, f2, f3)


N = int(eval(input()))

print((f(0, False, False, False)))
# Original solution
import itertools

N = int(eval(input()))
ans = 0
for i in range(3, len(str(N))+1) :
    for ptn in itertools.product([3,5,7], repeat = i) :
        if (3 not in ptn) or (5 not in ptn) or (7 not in ptn) :
            continue
        a = int("".join(list(map(str,ptn))))
        if a <= N :
            ans += 1
print(ans)


# Optimized solution
import itertools

N = int(eval(input()))

ans = 0
for i in range(3, len(str(N))+1) :
    for ptn in itertools.product([3,5,7], repeat = i) :
        if (3 not in ptn) or (5 not in ptn) or (7 not in ptn) :
            continue
        p = int("".join(list(map(str,ptn))))
        if p <= N :
            ans += 1
print(ans)
# Original solution
n=int(eval(input()))
d=["3","5","7"]
ans=[]
ans+=d
while d:
    a=d.pop(0)
    if len(a)<9:
        for i in "357":
            d+=[i+a]
            ans+=[i+a]
ans=list(map(int,ans))
ans.sort()
print((sum(i<=n for i in ans if len(set(str(i)))==3)))

# Optimized solution
n=int(eval(input()))
d=["3","5","7"]
ans=0
while d:
    a=d.pop(0)
    if int(a)<=n and len(set(a))==3:ans+=1
    if len(a)<9:
        for i in "357":d+=[i+a]
print(ans)
# Original solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    def rec(n, used):
        ans = 0
        if all(used):
            ans += 1
        for i, d in enumerate((3, 7, 5)):
            if 10 * n + d <= N:
                cur = used[i]
                used[i] = True
                ans += rec(10 * n + d, used)
                used[i] = cur
        return ans

    print((rec(0, [False, False, False])))
    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    def rec(n, used):
        ans = 0
        if used == 7:
            ans += 1
        for i, d in enumerate((3, 7, 5)):
            if 10 * n + d <= N:
                ans += rec(10 * n + d, used | (1 << i))
        return ans

    print((rec(0, 0)))
    return


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))

def make753(s):
    count = 0
    if int(s) > n:
        return 0
    if all(s.count(i) > 0 for i in '753'):
        count += 1
    for i in '753':
        count += make753(s + i)
    return count

print((make753('0')))

# Optimized solution
n = int(eval(input()))
count = 0

def make753(s):
    global count
    if int(s) > n:
        return 0
    if all(s.count(i) > 0 for i in '753'):
        count += 1
    for i in '753':
        make753(s + i)
    return count
        
print((make753('0')))
# Original solution
N, M = list(map(int, input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(N)

for _ in range(M):
    A, B = list(map(int, input().split()))
    A = A - 1
    B = B - 1
    uf.union(A, B)
    uf.find(A)

ans = 0
for k, v in list(uf.all_group_members().items()):
    ans = max(ans, len(v))
print(ans)

# Optimized solution
class UnionFind:
    def __init__(self, N):
        self.parent = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def find(self, x):
        r = x
        while self.parent[r] != r:
            r = self.parent[r]
        while self.parent[x] != r:
            x, self.parent[x] = self.parent[x], r
        return r

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
            self.size[y] += self.size[x]
        else:
            self.parent[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return self.size[self.find(x)]

N, M = list(map(int, input().split()))
uf = UnionFind(N)
for _ in range(M):
    A, B = list(map(int, input().split()))
    uf.unite(A-1, B-1)

ans = max(uf.get_size(i) for i in range(N))
print(ans)
# Original solution

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


def solve():
    N, M = list(map(int, input().split()))
    UF = UnionFind(N)
    for i in range(M):
        _a, _b = list(map(int, input().split()))
        UF.union(_a-1, _b-1)
    rt_l = UF.roots()
    ans = 0
    for _rt in rt_l:
        _len = len(UF.members(_rt))
        if ans < _len:
            ans = _len

    print(ans)


solve()


# Optimized solution

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


def solve():
    N, M = list(map(int, input().split()))
    UF = UnionFind(N)
    for i in range(M):
        _a, _b = list(map(int, input().split()))
        UF.union(_a-1, _b-1)
    rt_l = UF.roots()
    ans = 0
    for _rt in rt_l:
        _len = UF.size(_rt)
        if ans < _len:
            ans = _len

    print(ans)


solve()
# Original solution
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


n, m = list(map(int, input().split()))
uf = UnionFind(n)

for _ in range(m):
    a, b = list(map(int, input().split()))
    uf.union(a-1, b-1)

ans = 0
for l in list(uf.all_group_members().values()):
    ans = max(ans, len(l))

print(ans)

# Optimized solution
class UnionFind:
    def __init__(self, n=0):
        self.d = [-1]*n
    def find(self, x):
        if self.d[x] < 0:
            return x
        else:
            self.d[x] = self.find(self.d[x])
            return self.d[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.d[x] > self.d[y]:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        return True
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def size(self, x):
        return -self.d[self.find(x)]


n, m = list(map(int, input().split()))
uf = UnionFind(n)

for _ in range(m):
    a, b = list(map(int, input().split()))
    uf.unite(a-1, b-1)

ans = 0
for i in range(n):
    ans = max(ans, uf.size(i))

print(ans)
# Original solution
# Union Find
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]


def unite(x, y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x, y = y, x
        par[x] += par[y]
        par[y] = x
        return True


def same(x, y):
    return find(x) == find(y)


def size(x):
    return -par[find(x)]


import sys

input = sys.stdin.readline
n, m = list(map(int, input().split()))
a = set()
for _ in range(m):
    ab = sorted(map(int, input().split()))
    a.add((ab[0], ab[1]))
par = [-1] * n

for x, y in a:
    unite(x - 1, y - 1)

d = {}
for i in range(n):
    i = find(i)
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
print((max(d.values())))

# Optimized solution
# Union Find
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]


def unite(x, y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x, y = y, x
        par[x] += par[y]
        par[y] = x
        return True


import sys

input = sys.stdin.readline
n, m = list(map(int, input().split()))
par = [-1] * n
a = set()
for _ in range(m):
    ab = sorted(map(int, input().split()))
    a.add((ab[0], ab[1]))

for x, y in a:
    unite(x - 1, y - 1)

print((-min(par)))
# Original solution
N, M = list(map(int, input().split()))
AB = [list([int(x)-1 for x in input().split()]) for _ in range(M)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(N)
for i in range(M):
    a, b = AB[i]
    uf.union(a, b)
    
ans = 0
for val in list(uf.all_group_members().values()):
    ans = max(ans, len(val))

print(ans)

# Optimized solution
N, M = list(map(int, input().split()))
AB = [list([int(x)-1 for x in input().split()]) for _ in range(M)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(N)
for i in range(M):
    a, b = AB[i]
    uf.union(a, b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))

print(ans)
# Original solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))

n,m=nii()
l=[lnii() for i in range(m)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

uf=UnionFind(n)
for a,b, in l:
  a-=1
  b-=1
  if uf.same(a,b)==False:
    uf.union(a,b)

ans=0
roots=uf.roots()
for i in uf.roots():
  mem=len(uf.members(i))
  ans=max(ans,mem)
print(ans)

# Optimized solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))

n,m=nii()
l=[lnii() for i in range(m)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.parents[self.find(x)]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

uf=UnionFind(n)
for a,b, in l:
  a-=1
  b-=1
  if uf.same(a,b)==False:
    uf.union(a,b)

ans=0
roots=uf.roots()
for i in uf.roots():
  ans=max(ans,uf.size(i))
print(ans)
# Original solution
'''
	We can show that if u and v belong to the same connected component, then they are friends w/ each other
	So everyone in a given connected component is friends with one another
	So everyone in a given connected component must be separated into different groups

	If we have a CC of with sz nodes in it, then we need at least sz different groups

	So, the minimum number of groups needed is max sz(CC)
'''
import sys
sys.setrecursionlimit(4*10**5)

n, m = list(map(int,input().split()))
adj = [[] for u in range(n+1)]
for i in range(m):
	u, v = list(map(int,input().split()))
	adj[u].append(v)
	adj[v].append(u)

vis = [False for u in range(n+1)]
def dfs(u):
	if vis[u]:
		return 0
	vis[u] = True

	sz = 1
	for v in adj[u]:
		sz += dfs(v)
	return sz

CCs = []
for u in range(1,n+1):
	if not vis[u]:
		CCs.append(dfs(u))

print((max(CCs)))

# Optimized solution
'''
	We can show that if u and v belong to the same connected component, then they are friends w/ each other
	So everyone in a given connected component is friends with one another
	So everyone in a given connected component must be separated into different groups

	If we have a CC of with sz nodes in it, then we need at least sz different groups

	So, the minimum number of groups needed is max sz(CC)
'''
import sys
sys.setrecursionlimit(2*10**5+5)

n, m = list(map(int,input().split()))
adj = [[] for u in range(n+1)]
for i in range(m):
	u, v = list(map(int,input().split()))
	adj[u].append(v)
	adj[v].append(u)

vis = [False for u in range(n+1)]
def dfs(u):
	if vis[u]:
		return 0
	vis[u] = True

	sz = 1
	for v in adj[u]:
		sz += dfs(v)
	return sz

CCs = []
for u in range(1,n+1):
	if not vis[u]:
		CCs.append(dfs(u))

print((max(CCs)))
# Original solution
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n,m=list(map(int, input().split()))
uf = UnionFind(n)
for i in range(m):
    a,b = list(map(int, input().split()))
    uf.union(a-1,b-1)
a=uf.all_group_members()
ans=0
for v in list(a.values()):
    ans=max(ans,len(v))
print(ans)

# Optimized solution
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=list(map(int,input().split()))
uf = UnionFind(n)

for i in range(m):
    a,b=list(map(int,input().split()))
    uf.union(a-1,b-1)

ans=0
for i in range(n):
    ans=max(ans, uf.size(i))
print(ans)