03, long form

This commit is contained in:
Rasmus Malver 2022-12-03 11:49:54 +01:00
parent 9bdcd2cc34
commit 7eb1a1ee1e
3 changed files with 2821 additions and 0 deletions

2500
02/input.txt Normal file

File diff suppressed because it is too large Load diff

21
03/2022-12-03-AB.py Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# The long way round
def valuar(instr):
return ord(instr)-38 if instr.isupper() else ord(instr)-96
result = 0
for l in open("03/i"):
common = list(set(l[0:int(len(l)/2)]).intersection(l[int(len(l)/2):]))[0]
result += valuar(common)
print(result)
result = 0
for team in more_itertools.chunked(open("03/i").read().splitlines(),3):
shared = list(set.intersection(set(team[0]),set(team[1]),set(team[2])))[0]
result += valuar(shared)
print(result)

300
03/i Normal file
View file

@ -0,0 +1,300 @@
fzmmmfwDWFzlQQqjCQjDGnqq
tJHJvLJVVttNsvTtTvgHHSVwCsQRQQZCZZMqQMQBnqBMQs
LgThNJhNSgTJVgvgtghPhbpfWzfbwfPmpprb
lDLnSnLZRjmWrlhrFF
PffQJNqJbPZbpmjrrCVNFmCh
qzbcbqfMfZMTfQTqqzzTPPLMHgBBBtHRStvgHRDBnSRL
WPZfJlZZCMwwZPWCwWzVHQhsshVSsfNQHdvQNN
FLGDGGnGdVjQQQDQ
ccFFbggLnRcLFRtFBmnJzdZZzZBMpwJlZMppMp
RZsnCZssCnDccJCnfcQfHTdzMzhdLdMTqdRqpRLwqq
tNrGNrrvGhTThQqw
rrFStPgrFWWgvmPgQjtmNtmJcfJcsJsZblDZfbfHDFHnfl
RdTfgbbPbJWDDqRvsDsmVG
NSQZLQZHpFGLqnLszrJm
ZMSNMHhNZMMSQwhQJWPBJCbhbcgtgfcJ
qZfqPvLnnZGpGpCJlvsMsMlHJJHB
mTWFFFTTtVSJMzzjWgSH
RbVdtdFtcrmbRQDDVHDQTbDNwLPLfnqZnhZhQnNwfNqnnn
nhHfSGHGThhZjnhrrSnsSczdzlfzzdQQVzRNFNcFdl
JJvCDvmCbtvpvbMmDvLbCJ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