idk how to do multi line spoilers lol
letters = ['','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
total_score = 0
team = []
for line in open("input.txt"):
team.append(line.strip())
for i in range(2, len(team), 3):
for letter in team[i]:
if letter in team[i-2] and letter in team[i-1]:
total_score += letters.index(letter)
break
print(total_score)
some real caveman shit but it works
Jump in the discussion.
No email address required.
here's my... verbose solution (debugging code
removed)
Jump in the discussion.
No email address required.
I love the marsify inserts lmao
rdrama turing complete when
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
Hello World:
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Does nobody know what a set is?
Jump in the discussion.
No email address required.
A set is a list that doesn’t have any duplicates in it.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Imagine not doing it in k you fucking retards:
Le edit: WHY DOES CODEBLOCKS HAVE EMOJIS ENABLED
@Jinglevann YOU FUCKING RETARD NO WONDER YOU CODE IN PYTHON
Jump in the discussion.
No email address required.
fixed, rude BIPOC
Jump in the discussion.
No email address required.
Thank you cutie sorry I was drunk when I solved and then wrote that.![:marseycapylove: :marseycapylove:](/e/marseycapylove.webp)
Jump in the discussion.
No email address required.
its okay bb![:marseylove: :marseylove:](/e/marseylove.webp)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
still borked in preview : shows shit like
<img class="emoji " src="/e/3.webp">
, but the post itself is fineJump in the discussion.
No email address required.
fixed king
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
Jump in the discussion.
No email address required.
More options
Context
Jump in the discussion.
No email address required.
More options
Context
what's the big O of that?
Jump in the discussion.
No email address required.
If you can't tell from just looking at it, Arthur Whitney will die.![:marseysulk: :marseysulk:](/e/marseysulk.webp)
Jump in the discussion.
No email address required.
i really can't man, that's y I asked.
is this o(n) or worse?
cause if it's worse, alan will roll over in is grave WHEN WILL THE INHUMANITY EVER END?!![:marseydizzy: :marseydizzy:](/e/marseydizzy.webp)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Hi
@dart200,
Your comment has been automatically removed because you forgot to include
trans lives matter
.Don't worry, we're here to help! We won't let you post or comment anything that doesn't express your love and acceptance towards the trans community. Feel free to resubmit your comment with
trans lives matter
included.This is an automated message; if you need help, you can message us here.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
sum([' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.find(asdasd) for asdasd in [next(iter(set(chuck[0]).intersection(chuck[1]))) for chuck in [(sneed[int(len(sneed)/2):], sneed[:int(len(sneed)/2)]) for sneed in [line.strip('\n') for line in open('input').readlines()]]]])
sum([" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".find(chuck) for chuck in [next(iter(set(sneed[0]).intersection(sneed[1], sneed[2]))) for sneed in [open('input').read().split('\n')[:-1][i:i+3] for i in range(0, len(open('input').readlines()[:-1]), 3)]]])
Jump in the discussion.
No email address required.
More options
Context
Part 1:
Jump in the discussion.
No email address required.
did a
steal your enter key?
Jump in the discussion.
No email address required.
More options
Context
Part 2:
There's probably a one-liner for chunking
file.readlines()
while only reading the file once (probably somewhere in itertools), but I'm done for today.Part 1 using modulus and removing a few unnecessary iterator-to-list conversions:
Jump in the discussion.
No email address required.
I'm glad I wasn't the only one who had to open the file twice. Felt like it was dumb just to get the file length
but I guess you gotta
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Darn btfo my 1 liner
Jump in the discussion.
No email address required.
More options
Context
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Basically the same as Geese's grugbrained tbh. … ALSO: Once again wondering who 986674 and 2339424 are![:marseypregunta: :marseypregunta:](/e/marseypregunta.webp)
Jump in the discussion.
No email address required.
I keep setting ORD values using absolute numbers because I'm r-slurred and forget I can feed the char itself in. I'm hoping seeing you do it properly will shock some sense into me.
Jump in the discussion.
No email address required.
More options
Context
i am 2339424
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Jump in the discussion.
No email address required.
i think ord is the wrong way around. caps are first in ASCII but in advent of code they are last.
theoretically you could do this
result is numbers 1-52
Jump in the discussion.
No email address required.
More options
Context
it looks r-slurred but it was the first thing i thought of and I already have macros set up for the quoting and changing the case so it only really took as long as typing out the lowercase alphabet
looking back i should have just made it a string and saved on the commas
Jump in the discussion.
No email address required.
More options
Context
More options
Context
First 3 days in GNU APL:
Jump in the discussion.
No email address required.
genuinely keep yourself safe
Jump in the discussion.
No email address required.
More options
Context
What the god darn heck is going on here
Also whatever this is someone do it in Haskell so I spend five hours looking at it just to get more and more and more pissed off at having the wrong flavour of autism
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
Sigh
There are people in the world who would look at that and say how beautiful and elegant it is
It just makes me seethe
I really don't know how they manage to visualise it all in their heads without getting lost
Jump in the discussion.
No email address required.
It's similar to people who think Common Lisp is pretty. It's really just a very acquired taste, and IMO i doubt many people these days really think it looks pretty and just fake it.
Lisp looks fricking ugly as heck lol, and it's unusable without a good text editor (Emacs usually), which, in my honest opinion, is a sign of an imperfect language if you need another tool to even write it effectively. Yet I see lots of neurodivergents saying it's like the Mona Lisa of programming languages (its functionally cool in theory, but it still looks fricking ugly)
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
sexp lole! xD xP shits all over the carpet
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Nice bait![:marseyclapping: :marseyclapping:](/e/marseyclapping.webp)
Jump in the discussion.
No email address required.
it is a remarkable text editor![:marseyhappytears: :marseyhappytears:](/e/marseyhappytears.webp)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
I had to learn it for one of my classes it was so gay and Jewish
Jump in the discussion.
No email address required.
More options
Context
It isn't one I've encountered. I have a degree in Computer Science but I'm not rabidly enthusiastic about the subject enough to have tried every single language there is like some people seem to do.
To me, it's like... I'll pick from the box that will let me get the job done in the simplest and most effective manner. Most of the time that's going to be whatever's currently most popular in the sector you're targeting because that's where you'll find the most supportive/active community and the largest variety of libraries and examples. When you're pushing into performance limited areas or going from a prototype to something business you might want to refactor for something more performant or more optimised for that specific type of processing.
I don't really get these people who always want to be working with the absolute bleeding edge language and who are always evangelizing it. It just seems so exhausting.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
Jump in the discussion.
No email address required.
More options
Context
what the frick is ⍝
Jump in the discussion.
No email address required.
sus
Jump in the discussion.
No email address required.
More options
Context
More options
Context
How the FRICK do you and the K guy who posted earlier understand this shit?!
Jump in the discussion.
No email address required.
Just for you, day 3:
Evaluation is simple (right to left, no priority BS) so writing one-liners comes naturally. Much easier to keep track of than half the answers itt triggering longpostbot.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
mine was similar
Jump in the discussion.
No email address required.
intersection()-cels rise up.
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
zoz
Jump in the discussion.
No email address required.
zle
Jump in the discussion.
No email address required.
zozzle
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
c++ Part one
Part two
Maybe i should just have just taken the o(n^2) pill and do it with 'in'.
Jump in the discussion.
No email address required.
congrats on using a sane language that dosent store everything in unicode by default![:marseycry: :marseycry:](/e/marseycry.webp)
Jump in the discussion.
No email address required.
More options
Context
Dont initialize your integers like that, it makes you look like a total fu cking tool. Also, use size_t and ++i in your for loop.
Jump in the discussion.
No email address required.
you're the reason c++ has namespaces
Jump in the discussion.
No email address required.
Dude, C++ is on a 3-year cycle, C++17, C++20, C++23. SMH my head plebs pretending to know shit.
Primitive initialization has different behaviors than classes, so there's no reason you need to treat them the same way, even stylistically.
Also, the bigger issue is that awful noob-like for loop that borders on being wrong, not just stylistic differences.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Amazing parsing of code
Jump in the discussion.
No email address required.
More options
Context
you're fricking bananas if you think I'm reading all that, take my downmarsey and shut up idiot
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Still pretty easy, these get hard in week two right? I've usually forgotten that I've sworn that it was definitely happening this year by then. Can't get the code formatting right so I'm pasting the screenshot.
Jump in the discussion.
No email address required.
Me in week 1: "that was fun, my only regret is that it was a bit too short"
Me in week 3: "please make it stop I can't take it anymore"
Jump in the discussion.
No email address required.
More options
Context
More options
Context
LONG POST ALERT, I'm actually kind of proud of the "contains" subfunction
Jump in the discussion.
No email address required.
Jesse what the frick are you talking about??
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Jump in the discussion.
No email address required.
More options
Context
Lol imagine using (((python)))
Jump in the discussion.
No email address required.
the rankings are based on how quick u are, using a scripting language is the obvious choice
Jump in the discussion.
No email address required.
I hate scripting languages![:marseysad: :marseysad:](/e/marseysad.webp)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
is that even faster
Jump in the discussion.
No email address required.
No
Jump in the discussion.
No email address required.
just curious, I'm not really interested
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
s://youtube.com/
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
Allah help me I have once again done some retarded shit
Jump in the discussion.
No email address required.
More options
Context
alright guys, here's my enterprise grade, production ready, world deployable ts answer. notice how type safe it is.
PART 2, no declared vars. so
let
's get crunkJump in the discussion.
No email address required.
This is pretty cool.
Jump in the discussion.
No email address required.
is it very cool.
for maximum coolness, make sure to do it whenever and wherever possible.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Anyone else doing javascript?
Jump in the discussion.
No email address required.
More options
Context
trying to learn python
and part two:
Jump in the discussion.
No email address required.
More options
Context
Frick me, man...
Shouldn't have used sets
Edit:
Fixed it up a bit
Jump in the discussion.
No email address required.
jeez, and this is what they want to write linux out of next?
Jump in the discussion.
No email address required.
It's not usually this bad, this is just me being r-slurred
Jump in the discussion.
No email address required.
yeah man, maybe u should have just used a lookup array? tho, idk wtf ur doing really, so yeah.
Jump in the discussion.
No email address required.
For every 3 lines:
one by one split them in half, put each half's characters in a set, find the set intersection i.e. the character that's present in both halves and get its value
take all 3 lines and find the character that's present in all 3 also using sets and get its value
the values get summed up in their respective variables, sum and sum2
It's a bit difficult if you don't know functional programming.
Also cleaned it up a bit:
Jump in the discussion.
No email address required.
fuk man, i wrote my solution in about 10 lines using js split and reduce, with one hashmap. if that's not "functional", then idc for whatever functional is.
but what ur doing is ... u don't need to put the 2nd half in another hashmap just so u can use builtins to find the intersection between the two, lol. u can just iterate over the 2nd half and as soon as u find a character in the hashmap of the 1st half .... that's ur "intersetion". i suppose the built-ins do that for u, but it doesn't look easier to me, and ur creating excess data structures.
but (2) is even more mind boggling. once u have the set intersection, that should be one character, and why do u ever need to make sure it's present in all 3?
Jump in the discussion.
No email address required.
Well yeah, I could've but at this point it's a difference of a couple of lines at most so w/e.
Because that's the point of the puzzle?
In their example 'r' was the solution but if I did what you say, I'd also get 'f'
Jump in the discussion.
No email address required.
if only the problem was a couple extra lines.
and the insection itself guarantees it's in both sets, already. are r u doing additional searches to find something already known?
Jump in the discussion.
No email address required.
I'm not doing any additional searches, after the first intersection, the resulting set only has a few characters. That set is then intersected with the third one. It's not like I'm doing a triple for loop.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
Hi
@dart200,
Your comment has been automatically removed because you forgot to include
trans lives matter
.Don't worry, we're here to help! We won't let you post or comment anything that doesn't express your love and acceptance towards the trans community. Feel free to resubmit your comment with
trans lives matter
included.This is an automated message; if you need help, you can message us here.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
So easy with real languages
https://fsdfsd.net/cyberdick/AdventOfCode2022/src/branch/master/AOC2022/Puzzles/Day3.cs
Jump in the discussion.
No email address required.
More options
Context
Commented out code is from part 1. I'm gonna be so fricked if I keep writing code like this when it gets difficult lmao
Jump in the discussion.
No email address required.
More options
Context
Part 1:
Jump in the discussion.
No email address required.
Part 2:
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Late submission, but I was recovering from a hangover from a party last night so meh.
Jump in the discussion.
No email address required.
More options
Context
Euro Times.... Cant compete but do it any way:
Jump in the discussion.
No email address required.
More options
Context
Jump in the discussion.
No email address required.
that's a pretty cool way to iterate over chunks, will steal
Jump in the discussion.
No email address required.
More options
Context
More options
Context
ruby is a wonderful language and so much more pleasant to script in than python
Jump in the discussion.
No email address required.
More options
Context
Cursed Perl
I only did the first bit for now. Enjoy
Jump in the discussion.
No email address required.
More options
Context
That's one genuinely cool woman.
Jump in the discussion.
No email address required.
More options
Context
didn't see the thread, here's my matlab code![:marseytunaktunak: :marseytunaktunak:](/e/marseytunaktunak.webp)
Jump in the discussion.
No email address required.
More options
Context
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Hi
@dart200,
Your comment has been automatically removed because you forgot to include
trans lives matter
.Don't worry, we're here to help! We won't let you post or comment anything that doesn't express your love and acceptance towards the trans community. Feel free to resubmit your comment with
trans lives matter
included.This is an automated message; if you need help, you can message us here.
Jump in the discussion.
No email address required.
More options
Context