<commit_before>#include "C:\Factory\Common\all.h"
#include "C:\Factory\Common\Options\CRandom.h"

// ---- 

uint ModPow(uint v, uint e, uint m) {
	uint64 r;

	if(!e)
		return 1;

	r = ModPow(v, e / 2, m);
	r *= r;
	r %= m;

	if(e & 1) {
		r *= v;
		r %= m;
	}
	return r;
}

#define CRBUFFSIZE 1024

uint16 CRnd16(void) {
	static uint16 buff[CRBUFFSIZE];
	static uint i = CRBUFFSIZE;

	if(CRBUFFSIZE <= i) {
		HCRYPTPROV hp;

		if(!CryptAcquireContext(&hp, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
			exit(1); // fatal

		if(!CryptGenRandom(hp, sizeof(buff), (uchar *)buff))
			exit(1); // fatal

		CryptReleaseContext(hp, 0);
		i = 0;
	}
	return buff[i++];
}

// ---- ؂

TestMain() {
	uchar ops[0x1000];
	uint c, p, q, m, e, d; // 32bit

	memset(ops, 0x00, 0x1000);
	ops[0] = 1;

#define op(p) (ops[(p) / 16] & 1 << (p) / 2 % 8)

	for(c = 3; c < 0x100; c += 2)
		if(!op(c))
			for(d = c * c / 2; d < 0x10000 / 2; d += c)
				ops[d / 8] |= 1 << d % 8;
genPQ:
	do {
		do p = CRnd16() | 1; while(op(p));
		do q = CRnd16() | 1; while(op(q) || p == q);
		m = p * q;
	}
	while(m < 0x10000);

	p--;
	q--;

	for(e = p, d = q; e != d; e < d ? (d -= e) : (e -= d));
<commit_msg>coffee break<commit_after>#include "C:\Factory\Common\all.h"
#include "C:\Factory\Common\Options\CRandom.h"

// ---- 

uint ModPow(uint v, uint e, uint m) {
	uint64 r;

	if(!e)
		return 1;

	r = ModPow(v, e / 2, m);
	r *= r;
	r %= m;

	if(e & 1) {
		r *= v;
		r %= m;
	}
	return r;
}

#define CRBUFFSIZE 1024

uint16 CRnd16(void) {
	static uint16 buff[CRBUFFSIZE];
	static uint i = CRBUFFSIZE;

	if(CRBUFFSIZE <= i) {
		HCRYPTPROV hp;

		if(!CryptAcquireContext(&hp, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
			exit(1); // fatal

		if(!CryptGenRandom(hp, sizeof(buff), (uchar *)buff))
			exit(1); // fatal

		CryptReleaseContext(hp, 0);
		i = 0;
	}
	return buff[i++];
}

// ---- ؂

TestMain() {
	uchar ops[0x1000];
	uint c, p, q, m, e, d; // 32bit

	memset(ops, 0x00, 0x1000);
	ops[0] = 1;

#define op(p) (ops[(p) / 16] & 1 << (p) / 2 % 8)

	for(c = 3; c < 0x100; c += 2)
		if(!op(c))
			for(d = c * c / 2; d < 0x10000 / 2; d += c)
				ops[d / 8] |= 1 << d % 8;

genPQ:
	do {
		do p = CRnd16() | 1; while(op(p));
		do q = CRnd16() | 1; while(op(q) || p == q);
		m = p * q;
	}
	while(m < 0x10000);

	p--;
	q--;

	for(e = p, d = q; e != d; e < d ? (d -= e) : (e -= d));

{'fraction_non_alphanumeric': 0.2247863247863248, 'fraction_numerical': 0.06153846153846154, 'mean_word_length': 2.530920060331825, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 3, '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': '2081327', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1119, 'n_words': 295}