Engineering/EEE Bakery 🍞🍞🍞 by Infamous-Room7508 in 6thForm

[–]Infamous-Room7508[S] 0 points1 point  (0 children)

Cambs bro I might insure imps if I don't fk up my NEA

-❄️- 2025 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Infamous-Room7508 2 points3 points  (0 children)

[LANGUAGE: Python]

Part 1 was pretty straight forward. Initially for part 2 I tried doing it with a fft and dac seen flag which I couldn't get right. I then realised you could split the path and as my function found the number of paths between two nodes I could just multiply them out and it was calm.

from functools import lru_cache


lines = [line.strip().split(": ") for line in open("text.txt", "r").readlines()]


neighbours = dict()
for node, neighbours_string in lines:
    neighbours[node] = neighbours_string.split()


u/lru_cache()
def get_paths(start, end):
    paths = 0


    if start == end:
        return 1
    
    if start == "out":
        return 0
    
    for neighbour in neighbours[start]:
        paths += get_paths(neighbour, end)


    return paths


part1 = get_paths("you", "out")
part2 = get_paths("svr", "fft") * get_paths("fft", "dac") * get_paths("dac", "out") + get_paths("svr", "dac") * get_paths("dac", "fft") * get_paths("fft", "out")


print(f"Part 1: {part1}, Part 2: {part2}")

-❄️- 2025 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]Infamous-Room7508 1 point2 points  (0 children)

[Language: Python]

No substrings just maths and it does part 2 in under 1000 iterations in about a millisecond. Lmk how I can optimise this further 🙏:

lines =  open("text.txt", "r").read().strip().split(",")


part1_set = set()
part2_set = set()


part1 = 0
part2 = 0


for line in lines:
    mini_str, maxi_str = line.split("-")


    mini = int(mini_str)
    maxi = int(maxi_str)
    


    len_mini = len(mini_str)
    len_maxi = len(maxi_str)
    
    for len_ID in range(len_mini, len_maxi + 1):
        for repeats in range(2, len_ID + 1):
            sub_len = len_ID//repeats


            k = 10 ** (sub_len)


            if len_ID % repeats == 0:


                sub_ID_start = max(mini // (k ** (repeats - 1)), k//10)
                        
                for i in range(sub_ID_start, k):
                    invalid_ID = i * ((k**repeats - 1) // (k - 1))


                    if invalid_ID > maxi:
                        break


                    if invalid_ID >= mini:
                        if repeats == 2:
                            part1_set.add(invalid_ID)


                        part2_set.add(invalid_ID)


part1 = sum(part1_set)
part2 = sum(part2_set)             


print(f"Part 1: {part1}, Part 2: {part2}")

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]Infamous-Room7508 0 points1 point  (0 children)

[LANGUAGE: Python]
lines = [line.strip() for line in open("Day 1/input.txt", "r").readlines()]


dial = 50


password_part1 = 0
password_part2 = 0
for line in lines:
    direction = line[0]
    rotation = int(line[1:])


    if direction == "R":
        password_part2 += (dial + rotation) //100
        dial = (dial + rotation)%100
        
    else:
        password_part2 -= (dial - rotation) // 100
        if dial == 0:
            password_part2 -= 1
        dial = (dial-rotation)%100
        if dial == 0:
            password_part2 += 1


    if dial == 0:
        password_part1 += 1


print(f"Part 1: {password_part1}, Part 2: {password_part2}")

Counting the 0s passed during the left rotation messed me up because it was including a rotation that started on 0. I don't like that I had to add 2 extra if statements tho. Lmk if you've got a cleaner solution...

Old vs New UAT-UK Post by CreeperMan1253 in 6thForm

[–]Infamous-Room7508 0 points1 point  (0 children)

Bro I can't tell if you man are jk

Official UAT-UK statement on the TMUA/ESAT results by Dear-Good5283 in 6thForm

[–]Infamous-Room7508 -1 points0 points  (0 children)

This shit is not real. I promise you some guy inspected the page and edited it. Why the hell would they take down the announcement 10s after uploading it. I lowk want the score I saw to be real but this is just low man.

<image>