<jupyter_start><jupyter_text><jupyter_code>#<NAME> 18BCE2030
code = """
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#define RNG_MOD 0x80000000
int state;
int rng_int(void);
double rng_doub(double range);

int main() {
    int i, ctr;
    unsigned int n;
    double x, y, pi;
    n = 1<<30;
    ctr = 0;
    #pragma omp threadprivate(state)
    #pragma omp parallel private(x, y) reduction(+:ctr) 
    {
        state = 25234 + 17 * omp_get_thread_num();
        #pragma omp for
        for (i = 0; i <= n; i++) {
            x = (double)rng_doub(1.0);
            y = (double)rng_doub(1.0);
            if (x*x + y*y <= 1) ctr++;
        }
    }
    pi = 4.0*ctr / n;
    printf("Pi: %lf", pi);
    return 0;
}

int rng_int(void) {
   return (state = (state * 1103515245 + 12345) & 0x7fffffff);
}

double rng_doub(double range) {
    return ((double)rng_int()) / (((double)RNG_MOD)/range);
}
"""
text_file = open("code.c", "w")
text_file.write(code)
text_file.close()
%env OMP_NUM_THREADS=10
!gcc -o hello -fopenmp code.c
!./hello<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16884328358208955, 'fraction_numerical': 0.05037313432835821, 'mean_word_length': 2.8736462093862816, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '502378', 'license': 'MIT', 'n_tokens_mistral': 493, 'n_tokens_neox': 446, 'n_words': 101, 'path': 'PDC_lab4(1.0).ipynb', 'repo_name': 'holps-7/PDC-weekly', 'size': '1079'}