What context free grammar generates the language $L(G) = \{a^ib^jc^{2i}d^m\}$
For matching number of a and c you need to do something like this:

$$
S \rightarrow AB \\
A \rightarrow aAcc \\
A \rightarrow C \\
C \rightarrow bC | λ \\
B \rightarrow dB | λ 
$$

You need to produce them in one rule to be sure the ratio is kept.