docs: private double optimize(int k0, int kmax, double sumx, double sumx2, double xp, double yp, double sumxy, double sumy) {
      int k = kmax - k0 + 1;
      return (sumxy - xp * sumy - yp * sumx + k * xp * yp) / (sumx2 - 2 * sumx * xp + k * xp * xp);
      // return (-xp * yp * + yp * sumx - sumxy + xp * sumy) / (-xp * xp *
      // kmax - sumx2 + 2 * xp * sumx);
    }