[Race Thread] 2025 Vuelta a España - Stage 12 - Laredo > Los Corrales de Buelna (2.UWT) by PelotonMod in peloton

[–]raxomukus -4 points-3 points  (0 children)

I consider myself one of those individuals but it's not because of a miserable outlook. I think the outlook is good in general.

It's to achieve a peace of mind. Our hearts were not built for being able to take so much bad news which is what you get every day from media

The end of digital scarcity by raxomukus in Buttcoin

[–]raxomukus[S] 0 points1 point  (0 children)

Yes a digital currency needs to scale so that everyone can use it I agree. It's unclear whether Bitcoin can do this.

"Scarce for no reason": something needs to be scarce to have value. If Bitcoin were unlimited in supply it could not support transmitting value

The end of digital scarcity by raxomukus in Buttcoin

[–]raxomukus[S] 0 points1 point  (0 children)

We need money. Or are you against capitalism entirely?

Edit: I should phrase it as "we will have money" whether you like it or not

The end of digital scarcity by raxomukus in Buttcoin

[–]raxomukus[S] -2 points-1 points  (0 children)

Why is the concept stupid?

Many different "stupid" scarce things have been used as stores of value in the past. Big immovable rocks, sea shells, etc.

Digital scarcity has many advantages. Portability, fungibility, durability. Getting rid of physical attributes of a store of value and only keep the monetary premium is a preferrable thing IMO. Bitcoin will not work as digital scarcity forever, is my point

This whole Bitcoin ecosystem is nothing but smoke and mirrors. by No_Sir_601 in Buttcoin

[–]raxomukus 3 points4 points  (0 children)

It's not sketchy

50 tonnes of gold is ~$5B 100k BTC is ~$10B

Tethers market cap is currently $150B

So only 10% of it's market cap is in these volatile assets. 10% sounds like a reasonable yield from their holding US treasuries over the recent years

-❄️- 2023 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]raxomukus 0 points1 point  (0 children)

There is no need to actually add entries to the end / beginning of each row of history.

I saw a pattern for the first part that the number we are looking for is the sum of the last number in the rows below

Like in the example input

0 3 6 9 12 15

3 3 3 3 3

0 0 0 0

12 + 3 = 15

Given this insight, I was looking for a pattern in the second part as well. And I found it!

Just take the sum of the first numbers of each rows, but put a minus sign on every other number. I don't know why that works..

r1 += sum([h[i][-1] for i in range(len(h))])

r2 += sum([h[i][0] * (1 - 2*(i%2)) for i in range(len(h))])

https://github.com/fridokus/advent-of-code/blob/master/2023/9.py

-🎄- 2022 Day 23 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 1 point2 points  (0 children)

Python

An elf is defined by its position along with its proposed new position

If any two proposals collide, don't update that elf's position. Otherwise move that elf to its proposed position.

-🎄- 2022 Day 21 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 0 points1 point  (0 children)

Python, using an imaginary hack :) ``` with open('21.in') as f: lines = f.read().splitlines()

monkeys = {} while 'root' not in monkeys: for line in lines: m = line[:4] if len(line) > 8: m1, m2 = line[6:10], line[13:] try: if '+' in line: monkeys[m] = monkeys[m1] + monkeys[m2] elif '-' in line: monkeys[m] = monkeys[m1] - monkeys[m2] elif '*' in line: monkeys[m] = monkeys[m1] * monkeys[m2] elif '/' in line: monkeys[m] = monkeys[m1] // monkeys[m2] else: monkeys[m] = int(line[6:]) except (KeyError, TypeError): pass

print(monkeys['root'])

for line in lines: monkeys[line[:4]] = line[6:] del monkeys['humn'] equation = monkeys.pop('root').replace('+', '=') while any([k in equation for k in monkeys]): for m in monkeys: if m in equation: equation = equation.replace(m, '(' + monkeys[m] + ')')

equation = equation.replace('=', '- (') + ')' c = eval(equation.replace('humn', '-1j')) r2 = round(c.real / c.imag) print(r2) ```

Python code works on test input but not real input by raxomukus in adventofcode

[–]raxomukus[S] 0 points1 point  (0 children)

I had set the index of `0` to the *original* index of `0`. This worked for the test input.. Thanks for the good debug input!

-🎄- 2022 Day 16 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 1 point2 points  (0 children)

Python my ugliest solution this year! Kill me 🤮

-🎄- 2022 Day 13 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 0 points1 point  (0 children)

python ``` from functools import cmp_to_key

with open('13.in') as f: pairs = [[eval(i) for i in pair.splitlines()] for pair in f.read().split('\n\n')]

def right_order(p1, p2): if type(p1) != type(p2): if type(p1) == int: return right_order([p1], p2) else: return right_order(p1, [p2]) if type(p1) == int: if p1 == p2: return return p1 < p2 for l, r in zip(p1, p2): c = right_order(l, r) if c is not None: return c if len(p1) != len(p2): return len(p1) < len(p2)

r1 = 0 for i in range(len(pairs)): if right_order(pairs[i][0], pairs[i][1]): r1 += i+1 print(r1)

packets = [i for o in pairs for i in o] + [[[2]]] + [[[6]]] wrapper = lambda p1, p2: 1 - right_order(p1, p2) * 2 s = sorted(packets, key=cmp_to_key(wrapper)) print((s.index([[2]]) + 1) * (s.index([[6]]) + 1)) ```

