We report measurements of the lifetimes of the $\Lambda_c^+$, $\Xi_c^+$ and $\Xi_c^0$ charm baryons using proton-proton collision data at center-of-mass energies of 7 and 8\tev, corresponding to an integrated luminosity of 3.0 fb$^{-1}$, collected by the LHCb experiment. The charm baryons are reconstructed through the decays $\Lambda_c^+\to pK^-\pi^+$, $\Xi_c^+\to pK^-\pi^+$ and $\Xi_c^0\to pK^-K^-\pi^+$, and originate from semimuonic decays of beauty baryons. The lifetimes are measured relative to that of the $D^+$ meson, and are determined to be \begin{align*} \tau_{\Lambda_c^+} &= 203.5\pm1.0\pm1.3\pm1.4~{\rm fs}, \newline \tau_{\Xi_c^+} &= 456.8\pm3.5\pm2.9\pm3.1~{\rm fs}, \newline \tau_{\Xi_c^0} &= 154.5\pm1.7\pm1.6\pm1.0~{\rm fs}, \end{align*} where the uncertainties are statistical, systematic, and due to the uncertainty in the $D^+$ lifetime. The measurements are approximately 3--4 times more precise than the current world average values. The $\Lambda_c^+$ and $\Xi_c^+$ lifetimes are in agreement with previous measurements; however, the $\Xi_c^0$ baryon lifetime is approximately 3.3 standard deviations larger than the world average value.