Compare commits

..

No commits in common. "4149748766eccc3166877cd334d8bf4ab744e90f" and "d6b170e274ff44a07bb3e07c84b7a1381cf96dd8" have entirely different histories.

4 changed files with 19 additions and 14 deletions

View File

@ -1,6 +1,6 @@
#pragma once
#include <BAN/Optional.h>
#include <stdint.h>
namespace Kernel::ACPI
{

View File

@ -43,21 +43,26 @@ i64 part2(FILE* fp)
BAN::HashMap<i64, i64> lhs;
BAN::HashMap<i64, i64> rhs;
constexpr auto increment_count =
[](auto& map, i64 key) {
auto it = map.find(key);
if (it == map.end())
MUST(map.insert(key, 1));
else
it->value++;
};
for (;;) {
i64 l, r;
if (fscanf(fp, "%" SCNd64 " %" SCNd64 "\n", &l, &r) != 2)
break;
increment_count(lhs, l);
increment_count(rhs, r);
{
auto it = lhs.find(l);
if (it == lhs.end())
MUST(lhs.insert(l, 1));
else
it->value++;
}
{
auto it = rhs.find(r);
if (it == rhs.end())
MUST(rhs.insert(r, 1));
else
it->value++;
}
}
i64 result = 0;

View File

@ -7,7 +7,7 @@ int main()
for (int i = 1; i <= 25; i++)
{
char command[128];
sprintf(command, "/bin/aoc2024/aoc2024_day%d", i);
sprintf(command, "/bin/aoc2024/day%d", i);
struct stat st;
if (stat(command, &st) == -1)

View File

@ -20,7 +20,7 @@ __BEGIN_DECLS
#include <bits/types/locale_t.h>
struct sigevent;
#include <signal.h>
struct tm
{