#include #include char *load_input() { FILE *fp = fopen("input.txt", "r"); fseek(fp, 0L, SEEK_END); int sz = ftell(fp); rewind(fp); char *data_buffer = malloc((sz + 1) * sizeof(char)); fread(data_buffer, sz, 1, fp); data_buffer[sz] = 0; fclose(fp); return data_buffer; } InputWithSize *load_input_with_size() { FILE *fp = fopen("input.txt", "r"); fseek(fp, 0L, SEEK_END); int sz = ftell(fp); rewind(fp); char *data_buffer = malloc((sz + 1) * sizeof(char)); fread(data_buffer, sz, 1, fp); data_buffer[sz] = 0; fclose(fp); InputWithSize *input_with_size = malloc(sizeof(InputWithSize)); input_with_size->size = sz + 1; input_with_size->data_buffer = data_buffer; return input_with_size; } void free_input_with_size(InputWithSize *input_with_size) { free(input_with_size -> data_buffer); free(input_with_size); } void print_binary(int q) { char c[33] = {0}; for (int i = 0; i < 32; i++) { c[i] = q & (1<