5. Let the set $X=\{1,2, \cdots, 100\}$, and the function $f: X \rightarrow X$ satisfies the following conditions:
(1) For any $x \in X$, $f(x) \neq x$;
(2) For any 40-element subset $A$ of $X$, $A \cap f(A) \neq \varnothing$.

Find the smallest positive integer $k$ such that for any function $f$ satisfying the above conditions, there exists a $k$-element subset $B$ of $X$ such that
$$
B \cup f(B)=X.
$$

[Note] For any subset $T$ of $X$, define
$f(T)=\{f(t) \mid t \in T\}$.
(Zhai Zhenhua)
5. First consider the function $f: X \rightarrow X$ defined as follows:

For $i=1,2, \cdots, 30, j=91,92, \cdots, 99$, define
$f(3 i-2)=3 i-1, f(3 i-1)=3 i$,
$f(3 i)=3 i-2, f(j)=100, f(100)=99$.
Clearly, the function $f$ satisfies condition (1).
For any 40-element subset $A$ of the set $X$, either there exists an integer $i(1 \leqslant i \leqslant 30)$ such that
$|A \cap\{3 i-2,3 i-1,3 i\}| \geqslant 2$,

in which case $A \cap f(A) \neq \varnothing$, or $91,92, \cdots, 100 \in A$, in which case $A \cap f(A) \neq \varnothing$ as well, i.e., the function $f$ also satisfies condition (2).
If a subset $B$ of the set $X$ satisfies $f(B) \cup B=X$, then
$|B \cap\{3 i-2,3 i-1,3 i\}| \geqslant 2(1 \leqslant i \leqslant 30)$,

and $91,92, \cdots, 98 \in B$, and at least one of $99$ and $100$ belongs to the set $B$, thus $|B| \geqslant 69$.

We need to prove: For any function $f$ that satisfies the conditions of the problem, there always exists a subset $B$ with no more than 69 elements such that
$f(B) \cup B=X$.
Consider all subsets $U \subseteq X$ that satisfy $U \cap f(U)=\varnothing$ (by condition (1), $\{x\} \cap f(\{x\})=\varnothing$, so such subsets $U$ exist). Among these subsets, choose a subset $U$ such that $|U|$ is maximized, and if there are multiple subsets $U$ that meet the requirement, then choose the one with the largest $|f(U)|$.

Let $V=f(U), W=X \backslash(U \cup V), U, V, W$ are pairwise disjoint, and their union is $X$.
By condition (2), $|U| \leqslant 39$.
Thus, $|V| \leqslant 39, |W| \geqslant 22$.
(i) For any $w \in W$, it must be that $f(w) \in U$.
Otherwise, let $U^{\prime}=U \cup\{w\}$.
Since $f(U)=V, f(w) \notin U$, and $f(w) \neq w$, it follows that $U^{\prime} \cap f\left(U^{\prime}\right)=\varnothing$, which contradicts the maximality of $|U|$.
(ii) If $w_{1}, w_{2} \in W\left(w_{1} \neq w_{2}\right)$, then $f\left(w_{1}\right) \neq f\left(w_{2}\right)$.
Otherwise, let $u=f\left(w_{1}\right)=f\left(w_{2}\right)$.
By conclusion (i), $u \in U$.
Let $U^{\prime}=(U \backslash\{u\}) \cup\left\{w_{1}, w_{2}\right\}$.
Since $f\left(U^{\prime}\right) \subseteq V \cup\{u\}, U^{\prime} \cap(V \cup\{u\})=\varnothing$, it follows that $U^{\prime} \cap f\left(U^{\prime}\right)=\varnothing$, which contradicts the maximality of $|U|$.
Let $W=\left\{w_{1}, w_{2}, \cdots, w_{m}\right\}$, and set
$u_{i}=f\left(w_{i}\right)(1 \leqslant i \leqslant m)$.
By (i) and (ii), $u_{1}, u_{2}, \cdots, u_{m}$ are distinct elements of the subset $U$.
(iii) For $1 \leqslant i|f(U)|$, which contradicts the maximality of $|f(U)|$.

Therefore, $f\left(u_{1}\right), f\left(u_{2}\right), \cdots, f\left(u_{m}\right)$ are distinct elements of the subset $V$.
Thus, $|V| \geqslant|W|$.
Since $|U| \leqslant 39$, it follows that $|V|+|W| \geqslant 61$.
Thus, $|V| \geqslant 31$.
Let $B=U \cup W$. Then
$|B| \leqslant 69$, and $f(B) \cup B \supseteq V \cup B=X$.
In conclusion, the smallest positive integer $k$ is 69.