Why is there a square on |x1 - x2|? Shouldn't it be 1/2k(|x1-x2| - L0)^2?
I think you are right according to last year's comments.
This systems look like a molecular system that the the molecules attract each other when they are far from each other and exclude each other when they are too close. The difference might be, the spline limits such kind of effect to be applied to specific objects around a single mass only instead of applying the force to all the objects in the system.
I find it easier to memorize the potential energy of a mass-spring system when I just memorize the formula for the force of a spring is F = -k(L' - L0), and the energy of a system is E = FL. Then we can just integrate L' from L0 to L to derive the formula above.
I tried keliu's approach with the quiz, and found it effective.