suhas 1 year ago
commit ec08c38149

@ -0,0 +1 @@
Subproject commit a7101bd3eb0f8c1856bcd9a593d1aab09cdf3ef8

@ -0,0 +1,50 @@
stacks = [
list("SCVN")[::-1],
list("ZMJHNS")[::-1],
list("MCTGJND")[::-1],
list("TDFJWRM")[::-1],
list("PFH")[::-1],
list("CTZHJ")[::-1],
list("DPRQFSLZ")[::-1],
list("CSLHDFPW")[::-1],
list("DSMPFNGZ")[::-1]
]
l = open("in.txt", "r").read().split("\n")
# part1
for instr in l:
cmds = instr.split(" ")
ol = stacks[int(cmds[3])-1]
nl = stacks[int(cmds[5])-1]
take = int(cmds[1])
for _ in range(take):
old = ol[0]
nl.insert(0, old)
del ol[0]
print(''.join([stk[0] for stk in stacks]))
stacks2 = [
list("SCVN"),
list("ZMJHNS"),
list("MCTGJND"),
list("TDFJWRM"),
list("PFH"),
list("CTZHJ"),
list("DPRQFSLZ"),
list("CSLHDFPW"),
list("DSMPFNGZ")
]
# part2
for instr in l:
cmds = instr.split(" ")
# move 3 from 9 to 6
ol = stacks2[int(cmds[3])-1]
nl = stacks2[int(cmds[5])-1]
take = int(cmds[1])
takelist = ol[(-1 * take):]
[nl.append(e) for e in takelist]
print(''.join([stk[-1] for stk in stacks2]))

