add pairclosestsum and Z