<commit_before><commit_msg>solve Problem#10 by BF. isPrime use sqrt<commit_after>#include <iostream>
#include <string>
#include <ctime>
#include <cmath>

using namespace std;

bool isPrime(long long n)
{
    long long mid = static_cast<long long>(sqrt(n));
    long long i = 2;
    for (i = 2; i <= mid; i++)
    {
        if (n % i == 0)
            break;
    }

    if (i > mid)
        return true;
    else
        return false;
}

int main()
{
    clock_t time_begin = clock();

    const long long MAX_LIMIT = 2000000;
    long long n = 0;
    long long sum = 2;
    for (n = 3; n <= MAX_LIMIT; n++)
    {
        if (n % 2 != 0 && isPrime(n))
        {
            sum += n;
        }
    }
    cout << "sum of primes under " << MAX_LIMIT << " :" << sum << endl;

    clock_t time_end = clock();
    double time_cost = (double)(time_end - time_begin)/CLOCKS_PER_SEC;
    cout << "TIME COST:" << time_cost << " s" << endl;
    return 0;
}
{'fraction_non_alphanumeric': 0.14708994708994708, 'fraction_numerical': 0.01904761904761905, 'mean_word_length': 2.122112211221122, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 9, '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': '861845', 'n_tokens_mistral': 360, 'n_tokens_neox': 336, 'n_words': 103}