@ -0,0 +1,502 @@
move 3 from 9 to 6
move 7 from 6 to 2
move 1 from 1 to 5
move 7 from 7 to 1
move 3 from 9 to 7
move 1 from 9 to 1
move 1 from 7 to 2
move 11 from 1 to 8
move 9 from 8 to 2
move 1 from 6 to 7
move 3 from 7 to 3
move 7 from 3 to 4
move 9 from 8 to 7
move 3 from 3 to 1
move 2 from 5 to 2
move 6 from 7 to 3
move 1 from 1 to 7
move 1 from 9 to 2
move 1 from 5 to 3
move 1 from 8 to 2
move 2 from 7 to 5
move 1 from 1 to 4
move 3 from 5 to 8
move 2 from 8 to 7
move 1 from 8 to 9
move 7 from 3 to 1
move 8 from 2 to 5
move 3 from 7 to 3
move 1 from 5 to 1
move 1 from 9 to 6
move 1 from 7 to 4
move 1 from 6 to 3
move 1 from 7 to 1
move 9 from 4 to 5
move 8 from 1 to 2
move 3 from 3 to 2
move 1 from 1 to 6
move 7 from 5 to 6
move 1 from 1 to 5
move 1 from 3 to 5
move 21 from 2 to 3
move 8 from 6 to 3
move 5 from 4 to 9
move 9 from 3 to 8
move 17 from 3 to 5
move 6 from 2 to 1
move 2 from 9 to 1
move 3 from 3 to 6
move 3 from 2 to 5
move 7 from 8 to 2
move 3 from 6 to 9
move 2 from 2 to 4
move 1 from 2 to 6
move 2 from 2 to 6
move 2 from 6 to 5
move 1 from 6 to 1
move 2 from 2 to 7
move 1 from 8 to 2
move 4 from 9 to 1
move 4 from 1 to 6
move 1 from 8 to 5
move 3 from 6 to 9
move 1 from 9 to 1
move 2 from 9 to 2
move 4 from 4 to 5
move 1 from 7 to 8
move 1 from 7 to 5
move 8 from 1 to 8
move 1 from 1 to 9
move 1 from 6 to 8
move 2 from 2 to 6
move 1 from 1 to 3
move 1 from 2 to 5
move 1 from 3 to 4
move 3 from 9 to 4
move 4 from 4 to 1
move 29 from 5 to 1
move 2 from 6 to 3
move 2 from 3 to 5
move 2 from 5 to 9
move 7 from 8 to 1
move 3 from 8 to 6
move 6 from 1 to 6
move 2 from 9 to 8
move 2 from 5 to 3
move 3 from 5 to 6
move 2 from 5 to 6
move 1 from 5 to 1
move 2 from 3 to 9
move 1 from 8 to 6
move 1 from 8 to 3
move 1 from 3 to 5
move 5 from 1 to 5
move 5 from 6 to 2
move 25 from 1 to 9
move 9 from 9 to 3
move 7 from 6 to 8
move 9 from 5 to 9
move 2 from 6 to 5
move 6 from 9 to 7
move 1 from 6 to 8
move 3 from 2 to 1
move 3 from 8 to 1
move 5 from 9 to 6
move 3 from 9 to 1
move 4 from 6 to 9
move 2 from 7 to 4
move 1 from 4 to 1
move 1 from 6 to 2
move 7 from 1 to 6
move 1 from 9 to 8
move 9 from 3 to 9
move 5 from 1 to 7
move 1 from 5 to 7
move 3 from 1 to 7
move 3 from 6 to 7
move 8 from 9 to 1
move 3 from 7 to 3
move 1 from 5 to 6
move 3 from 1 to 7
move 4 from 1 to 4
move 2 from 8 to 5
move 1 from 4 to 2
move 3 from 2 to 7
move 2 from 6 to 4
move 1 from 1 to 2
move 18 from 7 to 5
move 1 from 7 to 5
move 1 from 2 to 3
move 4 from 5 to 9
move 1 from 2 to 1
move 2 from 3 to 9
move 2 from 3 to 4
move 2 from 6 to 5
move 1 from 8 to 3
move 4 from 9 to 7
move 1 from 1 to 9
move 3 from 5 to 2
move 2 from 8 to 6
move 2 from 6 to 1
move 5 from 5 to 7
move 7 from 9 to 7
move 11 from 5 to 9
move 3 from 7 to 6
move 6 from 4 to 9
move 5 from 7 to 3
move 6 from 3 to 6
move 2 from 1 to 2
move 2 from 4 to 9
move 6 from 9 to 2
move 1 from 7 to 5
move 10 from 2 to 9
move 4 from 9 to 4
move 1 from 4 to 3
move 31 from 9 to 3
move 1 from 9 to 4
move 6 from 3 to 8
move 1 from 5 to 8
move 5 from 6 to 4
move 4 from 3 to 2
move 1 from 4 to 6
move 22 from 3 to 7
move 6 from 4 to 7
move 4 from 6 to 2
move 8 from 8 to 1
move 3 from 2 to 8
move 2 from 1 to 9
move 1 from 2 to 6
move 3 from 2 to 5
move 2 from 5 to 4
move 2 from 6 to 4
move 24 from 7 to 4
move 1 from 7 to 4
move 2 from 1 to 5
move 2 from 9 to 6
move 10 from 4 to 6
move 3 from 1 to 6
move 6 from 7 to 1
move 2 from 2 to 3
move 1 from 7 to 4
move 2 from 8 to 4
move 1 from 8 to 5
move 4 from 5 to 2
move 5 from 4 to 1
move 2 from 7 to 8
move 2 from 8 to 4
move 5 from 6 to 3
move 2 from 4 to 3
move 1 from 7 to 5
move 2 from 3 to 6
move 1 from 5 to 1
move 3 from 6 to 8
move 11 from 4 to 3
move 7 from 6 to 1
move 3 from 8 to 1
move 1 from 2 to 3
move 2 from 6 to 9
move 2 from 2 to 3
move 3 from 4 to 3
move 2 from 9 to 4
move 1 from 6 to 3
move 5 from 1 to 2
move 2 from 4 to 3
move 24 from 3 to 7
move 3 from 3 to 9
move 1 from 2 to 6
move 1 from 2 to 5
move 1 from 6 to 1
move 4 from 2 to 1
move 2 from 9 to 2
move 1 from 2 to 4
move 18 from 7 to 5
move 1 from 2 to 1
move 1 from 9 to 1
move 2 from 5 to 7
move 13 from 1 to 8
move 3 from 4 to 9
move 7 from 1 to 7
move 13 from 7 to 6
move 1 from 9 to 5
move 3 from 4 to 3
move 1 from 9 to 8
move 3 from 1 to 3
move 1 from 9 to 5
move 2 from 1 to 4
move 2 from 7 to 3
move 4 from 3 to 1
move 1 from 1 to 5
move 9 from 6 to 7
move 5 from 7 to 1
move 2 from 4 to 1
move 4 from 6 to 1
move 3 from 5 to 3
move 3 from 3 to 5
move 7 from 1 to 6
move 6 from 6 to 1
move 1 from 6 to 8
move 2 from 7 to 9
move 2 from 1 to 5
move 1 from 3 to 7
move 7 from 5 to 9
move 10 from 1 to 5
move 8 from 8 to 4
move 6 from 4 to 8
move 1 from 4 to 1
move 2 from 9 to 8
move 2 from 1 to 3
move 2 from 7 to 3
move 1 from 7 to 8
move 4 from 3 to 8
move 1 from 3 to 2
move 20 from 5 to 8
move 1 from 2 to 4
move 4 from 9 to 4
move 4 from 4 to 5
move 18 from 8 to 6
move 3 from 9 to 6
move 1 from 3 to 9
move 10 from 8 to 7
move 7 from 7 to 9
move 7 from 8 to 5
move 3 from 7 to 8
move 6 from 5 to 1
move 6 from 9 to 4
move 1 from 9 to 6
move 1 from 3 to 6
move 1 from 8 to 5
move 1 from 9 to 4
move 12 from 6 to 7
move 5 from 7 to 1
move 6 from 8 to 5
move 1 from 5 to 1
move 3 from 5 to 3
move 8 from 4 to 9
move 2 from 3 to 7
move 4 from 7 to 2
move 10 from 5 to 6
move 11 from 1 to 6
move 4 from 2 to 5
move 1 from 3 to 8
move 1 from 8 to 9
move 1 from 4 to 7
move 3 from 7 to 4
move 1 from 1 to 6
move 1 from 4 to 7
move 1 from 7 to 1
move 4 from 5 to 2
move 3 from 7 to 1
move 2 from 4 to 8
move 20 from 6 to 8
move 4 from 1 to 5
move 2 from 5 to 2
move 6 from 6 to 1
move 5 from 1 to 8
move 7 from 6 to 2
move 6 from 9 to 7
move 2 from 9 to 8
move 2 from 7 to 4
move 4 from 2 to 6
move 3 from 5 to 8
move 12 from 8 to 7
move 1 from 4 to 3
move 1 from 2 to 9
move 1 from 9 to 2
move 1 from 6 to 8
move 1 from 3 to 1
move 2 from 1 to 6
move 1 from 4 to 2
move 3 from 6 to 2
move 2 from 5 to 7
move 1 from 9 to 8
move 6 from 2 to 4
move 17 from 7 to 1
move 10 from 1 to 7
move 4 from 2 to 6
move 10 from 7 to 8
move 3 from 6 to 2
move 4 from 4 to 1
move 2 from 6 to 4
move 4 from 2 to 6
move 1 from 7 to 1
move 2 from 4 to 3
move 12 from 1 to 7
move 5 from 6 to 3
move 17 from 8 to 2
move 4 from 3 to 8
move 1 from 4 to 2
move 20 from 8 to 7
move 19 from 2 to 6
move 7 from 6 to 3
move 7 from 3 to 5
move 2 from 5 to 7
move 4 from 6 to 9
move 1 from 4 to 2
move 1 from 2 to 1
move 2 from 3 to 6
move 1 from 2 to 6
move 1 from 3 to 1
move 4 from 6 to 2
move 1 from 5 to 9
move 7 from 7 to 3
move 7 from 3 to 8
move 5 from 8 to 1
move 2 from 8 to 3
move 1 from 2 to 1
move 3 from 5 to 6
move 1 from 3 to 9
move 2 from 9 to 2
move 8 from 1 to 7
move 3 from 7 to 6
move 2 from 2 to 4
move 21 from 7 to 3
move 10 from 3 to 1
move 2 from 9 to 2
move 7 from 3 to 4
move 3 from 3 to 7
move 4 from 2 to 3
move 3 from 7 to 8
move 1 from 3 to 6
move 1 from 3 to 2
move 4 from 7 to 9
move 10 from 1 to 6
move 1 from 5 to 9
move 6 from 7 to 2
move 24 from 6 to 5
move 2 from 8 to 4
move 1 from 8 to 6
move 2 from 2 to 9
move 5 from 2 to 7
move 1 from 2 to 9
move 11 from 4 to 1
move 3 from 3 to 2
move 4 from 9 to 7
move 1 from 1 to 5
move 1 from 6 to 1
move 5 from 1 to 9
move 5 from 9 to 7
move 5 from 7 to 5
move 23 from 5 to 2
move 5 from 7 to 8
move 6 from 5 to 6
move 1 from 3 to 7
move 1 from 5 to 7
move 6 from 7 to 8
move 3 from 6 to 1
move 2 from 8 to 7
move 4 from 2 to 1
move 4 from 8 to 5
move 7 from 2 to 3
move 1 from 7 to 4
move 1 from 4 to 7
move 4 from 3 to 8
move 6 from 1 to 9
move 4 from 8 to 6
move 3 from 1 to 5
move 3 from 8 to 5
move 1 from 1 to 8
move 3 from 9 to 1
move 3 from 6 to 7
move 1 from 7 to 9
move 3 from 8 to 3
move 8 from 5 to 7
move 11 from 2 to 8
move 5 from 8 to 3
move 1 from 8 to 7
move 10 from 3 to 4
move 2 from 5 to 8
move 3 from 9 to 2
move 1 from 9 to 6
move 7 from 2 to 7
move 6 from 9 to 4
move 1 from 8 to 5
move 3 from 6 to 8
move 1 from 5 to 3
move 2 from 3 to 1
move 6 from 1 to 3
move 13 from 7 to 5
move 16 from 4 to 3
move 2 from 1 to 5
move 5 from 5 to 4
move 11 from 3 to 4
move 2 from 7 to 1
move 7 from 3 to 1
move 2 from 8 to 3
move 8 from 1 to 9
move 12 from 4 to 8
move 1 from 1 to 4
move 2 from 6 to 2
move 3 from 7 to 8
move 2 from 4 to 6
move 5 from 8 to 1
move 3 from 7 to 5
move 6 from 5 to 7
move 2 from 2 to 5
move 1 from 4 to 9
move 5 from 1 to 8
move 6 from 3 to 1
move 7 from 5 to 7
move 7 from 9 to 2
move 1 from 6 to 7
move 1 from 1 to 9
move 2 from 5 to 3
move 2 from 9 to 6
move 13 from 7 to 3
move 2 from 6 to 1
move 1 from 9 to 2
move 16 from 8 to 7
move 6 from 8 to 5
move 3 from 2 to 5
move 4 from 2 to 1
move 3 from 1 to 8
move 2 from 8 to 9
move 1 from 8 to 7
move 1 from 2 to 1
move 8 from 3 to 1
move 1 from 4 to 5
move 1 from 6 to 3
move 2 from 9 to 7
move 5 from 1 to 4
move 15 from 7 to 9
move 11 from 9 to 3
move 7 from 1 to 3
move 2 from 1 to 6
move 1 from 6 to 3
move 2 from 4 to 5
move 2 from 4 to 9
move 7 from 5 to 9
move 5 from 9 to 3
move 1 from 1 to 6
move 5 from 5 to 9
move 1 from 4 to 8
move 1 from 8 to 4
move 3 from 7 to 4
move 8 from 9 to 5
move 1 from 6 to 4
move 4 from 9 to 3
move 1 from 9 to 3
move 23 from 3 to 1
move 12 from 1 to 2
move 6 from 1 to 9
move 5 from 9 to 7
move 3 from 3 to 7
move 6 from 4 to 3
move 1 from 6 to 8
move 6 from 1 to 2
move 3 from 7 to 3
move 3 from 2 to 5
move 10 from 3 to 5
move 1 from 1 to 8
move 12 from 2 to 5
move 3 from 2 to 9
move 2 from 8 to 4
move 13 from 5 to 1
move 2 from 9 to 2
move 2 from 1 to 3
move 11 from 3 to 1
move 2 from 2 to 1
move 2 from 1 to 9
move 16 from 1 to 7
move 17 from 5 to 8
move 1 from 1 to 2
move 3 from 9 to 6

