Skip to content

Commit 636c4f6

Browse files
committed
Cleanup
1 parent 3f08aba commit 636c4f6

2 files changed

Lines changed: 29 additions & 4 deletions

File tree

aoc/2025/02/02.vn.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Advent of code Day 02
2+
# https://adventofcode.com/2025/day/02
3+
# 02/12/2025
4+
5+
from tqdm.auto import tqdm
6+
7+
with open("input.txt") as f:
8+
inp = list(
9+
map(
10+
lambda l: tuple(map(int, l.split("-"))),
11+
f.readlines()[0].strip().split(","))
12+
)
13+
14+
res1 = 0
15+
res2 = 0
16+
for l, r in tqdm(inp):
17+
for n in range(l, r + 1):
18+
s = str(n)
19+
s1 = s[:len(s)//2]
20+
s2 = s[len(s)//2:]
21+
if s1 == s2:
22+
res1 += n
23+
24+
for p in range(1, len(s)//2 + 1):
25+
if s == s[:p] * (len(s) // p):
26+
res2 += n * (p != len(s))
27+
break
28+
29+
print(res1, res2)

aoc/2025/02/animated/02_animated.vn.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)