The expansion of the Universe is understood to have accelerated during two
epochs: in its very first moments during a period of Inflation and much more
recently, at $z < 1$, when Dark Energy is hypothesized to drive cosmic
acceleration. The undiscovered mechanisms behind these two epochs represent
some of the most important open problems in fundamental physics. The large
cosmological volume at $2 < z < 5$, together with the ability to efficiently
target high-$z$ galaxies with known techniques, enables large gains in the
study of Inflation and Dark Energy. A future spectroscopic survey can test the
Gaussianity of the initial conditions up to a factor of ~50 better than our
current bounds, crossing the crucial theoretical threshold of
$\sigma(f_{NL}^{\rm local})$ of order unity that separates single field and
multi-field models. Simultaneously, it can measure the fraction of Dark Energy
at the percent level up to $z = 5$, thus serving as an unprecedented test of
the standard model and opening up a tremendous discovery space.