File diff suppressed because it is too large Load Diff

@ -0,0 +1,9 @@
[['S', 'C', 'V', 'N'],
['Z', 'M', 'J', 'H', 'N', 'S'],
['M', 'C', 'T', 'G', 'J', 'N', 'D'],
['T', 'D', 'F', 'J', 'W', 'R', 'M'],
['P', 'F', 'H'],
['C', 'T', 'Z', 'H', 'J'],
['D', 'P', 'R', 'Q', 'F', 'S', 'L', 'Z'],
['C', 'S', 'L', 'H', 'D', 'F', 'P', 'W'],
['D', 'S', 'M', 'P', 'F', 'N', 'G', 'Z']]

@ -0,0 +1,18 @@
fi = open("in.txt", "r")
lst = fi.read().split("\n")
good1 = 0
good2 = 0
for el in lst[:-1:]:
sets = el.split(",")
set1 = set(range(int(sets[0].split('-')[0]), int(sets[0].split('-')[-1])+1))
set2 = set(range(int(sets[1].split('-')[0]), int(sets[1].split('-')[-1])+1))
if set2.issubset(set1) or set1.issubset(set2):
good1 += 1
if len([el for el in set1 if el in set2]) > 0:
good2 += 1
print(good1)
print(good2)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,19 @@
fi = open("in.txt", "r")
lst = []
tempLi = []
for li in fi.readlines():
if not li == "\n":
tempLi.append(int(li))
if li == "\n":
lst.append(tempLi)
tempLi = []
su = map(sum, lst)
print(f"part 1: {max(su)}")
sumList = [num for num in map(sum, lst)]
sumList.sort(reverse=True)
print(f"part 2: {sumList[0] + sumList[1] + sumList[2]}")

