  Quantum systems show contextuality. More precisely, it is impossible to
reproduce the quantum-mechanical predictions using a non-contextual realist
model, i.e., a model where the outcome of one measurement is independent of the
choice of compatible measurements performed in the measurement context. There
has been several attempts to quantify the amount of contextuality for specific
quantum systems, for example, in the number of rays needed in a KS proof, or
the number of terms in certain inequalities, or in the violation, noise
sensitivity, and other measures. This paper is about another approach: to use a
simple contextual model that reproduces the quantum-mechanical contextual
behaviour, but not necessarily all quantum predictions. The amount of
contextuality can then be quantified in terms of additional resources needed as
compared with a similar model without contextuality. In this case the
contextual model needs to keep track of the context used, so the appropriate
measure would be memory. Another way to view this is as a memory requirement to
be able to reproduce quantum contextuality in a realist model. The model we
will use can be viewed as an extension of Spekkens' toy model [Phys. Rev. A 75,
032110 (2007)], and the relation is studied in some detail. To reproduce the
quantum predictions for the Peres-Mermin square, the memory requirement is more
than one bit in addition to the memory used for the individual outcomes in the
corresponding noncontextual model.
