Sequences of compatible quantum measurements can be contextual and any simulation with a classical model conforming with the quantum predictions needs to use internal memory. Kleinmann et al (2011 New J. Phys. 13 113011) showed that simulating sequences from the Peres-Mermin scenario requires at least three different internal states in order not to contradict the deterministic predictions of quantum theory. We extend this analysis to probabilistic quantum predictions and ask how much memory is required to simulate correlations generated for sequences of compatible observables by any quantum state. We find that even in this comprehensive approach only three internal states are required for a perfect simulation of quantum correlations in the Peres-Mermin scenario.