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

static int myAtoi(char* str)
{
    char *s;
    int n = 0, sign = 0;

    while (*str == ' ' || *str == '\t') {
        str++;
    }

    for (s = str; *s != '\0'; s++) {
        if (isdigit(*s)) {
            int d = *s - '0';
            if (sign) {
                if (-n < (INT_MIN + d) / 10) {
                    n = INT_MIN;
                    break;
                }
            } else {
                if (n > (INT_MAX - d) / 10) {
                    n = INT_MAX;
                    break;
                }
            }
            n = n * 10 + d;
        } else if (*s == '-' && isdigit(*(s + 1))) {
            sign = 1;
        } else if (*s == '+' && isdigit(*(s + 1))) {
            sign = 0;
        } else {
            break;
        }
    }

    return sign ? -n : n;   <commit_msg>Improve atoi<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

static int myAtoi(char* str)
{
    char *s;
    int n = 0, sign = 0;

    while (*str == ' ' || *str == '\t') {
        str++;
    }

    for (s = str; *s != '\0'; s++) {
        if (isdigit(*s)) {
            int d = *s - '0';
            if (sign) {
                if (-n < (INT_MIN + d) / 10) {
                    n = INT_MIN;
                    break;
                }
            } else {
                if (n > (INT_MAX - d) / 10) {
                    n = INT_MAX;
                    break;
                }
            }
            n = n * 10 + d;
        } else if (*s == '-' && isdigit(*(s + 1)) && (n == 0)) {
            sign = 1;
        } else if (*s == '+' && isdigit(*(s + 1)) && (n == 0)) {
            sign = 0;
        } else {
            break;
        }
    }

    return sign ? -n : n;   
{'fraction_non_alphanumeric': 0.18019026301063235, 'fraction_numerical': 0.016787912702853944, 'mean_word_length': 0.8980891719745223, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2829020', 'n_tokens_mistral': 657, 'n_tokens_neox': 599, 'n_words': 159}