Imgaine that a cart intially moving with velocity V_0, collides with a cart at rest and then the two carts stick together. Find a equation for potential energy in this case.

Potential energy? What potential energy? Surely not the heat generated due to the collision.