<commit_before>#include "prime.h"

using namespace std;

int firstCandidate(unsigned long int currPrime, vector<int>& possPrime){
    for (int i = currPrime + 1; i < possPrime.size(); i++) {
        if (possPrime.at(i) == 1) {
            return i;
        }
    }
    
    return 0;
}

vector<unsigned long int> firstNPrime(unsigned long int n){
    
    vector<unsigned long int> primes;
    primes.push_back(2);
    
    vector<int> possPrime;
    unsigned long int currPrime = 2;
    
    for (unsigned long int i = 0; i < n; i++) {
        possPrime.push_back(1);
    }
    possPrime.at(1) = 0;
    
    while (currPrime < n) {
        currPrime = firstCandidate(currPrime,possPrime);
        
        if (currPrime == 0) {
            return primes;
        }
        
        primes.push_back(currPrime);
        
        for (int i = 0; i*currPrime < n; i++) {
            possPrime.at(i*currPrime) = 0;
        }
    }
    
    return primes;
}<commit_msg>Optimization.<commit_after>#include "prime.h"

using namespace std;

int firstCandidate(unsigned long int currPrime, vector<int>& possPrime){
    for (int i = currPrime + 1; i < possPrime.size(); i++) {
        if (possPrime.at(i) == 1) {
            return i;
        }
    }
    
    return 0;
}

vector<unsigned long int> firstNPrime(unsigned long int n){
    
    vector<unsigned long int> primes;
    
    vector<int> possPrime;
    unsigned long int currPrime = 1;
    
    for (unsigned long int i = 0; i < n; i++) {
        possPrime.push_back(1);
    }
    possPrime.at(1) = 0;
    
    while (true) {
        currPrime = firstCandidate(currPrime,possPrime);
        
        if (currPrime == 0) {
            return primes;
        }
        
        primes.push_back(currPrime);
        
        for (int i = currPrime; i * currPrime < n; i++) {
            possPrime.at(i*currPrime) = 0;
        }
    }
    
    return primes;
}
{'fraction_non_alphanumeric': 0.12067156348373557, 'fraction_numerical': 0.011542497376705142, 'mean_word_length': 1.8633633633633633, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4952577', 'n_tokens_mistral': 685, 'n_tokens_neox': 629, 'n_words': 159}