advent of code day 3: i might be r-slurred edition

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

80
Jump in the discussion.

No email address required.

Lol imagine using (((python)))

#include <stdio.h>

int main(void){
	FILE *f = fopen("input.txt","r");
	char buffer1[1024],buffer2[1024],buffer3[1024];
	int sum = 0;
	while(fgets(buffer1,1024,f) != NULL){
	fgets(buffer2,1024,f);
	fgets(buffer3,1024,f);
		int end1=0,end2=0,end3=0;
		while(buffer1[end1] != '\n')
			end1++;
		while(buffer2[end2] != '\n')
			end2++;
		while(buffer3[end3] != '\n')
			end3++;
		int done = 0;
		for(int i=0;i<=end1 && done == 0;i++){
			for(int j=0;j<=end2 && done == 0;j++){
				for(int k=0;k<=end3 && done == 0;k++){
					if(buffer1[i] == buffer2[j] && buffer1[i] == buffer3[k]){
						char q = buffer1[i];
						if( q >= 'A' && q <= 'Z' )
							sum += q - 38;
						else
							sum += q - 96;
						done = 1;
					}
				}
			}
		}
		
	}
	printf("%d\n",sum);
	fclose(f);
	return 0;
}
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:

Jump in the discussion.

No email address required.

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.

:marseyill:

Jump in the discussion.

No email address required.

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.