  In this paper, we first give explicit formulas for the number of solutions of
unweighted linear congruences with distinct coordinates. Our main tools are
properties of Ramanujan sums and of the discrete Fourier transform of
arithmetic functions. Then, as an application, we derive an explicit formula
for the number of codewords in the Varshamov--Tenengolts code $VT_b(n)$ with
Hamming weight $k$, that is, with exactly $k$ $1$'s. The Varshamov--Tenengolts
codes are an important class of codes that are capable of correcting asymmetric
errors on a $Z$-channel. As another application, we derive Ginzburg's formula
for the number of codewords in $VT_b(n)$, that is, $|VT_b(n)|$. We even go
further and discuss connections to several other combinatorial problems, some
of which have appeared in seemingly unrelated contexts. This provides a general
framework and gives new insight into all these problems which might lead to
further work.
