<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <string.h>

char* swap (char* source, int i, int j) {
    char saved = source[i];
    source[i] = source[j];
    source[j] = saved;
}

void generate_permutations (int n, char* a) {
    if (n == 0) {
        printf("%s\n", a);
    } else {
        for (int i = 0; i <= n; i++) {
            generate_permutations(n - 1, a);
            swap(a, n % 2 == 0 ? i : 0, n);
        }
    }
}

int main (int argc, const char* argv[]) {
    if (argc != 2) {
        fprintf(stderr, "Need exactly one argument!\n");
        return 1;
    }
    
    size_t len = strlen(argv[1]);
    char * word = malloc(len + 1); // Remember null terminator
    word = strncpy(word, argv[1], len);
    
    generate_permutations(len - 1, word);
    return 0;<commit_msg>Add mildly pedantic free<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <string.h>

char* swap (char* source, int i, int j) {
    char saved = source[i];
    source[i] = source[j];
    source[j] = saved;
}

void generate_permutations (int n, char* a) {
    if (n == 0) {
        printf("%s\n", a);
    } else {
        for (int i = 0; i <= n; i++) {
            generate_permutations(n - 1, a);
            swap(a, n % 2 == 0 ? i : 0, n);
        }
    }
}

int main (int argc, const char* argv[]) {
    if (argc != 2) {
        fprintf(stderr, "Need exactly one argument!\n");
        return 1;
    }

    size_t len = strlen(argv[1]);
    char * word = malloc(len + 1); // Remember null terminator
    word = strncpy(word, argv[1], len);

    generate_permutations(len - 1, word);

    free(word);
    return 0;
{'fraction_non_alphanumeric': 0.16707466340269278, 'fraction_numerical': 0.01591187270501836, 'mean_word_length': 2.193359375, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2070683', 'n_tokens_mistral': 619, 'n_tokens_neox': 589, 'n_words': 175}