<commit_before>#include <stdio.h>
#include <math.h>   // ceil()
#include <stdlib.h> // exit()

int main(int argc, char *argv[]) {
	char part_filename[200];
	FILE *ptr_source, *ptr_part;
	size_t parts, i, written_bytes;
	unsigned long int part_size;
	int byte;

	if (argc != 3) {
		printf("Usage: %s <maximum part size in MiB> <file to split>\n", argv[0]);
		exit(1);
	}

	if ((ptr_source = fopen(argv[2], "rb")) == NULL) {
		perror("Could not open file to split");
		exit(1);
	}

	fseek(ptr_source, 0, SEEK_END);
	part_size = atol(argv[1]) * 1024 * 1024;
	if (part_size == 0) {
		printf("Invalid part size: %s\n", argv[1]);
		exit(1);
	}
	parts = (size_t) ceil((double) ftell(ptr_source) / part_size);
	rewind(ptr_source);

	printf("File will be split into %u parts.\n", parts);

	for (i = 0; i < parts; i++) {
		printf("\nWriting part%02d... ", i);
		sprintf(part_filename, "%s.part%02d", argv[2], i);
		
		if ((ptr_part = fopen(part_filename, "wb")) == NULL) {
			perror("Could not open part for writing");
			exit(1);
		}

		for (written_bytes = 0; written_bytes < part_size &&
		    (byte = fgetc(ptr_source)) != EOF; written_bytes++)
		{
			fputc(byte, ptr_part);
		}

		printf("(%u bytes)", written_bytes);
		fclose(ptr_part);
	}

	printf("\n\nDone!\n");
	fclose(ptr_source);

	return 0;
}<commit_msg>Store written_bytes as unsigned long<commit_after>#include <stdio.h>
#include <math.h>   // ceil()
#include <stdlib.h> // exit()

int main(int argc, char *argv[]) {
	char part_filename[200];
	FILE *ptr_source, *ptr_part;
	size_t parts, i;
	unsigned long int part_size, written_bytes;
	int byte;

	if (argc != 3) {
		printf("Usage: %s <maximum part size in MiB> <file to split>\n", argv[0]);
		exit(1);
	}

	if ((ptr_source = fopen(argv[2], "rb")) == NULL) {
		perror("Could not open file to split");
		exit(1);
	}

	fseek(ptr_source, 0, SEEK_END);
	part_size = atol(argv[1]) * 1024 * 1024;
	if (part_size == 0) {
		printf("Invalid part size: %s\n", argv[1]);
		exit(1);
	}
	parts = (size_t) ceil((double) ftell(ptr_source) / part_size);
	rewind(ptr_source);

	printf("File will be split into %u parts.\n", parts);

	for (i = 0; i < parts; i++) {
		printf("\nWriting part%02d... ", i);
		sprintf(part_filename, "%s.part%02d", argv[2], i);
		
		if ((ptr_part = fopen(part_filename, "wb")) == NULL) {
			perror("Could not open part for writing");
			exit(1);
		}

		for (written_bytes = 0; written_bytes < part_size &&
		    (byte = fgetc(ptr_source)) != EOF; written_bytes++)
		{
			fputc(byte, ptr_part);
		}

		printf("(%lu bytes)", written_bytes);
		fclose(ptr_part);
	}

	printf("\n\nDone!\n");
	fclose(ptr_source);

	return 0;
}
{'fraction_non_alphanumeric': 0.19029567854435178, 'fraction_numerical': 0.022744503411675512, 'mean_word_length': 3.951219512195122, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, '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': '6040386', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1033, 'n_words': 262}