2024 day 1.

This commit is contained in:
Mikaël Capelle 2024-12-01 10:26:02 +01:00
parent dd8458fa96
commit d1733a5888
78 changed files with 1261 additions and 13 deletions

12
run.ps1
View File

@ -1,12 +0,0 @@
param(
[switch]$Test,
[PSDefaultValue()]
[Parameter(Mandatory = $false)]
$Year = 2023,
[Parameter(Mandatory = $true, Position = 0)]
$Day)
$folder = $Test ? "tests" : "inputs"
$env:AOC_VERBOSE = $VerbosePreference -eq "Continue"
Get-Content ".\$Year\$folder\day$Day.txt" | python ".\$Year\day$Day.py"

View File

View File

@ -0,0 +1,14 @@
import sys
from collections import Counter
values = list(map(int, sys.stdin.read().strip().split()))
column_1 = sorted(values[::2])
column_2 = sorted(values[1::2])
counter_2 = Counter(column_2)
answer_1 = sum(abs(v1 - v2) for v1, v2 in zip(column_1, column_2, strict=True))
answer_2 = sum(value * counter_2.get(value, 0) for value in column_1)
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -0,0 +1,10 @@
import sys
lines = sys.stdin.read().splitlines()
answer_1 = ...
answer_2 = ...
print(f"answer 1 is {answer_1}")
print(f"answer 2 is {answer_2}")

View File

@ -25,7 +25,7 @@ def main():
default=None,
help="input to use (override user and test)",
)
parser.add_argument("-y", "--year", type=int, help="year to run", default=2023)
parser.add_argument("-y", "--year", type=int, help="year to run", default=2024)
parser.add_argument("day", type=int, help="day to run")
args = parser.parse_args()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
3 4
4 3
2 5
1 3
3 9
3 3