grundy(p) = mex of children's Grundy values. 0 means the mover loses. A sum of games is decided by the XOR of component Grundy values.
mex of a set is its smallest missing non-negative integer.
See junior.md for the definitions and professional.md for the proof that grundy(sum) = XOR of component Grundy values.