Solution (source code)

= Solution

The two-event <inclusion-exclusion principle> subtracts the overlap counted twice:
$$
\boxed{P(A)+P(B)-P(A\cap B)=P(A\cup B).}
$$