#include #include #include #include #include #include #include #include #include char input[] = { #embed "input.txt" ,'\0' // null terminator }; int width = 0; int height = 0; uint64_t result = 0; uint64_t parseNum(char* str){ int i = 0; while(str[i] == ' '){ i++; } uint64_t out = 0; while(str[i] != ' ' && str[i] != '\n'){ //printf("%c", str[i]); out += str[i]-0x30; out *= 10; i++; } out /=10; return out; } int main(int argc, char *argv[]){ clock_t start, end; start = clock(); while(input[width] != '\n'){ width++; } printf("width: %d\n", width); //parse ranges first int i = 0; int lines = 0; while(input[i+1] != 0){ lines++; i+=(width+1); } char* symbols = input+(width+1)*(lines-1); printf("line count: %d\n", lines); printf("symbols:\n%s\n", symbols); printf("parsing the first number: %lu\n", parseNum(input+8)); int parse_length = 1; uint64_t col_res; while(*symbols != 0){ while(symbols[parse_length] == ' ' || symbols[parse_length] == '\n'){ parse_length++; } parse_length--; printf("parsing %d long numbers\n", parse_length); if(*symbols == '*'){ col_res = 1; printf("multiplying....\n"); for(int i = 1; i