CFG where u has same number of 1s as v
The idea is to extract a pair of 1s one by one, so the key grammar is

\begin{align} 
S&amp;\rightarrow S_01S1S_2 \\
S&amp;\rightarrow S_0S_2
\end{align}

where $S_0$ represents $0^*$ and $S_2$ represents $2^*$.