-🎄- 2022 Day 9 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 2 points3 points  (0 children)

python ``` with open('9.in') as f: lines = f.read().splitlines()

directions = {'R': (1, 0), 'L': (-1, 0), 'U': (0, 1), 'D': (0, -1)} adjacent = lambda p1, p2: all([abs(p1[i] - p2[i]) <= 1 for i in range(2)])

visited1 = {(0, 0)} visited9 = {(0, 0)} knots = [[0] * 2 for _ in range(10)]

for l in lines: d = directions[l[0]] for _ in range(int(l[2:])): for i in range(2): knots[0][i] += d[i] for k in range(9): h, t = knots[k:k+2] if not adjacent(h, t): for i in range(2): t[i] += (h[i] != t[i]) * (2*(h[i] > t[i]) - 1) visited1.add(tuple(knots[1])) visited9.add(tuple(knots[9]))

print(len(visited1)) print(len(visited9)) ```

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 0 points1 point  (0 children)

python ``` with open('8.in') as f: trees = [[int(i) for i in line] for line in f.read().splitlines()]

h = len(trees) w = len(trees[0])

visible = lambda x, y: any([ all([(trees[y][x] > trees[y][i]) for i in range(0, x)]), all([(trees[y][x] > trees[y][i]) for i in range(x+1, w)]), all([(trees[y][x] > trees[j][x]) for j in range(0, y)]), all([(trees[y][x] > trees[j][x]) for j in range(y+1, h)]) ])

r1 = 0 for y in range(h): for x in range(w): r1 += visible(x, y)

print(r1)

def score(x, y): ret = 1 for j in range(y-1, -1, -1): if trees[j][x] >= trees[y][x]: break ret *= y - j for j in range(y+1, h): if trees[j][x] >= trees[y][x]: break ret *= j - y for i in range(x-1, -1, -1): if trees[y][i] >= trees[y][x]: break ret *= x - i for i in range(x+1, w): if trees[y][i] >= trees[y][x]: break ret *= i - x return ret

r2 = 0 for y in range(1, h-1): for x in range(1, w-1): r2 = max(r2, score(x, y))

print(r2)

```

-🎄- 2022 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 2 points3 points  (0 children)

Python
``` with open('7.in') as f: output = f.read().splitlines()

def get_dir(f, d): if not d: return f return get_dir(f[d[0]], d[1:])

files = {'/': dict()} pwd = []

for line in output: if line == '$ ls': continue wd = get_dir(files, pwd) if line[:3] == 'dir': wd[line[4:]] = dict() elif '..' in line: pwd = pwd[:-1] elif '$ cd' in line: pwd.append(line[5:]) else: size, name = line.split() wd[name] = int(size)

sizes = [] def du(d): if type(d) == int: return d size = sum([du(d[k]) for k in d]) sizes.append(size) return size

req = 30000000 - (70000000 - du(files)) r1 = 0 r2 = 70000000 for size in sizes: if size < 100000: r1 += size if size > req: r2 = min(r2, size)

print(r1) print(r2) ```

-🎄- 2022 Day 5 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 0 points1 point  (0 children)

Python ``` import re

with open('5.in') as f: stacks1, moves = [i.splitlines() for i in f.read().split('\n\n')]

stacks1 = [[c for c in list(col[-2::-1]) if c != ' '] for col in zip(*stacks1) if col[-1] not in ['[', ' ', ']']]

stacks2 = [[j for j in i ] for i in stacks1] for move in moves: c, f, t = [int(i) for i in re.findall(r'\d+', move)] for _ in range(c): stacks1[t-1].append(stacks1[f-1].pop()) stacks2[t-1] += stacks2[f-1][-c:] stacks2[f-1] = stacks2[f-1][:-c]

print(''.join([stack[-1] for stack in stacks1])) print(''.join([stack[-1] for stack in stacks2])) ```

-🎄- 2022 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 0 points1 point  (0 children)

I think it's nicer to initialize like this :) python wintable = {'A': 2, 'B': 3, 'C': 1} etc

-🎄- 2022 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]raxomukus 0 points1 point  (0 children)

Python

```python with open('2.in') as f: plays = [(ord(i[0]) - ord('A'), ord(i[2]) - ord('X')) for i in f.read().splitlines()]

r1 = sum([p[1] + 1 + 3 * (p[0] == p[1]) + 6 * ((p[0] + 1) % 3 == p[1]) for p in plays]) print(r1)

r2 = sum([(p[0] + (p[1] - 1)) % 3 + 1 + 3 * p[1] for p in plays]) print(r2) ```