What is an example of a hidden variable model that meets the bound of Bell's inequality? Following https://en.wikipedia.org/wiki/Bell%27s_theorem:


The best possible local realist imitation (red) for the quantum correlation of two spins in the singlet state (blue), insisting on perfect anti-correlation at 0°, perfect correlation at 180°.

Just for my own understanding and learning of math, let's pretend that indeed the experimental data was the red curve rather than the blue curve. Then following the same article, we would be able to model this using a local realist model:
$$
{\displaystyle C_{h}(a,b)=E(A(\mathbf {a} ,\lambda )B(\mathbf {b} ,\lambda ))=\int _{\Lambda }A(\mathbf {a} ,\lambda )B(\mathbf {b} ,\lambda )p(\lambda )d\lambda .}
$$
What choices of $A(\mathbf {a} ,\lambda )$, $B(\mathbf {b} ,\lambda )$, and $p(\lambda )$ would yield the red curve?
 A: Assuming $\mathbf {a}, \mathbf{b} \in \mathbb{R}^2$, with $\alpha, \beta$ being the corresponding angles, the following model yields the red graph:
\begin{array}{l}
 \lambda \sim{\rm{Uniform}}\left[ {0,2\pi } \right] \to \mathop P\left( \lambda  \right) = \frac{1}{{2\pi }} \\ 
 A(\mathbf {a} ,\lambda ) = {\mathop{\rm sgn}} \cos (\alpha - \lambda) \\
B(\mathbf {b} ,\lambda ) = -{\mathop{\rm sgn}} \cos (\beta - \lambda)  
 \end{array}
A: For a while this question has haunted me more than the whole theorem and implications of its violation. @Gabi I found what I'm seeing now is exactly the same solution by doing a simulation, understanding it as a sort of "non-probabilistic limit" (taking it from a different angle so to speak - pun intended). It's not completely self-evident or very intuitive per sé. @FrédéricGrosshans thank you for pointing out that the same was given by Bell. For anyone still reading this, I've attached a screenshot of the sim, which should be quite self-explanatory. It's ultra low-res, so you can literally count the green matching dots at the left, which are then printed as a function of the angle at the right. Don't mind it looking a bit messy, it has other uses too. 
