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

#define DEBUG       0
#define MAX_LEN     500001

char s[MAX_LEN * 2];
int radius[MAX_LEN * 2];

void manacher(char *str, int * out) {
    // # - pre process
    int * rl = (int *)malloc(sizeof(int) * (2 * strlen(str) + 2));
    char * tmp = (char *)malloc(2 * strlen(str) + 2);

    memset(rl, 0, sizeof(int) * (2 * strlen(str) + 2));
    memset(tmp, 0, 2 * strlen(str) + 2);

    size_t j = 0;
    for (size_t i = 0; i < strlen(str); i++) {
        tmp[j++] = '#';
        tmp[j++] = str[i];
    }
    tmp[j] = '#';

    int max_right = 0, pos = 0;
    int len_tmp = strlen(tmp);

    for (int i = 0; i < len_tmp; i++) {
        if (i < max_right) {
            rl[i] = rl[2 * pos - i] > (max_right - i) ? (max_right - i) : rl[2 * pos - i];
        }
        else {
            rl[i] = 1;
        }

        while (i - rl[i] >= 0 && i + rl[i] < len_tmp && tmp[i - rl[i]] == tmp[i + rl[i]]) {
            rl[i] ++;
        }

        if (i + rl[i] - 1 > max_right) {
            max_right = i + rl[i] - 1;
            pos = i;
        }
    }

    for (size_t i = 1; i < len_tmp; i += 2) {
        out[(i - 1) / 2] = rl[i] / 2;
    }

	free(tmp);
    free(rl);
}

int main() {
    int n;

#if DEBUG
    FILE * fp = fopen("input.txt", "r");
    FILE * fp_out = fopen("output.txt", "w");
    fscanf(fp, "%d", &n);
    fscanf(fp, "%s", s);
#else
    scanf("%d", &n);
    scanf("%s", s);
#endif

    // copy
    for (size_t i = 0; i < n; i++) {
        s[i + n] = s[i];
    }

    manacher(s, radius);

#if DEBUG
    fclose(fp);
    fclose(fp_out);
#endif

    return 0;
}
<commit_msg>error<commit_after>#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>

#define DEBUG       0
#define MAX_LEN     500001

char s[MAX_LEN * 2];
int radius[MAX_LEN * 4 + 4];

void manacher(char *str, int * out) {
    // # - pre process
    char * tmp = (char *)malloc(2 * strlen(str) + 2);

    memset(tmp, 0, 2 * strlen(str) + 2);

    size_t j = 0;
    for (size_t i = 0; i < strlen(str); i++) {
        tmp[j++] = '#';
        tmp[j++] = str[i];
    }
    tmp[j] = '#';

    int max_right = 0, pos = 0;
    int len_tmp = strlen(tmp);

    for (int i = 0; i < len_tmp; i++) {
        if (i < max_right) {
            out[i] = out[2 * pos - i] > (max_right - i) ? (max_right - i) : out[2 * pos - i];
        }
        else {
            out[i] = 1;
        }

        while (i - out[i] >= 0 && i + out[i] < len_tmp && tmp[i - out[i]] == tmp[i + out[i]]) {
            out[i] ++;
        }

        if (i + out[i] - 1 > max_right) {
            max_right = i + out[i] - 1;
            pos = i;
        }
    }

	free(tmp);
}

int main() {
    int n;

#if DEBUG
    FILE * fp = fopen("input.txt", "r");
    FILE * fp_out = fopen("output.txt", "w");
    fscanf(fp, "%d", &n);
    fscanf(fp, "%s", s);
#else
    scanf("%d", &n);
    scanf("%s", s);
#endif

    // copy
    for (size_t i = 0; i < n; i++) {
        s[i + n] = s[i];
    }

    manacher(s, radius);

    for (size_t i = 1; i < 2 * n; i += 2) {
        int max = 0;

        for (size_t j = i; j < i + 2 * n; j ++) {
            int r = radius[j];
            int left = j + 1 - radius[j];
            int right = j - 1 + radius[j];

            if (left < (i - 1)) {
                r = j - (i - 1) + 1;
            }

            if (right > i - 1 + 2 * n) {
                if (r < (i + 2 * n - j)) {
                    r = i + 2 * n - j;
                }
            }

            if ((r - 1) > max) {
                max = r - 1;
            }
        }

#if DEBUG
        fprintf(fp_out, "%d\n", max);
#else
        printf("%d\n", max);
#endif
    }

#if DEBUG
    fclose(fp);
    fclose(fp_out);
#endif

    return 0;
}

{'fraction_non_alphanumeric': 0.200836820083682, 'fraction_numerical': 0.021182008368200837, 'mean_word_length': 1.5032722513089005, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2235334', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1553, 'n_words': 416}