Converting my [comment](https://mathoverflow.net/questions/447519/bounding-size-of-group-by-number-of-generators-order-of-elements-and-nilpotenc#comment1156329_447519) into an answer:

The $k$th term of the lower central series modulo the $(k+1)$th term is generated by the left-normed commutators $[x_1, \dotsc, x_k]$ with $x_1, \dotsc, x_k \in \{g_1, \dotsc, g_m\}$, of which there are at most $m^{k-1}(m-1)$ for $k > 1$ (since $x_1 \ne x_2$). Therefore
$$\dim G \le m + \sum_{k=2}^C m^{k-1}(m-1) = m^C.$$