c = (qy py) / (qx px)
rx = c^2 px qx
Wrong formula
Use this one -->
dx = (Qx - Px) % modulo
dy = (Qy - Py) % modulo
c = dy * invert(dx) % modulo
Rx = (c*c - Px - Qx) % modulo
Ry = (c*(Px - Rx) - Py) % modulo
Formula is correct. Actually invert(dx) is (qx px), so
c = dy * invert(dx) is the same as
c = (qy py) / (qx px)