Solution (source code)

= Solution

Define the <energy function> $\mathcal E=\sum_i\dot q_i p_i-L$. Along solutions of the <Euler-Lagrange equations>,
$$
\frac{d\mathcal E}{dt}=\sum_i\left[\ddot q_i p_i+\dot q_i\dot p_i-\frac{\partial L}{\partial q_i}\dot q_i-\frac{\partial L}{\partial\dot q_i}\ddot q_i\right]-\frac{\partial L}{\partial t}=-\frac{\partial L}{\partial t}.
$$
Consequently
$$
\boxed{\partial L/\partial t=0\quad\Longrightarrow\quad\mathcal E=\text{constant}.}
$$
For an ordinary isolated <mechanical system> with $L=T-U$, a time-independent quadratic <kinetic energy> and a velocity-independent <potential energy>, $\sum_i\dot q_i p_i=2T$, so $\mathcal E=T+U$. For a more general <Lagrangian>, the conserved quantity is the displayed <energy function>; identifying it with $T+U$ requires these assumptions.