Program was written in c++ using Microsoft Visual Studio, you can load it the VS using the .sln file.
First Ball class is created, balls are initialized with random positions and velocities. In run loop, program iterates through pairs of balls (because thanks to Newton's third law F12 = -F21, wit is not necessary to loop through all the balls), then gravity is calculated and if collision happens deflection. On collision there is some loss of momentum specified c_rest = 0.25 so that the balls have a tendency to "stick" together.