<jupyter_start><jupyter_text><jupyter_code>#<NAME> 18BCE2030
code = """
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
#define MAX_ 100000000
double Rand(double L, double U)  
{  
    return L + (U - L) * rand() * 1.0 / RAND_MAX;  
}  
int main()
{
   long long i,ctr=0;
   double x,y,pi;
   time_t t;
   srand((unsigned) time(&t));
   #pragma omp parallel for private(x,y) reduction(+:ctr)
   for(i=0;i<MAX_;i++)
   {
        x = Rand(-1.0, 1.0);  
	    y = Rand(-1.0, 1.0);  
        if((x*x+y*y)<=1)
            ctr++;
   } 
   pi = ctr*4.0/MAX_;
   printf("Pi: %lf",pi);
   return 0;
}
"""
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>env: OMP_NUM_THREADS=10
Pi: 3.141653
{'fraction_non_alphanumeric': 0.19578686493184635, 'fraction_numerical': 0.05204460966542751, 'mean_word_length': 3.0603015075376883, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '301080', 'license': 'MIT', 'n_tokens_mistral': 397, 'n_tokens_neox': 368, 'n_words': 74, 'path': 'PDC_lab4(2.0).ipynb', 'repo_name': 'holps-7/PDC-weekly', 'size': '814'}