#include<cstdio>
#include<cstring>
+#include<cstdlib>
#include<cassert>
#include<algorithm>
sum += pdf[i];
}
+ if (sum <= EPSILON) { fprintf(stderr, "No valid read to estimate the length distribution!\n"); exit(-1); }
+
for (int i = 1; i <= span; i++) {
pdf[i] = pdf[i] / sum;
cdf[i] = cdf[i - 1] + pdf[i];