Solution (source code)

= Solution

The <Dirichlet hyperbola method> counts each factorization $n=ab$ once and gives, with $y=\lfloor\sqrt x\rfloor$,
$$
\sum_{n\leq x}\tau(n)
=\sum_{ab\leq x}1
=2\sum_{a\leq y}\left\lfloor\frac xa\right\rfloor-y^2.
$$
Using $\lfloor x/a\rfloor=x/a+O(1)$ and the <harmonic number> estimate $H_y=\log y+\gamma+O(1/y)$, where $\gamma$ is the <Euler--Mascheroni constant>, we obtain
$$
\sum_{n\leq x}\tau(n)
=2x(\log y+\gamma)-y^2+O(y)
=x\log x+(2\gamma-1)x+O(\sqrt x).
$$
Thus one may take $C=2\gamma-1$.