@ -0,0 +1,7 @@
# part 1
print(max([ sum([int(z) for z in x]) for x in [x.split('\n') for x in open('in.txt', 'r').read().split('\n\n') ]]))
# part 2
print(sum(sorted([ sum([int(z) for z in x]) for x in [x.split('\n') for x in open('in.txt', 'r').read().split('\n\n')]], reverse=True)[0:3]))

@ -0,0 +1,300 @@
GGVGlqWFgVfFqqVZGFlblJPMsDbbMrDMpDsJRn
LwzHtwdLHHwDrzPZzzsJbJ
wdLTBvSvHvZVGCjhfN
HsSSnZVHjjssZnJpSJjBHHWgQGcgqqQLQdQFqNgWgqGNDg
rmmRwrtfThtTrbCrGGGcLBDTqDBNQLdL
mwPrrbzPfwvbzhwMMnnjHnBjZlnzMM
gjjdMBgdqdTpJpBcjgRRRlqnvrqfnZtrtZDw
zHShWLhCszCWHVbVzQWCPtQvNZRwtfftfNnrnftlfR
PzPSssHbVhCLFMJFcMFJJMjdJw
ZqJdtpfpjmpJjpnwWdttTCDLLTQFNTzTzrcqrQqc
MsSlBGvBsSGGSlbGsCgggNTgzNLczFQNrNQVQcFzFF
sGHHSGllhvMGhSRGCjtjtjnjnnmHWpWWtJ
tMdjQlHPHsGjsCtsCpwwqfhfnnFMDMrpfD
SbNvWvBRJRWwFSgppgSrfg
RNcNbvzJRcVLRVzTRFLjdHCQttdZdPlHstPl
QWqgpdBflpHNCNWNHHPm
VVMbbJsLFVMhrMJMmRjFNHwHjjCTGSSRFj
mbMsZzsLmVhJZrcLcJhLMtnqvBnZdggplDffvlnlvnDn
prnNnsFnZpnBNd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G'}
{'Q'}
{'S'}
{'h'}
{'W'}
{'q'}
{'H'}
{'Z'}
{'r'}
{'B'}
{'J'}
{'b'}
{'d'}
{'s'}
{'F'}
{'W'}
{'S'}
{'G'}
{'B'}
{'c'}
{'H'}
{'B'}
{'B'}
{'n'}
{'P'}
{'T'}
{'t'}
{'q'}
{'s'}
{'b'}
{'t'}
{'c'}
{'T'}
{'c'}
{'Q'}
{'f'}
{'Q'}
{'N'}
{'s'}
{'f'}
{'T'}
{'n'}
{'V'}
{'H'}
{'P'}
{'R'}
{'H'}
{'P'}
{'H'}
{'m'}
{'n'}
{'v'}
{'S'}
{'T'}
{'N'}
{'l'}
{'J'}
{'g'}
{'g'}
{'P'}
{'L'}
{'j'}
{'R'}
{'l'}
{'W'}
{'z'}
{'J'}
{'Q'}
{'V'}
{'Z'}
{'h'}
{'R'}
{'t'}
{'v'}
{'W'}
{'B'}
{'d'}
{'W'}
{'G'}
{'F'}
{'B'}
{'B'}
{'G'}
{'G'}

