  The habitability of planets around M dwarfs ($\lesssim 0.5 M_\odot$) can be
affected by the XUV (X rays + extreme UV) emission of these stars, with flares
occasionally increasing the XUV flux by more than 2 orders of magnitude above
quiescent levels. This wavelength range can warm and ionize terrestrial
planets' upper atmospheres, which expands the planetary radius and promotes
atmospheric loss. In this work, we study the contribution of the XUV flux due
to flares on the atmospheric escape of Earth-like planets orbiting M dwarfs
through numerical simulations. We considered the first Gyr of planets with
initial surface water abundances between 1 and 10 terrestrial oceans (TO), a
small primordial hydrogen envelope ($\le$ $10^{-3}$~$M_{\oplus}$), and with
host star masses between 0.2 and 0.6 $M_{\odot}$. In this parameter range, we
find that flares can remove up to two TO more than nonflaring stars, which, in
some cases, translates to a doubling of the total water loss. We also find that
flaring can increase atmospheric oxygen partial pressures by hundreds of bars
in some cases. These results were obtained by adding a new module for flares to
the \vplanet software package and upgrading its atmospheric escape module to
account for Roche lobe overflow and radiation/recombination-limited escape.
