omp multiple reductions

#include <iostream>
#include <omp.h>

int main() {
    const int size = 1000;
    int data[size];
    int sum = 0, product = 1, max_value = 0;

    // Initialize data array
    for (int i = 0; i < size; ++i) {
        data[i] = i + 1;
    }

    #pragma omp parallel for reduction(+:sum) reduction(*:product) reduction(max:max_value)
    for (int i = 0; i < size; ++i) {
        sum += data[i];
        product *= data[i];
        if (data[i] > max_value) {
            max_value = data[i];
        }
    }

    std::cout << "Sum: " << sum << std::endl;
    std::cout << "Product: " << product << std::endl;
    std::cout << "Max Value: " << max_value << std::endl;

    return 0;
}