The Cobb Douglas production function with constants returns to scale
$$y = \prod_i x_i^{\alpha_i} = A \prod_i \left(\frac{x_i}{\alpha_i}\right)^{\alpha_i} ,$$
where $A:= \prod_i \alpha_i^{\alpha_i}$ annoying constant.
Cost minimization with perfect competition
$$\min_x \ \ p^\top x\ \lvert \ y = \prod \left(\frac{x_i}{\alpha_i}\right)^{\alpha_i},$$
implies FOC
$$p_j - \lambda \left[A\prod_i \left(\frac{x_i}{\alpha_i}\right)^{\alpha_i}\right] \left(\frac{x_j}{\alpha_j}\right)^{-1}=0 \Leftrightarrow
\frac{\lambda y}{p_j} =\frac{x_j}{\alpha_j},$$
insert in production function to get
$$y = A\prod_i \left( \frac{\lambda y}{p_i}\right)^{\alpha_i} \Leftrightarrow \lambda = \frac{\bar p}{A},$$
where $\bar p := \prod_i p_i^{\alpha_i}$ which is a price index for production factors. Reinsert in FOC to get
$$p_j - \frac{\bar p}{A}\left[A\prod_i \left(\frac{x_i}{\alpha_i}\right)^{\alpha_i}\right] \left(\frac{x_j}{\alpha_j}\right)^{-1}=p_j - \frac{\bar p}{A}y \left(\frac{x_j}{\alpha_j}\right)^{-1}=0,$$
from which you find
$$(1) \ \ \ p_j x_j = \frac{\alpha_j \bar p}{A} \cdot y,$$
using this formula several implications follow. First take sum over $j$ and use $\sum_j \alpha_j = 1$ to get cost function
$$(2) \ \ C(p,y)= \frac{\bar p}{A} y.$$
Set $y=1$ to get unit cost, diffrentiate with $y$ to get marginal cost, divide with y to get average cost and it follows that
$$(3) \ \ C(p,1) = \frac{\partial C(p,y)}{\partial y} = \frac{C(p,y)}{y} = \frac{\bar p}{A}.$$
Finally from (1) divide with $x_j$ to get
$$(4) \ \ x_j^\star(p,y) = \frac{\alpha_j C(p,y)}{p_j} = \frac{\alpha_j}{p_j} \frac{\bar p}{A} y,$$
stating that the share $\alpha_j$ of the costs are used on production factor $x_j$ and under perfect competition there is zero profit so revenue equals costs, hence $\alpha_j$ of the revenue must be used (price of $y$ must be unit cost, marginal cost, average cost = $C(p,1)$).
With only two production factors the cost function can be written as
$$C(p,y) = C(p_1,p_2,y) = \frac{\bar p}{A} y = \frac{p_1^{\alpha} p_2^{1-\alpha}}{\alpha^\alpha (1-\alpha)^{(1-\alpha)}} y,$$
hence marginal cost are easily seen to be
$$\frac{\partial C(p,y)}{\partial y} = \frac{p_1^{\alpha} p_2^{1-\alpha}}{\alpha^\alpha (1-\alpha)^{(1-\alpha)}}.$$