double tmp = 0;
#pragma omp parallel
{
#pragma omp for reduction(+:tmp)
for (int i = 0; i < N; ++i) {
tmp += i * i;
}
#pragma omp single
{
tmp = sqrt(tmp);
}
} //end #pragma omp parallel