Advent of Code

Diff
Login

Diff

Differences From Artifact [6878e59665]:

To Artifact [ccb46b8722]:


1
2
3
4
5
6
7
8

9
10

11
12

13
14


15
16
17








18
19
20
21
22
23
24
1
2
3
4
5
6
7

8

9
10
11
12
13


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33







-
+
-

+


+
-
-
+
+



+
+
+
+
+
+
+
+







#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "aocdailies.h"
#include "aocutils.h"

void aoc201504(char *data, size_t len) {
    (void)len; // unused argument
    data[--len] = 0; // remove newline, adjust `len`
    unsigned extra = 1;
    char longkey[128];
    unsigned extra = 1;
    for (;;) {
        sprintf(longkey, "%s%u", data, extra);
        unsigned char tmp[16];
        //md5(longkey);
        if (1) break;
        md5mini(tmp, longkey);
        if ((tmp[0] == 0) && (tmp[1] == 0) && (tmp[2] < 16)) break;
        extra++;
    }
    printf("Follow your key with %u to obtain five zeroes\n", extra);
    for (;;) {
        sprintf(longkey, "%s%u", data, extra);
        unsigned char tmp[16];
        md5mini(tmp, longkey);
        if ((tmp[0] == 0) && (tmp[1] == 0) && (tmp[2] == 0)) break;
        extra++;
    }
    printf("Follow your key with %u to obtain six zeroes\n", extra);
}

struct House {
    int row, col;
};

void aoc201503(char *data, size_t len) {