@ -0,0 +1,34 @@
fi = open("in.txt", "r")
sum = 0
ip = fi.readlines()
# part 1
for line in ip:
half = line[0:len(line)//2]
ohalf = line[len(line)//2::]
common = set()
_ = [ common.add(el) for el in half if el in ohalf ]
el: str = common.pop()
if el.isupper():
sum += ord(el) - 38
else:
sum += ord(el) - 96
print(sum)
# part 2
sum2 = 0
for i in range(0, len(ip)-2, 3):
common = set()
_ = [ common.add(el) for el in ip[i].strip() if (el in ip[i+1].strip() and el in ip[i+2].strip()) ]
el: str = common.pop()
if el.isupper():
sum2 += ord(el) - 38
else:
sum2 += ord(el) - 96
print(sum2)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,92 @@
fi = open('in.txt', 'r')
RO, PO, SO = "A", "B", "C"
RM, PM, SM = "X", "Y", "Z"
W, D, L = 6, 3, 0
R, P, S = 1, 2, 3
x = fi.read().split('\n')
x2 = [z.split(" ") for z in x]
# 0 is the oppontent, 1 is you
score = 0
def w(o, m):
return (m == RM and o == SO) or ( m == PM and o == RO ) or (m == SM and o == PO)
def d(o, m):
return (m == RM and o == RO) or (m == PM and o == PO) or (m == SM and o == SO)
def p(x):
match x:
case "X":
return 1
case "Y":
return 2
case "Z":
return 3
case _:
return 0
for sc in x2[0:-1]:
if (w(sc[0], sc[1])):
score += W
elif (d(sc[0], sc[1])):
score += D
else:
score += L
score += p(sc[1])
print(score)
# A = rock, B = Paper, C = Scissors
def x(o):
match o:
case "A":
return SM
case "B":
return RM
case "C":
return PM
case _:
return ""
def d2(o):
match o:
case "A":
return RM
case "B":
return PM
case "C":
return SM
case _:
return ""
def w2(o):
match o:
case "A":
return PM
case "B":
return SM
case "C":
return RM
case _:
return ""
score2 = 0
for sc in x2[0:-1]:
match sc[1]:
case "X":
resu = x(sc[0])
score2 += 0
case "Y":
resu = d2(sc[0])
score2 += 3
case "Z":
resu = w2(sc[0])
score2 += 6
score2 += p(resu)
print(score2)
Loading…
Cancel
Save