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

clock_t begin, end;
double time_spent;

void reverse_string(char *str){
    // skip null
    if (str == 0){ return; }
    // skip empty string
    if (*str == 0){ return; }
    // get range
    char *start = str;
    char *end = start + strlen(str) - 1; // -1 for \0
    char temp;
    // reverse
    while (end > start){
    	temp = *start;
    	*start = *end;
    	*end = temp;
    	++start;
    	--end;
    }
}

int is_palindrome_number(int n){
  char n_str[10], r_str[10];
  snprintf(n_str, sizeof(n_str), "%d", n); // convert int to str
  snprintf(r_str, sizeof(r_str), "%d", n);
  reverse_string(0);
  reverse_string(r_str);
  if(strcmp(n_str, r_str) == 0){
    return 0;
  }else{
    return -1;
  }
}

int main(int argc, char *argv[]){
  begin = clock();

  int x, y, v, largest_number;
  for(x = 100; x < 999; x++){
    for(y = 100; y < 999; y++){
      v = x * y;
      if(v > largest_number){
        if(is_palindrome_number(v) == 0){
          largest_number = v;
        }
      }
    }
  }

  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;

  printf("=> Result: %d\n", largest_number);
  printf("=> Time: %fs\n", time_spent);
}<commit_msg>Improves C solution of problem 4<commit_after>#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

clock_t begin, end;
double time_spent;

int is_palindrome(int n){
	char n_str[10];
	snprintf(n_str, sizeof(n_str), "%d", n); // convert int to str
	
	int length = strlen(n_str);
	int start, end, middle;
	
	end = length - 1;
	middle = length / 2;
	
	for(start = 0; start < middle; start++){
		if(n_str[start] != n_str[end]){
			break;
		}
		end--;
	}

	if(start == middle)
		return 0;
		
	return -1;
}

int main(int argc, char *argv[]){
	begin = clock();
	
	int x, y, v, largest_number;
  
    for(x = 100; x < 999; x++){
      for(y = 100; y < 999; y++){
        v = x * y;
        if(v > largest_number && is_palindrome(v) == 0){
            largest_number = v;
          }
        }
      }

  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;

  printf("=> Result: %d\n", largest_number);
  printf("=> Time: %fs\n", time_spent);
}
{'fraction_non_alphanumeric': 0.17817371937639198, 'fraction_numerical': 0.02093541202672606, 'mean_word_length': 2.5764331210191083, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 18, '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': '1508305', 'n_tokens_mistral': 951, 'n_tokens_neox': 885, 'n_words': 233}