void prt_sequence(int *begin, int *end) {
    for (; begin < end; ++begin) 
        printf("%d\n", *begin);
}

void set_sequence(int *begin, int *end, int v) {
	for (; begin < end; ++begin) *begin = v;
}

void sqrt_sequence(double *begin, double *end) {
	for (; begin < end; ++begin) *begin = sqrt(*begin);
}

double avrg(double *begin, double *end) {
    double *p, x = 0.0;

    if (begin >= end) return 0.0;

    for (p = begin; p < end; ++p) x += *p;

    return x / (end - begin);
}

double* partition(double *begin, double *end, double cut) {
    while (begin < end) {
        while (begin < end && *begin < cut) ++begin;
        while (begin < end && *(--end) >= cut) ; 

        if (begin < end) {
            double x = *begin;
            *begin = *end;
            *end = x;
            ++begin;
        }
    }

    return begin;
}

