  A random access code (RAC), corresponding to a communication primitive with
various applications in quantum information theory, is an instance of a
preparation-and-measurement scenario. In this work, we consider (n,d)-RACs
constituting an "n"-length string, constructed from a "d" size set of letters,
and send an encoding of the string in a single d-level physical system and
present their quantum advantages. We first characterize optimal classical RACs,
proving that the well-known classical strategy known as
majority-encoding-identity-decoding is indeed optimal. We then construct a
quantum protocol by exploiting only two incompatible measurements, the minimal
requirement, and show the advantages beyond the classical one. We also discuss
the generality of our results and whether quantum advantages are valid for all
types of (n, d)->1 RACs.
