  Changes in temperature or stress state may induce reversible
B2$\leftrightarrow$(R)$\leftrightarrow$ B19' martensitic transformations and
associated shape memory effects in close-to-stoichiometric nickel-titanium
(NiTi) alloys. Recent experimental studies confirmed a considerable impact of
the hydrogen-rich aging atmosphere on the subsequent B2 austenite
$\leftrightarrow$ B19' martensite transformation path. In this paper, we employ
Density Functional Theory to study properties of Ar, He, and H interstitials in
B2 austenite and B19' martensite phases. We show that H interstitials exhibit
negative formation energies, while Ar and He interstitials yield positive
values. Our theoretical analysis of slightly Ni-rich Ni--Ti alloys with the
austenite B2 structure shows that a slight over-stoichiometry towards Ni-rich
compositions in a range 51--$52\,\text{at.%}$ is energetically favorable. The
same conclusion holds for H-doped NiTi with the H content up to
$\approx6\,\text{at.%}$. In agreement with experimental data we predict H atoms
to have a strong impact on the martensitic phase transformation in NiTi by
altering the mutual thermodynamic stability of the high-temperature cubic B2
and the low-temperature monoclinic B19' phase of NiTi. Hydrogen atoms are
predicted to form stable interstitial defects. As this is not the case for He
and Ar, mixtures of hydrogen and the two inert gases can be used in annealing
experiments to control H partial pressure when studying the martensitic
transformations in NiTi in various atmospheres.
