2024 day 1.
This commit is contained in:
parent
def4305c1c
commit
4dd2d5d9c9
12
run.ps1
12
run.ps1
@ -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"
|
0
src/holt59/aoc/2024/__init__.py
Normal file
0
src/holt59/aoc/2024/__init__.py
Normal file
14
src/holt59/aoc/2024/day1.py
Normal file
14
src/holt59/aoc/2024/day1.py
Normal 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}")
|
10
src/holt59/aoc/2024/day10.py
Normal file
10
src/holt59/aoc/2024/day10.py
Normal 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}")
|
10
src/holt59/aoc/2024/day11.py
Normal file
10
src/holt59/aoc/2024/day11.py
Normal 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}")
|
10
src/holt59/aoc/2024/day12.py
Normal file
10
src/holt59/aoc/2024/day12.py
Normal 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}")
|
10
src/holt59/aoc/2024/day13.py
Normal file
10
src/holt59/aoc/2024/day13.py
Normal 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}")
|
10
src/holt59/aoc/2024/day14.py
Normal file
10
src/holt59/aoc/2024/day14.py
Normal 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}")
|
10
src/holt59/aoc/2024/day15.py
Normal file
10
src/holt59/aoc/2024/day15.py
Normal 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}")
|
10
src/holt59/aoc/2024/day16.py
Normal file
10
src/holt59/aoc/2024/day16.py
Normal 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}")
|
10
src/holt59/aoc/2024/day17.py
Normal file
10
src/holt59/aoc/2024/day17.py
Normal 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}")
|
10
src/holt59/aoc/2024/day18.py
Normal file
10
src/holt59/aoc/2024/day18.py
Normal 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}")
|
10
src/holt59/aoc/2024/day19.py
Normal file
10
src/holt59/aoc/2024/day19.py
Normal 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}")
|
10
src/holt59/aoc/2024/day2.py
Normal file
10
src/holt59/aoc/2024/day2.py
Normal 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}")
|
10
src/holt59/aoc/2024/day20.py
Normal file
10
src/holt59/aoc/2024/day20.py
Normal 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}")
|
10
src/holt59/aoc/2024/day21.py
Normal file
10
src/holt59/aoc/2024/day21.py
Normal 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}")
|
10
src/holt59/aoc/2024/day22.py
Normal file
10
src/holt59/aoc/2024/day22.py
Normal 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}")
|
10
src/holt59/aoc/2024/day23.py
Normal file
10
src/holt59/aoc/2024/day23.py
Normal 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}")
|
10
src/holt59/aoc/2024/day24.py
Normal file
10
src/holt59/aoc/2024/day24.py
Normal 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}")
|
10
src/holt59/aoc/2024/day25.py
Normal file
10
src/holt59/aoc/2024/day25.py
Normal 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}")
|
10
src/holt59/aoc/2024/day3.py
Normal file
10
src/holt59/aoc/2024/day3.py
Normal 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}")
|
10
src/holt59/aoc/2024/day4.py
Normal file
10
src/holt59/aoc/2024/day4.py
Normal 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}")
|
10
src/holt59/aoc/2024/day5.py
Normal file
10
src/holt59/aoc/2024/day5.py
Normal 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}")
|
10
src/holt59/aoc/2024/day6.py
Normal file
10
src/holt59/aoc/2024/day6.py
Normal 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}")
|
10
src/holt59/aoc/2024/day7.py
Normal file
10
src/holt59/aoc/2024/day7.py
Normal 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}")
|
10
src/holt59/aoc/2024/day8.py
Normal file
10
src/holt59/aoc/2024/day8.py
Normal 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}")
|
10
src/holt59/aoc/2024/day9.py
Normal file
10
src/holt59/aoc/2024/day9.py
Normal 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}")
|
@ -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()
|
||||
|
1000
src/holt59/aoc/inputs/holt59/2024/day1.txt
Normal file
1000
src/holt59/aoc/inputs/holt59/2024/day1.txt
Normal file
File diff suppressed because it is too large
Load Diff
0
src/holt59/aoc/inputs/holt59/2024/day10.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day10.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day11.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day11.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day12.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day12.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day13.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day13.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day14.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day14.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day15.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day15.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day16.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day16.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day17.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day17.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day18.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day18.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day19.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day19.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day2.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day2.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day20.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day20.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day21.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day21.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day22.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day22.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day23.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day23.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day24.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day24.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day25.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day25.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day3.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day3.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day4.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day4.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day5.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day5.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day6.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day6.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day7.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day7.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day8.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day8.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day9.txt
Normal file
0
src/holt59/aoc/inputs/holt59/2024/day9.txt
Normal file
6
src/holt59/aoc/inputs/tests/2024/day1.txt
Normal file
6
src/holt59/aoc/inputs/tests/2024/day1.txt
Normal file
@ -0,0 +1,6 @@
|
||||
3 4
|
||||
4 3
|
||||
2 5
|
||||
1 3
|
||||
3 9
|
||||
3 3
|
0
src/holt59/aoc/inputs/tests/2024/day10.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day10.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day11.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day11.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day12.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day12.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day13.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day13.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day14.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day14.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day15.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day15.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day16.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day16.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day17.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day17.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day18.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day18.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day19.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day19.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day2.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day2.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day20.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day20.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day21.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day21.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day22.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day22.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day23.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day23.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day24.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day24.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day25.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day25.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day3.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day3.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day4.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day4.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day5.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day5.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day6.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day6.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day7.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day7.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day8.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day8.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day9.txt
Normal file
0
src/holt59/aoc/inputs/tests/2024/day9.txt
Normal file
Loading…
Reference in New Issue
Block a user