Solution (source code)

= Solution

For every $x\in X$, invariance gives
$$
\mu(T^{-1}\{x\})=\mu(\{x\})>0.
$$
Thus $T^{-1}\{x\}$ is nonempty, so $T$ is a <surjective function>. A surjection from a <finite set> to itself is a <bijection>. Therefore
$$
\boxed{T\text{ is bijective}}.
$$
This is the <finite full-support measure-preserving map is bijective> principle.