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

typedef enum
{
	SUCCESS, FAIL
} Status;

typedef struct Quadratic
{
	float a;
	float b;
	float c;
} Quadratic;

typedef struct Roots
{
	float x1;
	float x2;
} Roots;

Status initializeQuadratic(Quadratic *quad)
{
	quad->a = 0;
	quad->b = 0;
	quad->c = 0;
	return SUCCESS;
}

Status initializeRoots(Roots *roots)
{
	roots->x1 = 0;
	roots->x2 = 0;
	return SUCCESS;
}

Status verifyQuadratic(Quadratic *quad)
{
	if(quad->a == 0)
	{
		printf("'a' must be non-zero");
	}
	else if(quad->b == 0)
	{
		printf("'b' must be non-zero");
	}
	else if(quad->c == 0)
	{
		printf("'c' must be non-zero");
		return FAIL;
	}
	return SUCCESS;
}

Status solveRoots(Quadratic *quad, Roots *roots)
{
	if(quad->b*quad->b - 4*quad->a*quad->c < 0)
	{
		return FAIL;
	}
	roots->x1 = ((-quad->b) - sqrt((quad->b*quad->b)-(4*quad->a*quad->c))) / (2*quad->a);
	roots->x2 = ((-quad->b) + sqrt((quad->b*quad->b)-(4*quad->a*quad->c))) / (2*quad->a);
	return SUCCESS;
}


int main(void)
{
	char buffer[25];
	if(fgets(buffer, sizeof(buffer), stdin) != NULL)
	{
		Quadratic quad;
		initializeQuadratic(&quad);
		quad.a = atof(buffer);
		char *firstSpace = strchr(buffer, ' ');
		quad.b = atof(firstSpace);
		char *secondSpace = strchr(firstSpace+1, ' ');
		quad.c = atof(secondSpace);

		if(verifyQuadratic(&quad) == SUCCESS)
		{
			Roots roots;
			initializeRoots(&roots);

			if(solveRoots(&quad, &roots) == SUCCESS)
			{
				printf("X1: %.1f\n", roots.x1);
				if(roots.x1 != roots.x2)
				{
					printf("X2: %.1f", roots.x2);
				}
			}
			else
			{
				printf("No roots");
				exit(1);
			}
		}
		else
		{
			return(FAIL);
		}
	}
	else
	{
		printf("Invalid input");
		return FAIL;
	}
	return SUCCESS;
}
<commit_msg>Updated stuff<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef enum
{
	SUCCESS, FAIL
} Status;

typedef struct Quadratic
{
	float a;
	float b;
	float c;
} Quadratic;

typedef struct Roots
{
	float x1;
	float x2;
} Roots;

Status initializeQuadratic(Quadratic *quad)
{
	quad->a = 0;
	quad->b = 0;
	quad->c = 0;
	return SUCCESS;
}

Status initializeRoots(Roots *roots)
{
	roots->x1 = 0;
	roots->x2 = 0;
	return SUCCESS;
}

Status verifyQuadratic(Quadratic *quad)
{
	if(quad->a == 0)
	{
		printf("'a' must be non-zero");
		return FAIL;
	}
	else if(quad->b == 0)
	{
		printf("'b' must be non-zero");
		return FAIL;
	}
	else if(quad->c == 0)
	{
		printf("'c' must be non-zero");
		return FAIL;
	}
	return SUCCESS;
}

Status solveRoots(Quadratic *quad, Roots *roots)
{
	if(quad->b*quad->b - 4*quad->a*quad->c < 0)
	{
		return FAIL;
	}
	roots->x1 = ((-quad->b) - sqrt((quad->b*quad->b)-(4*quad->a*quad->c))) / (2*quad->a);
	roots->x2 = ((-quad->b) + sqrt((quad->b*quad->b)-(4*quad->a*quad->c))) / (2*quad->a);
	return SUCCESS;
}

float getFloat(char *string)
{
	char *errorBuffer;
	*errorBuffer = 0;
	float tmp = (float)(strtod(string, &errorBuffer));
	printf("'%c'", *errorBuffer);
	if(*errorBuffer == ' ' || *errorBuffer == '\n' || *errorBuffer == '\0')
	{
		return tmp;
	}
	printf("Invalid input1");
	exit(FAIL);
}

Status getFloats(char *string, Quadratic *quad)
{
	quad->a = getFloat(string);
	char *firstSpace = strchr(string, ' ');
	quad->b = getFloat(firstSpace);
	char *secondSpace = strchr(firstSpace+1, ' ');
	quad->c = getFloat(secondSpace);
	return SUCCESS;
}


int main(void)
{
	char buffer[25];
	if(fgets(buffer, sizeof(buffer), stdin) != NULL)
	{
		Quadratic quad;
		initializeQuadratic(&quad);

		Roots roots;
		initializeRoots(&roots);
		getFloats(buffer, &quad);

		if(verifyQuadratic(&quad) == SUCCESS)
		{
			if(solveRoots(&quad, &roots) == SUCCESS)
			{
				printf("X1: %.1f\n", roots.x1);
				if(roots.x1 != roots.x2)
				{
					printf("X2: %.1f", roots.x2);
				}
			}
			else
			{
				printf("No roots");
				exit(1);
			}
		}
		else
		{
			return(FAIL);
		}
	}
	else
	{
		printf("'%s'Invalid input2", buffer);
		return FAIL;
	}
	return SUCCESS;
}

{'fraction_non_alphanumeric': 0.19807983830217282, 'fraction_numerical': 0.017180394138453764, 'mean_word_length': 3.4633596392333708, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 64, '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': '4144393', 'n_tokens_mistral': 1884, 'n_tokens_neox': 1682, 'n_words': 334}