Solution (source code)

= Solution

With constant <masses>, differentiate the <moment of inertia> twice:
$$
 \frac12I''=\sum_i m_i\dot r_i^2+\sum_i m_i r_i\cdot\ddot r_i=2K+\sum_i r_i\cdot F_i.
$$
For each pair, $F_{ij}=-Gm_im_j(r_i-r_j)/|r_i-r_j|^3$ and $F_{ji}=-F_{ij}$. Hence its contribution is $(r_i-r_j)\cdot F_{ij}=-Gm_im_j/|r_i-r_j|=V_{ij}$. Summing over unordered pairs gives $\sum r_i\cdot F_i=V$. Time-averaging over $[0,T]$ yields
$$
 2\overline K_T+\overline V_T=\frac{I'(T)-I'(0)}{2T}.
$$
For a bound system with $I'(T)=o(T)$, or a stationary equilibrium with zero average left-hand <derivative>, the <limit> is the <virial theorem>
$$
\boxed{2\langle K\rangle+\langle V\rangle=0.}
$$
Bounded spatial extent together with bounded <velocities> suffices for the <derivative> condition; possible gravitational collisions must be excluded or otherwise regularized.