Setup


In [1]:
import sys
import os

import re
import collections
import itertools
import bcolz
import pickle

import numpy as np
import pandas as pd
import gc
import random
import smart_open
import h5py
import csv

import tensorflow as tf
import gensim
import string

import datetime as dt
from tqdm import tqdm_notebook as tqdm

import numpy as np
import pandas as pd

import matplotlib.pyplot as plt
plt.style.use('seaborn-poster')
import seaborn as sns

random_state_number = 967898


/home/bicepjai/Programs/anaconda3/envs/interviews/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
  return f(*args, **kwds)

Code

Day 1: Inverse Captcha


In [2]:
! cat day1_input.txt


31813174349235972159811869755166343882958376474278437681632495222499211488649543755655138842553867246131245462881756862736922925752647341673342756514856663979496747158241792857625471323535183222497949751644488277317173496124473893452425118133645984488759128897146498831373795721661696492622276282881218371273973538163779782435211491196616375135472517935481964439956844536136823757764494967297251545389464472794474447941564778733926532741752757865243946976266426548341889873514383464142659425122786667399143335772174973128383869893325977319651839516694295534146668728822393452626321892357192574444856264721585365164945647254645264693957898373214897848424966266582991272496771159583715456714645585576641458358326521858518319315233857473695712238323787254556597566461188452279853766184333696344395818615215846348586541164194624371353556812548945447432787795489443312941687221314432694115847863129826532628228386894683392352799514942665396273726821936346663485499159141368443782475714679953213388375939519711591262489869326145476958378464652451441434846382474578535468433514121336844727988128998543975147649823215332929623574231738442281161294838499441799996857746549441142859199799125595761724782225452394593514388571187279266291364278184761833324476838939898258225748562345853633364314923186685534864178665214135631494876474186833392929124337161222959459117554238429216916532175247326391321525832362274683763488347654497889261543959591212539851835354335598844669618391876623638137926893582131945361264841733341247646125278489995838369127582438419889922365596554237153412394494932582424222479798382932335239274297663365164912953364777876187522324991837775492621675953397843833247525599771974555545348388871578347332456586949283657613841414576976542343934911424716613479249893113961925713317644349946444271959375981158445151659431844142242547191181944395897963146947935463718145169266129118413523541222444997678726644615185324461293228124456118853885552279849917342474792984425629248492847827653133583215539325866881662159421987315186914769478947389188382383546881622246793781846254253759714573354544997853153798862436887889318646643359555663135476261863

In [18]:
input_data = None
with open("day1_input.txt") as f:
    input_data = f.read().strip().split()[0]

part1

The captcha requires you to review a sequence of digits (your puzzle input) and

find the sum of all digits that match the next digit in the list. The list is circular,

so the digit after the last digit is the first digit in the list.


In [68]:
def get_captcha11(s):
    ssum = 0
    for i1, i2 in zip(s, s[1:]+s[0]):
        if i1 == i2:
            ssum += int(i1)
    return ssum

In [69]:
def get_captcha12(s):
    n = len(s)
    ssum = int(s[0]) if s[0] == s[-1] else 0
    i1 = 0
    while i1 < n-1:
        if s[i1] == s[i1+1]:
            ssum += int(s[i1])
        i1+=1
    return ssum

In [70]:
assert  get_captcha12("1122") == 3
assert  get_captcha12("1111") == 4
assert  get_captcha12("1234") == 0
assert  get_captcha12("91212129") == 9

In [71]:
get_captcha12(input_data)


Out[71]:
1203

part2

Now, instead of considering the next digit, it wants you to consider the digit halfway around

the circular list. That is, if your list contains 10 items, only include a digit in your sum

if the digit 10/2 = 5 steps forward matches it. Fortunately, your list has an even number of elements.


In [88]:
def get_captcha21(s):
    n = len(s)
    ssum = 0
    i1 = 0
    halfway_circle = n//2
    while i1 < n:
        if s[i1] == s[(i1+halfway_circle)%n]:
            ssum += int(s[i1])
        i1+=1
    return ssum

In [89]:
assert  get_captcha21("1212") == 6
assert  get_captcha21("1221") == 0
assert  get_captcha21("123425") == 4
assert  get_captcha21("123123") == 12
assert  get_captcha21("12131415") == 4

In [90]:
get_captcha21(input_data)


Out[90]:
1146

Day 2: Corruption Checksum


In [92]:
! cat day2_input.txt


116	1259	1045	679	1334	157	277	1217	218	641	1089	136	247	1195	239	834
269	1751	732	3016	260	6440	5773	4677	306	230	6928	7182	231	2942	2738	3617
644	128	89	361	530	97	35	604	535	297	599	121	567	106	114	480
105	408	120	363	430	102	137	283	123	258	19	101	181	477	463	279
873	116	840	105	285	238	540	22	117	125	699	953	920	106	113	259
3695	161	186	2188	3611	2802	157	2154	3394	145	2725	1327	3741	2493	3607	4041
140	1401	110	119	112	1586	125	937	1469	1015	879	1798	122	1151	100	926
2401	191	219	607	267	2362	932	2283	889	2567	2171	2409	1078	2247	2441	245
928	1142	957	1155	922	1039	452	285	467	305	506	221	281	59	667	232
3882	1698	170	5796	2557	173	1228	4630	174	3508	5629	4395	180	5100	2814	2247
396	311	223	227	340	313	355	469	229	162	107	76	363	132	453	161
627	1331	1143	1572	966	388	198	2068	201	239	176	1805	1506	1890	1980	1887
3390	5336	1730	4072	5342	216	3823	85	5408	5774	247	5308	232	256	5214	787
176	1694	1787	1586	3798	4243	157	4224	3603	2121	3733	851	2493	4136	148	153
2432	4030	3397	4032	3952	2727	157	3284	3450	3229	4169	3471	4255	155	127	186
919	615	335	816	138	97	881	790	855	89	451	789	423	108	95	116

In [118]:
input_data = []
with open("day2_input.txt") as f:
    for line in f.read().split("\n"):
        input_data += [list(map(int,line.split("\t")))] if line else []

part 1

For each row, determine the difference between the largest value and the

smallest value; the checksum is the sum of all of these differences.


In [124]:
def get_checksum1(ll):
    return sum([max(l) - min(l) for l in ll])

In [125]:
assert get_checksum1([[5,1,9,5],[7,5,3],[2,4,6,8]]) == 18

In [126]:
get_checksum1(input_data)


Out[126]:
41887

part 2

the goal is to find the only two numbers in each row where one evenly

divides the other - that is, where the result of the division operation is

a whole number. They would like you to find those numbers on each line,

divide them, and add up each line's result.


In [137]:
def get_checksum2(ll):
    csum = 0
    for l in ll:
        ht = {}
        for i,a in enumerate(l):
            for b in l[i:]:
                if a == b:
                    continue
                if a%b == 0:
                    csum += a//b
                    break
                elif b%a == 0:
                    csum += b//a
                    break
    return csum

In [138]:
assert get_checksum2([[5,9,2,8],[9,4,7,3],[3,8,6,5]]) == 9

In [139]:
get_checksum2(input_data)


Out[139]:
226

Day 3: Spiral Memory

part 1


In [247]:
import math

def get_md_spiral_mem(n):

    # this number marks the odd square end from where the counting starts.
    # this counting is used to estimate the catesian cor ordinate which
    # can be used to find the manhattan distance
    ref = math.floor(math.sqrt(n))
    
    # the spiral starts after the squared odd number
    # if this is even reduce by 1 to get this place for reference
    ref = ref - 1 if ref%2==0 else ref
    
    # the number can be on either of the 4 sides when spiraling
    # find difference from the squared odd number reference
    diff = n - ref**2
    
    # since all are odd number squares
    # and the side considers the full side including 
    # the number that starts on the next side
    side_size = ref+1
    print("------", ref, diff, side_size)
    # lets estimate the absolutre value of thier
    # cartesian co ordinates. Since the reference is taken from the odd
    # square numbers, handle them properly, this part is not implemented
    # also this can be done pretty simply using comprehension,
    # but this way the code is understandable
    
    x,y = None, None
    if n <= ref**2 + side_size:
        # right side
        x = side_size//2
        d = ref**2 + side_size - n
        print("----right",d)
        y = (side_size//2) - d
    
    elif n <= ref**2 + 2*side_size:
        # top side
        y = side_size//2
        d = ref**2 + 2*side_size - n
        print("----top",d)
        x = (side_size//2) - d
    
    elif n <= ref**2 + 3*side_size:
        # left side
        x = side_size//2
        d = ref**2 + 3*side_size - n
        print("----left",d)
        y = (side_size//2) - d
        
    else:
        # bottom side
        y = side_size//2
        d = ref**2 + 4*side_size - n
        print("----bottom",d)
        x = (side_size//2) - d
        
    print("-----",x,y)
    return x + y

In [248]:
get_md_spiral_mem(347991)


------ 589 1070 590
----top 110
----- 185 295
Out[248]:
480

part 2 (incomplete)


In [ ]:

Day 4: High-Entropy Passphrases


In [249]:
! cat day4_input.txt


pphsv ojtou brvhsj cer ntfhlra udeh ccgtyzc zoyzmh jum lugbnk
vxjnf fzqitnj uyfck blnl impo kxoow nngd worcm bdesehw
caibh nfuk kfnu llfdbz uxjty yxjut jcea
qiho qif eupwww avyglnj nxzotsu hio lws
xjty usocjsh pivk qnknunc yjcgh bwya djw zpyr
ycfmfe mgq sjiomg nfzjul bjwkmgu yvsnvgj dcjupu wzz blmn
rdowgbt vpwfdoi blzl laghnk gsa vhnpo cztxzlb rtz hvwonhb eciju pfjtbo
bqs bqs dbutvgf mmzb izpyud rap izpyud xlzeb mnj hjncs
xpu vwp nujcos piu irindir tpmfd umtvlm gznu
sfpuxar qcnbte omouazv cnh uaxspfr sepolf rusafpx
xbmaf iceyqqq sabpt gliexel muubepe qqiyqce fmrcc eazk obkeonl fmccr kgk
apg gbycwe gap pag
gagv saqbk lwtllc wnhzz khxsjc
lgc alen rlmsp anel gcbvg
bujlaz rks rlqf deknmee yrp
scqvl weusbc bgvaz vgg cjwsfno vqy zbq aqy tvf bgzav
hbki vei fxdwljs myjuba elbsib pvy xxjxgi dtgv
linzaeu qbwdke fdg pykw
qvtdd aco aav bpu mvkcuc kjfj japgfki jfdl gem hog bdzsiea
wpbigkb lzhwba jssjkn qvb kmwu qddv
iny osyvqnt tumunzb torq bdeneg wywank poza ipp iggorw
tuko mhdbsf vmjdop jomaqpj rcdsud hmgspr lsas nzmwc
cirkjq nmjuu xtgejv gtexvj vjcmtqq unjmu
xsdmezq xvqjvqp exhygy qahju hvd qadmdh lok
wvvys kax rohrrar rwhnvi lhnmefp lsktouy bxilosp
wayf diobnl zvu obnidl oibnld
cewil ygsf ffzp ruxhu vah lnvwt aef lnnjc kgkb gxtlx feko
uti epphrin pywths cpzzh csjei nczhamy gayxmb bdcytq xkx fgmt
qvzyuwi dwo swkw bwjdrn dasgd ijgw vzabaop yefyhmc wgij
dyg sugrf vid etz weyqg nyntx dwfgwm khon hnzzzn xfyra
ofbh bdrsk rdrjj elaxvk jrjdr
msxau rsocvx zxdda mxz lknl
qktaywx dirpdbf unqnd wbrwkuu fvmqwl emxr big
xwz kvsydc ayokjyy qiah omw neo htltxx fxhwqwj colqvbb sxmo ephfkex
ncjxoaf fwjkc czmhv ylg axcjofn dvj bzqjku opvcr jiwzucg vmhzc
gmmnrt zqar twdwrg qiwwki fcbr lixm hjdwwe moiva
roinlxg cxeezve whannk cxeezve pyoj boweioy cpkgxsz
qkct qso xlb xyy aellfet rzt cbboow devfb nih fhbfxzi
qyc ltxia alixt atilx xtgrv
svruz ufvo rvesnxv dik vzurs jjg idk
xeudhrg hudn cilo ljplosb
kpb oyzvywx vldko qhfkwod bkeutk zqcqug pbriu wqocos
qkngzfy whobyri aze jvipdty ocirbep icqwc
kzxxlab sjr zhymws xkbx
nnxs gkwtld dwhkry snuibq dtdl aicug bhtlfzp qzk jctos
regvro mxcq hqof yraucxi jhkol iuxineo pbtnk rfjwc szgjpr ndqqj vfgm
yqrfox xoqrfy utbryu utubyr
jdubjt wqrl wnk rlqw nwiq pnbn qinw uaff ftdo htfrav
rum mur umr tij ovbahl losao imawwpb wadhww tbteyqc
napxd kzeiqcp ppgqucm xkityt frq hugrp gjgtt gmuqppc zwqme
xyuzs ysch howlzgu dkqppbs nvbiz mks mtxv vivouex uvawq
ffe lfsn nlq mpulheq ikcfo wdtz cnwsbph zkib muu
bqkxav wtecb lxwdhr kqbavx aqxvbk
czwswqx ldkxapd pfwd bdkkj iqohla cwosw ihqpd pcc ckhabbn
foiip hau rbqiyhh htm omeubgh symh evfcqg
lqx xlq rsgf izu esetis
npsrkdj fvulgkw eovw mzr uobcze azb tij ihoer ehori jit wknsqhm
gnrksh xwggt oosi bpnmhx qqaa mpmryu jhzyz
yad gbexqcr gbexqcr gbexqcr
ldca xxhznn twyy ytwy zhxnnx xfmpi
floioot kfyh dhibv ezyznar sfg sfg ezyznar
cinioim iiocmin ypla aypl
mhwcjbz dftuqsy wswop eizbf ptsd
ehx mlh nfxgfkz uuw xftmn ptlkbo vsnyo ttwce
oexvf orcg cncnkfk comvhl
lqewsj lyulrcl efixd qvd fhznqnz yvrkwyi xmhgc vzbp
dmr wrxqh thcm giomp rtvl ssc gwq rbklw hcmt fjvud
teozhb dmzwfv qkq pvcqfqq
hvlebc qqmg repxk zwrjdx ztruwb such tyligs ybg
psa rqznokd lgc jstqres yiqt mbiody xazb xjuk dtb
lea ncm rnh myzqzwm
wjml eums ueflvbr cjpgnl qduunu zfxaai jwlm lprzzg vrn ttetyr sume
uwkgeu uiahd plyewgi vveo nwhsitz mcitc uvk zsxehgs sewl
lnbdrka sgtivn sozzq mgd vhxfnlr twrfpk
gadphmk mbx lmlbrf tsnehnr lawdpm fnima gxgl
umty vrn dpow fsnnpjv fsnvnjp nnsvpjf cioaio
euu uue zeskmtk hob stekkzm
ypqpri qwdju ypriqp iprqyp jnoxqa
lkppi ingfxw wlulvp yhwrli nxwigf oyuhq ggfslx
kdd ypvr pyvr waw vyrp khqq mamxca bapq gobfm
iuq upvdpv zxef bfwns lmq lxswr kpsqo pwde iaaou nsw udy
lgzo nil ovgrmt omgtrv jrqp pqrj lit
uumyu iiakfj gvdtzz qbux yxn ejs dvlts
hcm ghutxq zswi tmyhqef hgxtuq
shkhkdk kad seubeax kdl mzu
cpykgr skx rfhpor xsk moyhlai ogv ophfrr dxipuuh
beyw jvrre opodn zdoajhx fhg ijs drczy drczy hjungq
jrzieja gfg yzdn yxm wshibsn fgg
xtylh vxscmvp rfymq uzhpyea spxcmvv dlni msj yxhlt
eov awql miv miv eov
mmvrfbg fjiyf hvqz zpuqmbf fszyuz ldfgni wemfjl fjjpl rbnpy rfb
ppzpeh nam ntv xnchtyk hja hpepzp foj bibvx nmmdlff bsrkp
qiy qiy umhlnh qiy
tyds oepk wae tdsy sdty
ukawr rkwau ghtjhm axy
wtbjiv btjivw ewaf hwk ttq
kdpun myve sqv rhvpy fnjwt puw ujhf thsp nkdadqr
vyw wkkpdpy xlgz lmmcuve ncuq lmotk
pmsfw vxd jpe qxlyasx ejp gwuv
pmgyndm ezofbvx nicbwrw kwnlj yjvnas fdpkfo mqcsyhn pyjpf fbexvzo vkftm erl
trmwvk rywuzoz hbidea kicohfz heidab deaibh
sogf govd dknpk vxrvk rlm vwhjk
xnxbfmw wguzrhd zbmkz piwppa mkbzz xvwrdgy flusfqb
cgduq hbnwr xfx mrejb ckw zkbaihf cloow cwk wuvthv iwqctx
vugx qbucd gxuv ocb cob
ilmet fbelxxz qratdfn unoj hbc duv srmikz
vnzuw zgpbqgf uzm thysyxd dinfh bgvr olungg ksd dsetwqz hpg
omagsf zpr coa kknx bzithq pewp flvoz xiiq weojqr wpep
aagj gcglqt gqcglt xbfx dhdx lbx
pljq plxuscw ilh wfk lhi hli fouieyw
hvnh zvm aqy dzitirm veq ctux
lglhs aqibdii hjbn cfgc qrg pnbntcx owoks ebz
jozngde lwne mbo omb fnyzvvj gndozje
bbdgc igtdj uhahgp sqduko
uuspedu fgnspm ewc slly jbs chl heanm abqijx kadvgxu
akfsft skna kusjqr rkqujs
erc vrljpu lruvjp lpvjur
iors hcdr fsqtcj vop vmn dtqnz tov oscjlw cdrh ctfjsq lrnts
fxp mczo sjlcxa mzoc jmsq hcxybow dmrr bcoxhyw
aac ewraerq odmxpz aac aac
zzio zebmxa szeej poordr gmi owwnnh xfx rzrab lfey jesze
akc yyoj vqod drtne
joxhvyf ymasnbr omouvq isxdrr
qyi ayrkzu jsk vqvvno jkkuxi zufnnwu mrsszdf
ocqi htfb tzjna cdt wkzhynm eergf
yokzugl usyuqu qvotq uweqyow lygkzuo kpmqmb uglyzok
glvshl imqv jrv xlpnsy gcg psj irtiamg wkl
bjcpc nvyloa dkkan efj okubpc cxlowm eone kmpny
cyxqys nmuaftv gqxj gtvsc
beouh dioxiah kizdy hyi cozrray rave fqxmxmj gdm
frjz amrsat lxvhzj azhevtu vxlzhj
zwmnrk sbk txzrcsj sbk oosgfej cvh zuthibi onvwd sbk nhwpzq
gzamt vraw kuk ugayl lyaug bww rwav ijah
bdjirxg vifjr rhbxpa oao yrhjxoi pbn
navb umesiys yhix phuhu aekkciu nlnsiq wjf idqdwp
cmhw rsu urs ziprlfe
kyhxitv cgty bnwjyq cygt sgjn pdab imarvhg yjbnqw
axaa ejancv yau njpc jvwy bpft kwjvg qzrbvtm diu njpc bpft
ambj upe rmqr yudbiqf krudp pqyf
tnb mobnpv vep ohxoc cyip wxyccfo jrbi rwsws kls zlv oohxc
fjh dmb hlbq bqc jhf kax suz fjjg rkpc
wjnn byfirm goeyh xtjmdka
tgyfxx hefpxln mveobqr yeo ftfn srt vim vlcu hevoi xtaaff
imyql xotcl poql rlueapq bkwykm hlalk bkwykm
gkec zff hbmtq rjxjbcf arerlu pvz cdaqi nijmhv uodwjh
mpctof mopftc ksfbat sbkatf
nvdd jub bvi kyggdbx nwtiok gjt mgsm dbhsn rzibgjm dvdn eqi
ysd iirp dfgzza wiyeoou ysd ispkv bcqg wwzqgq xphse
ntq ivposb gsd ezl tlkztp lez qyurp vxsmg dgs
wijs rydbj onm usiyqzb hwrol giusanb kewukl yziuqbs doojam nom
lfacyy xwwast truqtt tzneimn uxsydc ktu eqyaj ndszak
ffleooc kikif fohgop aucy moubqxu
iaxc pnwexdl ncy vmwm xrqoi wpgftq rofx utyzjuf stdxq twpgfq
ppmlp etsvi cjdx poly ynx vfxpslg mqjo qnpsage flpsxvg jwsxiqt
lbyhnb kflrpeq ssoti webxr embbjd kbnx ubzqco
khhc vwuqzb ebocbko rwmonkz edfqn hzh qhncoq gbwdi wjeg ocwow
ghzhd kcxblp lzwkkr gzhdh umk pblcxk
wyajtw jiff ouylv sni lwhlrg avqjiis igzx wbl lhrwgl
glhh kaxha tqii hwzx rgic kaxha rgyidmt qdgxfl ynjc oibfij
bapj bix rjniw ynbql idlvnmt wynpzbl zlpuoix kvn kakwys
aldpxxu iojxp rif xbyqtr jffdvy qnrq tqwsdiu
ulssco ktbymjw bfj zhkg zgc ctyri
ilrmq wfahcgk mrlqi bguad inj
cjzc rekuy ifr wfkg sple
cvjkp qbmumnp mprg ltmwxxh zpemtyb ozzssfd ksu mgrp
nvc sxp mpkxz bhlctq hguaa yrdkm iwsgfg qjssh gobbies hucdh
jdxrjw qmo qmo vobhnu
dnjib wtjp rfdjqdj skpvrb vkwevb kxxovp
fzi kicta zkuvr rfaawv ehklq cfdjsyb tukahwr zkuvr kicta ouq
aba ytdguk gqmpn hvxabff hvxabff dckj
fna wxyqhxd hvy khsu yypoyy lvvue medheua gim slf drdbeh ikihf
jquz wwo wwo ghlz jrbvb jrbvb
jwzvkl yjw ouwla yjw ouwla
zsvlgyf rzqbtj qygynem ukdgjm lbsyh tmdzp fbcaim eymzr
pvw sbs dvsa plmepl pwv ayxk vpw dwt
inayadn pnti yzhxk azga gxq aznbciu gjnmyqm
isgf ndqmk beyqq ebyqq srtzxo aiiw oqfuwp uoqwfp buejctv pxbk
pzl irv tzvzdb wcy eszm ybwiw ycw riizifd iybww
btpu cua azzqffy owcr
ofwq sqlpzat lozdxlc aevjmpc lcolzxd wbbysn qwfo vcrx gdzgi
dbpfmxu ydsxwl ijn svxtop csep ldqeog ffye zcrl soh aclw
wyiyyhv vyhiywy obgi hiyywvy
ddvaoc lhv spurn rgxyy onjw illvn yryxg xyyrg
vid wdttqq kajr myip
wolqlue phlunpt dcmmkfm sgxk dmmckmf sfng jlbsntq dxp
zmneyho fswj xdgsjc oefwjdi htgxvbd tgqrq xodoa
ynw bygqdnh hhmnkuw cojqrke qszzdjo orskwq mdfae asabn
vvpm vkj pcxghao caoxphg axhblxb vvmp
txox nzy eqn zgir dytsi girz ffa ugjjbzj brob fll
kbz pukqbd fiwmuh umwihf bkz dvz
vgs vejs vejs vejs mbkyjjy
viqmnmu bitkyw nddnk dknnd cldnpp hipub plcdpn fdzzpb mmyomn
ndylnfx gozlrx ngptk rnpteb wtacx xmtcjy xldha
fey doyxis ampmtr ycqh syw cqhlj hnngx
dijf nac tvkq ayo akbj lzmngdm wfxpn bpyvrf cvdqpa
zsofz lhho hgat wqskga mnt
mylwm zxsd omzpa waz hcrr lxmpq jsw sqtwak pzoma
rwhgsgt ysdq ztihici mpwcawv alkqg wsxiwx
snldn bcb anjdv cbb awsscc cqxult hjmjew mcycb fdpdg sesrh
kukrqm fawafz qdim wyobtqx bnvjnqg dcvqxta yptr nnpu ughldqp duo zafwaf
knb yjqb bscpnt nzg sqeu zkahna ttuf nsbtpc ixwit vucwj idix
bfqyx xlnpc ijrxu zkqi kjxtahr fgag orusms adi bfqyx bfqyx
dqddc ncbv bvfk hefikb dqddc hqjl otpx zfiu
ntkv qunrzx eztzure ctt rjo bkdt znvd jwdf gqhf mmhrzgt
zeavm hkbf rawqwuf pis dojlkt vnjhmi uvk cufmn qginezd xyut
hnidzk chlctc yst pepd dxntbxg vqk daxfpmu wshyddl
jgd vesqgo bdyqy igl ahstdm wjtd lrtkjsv tjsj sccxbih esn gkkzj
iisiswh jll rhlaf jqwwgfa wmhyo izva vrg zjkak nlxxfer rvhx
mkrkd jlqtpy ukstro ktuors wsj ynqpbp kpiyxzv nxeiwg xpzvkiy
jbr gnct fwklekg cmfqnm ctn gqobrs kwht
pztmjs yiffc kfhsblx yiffc yiffc
biezil iiezbl bzeiil smocoju
viiigm gmmmk yeiv dxzogro qsmzsur hukzwjn lcle syo mdj uruf rxfseu
extchsd adeff ouikoj fyaclr rwwvqsd dooe tcxheds zrdqqhm fdoxv kbxi tlcj
aycnydq qlxhka zoi shplo qll
bfry lbwckm ltq rbfy gpn vojp ruj dpxcve geq
svtvfwh lca lac qia vhwsftv nookdfz xgjiaf yvcdlt
aspgqym fryuzhx bbydf tbn bwutsc fqgi zij lmxhog qnmse
rbb gsys volnas onvlas lonasv vwjdso lnteapy
got iauk kficn jvfuy yvoe jcxwui hyamqx mke mwh jcxwui hyamqx
avutfi ggmha dkopc kothnnb syoi xsd wjedywy
oziejyz yzeijoz hnthyn knj juuq qujtp kgq bymlnlf yicf
zsejuy dybeap hvowmvn okxb yoi epadby cnzjk xfwprzc
lacg iiix fblhxvf nrkkol lnafzw qspzsn gvdy ipj zub uouseo
evukwkh ycjxxc lptwmf pmd izxdsos zrkavf pgjoy zwokg mpjiej
vqw ijwoy eaw wvq svmcq ccxi nyub ynlq eqornax uprt pygfe
plue okbbm btvm gba kutn jacjx ysqt lvx pcxxu qcf
pyw ffjfudq bvk hsdwdva fjnivhf odbmw krpgrj
hziesm bxa dceiwt tmvivjk snl fkh dahsxyx kqlhak lurtk
xss sswyxrg yqff dbkx kbxd mpzbmnl bzplnmm
uvz pjm ilrol pmj uzct ztcu brhkv
heiz jcn syjt zfvlvaq aflvqvz amcjh rxnitw
cxl nxvrn vjnz aewtr cxtko nnvcp ltptd adpxt zvjn fntklj
aymmm tuirj hzngq zhbh paqs kvpfo aqsp kmo acprw sabrso kdqmp
ndqjspv mmhp pndjsvq rti usm
ije oad mvelyg jadz ekm dao zdcmv
qwww tmwmdbb oxxfoza rgmf eonku brh gcgiuoi ojscn
fjedeek ohlax fiydku rbnxpg wfivg cdgs
axwbni hojye mwfe oyqknxp whdgfy ihku mbhr gagnz hehagxj
hibautd blnayq lnayqb gepml mgpel qunw
ircx oeb kujtip zbu ebo cmmn
upyqvot wbponp hnn vav avv tvrky omm
yzqsnf agbfsw dbxoya sfnqzy hqrxek qsnyzf oagyerm xxhukm
xzvk mvcwz oujr hell hoe xexa dqlpqt xdqz ucola hsvv tcmybhl
skldxr mzyol ybzyzd jnnxb rxncdy nkpwy fwlnsw omylz oiwieu fshv ngvha
jkwqf yxrox hejfoq orxyx
rijken xiwf mawqcfu erinjk jsi yyg mmu mdkfqb
ornjes krp eornjs enjros pyqp nnwwjl
wzd uqqo kyeli tikdle aykdjog uiz rbpnw mjxezf ihiz rlgyg
cjm ajqgvkz kfgyy dmczlc mjc kxcm zctyqgh ymsk jwhqfd czpqgan
vxkzvco owo qogj uyictoj kfr pyoo ejrru npluynx bvv jhhzu kuciwc
eqk pcsly kelu arzgoe trfo fotr cuaax
lagonw qvcssqz sdoklh uvovi sfrkmd hnvafj ltg wfjj
viwbkm hpwe kzzwrbr axjtlq mznin wwpjg unlwur
nuzorgo qfoz ydisca qxdfutv hzg
nqgge tobtt hjocx ntyqyi rxzkynw wrnxzyk ciscy trjt ottbt
yuii srawx gljxe eteogz kcu jlgxe tjik ktsnp agudqok jwol vfnyv
vgicg dhnrmxz sjhozy hlalx rutwq
nyoyoje kco hoyam hoyam tta iflud amh gdxcsj vqr fvsqcgv
xdmbtph ueen cskerl rxjvpdc
nricn addljzg obq rikez igq bxygkmv qmgojou uheubk qor
snzd ztusvr vrstzu mceddga hgu
vvrbfjg mcdhmsf ldtwl otuna gmjurrx jgrurxm rxmurjg yrioq
iotkvo sftfvn vvoit lllju xvlg rdsb ywmdf mzxigu kzq
sgqw gqsw lqfu wgqs xpiwou jurgucd azq wgaqpm
ijntzi chlnfj yjqatz hjflcn vys ofq oqf oadthe jrfw
mmc motjo vcwmod rpaszfk zgkkua bpja vjb htrk
bpfvvka kmger mnvvfl hakudy yfprdoo mvnlfv rgmek evnwg
mykpu juavkn cecdvi aszbi lxm hmps oaqoif
fshizd fsdzhi lvcq hhpb eavwno auqlwz rpv owcdojx amsmf qgnddd
pohmcn hlcxk qsesxh rncr
fgyrsis ldem avxmnh frpodq oefzn
plfpu qdyojz xdrzrjy kpv abkh fge bbnotvp liikmcu czvwl oyh
ovha muitw pzy edfjoo fhsxuh dliyruc dikcd cqem ywfy
exyry jtzqn tscr qbtxno cikk poqgr tnjzq eofe sxea anlikep kick
zcie purpw dmhhms bcdo prwup uprpw wfejgjd
kwtjc cmixp dodfwj hcgmmat pkeyspo ubnl ajxvj ffkh xvw
nvlgq oduus psufiqg lrwpn dleftn xtllqvf usgz
liarf sczsf sczsf wky qtzq qvve qvve
cit vtjsh jrhkyvi txj urmq hppx
rhblmxn rhblmxn lkgow dylurwc beyk gfcewxj ehpl disoe tjbjy lkgow
nbkrm jvk ffux ars agns bebic jzjfm kmnbr gptvtsa ufxf
hrlvup jaz tafyr qcgq wkd fiz bgsrx jmtcvo qkbvj
eontk djf tiafrng mtwat puainel nyjoh meynxbf eqdw
aspvmbx tgzuszm fpj xkl nzpr fjp vnomk byx sbtov tnu utn
ldyww gwmiddv hwyh gcgsdit gtgdisc suufl xsw dlwyw
sye dgbd wyf ixqzthx dgdb esy
nsdgera fqz xwbdgui ngdgbcd bcn qrdxml cwcmxws tncm mqsodj cqgk
estayas cocmbpv cdcf vygtswo aplwa estayas
ndc ndc wntr sfls sfls
gse svv esmi lcdii lnr kemrk gnk ildic blnqy wvn
mwlpm awkr sxsudub yauwww hnktbog fpnqc nmxoq yoparu tqjpkug nbipft
czwnkk hrodtmx yyzpil ooqjb cvxzfh
kwa wak gipak gsgrw
jyy fja jjk kuvoqdy urqx
doyu chgn gvtxi qjdigvy kxr dizwrjc sll zenl yyblj
epxeqih kfi hlog pakk kkiidrh hiufw wuhif baqzxzi bgcd phi jzjdxjp
hllhyad sodc nyrtfe kygof hyyqi txddqg wcwxvnt ewqmj wwv
vxymuoe caat diqwbo vfruxdf sqniefn hetcbl nvtttu ouesb
yvoez pvthzc tdowuci wjijicn fhpmq kfobag yctdwj
xaugkb rprkg tidpx pjk tpwwm pbcfhr wmwpt sfynrl iouaw zbnyu
auakc culuxg bffg rodyhea ixlmtfb jdurl szoa
xgona fjzho buh khbvti ddh mgj ptgaqps
dqldupd udpldqd poku gfgpcg zsvk grvk kntx jih uwvxdvq sivk
mwdnq wmqdn uzto mdqnw
alvfm qxqo thwru xqqo jilnsgs rnonk fwntuby ogbha
gvxlxyf cdpv khvpka kgt gshlaa tenb
mtgvvxh mrjrsd truk rrerzx tujweaz
ozepw gsqkr rtmmc cmrtm
spnthg xhlzuu xwcrxz aqqejhh bpzh
ectdftk rgp mkp vxp pevriz wkgfkaw vfygj peg gep wjn
bksbu ywsszf tsbrps vxicr hfustju ynnlbo
sio urbvf ujezjk vkyc ukjezj bvrfu qwwgqmw uqfekvx bzipxus qfumwh
druru kycweog ycmef rjyy fkgp
rmf ifbip rsztco coju wlr bfbmsug lwr bsufbgm nwmp
jjuxtyd yif rkldsvu binq spepa mfg aszm
ghilaau ncm sgbavz omzeotz azukf bgjw zqzo gjbw pld
gtog iqheik budeu guvljmi
qqlj jqql ttk xcxu
cfq cfq kpagib dxfxufw hhksbjh gpcp
xkeax acnia jjubfc mhot uxlhh gnkj pavta rciondm rkquh xudqian
wqhqzg psqh rnnc uujlgq
hpjpaoa maa rdndl xewqj nmagwx xewqj hxuyvou xziv rdndl fbxmbz hmfwghy
dtwnrca hbfcptw qrmvat sdatx les zwizogq
bodiwzg sgoas fsf wgkrn zgbdowi wfkz
ngcsg grtao wcfxpyl gngcs fxwycpl fkpt
txvngo vxngot tkoap zqjc qzcj oeruix myh ihgdfik qtt
rxeh fcbnoo rxeh lve wvoc pmnxej dlcbrh rztt noibg
zyvq lwxqu oyjv bvidmf wxuql
wzc zcw czw dnhkvrg nzslrf
cfgl uwhxu qnsfmt tgyabes mqnq nkitq hmcvxlt qqmn yzmb uomqp
lwziur hgmdmv zuvipkp vir apr gfaq zeo dunat mqgafzg
prq pqkr xlrw njf ncqni kgpoma cmtklv
jwfuc poz opz fuple
fgleub lcgnifu lkwo kftbc onvwvdx lukpod xgmh rnj
rwqvv ezjmoni llq ekd cdvv kzcci gzsj vuipv fnw
rtnua gbnzg kqtogns iozzwc kjpzz kiiurey yzlvzx cpy xrue
fexcjmw ebwssx ewbcgwd uwolou nfdhic vupiykn jss djoo xftbkgo
idf ipvmez qyevwd wfsjxja dif dig
szpbtsa bssaztp sptzasb qppgz odur cpmn wpmg
pxn zjmq rbnr azwstzm mln upaqyty nxp oge nlm
bfaryqv hag phtvh ypi
epeeog lip zqio wuehlnb bau sbd dsb
xbrrp sej agrqnpa aarpnqg bnwyi jbn
uqmsvd asmuyy czxviw pznnmvc
sddwmek wnaea iwphupk sabo
cingdks ksh mtyip zltgafm dflkcd wbdnqup uokm gmxpyd libz svv akce
qge ewv dkabkmb xcpi nrkmsu mkmb djvamg mhhrwjh
krjt etfhm bxzatw zdkvz ehov seyxbw mkiirs plzoplu sogmwb wodfcle
qwea adibdp emo homrd pjcrhlc eqaw kqsrp rphjlcc
gajzo nwjg qxjra jztcnir ijvjwez avxb afz zyywqz kcszgh elmlkfh
lbz ozia bctf bumoji anhil rta xvit
ejybire ypjl qevak fzalx mlh qxlei zib
xmzas kwojjz ntrnrw nbmxlv mdgxs xjhxg suo zdcrxl qkujisz pxmu
eezyd unrtm wyu vhufvto rpb isfcy ygh hgy
nszvbzv ebtt memrsva ebtt qwcaq bhbas pvzfbov ppjbdy nszvbzv jabvrp
rlo zbmi lugvu yeby
tfcd tvl faaq mnural nyarh xnxk ctdf bodz
vwdrhc gub bgu fpcovx rcvwhd jukwsue
aekrhi lpknnrh bett tkib ioqrap igwnst aekrhi lhha
acg mknhazp pcgjuk tajplv
masq fyjkn agq qhxbbl qga npzj fme xtihic rntisg iqv aqg
ipagh fjth mswztpi iexd cocojy vhqrla joe wrsrmw
njztu tsh auqrxca zpp
jctn webxi haq irrr qox irrr webxi
reaw axmnvd voakf lnz ftbxfh zjyxzl pryfjpv sistgb pov mshs
gsy ctsngl ptmnyx vpjx zpvtori pfu ioycdrq
aobdtlj osdnrth sgqe geqs qegs
oamrlxk ygbb rkamoxl nztl sarbmtj yqupjt plu sbtarmj vpa rxea
yvhgp yznko epwpza gqrsod rilukp cglhomj wnaplu ugvdko qdr
cggztg ajw gggzct ubmiefj kpa
rel lvasbh kobm mdnzla pwnyj ehep gzx nhjdnsg rxa
qaz gook rplqwh vsht
dhe aneq ivrn awekad ckcbt zsqca ehd rvni oulwfuu
oxgzzow wntz tkqaoi oxgzzow lwkdpgy lhd aekjasp tkqaoi dnhaw
alxghco cpanoa onjh hyeyebe whxn zfu zozbll gojn
zdqulsa dlqsazu zqudals sfedw
rydtrsv rrtvysd fvyza drdgh lsfzt blnxr cnxe tslzf iijyds ylcxn
cczea nxx kwol kopaza wuvr cyvoo whlicv
zbmrwdq tlzbevx jwzpsc uvkwpd bmss rbzblj
jogx jgi gji hypmtkg ijg oscjv
flkoqja kwmrqv wzehel fvmcfap mkwqvr ivwxg jqfwdvo hweezl
vgjg nzucho nuohcz ggvj tmxci
fqaqx zeybhtg bxeic lftuqp wzuerz sww qfltxk
keiy myrvp blkxcg lncqmsu diittlg fqrf digrel cpwrk ipan dkxb bymlzo
owm irygdz pyhj mow wmo
noul pbvvt zcv ueqyjl zhetlw lpjfhli
felvwb wdykz kyibdz haq qkouj vuav oztyqh
dyxo njcr hcuk ysrr pucw qbajztc
ooyaz pmt hqwu gjx tmp tpm pwz
lyhzajz dfot avyifo kdwka pwypcep kyyw tirlku zdpjmft
aexle hfxo dacwvcy xsiotyg cifq ibupshj aktt rzvf pgafj
pxubhw ibpm jxtxg iwnssf osbpj
exmtfyx blbfg emrunru zkuhoi lfzn zrj unmcece phuppi
icomb rmy mvsqqkh zwjubz lumq wekx
cmdgs gsr pfhqx pfhqx cmdgs pga
rpyf jejc adaiou dutv imbenyu dqw zhebjhu pryf vtxs yprf
cxj roprjn rqoh qacagru snxd
rczvi hfpl luc yowgj nvavlhw vjudkmv dwu teq
klwc cktzh ksnvswl nsgeu xyohp mhs fxnjhm fwrcg rdeadkx cim
ounvb vzqje ujctzzk iyy vxck ebtvbqr uswsmcr jveqz qejzv jmi pboq
lwffygh mqsh vnnj ufz qhms gqfuxo lurzmu
buf psdluck gapwoo wgll sbfavbc lljfvzx cdgo rpt sfvabcb
svefr kubbri fervs nboi zkvq
jwr vtc zkcpzb kczbzp cdned pzbzkc wigjuak fszgweu odflfek
vwdqm khnnj plokjg vnce venc vecn yzxtgb
tawl yrhoz tawl yrhoz
vvehsl kdhzgme rix rcs btm pxnlsps vlhesv sxpnslp yqjtool
eqpyw kpmkcyw wqhglxg ajfzo hbd qvmhy nhokah iisqvad kxuyd fxek
jsz txhwhah hxt djnvl srylveu pxp dzmmn epek tzs
joyzql jqczueb rtdyw fyc fjirfyn tjcalz joyzql fyc
pjrmiz xwnmwns kcqjuut zfgxhdr octwn kqppg zhfgxrd wmwnnxs
ema yqxqs aljjo ajloj wozb
urgmhiz epqj vhhaxdm ptlsvig qzbmm cumbho lkg gyzmg eaopyzf ncfy mqe
ijvwvo oszkees ugvyk hjdj ftip itfp
ylfw qutzdj mgqp cyjss yzsdqqi iykvs fyor sthyqp mrjtzee hgo zwqbtgk
bkfkns gco bykzc mje dwmkrwt ljegqor yxjxp oaleuu
xeltq ggyqis aud frtyxhx iwz wiz fwoxz fozxw
zdu nwduqsa nced iphaaxo
bqjj oah ezd brhgxrc pmkz kdog exw
ihatt hck iepn egemprp wrz wzcuo xjzeaa wku ivjvihh
cwkuof bmj qmxd qbtms zgdei bsqmt ssndhw eeenku lcsqy bvvodr
tek zsgytci vgoun kwwu
jcxvp ijxc buqgix uil zfoku
ggndshq bmjeo yqaxtik blspz yofh edaroy
ipvtxh ouye elln dllvx iqza nhwf zyfw pvlky
iydcx gvarm gvarm wegmiy
sfjd liiflle mulboe qywzs tzbns trojl pad mnfcrhb sltb
gthqj jvpsof jwlfyeg jwhlfj
qckv umzrge gnzc mnr xde
gvgxmhv txnait taxint ius iboqdj
vsfex kbpvsby qembkb efxvs vhflzvm eaazg dyg bbmekq
wxpfk xwfpk xwkpf cjsyi
knzg eefq feqe seppop ttxz qnqfn atgsy cch mkjlbwt uyhct
quzw jbiw miqehe qvf jyipqh kzcjxyh
teuvzf tdtwoi pcuafa cwgjk ccur lgmqv jpjdkk efrnw uloqn dpkjkj lwloeph
yaffjy xntstsv gygq sxttvsn tvnstxs
cvbmdf pfrfkna wupv van iocb hsiyke obspj ytyfkl hbsqtij hkcw
oeddmnu koso mdodeun ybe mhjbmwy ubejz soko yxvuv
nylhy ylnyh olb vcdik
gsp ilba llnu jjk urbvuma qzypf bkceotg ezxq hyvjngf
tfnegyq rue waeif tfnegyq mvqm
wvgnsk cpd oib wrdfaz kohwgkc kzzig hogkwck gkizz
fecuuyp yfq bvanvxb cjeqwf unw dccr qzh zqu voakj
utoazh bjuq kmhcre izmny mirorsy twnl jyoc
fnnpd dmr ccgu eqgewc zuqivf
kkxiba qdabuen oikaz dnuywmm
aogud adugo uzcglpj lucv dgoua mdsqa mvrg
lymhv sof hvyml mlvhy nit
chu bwxp xpbw ghaix seklnc ola zofnrwt uch
wtt abob vblijtd oabb qjws
uozrpw kgf gxidxm uehdr fta pqakkrq atf fat woaolk
gaee voshd ghlyy emvzlkg cmcgk tuwlsj jwtsul znrta mjieqph glker
qiugxas gkg cbzmoz kahs obzzcm
puz omcokz gjc heuqb
dgndhb wid wdi scwnrjf juaisgo eivaw hgdndb
mgcrd hnqg pkpeb vprxcp
atlcnzp fyp cpkivxi bzj ypf cqpt bysu
pnd jiitmzs csw mxnpck vxutdrs ivipzy cws xiegsy qut
txlk avcvbuu hnq yyriq ajyswd urgiwc
qgiqut gvblizs giqnfrk tty mvoj wpikl giqnfrk bkdpndu xztmxn hsmqxf
llthg zjslki wilj rcyfois bavz hrqxn
ytbw hlkl vip skycogy ejiirhx
ndmtg bthlbw lsoq cvlvo sqol sqlo bppl sdkbls dtpyzrq vgm
psm xpj xjp lqi spm gqirw aglpj
htg fcchvyt xffev szdu lieadft
nbjo qohgzu vofg vvild dbtyi pdolxn plnoao jxze xlpbxj brajzg
urpp jjv lihmvp ivkwdqr sesyp ypbry qok sesyp ivkwdqr was
yinepzv qvnzdtf apv ucxo bdioo juga hjfsyl hmowo avc
dmiv tplae iiuiaxx tpale pyzkc
giwhst mpexd byfyc swuzkc
yydkwp xuu vjya kav ujmcxy qrtp zvlk
lsvdyn tkw qxu omvlc wwmfvov mrgcoov dhpu tfair hupd zbx njzgwtw
zuz rsxc xsrc gdwwf nycsv zzu kcu
unlvzv jerqqgm nozma ykbflj qihqkx
pctffo begf ivrvy ezru mvqt waocq
tubtuk gxkc ikgw bjrird kxjebbh sbjyc yafkd khqajmt aclpmf gqfo yrpf
rdt vrxa fyudo myeosb ursflwk
wbjras edlbwdp ctobtw jbvtvcd xjgoo cmunxm mjtbpi klovx bypmsab unc
xckml uztr htublq vilabvr jdiwus qejxur evfw qqm
tzqq tzqq wkb wkb
dgmg ljzc dgmg mbmco cgze qsap jccvot uors iiq
rwvac woylk dmn teorprx nyuvz hcwwxlj lvej drbjo asjgq
ljen tpfl vixcivr guaf lnje waim jlen
djgaa janhi adudm yzv zkcb xqw fgvrz
kpkjoon ggzx skp rqcsw xgzg zgxg jtf ghc
rtnyxo qixfd nphekk mouzk gny fpzquw qgywx rpr gqydze
gawdlv vrivoof rte iyp gaih sfzplm
csojx wzojode uzy qulr lylmb guvtkwv
ovxj aamms ftxo ebckdqw wqvsdci jwfqxks jafrcrn yyomrot
qnu jqwr ywudxk qpsez rdc kiyfz iiecf dthxjjb bown
typ zxcvjo rip acjhl paaab qhqipg xkguye sbxy pomkvn
ofvaegv hgak oafevgv hkemar rqkha grklnsp msvkkku rekahm bxmjnw
ahoihju sdyn phi uhz lupbx
lavt jef klmq oqyfpf kis nazul ymezxek xpla fxyrfnt
nwnagwy hvpjqfg sgm ungfstr gso owqqxjh
hey hye ipyrt qxmthg jth wpbr hxgmtq cvfkfux qykdzhk movcfnl vxyoc
zsras abnrj fgaczuk ssazr xzf cnxu gns wnqqy dwjh szars
uhb zanlvh lvdotkb xekl kcofo
lhx iccy ibkjw ciykxaj imsx ehamqlz iwzapxc rhaltv
pofit owmpqej vwrobh jvox gdqehss yyxd styu tfkm fiotp
ecz mdpoqsv mdpoqsv yxx rexok hcfll yvury hdhcfu juhkvpt rspnfj hxvgdir
ohed mtigaoe eodh agmiteo
vjvv hfco cppbxtw hawsjxz ovlsq qgs risgwhg auhj
togivgg czrtvw ccz wzvtrc bse lsk
ndc ndc lrfi iyleol nchx jxpv xdcsfmp nnx wtvq pih tgc
hzpf sur zhfp klfmhx lbuidp xiqimnf
qddpdk trfxpip pnsowj hidgvnf prur rsrautp aamykfm fysqjmq xwzjane mbmtxhf oqctt
lfd eops govslp ultbye vrqai hcjkcf snpape
cbok koumkad otpozb pqcs emilpe wpcyvxd bock
spjb xkkak anuvk ejoklh nyerw bsjp zxuq vcwitnd xxtjmjg zfgq xkpf
juo pmiyoh xxk myphio ogfyf dovlmwm moevao qqxidn

In [15]:
input_data = []
with open("day4_input.txt") as f:
    for line in f.read().split("\n"):
        input_data += [list(line.split())] if line else []

part 1


In [266]:
def get_valid1(list_of_strings):
    valids = 0
    for l in list_of_strings:
        valids +=  1 if len(set(l)) == len(l) else 0
    return valids

In [267]:
assert get_valid([['aa','bb','cc','dd','ee']]) == 1
assert get_valid([['aa','bb','cc','dd','aaa']]) == 1
assert get_valid([['aa','bb','cc','dd','aa']]) == 0

In [268]:
get_valid(input_data)


Out[268]:
466

part 2


In [41]:
import collections
def get_valid2(list_of_strings):
    valids = 0
    for l in list_of_strings:
        counts = [collections.Counter(s) for s in l]
        valids += 1 if all([c1 != c2 for i,c1 in enumerate(counts) for c2 in counts[i+1:]]) else 0
    return valids

In [46]:
assert get_valid2([["abcde","fghij"]]) == 1
assert get_valid2([["abcde","xyz","ecdab"]]) == 0
assert get_valid2([["a","ab","abc","abd","abf","abj"]]) == 1
assert get_valid2([["iiii","oiii","ooii","oooi","oooo"]]) == 1
assert get_valid2([["oiii","ioii","iioi","iiio"]]) == 0

In [42]:
get_valid2(input_data)


Out[42]:
251

Day 5: A Maze of Twisty Trampolines, All Alike


In [47]:
! cat day5_input.txt


0
0
0
2
2
-1
-3
-3
0
-6
-9
0
-1
-12
-9
-2
0
-14
-6
-2
-10
-12
-10
-13
-2
1
-6
-14
-2
-11
-7
-9
-15
-22
-25
-26
-19
-28
1
-2
-38
-39
-30
-18
0
-26
-1
-24
-1
-30
-44
-35
-9
-32
-5
-34
-4
-15
-21
-30
-10
-32
-19
-40
-12
-49
-58
-2
-14
-51
-37
-9
-4
-48
-64
-37
-55
-40
-37
2
-22
-68
-57
-57
-83
-65
-38
-22
-20
-78
-27
-40
-4
-83
-33
-47
-74
-41
-74
-68
-18
-8
-27
-23
-53
-70
-43
-99
-48
-90
1
-74
-9
-80
-96
-33
-7
-53
-98
-54
-47
-84
-81
-79
-86
-14
-115
-121
-30
-28
-13
-113
-41
-20
-34
-19
-71
-39
-17
-91
-115
-108
-74
-134
-12
-91
-27
-59
-27
-132
-34
-8
-52
-93
-17
-151
-93
-102
-62
-62
-120
-25
-75
-35
-162
-61
-107
-83
-106
-23
-168
-42
-13
-74
-52
-169
-123
-95
-174
-56
-43
-84
-21
-5
-120
-130
-55
-3
-93
-158
-61
-4
-74
-65
-157
-112
-147
-24
-23
-155
-82
-73
-25
-82
-42
-200
-120
-57
-96
-38
-121
-25
-211
-117
-42
-181
-56
-204
-193
-88
-143
-167
-42
-178
-204
-57
-120
-33
-164
-122
-219
-136
-174
0
-36
-64
-77
-34
-158
-163
-194
-212
-101
-48
-216
-141
-142
-189
-101
-144
-158
-114
-88
-251
-172
-173
-94
-89
-12
-188
-218
-130
-33
-117
-39
-245
-195
-20
-37
-183
-24
-48
-159
-36
-68
-96
-215
-127
-241
-171
-44
-2
-203
-27
-37
-241
-173
-193
-143
-52
-187
-54
-236
-219
-71
-197
-162
-245
-133
-153
-240
-250
-91
-128
-20
-263
-124
-46
-290
-194
-191
-60
-92
-97
-284
-60
-44
-208
-59
-6
-40
-292
-1
-14
-27
-71
-144
-289
-16
-266
-80
-138
-215
-249
-104
-29
-260
-124
-178
-331
-283
-47
-253
-80
-316
-62
-15
-327
-64
-201
-26
-60
-110
-117
-13
-99
-139
-124
-25
-242
-92
-10
-322
-110
-169
-26
-353
-284
-234
-361
-95
-37
-93
-186
-90
-26
-90
-268
-179
-305
-378
-145
-238
-358
-186
-108
-120
-75
-109
-279
-192
-308
-197
-373
-19
-38
-238
-133
-60
-334
-45
-169
-167
-257
-107
-222
-380
-321
-99
-177
-268
-224
-45
-323
-407
-167
-125
-243
-331
-268
-132
-254
-204
-191
-280
-242
-223
-313
-237
-234
-274
-327
-271
-362
-39
-194
-184
-16
-214
-46
-199
-108
-332
-316
-29
-327
-200
-52
-260
-128
-103
-67
-109
-432
-399
-153
-403
-176
-434
1
-225
-286
-375
-206
-395
-275
-120
-404
-381
-156
-215
-350
-257
-293
-231
-114
-52
-149
-296
-440
-413
-285
-400
-265
-378
-75
-381
-281
-436
-137
-335
-111
-92
-12
-27
-20
-208
-322
-151
-264
-207
-361
-314
-258
-81
-327
-440
-286
-108
-272
-392
-17
-40
-486
-287
-205
-211
-160
1
-216
-114
-32
-143
-113
-489
-109
-56
-371
-258
-430
-29
-475
-141
-477
-169
-473
-264
-225
-123
-412
-395
-391
-28
-527
-493
-471
-401
-510
-430
-154
-34
-533
-544
-39
-535
-553
-447
-144
-517
-482
-362
-265
-434
-504
-526
-31
-53
-170
-44
-126
-75
-163
-136
-508
-564
-289
-68
-541
-165
-496
-78
-117
-268
-326
-361
-194
-483
-495
-560
-215
-363
-275
-426
-160
-333
-182
-457
-96
-200
-569
-236
-31
-365
-419
-43
-366
-385
-322
-430
-334
-156
-377
-184
-522
-289
-129
-87
-501
-606
-84
-163
-318
-552
-442
-590
-137
-517
-161
-333
-497
-150
-188
-401
-613
-131
-595
-18
-591
-134
-44
-637
-500
0
-349
-483
-258
-124
-449
-260
-150
-269
-305
-650
-619
-328
-478
-5
-514
-73
-261
-503
-101
-480
-37
-192
-497
-298
-464
-514
-515
-203
-17
-302
-9
-409
-285
-140
-46
-136
-470
-544
-666
-590
-382
-546
-619
-194
-543
-323
-264
-673
-177
-342
-539
-507
-660
-655
-272
-28
-181
-266
-242
-337
-116
-421
-537
-24
-6
-241
-110
-255
-429
-31
-380
-214
-337
-514
-68
-102
-320
-12
-648
-180
-192
-554
-182
-303
-623
-583
-686
-367
-325
-488
-71
-466
-625
-402
-104
-348
-690
-714
-708
-212
-302
-286
-44
-386
-455
-456
-353
-469
-145
-116
-412
-273
-705
-331
-519
-592
-630
-396
-82
-434
-35
-436
-490
-471
-738
-488
-476
-295
-399
-262
-44
-761
-121
-643
-383
-221
-11
-380
-555
-382
-68
-554
-621
-27
-549
-661
-197
-116
-339
-577
-206
-790
-283
-248
-163
-503
-481
-573
-308
-650
-42
-23
-451
-72
-470
-709
-589
-495
-377
-246
-5
-667
-697
-585
-511
0
-787
-559
-320
-81
-782
-660
-153
-111
-162
-584
-103
-774
-827
-453
-815
-290
-794
-667
-524
-281
-230
-205
-333
-495
-705
-568
-519
-132
-819
-190
-736
-135
-649
-712
-126
-233
-827
-353
-197
-803
-19
-124
-691
-234
-96
-690
-500
-321
-277
-56
-838
-512
-6
-70
-611
-285
-253
-14
-545
-143
-193
-352
-755
-634
-572
-320
-132
-522
-688
-273
-194
-613
-492
-715
-624
-581
-505
-185
-468
-853
-445
-407
-605
-86
-583
-160
-746
-436
-673
-597
-479
-278
-259
-503
-121
-710
-169
-363
-639
-325
-146
-760
-673
-177
-400
-431
-782
-756
-166
-300
-461
-917
-872
-786
-921
-346
-137
-638
-396
-812
-107
-303
-55
-70
-675
-477
-520
-843
-632
-290
-497
-758
-20
-636
-166
-681
-459
-591
-332
-65
-814
-373
-909
-72
-71
-513
-387
-209
-199
-777
-663
-635
-874
-596
-733
-226
-950
-845
-321
-94
-450
-672
-665
-469
-369
-415
-210
-290
-911
-140
-413
-823
-74
-833
-163
-577
-576
-926
-683
-417
-970
-11
-460
-689
-493
-879
-797
-578
-918
-633
-591
-915
-550
-646
-33
-122
-184
-324
-1006
-937
-215
-253
-420
-495
-797
-950
-631
-409
-528
-312
-282
-594
-377
-258
-1017
-354
-871
-25
-650
-765
-246
-710
-815
-772
-733
-920
-1001
-355
-581
-782
-711
-1044
-922
-74
-391
-3
-847
-1020
-963
-1036
-1007
-123
-605
-642
-591
-648
-688
-555
-937
-862
-885
-553
-509
-723
-696
-406
-960
-160
-633
-823
-874
-1076
-962
-736
-984
-486
-645
-932
-734
-744
-21
-20
-506

In [20]:
input_data = []
with open("day5_input.txt") as f:
    input_data = list(map(int,f.read().strip().split("\n")))

part 1


In [21]:
def when_out1(list_of_nos):
    l = list_of_nos[:]
    current_index = 0
    steps = 0
    while current_index <= len(l)-1 and current_index >= 0:
        # print("----",steps, l,current_index, current_index <= len(l)-1, current_index >= 0)
        steps += 1
        forward_index_by = l[current_index]
        l[current_index] += 1
        current_index += forward_index_by
    return  steps

In [22]:
assert(when_out1([0,3,0,1,-3])) == 5

In [23]:
when_out1(input_data)


Out[23]:
394829

part 2


In [24]:
def when_out2(list_of_nos):
    l = list_of_nos[:]
    current_index = 0
    steps = 0
    while current_index <= len(l)-1 and current_index >= 0:
        # print("----",steps, l,current_index, current_index <= len(l)-1, current_index >= 0)
        steps += 1
        forward_index_by = l[current_index]
        if forward_index_by >= 3:
            l[current_index] -= 1
        else:
            l[current_index] += 1
        current_index += forward_index_by
    return  steps

In [29]:
assert(when_out2([0,3,0,1,-3])) == 10

In [28]:
when_out2(input_data)


Out[28]:
31150702

Day 6: Memory Reallocation


In [155]:
! cat day6_input.txt


2	8	8	5	4	2	3	1	5	5	1	2	15	13	5	14

In [156]:
input_data = []
with open("day6_input.txt") as f:
    input_data = list(map(int,f.read().strip().split()))

part 1


In [177]:
import numpy as np
def cycling_reallocated_buffers1(buffers):
    l = np.array(buffers)
    n = len(l)
    diviup_by = n-1
    visited_buff_configs = set()
    buffer_config = "-".join(list(map(str,l)))
    step = 1
    while buffer_config not in visited_buff_configs:
        visited_buff_configs.add(buffer_config)
        max_index = np.argmax(l)
        divided = l[max_index]//diviup_by
        remainder = l[max_index]%diviup_by
        if divided == 0:
            for i in range(1,l[max_index]+1):
                l[(max_index+i)%n] += 1
            l[max_index] = 0
        else:
            l += divided
            l[max_index] = 0
            l[max_index] += remainder
            
        buffer_config = "-".join(list(map(str,l)))
        step += 1
    
    return step - 1

In [178]:
assert cycling_reallocated_buffers1([0,2,7,0]) == 5

In [179]:
cycling_reallocated_buffers1(input_data)


Out[179]:
3156

part 2


In [180]:
import numpy as np
def cycling_reallocated_buffers2(buffers):
    l = np.array(buffers)
    n = len(l)
    diviup_by = n-1
    visited_buff_configs = {}
    buffer_config = "-".join(list(map(str,l)))
    step = 1
    while buffer_config not in visited_buff_configs:
        visited_buff_configs[buffer_config] = step
        max_index = np.argmax(l)
        divided = l[max_index]//diviup_by
        remainder = l[max_index]%diviup_by
        if divided == 0:
            for i in range(1,l[max_index]+1):
                l[(max_index+i)%n] += 1
            l[max_index] = 0
        else:
            l += divided
            l[max_index] = 0
            l[max_index] += remainder
            
        buffer_config = "-".join(list(map(str,l)))
        step += 1
    
    return step - visited_buff_configs[buffer_config]

In [182]:
assert cycling_reallocated_buffers2([0,2,7,0]) == 4

In [183]:
cycling_reallocated_buffers2(input_data)


Out[183]:
1610

Day 7: Recursive Circus


In [184]:
! cat day7_input.txt


fjkfpm (69) -> kohxzh, liwvq, eqkio, xvoyybs
dsiixv (52)
fhimhm (66)
mdlubuq (73)
ulobwyb (41)
cbgnzhz (70)
hrheyzf (946) -> fixqj, msyvs, pdwjcd, tlgdija
yrnjhqc (31)
xlglga (714) -> hohft, funabvw, zhxnpoh, unpdcwm
hcvwov (240)
qnhvjec (35016) -> pimzjjp, ghatw, tbakk, olgmto, qeaqiuq, wnmnz, aabbf
efgdfa (405) -> uyedi, rxkmf, syhipz, zozcoqd, uwprsvh, dqhoh, rcbhgw
vofrtf (55)
gipbso (52)
cviwy (426) -> ildgly, syojg, tgoztyw, doavm
okzkfw (159) -> ndteuz, bkmepbs
ylfvgv (5)
ydxuhqe (72) -> bfftnj, uwrll, njlaepf, kbfpx
hwfcy (54)
iqtdzrh (65) -> qoppte, jcsqqxv
ddumyx (220) -> yjowio, gefjk
edagh (12)
kefudoj (82)
indjoox (36)
cliojs (35)
lrvmyj (79) -> fadkfic, pcikcq, fgeup
mvyzuw (73)
nholw (52)
sjbqzk (212) -> sijon, bcedyx
majskr (49)
qjutng (15)
iavwfbb (19)
ywonug (50) -> dgjyf, kobwktw
taxky (77)
lufkiy (44)
lcwqdxx (34)
felksho (204) -> vkile, ihadu, qfczh, wvgzlw, axawjtm, eutun, vkzmf
rvtus (94)
zjxjhwc (53)
bnmsz (95)
cvcyykp (31)
bfxvxpl (35)
niavkxg (16)
zwcsjgs (7)
gtqwrrx (44)
vszpkfs (107) -> rubvop, qsvjd
axawjtm (12) -> gtbocpw, oxlvr, mvfjras, vgyzdkt
ulvbf (82)
vkzmf (252)
jnedlwi (100) -> rkftwvy, gwyrtw
sztry (247) -> vddarvs, tlzlq
anwbrxk (69) -> ybnsg, rfwgt, pcppql
pfxoef (66)
ghqixh (171) -> cjcytbb, dmare
jwrmi (130) -> mhrzazo, qeuwgn
umsrz (7) -> jwrbg, wqpahuv, zquvn, sfjyf, uebmnqa, qqkqhzb, gmbup
wtsqx (46)
rzldn (31)
usmtdk (166) -> pikelbw, edwlns
pyhecs (59)
shwsf (56) -> wtbst, ryjqaz
jhkkrg (63)
eaagt (40)
wkbqm (59)
iivwxhd (150) -> yfgyi, grdimrp
nlkwsrn (50)
idnsypp (94)
aixwgk (41)
yhhnavm (84)
lngdxkd (146) -> hkkzpzh, ihvfxeo
dkwwoa (73) -> sntbr, xbywgft, xlkvx, akght
jevqne (8)
vurnn (81) -> fkehyrg, qhktzou
ngoog (20) -> uusec, rrnkqx, jafsqqu, ryeiot
hxhguzh (75)
kohxzh (1765) -> mjpmw, cbmkr, vmofl, wsjizsy, redeub
twpvnu (56)
kzumm (132) -> czgxag, vytlfm, qowepn
fgnye (44) -> pxcjw, bnmuprs
jvqfj (60)
yvllxxw (55)
hsmaze (34) -> fxzqvoh, fcvsqp, okzkfw, vwtsdsf, ipbbnp, txdprek
aujdy (14)
yjcevge (61) -> rpyxxhm, tfbqaoe
blcpm (217) -> qibrsjj, wcfykko
pfltnc (44)
anqas (63) -> riuwg, jhkkrg
rtseps (51)
vmkfcpw (92)
pcppql (78)
tqrqs (43)
syxdt (12)
ejlecie (79)
xpdmegi (16)
dgjyf (62)
uxhpm (51)
znchnta (66) -> sutzt, kvjyw, hlshpkq, corcne, rflrj, yhadh, ouypz
zmdvl (50)
fixysjm (1386) -> zjylql, ytadaxm, fgnye
yevywe (63) -> qeayjnt, ixyeq, hgaoiz, rcfaaml, zuzhmf
rxkmf (811) -> yedvssr, xvwgxm, wfeurd
mcmzs (53)
vsmdkp (60)
oyurf (27) -> zhjtcdl, jswxshd, hfwpcsa, lbvfwz, obolmhh, grgkv
yawmlbb (191) -> iavwfbb, xjjvneg
fblsn (44)
doavm (223) -> drasjw, cwwwcge
udyivld (18) -> osrdt, jpyojky, vhnnnv, gyxqc
ddqnllo (167) -> cdfij, quohxia
bwbym (55)
ufpdyq (22)
hkjcnv (73) -> nderndc, owjtoo
ndhravs (10)
qjkkohe (25)
jrott (44) -> jgylf, kaitdu
unvqq (173) -> lxdji, ldkojcj
zrgqfb (81)
csbgxs (29)
qeaqiuq (1106) -> nwlkk, ytyhmux, nxmtm, izpta
rqeftjw (51)
tbakbq (62)
vnhhu (62)
grgkv (85) -> xgmrufk, cvvkno
pggrr (29) -> bttvl, zrmzpo, upatvy
zumdwwu (43) -> jfssr, aujdy, adkyx, mragx
euxvn (105) -> qtazfdw, uzarat, mikalda
tpbcg (98)
kdnwlnz (36)
pncda (183) -> uswszht, zeebqts
zlvjnx (130) -> vctupmx, gmxdpc
iljdm (203) -> emqwt, leknm
lmgxknk (49)
pikelbw (34)
kqqegw (89)
eigsdc (20)
qbhvu (94)
kqoae (61) -> tqrqs, bfozr, kkqeg
bozfw (5)
silwwua (20867) -> kzocw, ymhsa, mzcebu
fcxninx (473) -> pmxzfd, kbvzpv, zskam, oyurf
ihvfxeo (14)
rkftwvy (52)
kccra (26)
vkxbeox (353)
suiagk (59)
lnqzgti (60)
leknm (50)
yxvmxzg (35)
jezubi (54) -> lnqzgti, hvsiuf
bzqhk (33) -> ndmpgss, kcoayj
xaovjvs (74)
mjuyo (263) -> psrup, boeuyxx
tvoptyn (1776) -> xjbtfms, tiphry
jbhohbx (25)
kqfgnql (22) -> pmozz, hspqr, ydxuhqe, txhxoib, cncoep, ripidvx, qezvrjl
pdkfixk (22)
kxzwel (80)
sykmuwo (243) -> zvogn, esmbu
livul (40)
rvmntl (346)
xqztuq (24) -> pyhecs, jqgkz, bsythck, ranlxct
edyohkw (79)
hszzxp (64) -> xcdswr, oukuy
yfgyi (56)
pmozz (74) -> ngaawt, oaknu, cgbkrnc
tfglbeh (56)
wpvozgo (53)
njaig (77)
jwrbg (134) -> fymyi, utpyp, ulxscm, cliojs
olnfe (33)
jcsqqxv (52)
fvkew (21)
nkdbmjv (34)
fhjgv (55)
tvqlaw (14)
wqpahuv (274)
myoyl (82)
pjzcs (38)
pcehxbx (1859) -> hlfmvdt, ngoog, mwhraq
kqohkg (56) -> hezkdc, kgfudu, omeew
adtpk (1655) -> unvqq, bpbwl, anqas, kmnzz
afihdk (65)
rtiaapt (18)
obolmhh (109) -> lufkiy, kiryhz
dkegbrt (45)
rbiarxk (81) -> erngeah, cqcjys, bxjqibv
hmrzqlh (87)
biemun (295) -> ejbtu, hszzxp, kcxiq, khixwdd, usmtdk
mvfjras (60)
uqktn (246) -> gtqwrrx, qtshuo
kmpmdb (8)
lylxk (22)
nxmtm (84)
goapac (88)
zlxlwv (43)
nirov (74)
fcjjqev (78)
finxtiu (92) -> vgdsszs, gofjvi, mxpvph
uvpwrf (73)
vgnkq (104) -> jczkx, iydqii
gsbmh (84)
ssblis (86)
knvxq (1845) -> pvbgvb, mcghosj, qocnylk
kvjyw (57) -> livul, eaagt, rukzsa, gsdzpjh
zhpdhat (76)
ypjnmr (39)
yauryvu (97)
ucahbv (82)
rkswk (70) -> kccra, lqasevp, bdvtnul, swqres
bqvtbsr (39)
cmfcqh (149) -> wlwnand, zikmmr
ouypz (67) -> mxelfv, fogmaih
nlrbcxx (41)
mrmuat (21)
kcxiq (150) -> mdvnu, dcwcs
aabbf (881) -> dsoyvp, hwraaxu, lrvmyj
mjxfsc (53)
dmare (55)
iruee (89)
gpsnzs (76)
wnpkwy (27)
zvnzep (174) -> tvqlaw, aufxtq
yysyjbk (1630) -> wpvozgo, mjxfsc, iality, vwupkmh
cgbkrnc (62)
mnfknb (41)
kcoayj (89)
vybmch (79) -> ebyfpmf, dnqdmxc
lmrzi (87)
tiyvea (30)
pcikcq (36)
mlqoz (20)
brmvw (144) -> qjutng, janbnmh
zgkxkj (72) -> bwrpc, wntfmtn, hwjmzs, vkxbeox
gzcbv (54)
nsqpaq (55)
hohft (69) -> hfjtksr, efzjseb, ypjnmr, bqvtbsr
kkqeg (43)
gafjq (74)
haano (296) -> rlburl, njkvleo
tvbmh (99)
fvsitx (212) -> nsvwcl, hohrape
yhtpdwu (71)
qxsjs (95)
qseqsgt (22)
vkhdfmv (36)
ikicwez (69)
tdrdq (24)
bgudw (94)
zhjtcdl (134) -> ceutto, fhynmi, qmyohe
pavtnxe (38)
xvoehjz (301) -> zznjih, wseim
klfyu (40)
zhxnpoh (119) -> ltyxiwk, wkgouh
bezoxx (184) -> afihdk, jevfpj
ivldghm (64) -> enmxpmj, wsrrryh
osnpbou (111) -> zpuktmx, itlno
uofuvf (70)
mgvcyl (51) -> nsqpaq, fhjgv
lluabej (97)
hwjmzs (273) -> agsfbkx, znswber
udlhalx (26)
gewlsr (476) -> uqktn, nknpwkc, udyivld
fsjvyxv (27)
birtjxh (78)
eplltu (84)
sdixs (54)
kqdseyh (46)
lfrfa (76) -> ejlecie, mvxud, wgevvca, carfsnj
lbwgsap (33) -> gpsnzs, santsu
pnjtt (45)
rcfaaml (157) -> avemxf, ehwcxy
tbutks (36)
xmhdsio (91)
byjcsn (51)
amslmyk (96)
jtdvzj (62)
xnaam (88) -> lylxk, sybcl, kuqsuy
boeuyxx (53)
pxcwhq (30)
mckyvtt (52)
pctkyat (25)
lomxh (53)
ltccbob (297) -> ndhravs, qlryl
vgyzdkt (60)
pyzbqz (74)
cjkieim (519) -> myeecwt, agtab, rhtqj, mmriyf, mfcutqz
ducdc (41)
mnxoac (30)
umtmwow (30)
qsxqwub (94) -> klfyu, mlzfw
pdwjcd (105) -> vcoszdq, fkmpv
wifaf (41) -> dnunil, gafjq, gwgchq
tpabsyz (91)
uwrll (47)
dcjiqny (1371) -> npblyaq, qeoetnp, qoeviy
rlburl (9)
itlno (37)
ehpdfno (285) -> bcrso, jqwaifx
njkvleo (9)
uswszht (24)
qvpou (180) -> sndject, bzmhwwo
ngaawt (62)
kyhezqn (45)
arouwsi (59)
uyoez (99)
quoqibc (195) -> znuldtj, bljppq
tiphry (33)
lbvfwz (89) -> qypsl, gzcbv
bzmhwwo (5)
tcbxnrf (285) -> ybgdelp, aqrpio
arjgn (392)
qfczh (218) -> ivhtlxa, jdazgj
jpyojky (79)
zinjsj (30)
qfsmgqe (982) -> mgvcyl, cekchxh, qnscg
mlzfw (40)
ulszlax (42)
myeecwt (69) -> veiljb, wydtqax, pnjtt, sxwbzyj
vkuucpv (260) -> fenymdp, uwehdau
qezvrjl (212) -> jdqhjk, htwzu, lzevbng
qnscg (161)
wkkkv (11)
bpbwl (149) -> mlqoz, miwjfr
icspwbg (83) -> iljdm, sztry, anwbrxk, ddqnllo, gtbmrcp, cpzwgk
bddlvs (70)
mragx (14)
vdyhna (166) -> glori, azttml, jxraf
zjylql (78) -> fsoqc, hefjuue
jdqhjk (16)
etkzf (11)
grdimrp (56)
tlics (101) -> twpvnu, tfglbeh
kskkjn (1081) -> uxmjgh, kqoae, wswwck, zwymlsj, qvpou, mtxzek, elxccty
qsvjd (31)
uurqa (33)
gytzi (18)
xsvage (27)
gefjk (21)
vpbec (263)
mocpa (79) -> ldvcrw, atxfply, ogtxa, rbbkdj, blcpm
wsdqchf (71)
zznjih (11)
ryjqaz (73)
hspqr (66) -> hjxzwnq, ojrixty
phkzo (263) -> licst, nbkzscx
haayebg (39) -> ogziig, pyscsi
kbdnbnd (94)
ioyealn (51)
nuoic (20) -> pmssap, bzuago, tvbmh
kuqsuy (22)
hvsiuf (60)
werskvv (78)
hohrape (90)
sybcl (22)
ksnxlcl (117) -> sdjxpp, yzpyzu, ulobwyb, afbnq
qlchz (5277) -> doxfeq, luiiv, hsmaze
ihadu (144) -> dquqam, ctvrea
dquqam (54)
pjamo (113) -> vnhhu, jtdvzj
xeypnpr (183) -> qiund, kdnwlnz
loaft (59)
loykzr (16)
bsbsdiu (81) -> ssmhkwq, alolk
efzjseb (39)
lbkrk (17)
ipbbnp (127) -> iauetan, tbakbq
uilvahq (1076) -> oztxjfl, oiufrau, ewyrp
gmbup (274)
gldvef (18)
evvfcyi (13)
nbhdty (97)
ncbrxsy (15)
dnunil (74)
zcggn (56)
mbcwjt (225) -> wxyaqte, kpffozq
vgkjgy (16)
bcnqhw (298) -> ohqivu, jzwusi, jzcstbe, xayqwyj, kmwkft
gyxqc (79)
ripidvx (148) -> rergyy, rwhjmp
mxpvph (67)
iauetan (62)
voawog (34)
mzcebu (11) -> rlgrkq, xlglga, hrheyzf, gbwfjf, mhkrny
sexuv (92) -> ednlrw, zcggn
fezoyaj (78)
uxmjgh (70) -> mnxoac, pxcwhq, ytjheqk, tmtfhr
tvfptpz (73)
rywggm (78) -> gxuovng, ragcph, epstabj
ymhsa (7457) -> zzqtmxd, yfwwrkp, yahzcyp, hmugaom
ygvvvq (392)
izssdb (215) -> ycseeag, ytzdrvj
bttvl (95)
abjmd (30)
mspxpr (1837) -> fvhvq, guvto
enogehk (45)
cqcjys (44)
rfllomn (107) -> lqndkq, tzkgrjf, lcius, lhlgijf
wvdswpz (34)
ocqrpkf (46)
oaknu (62)
qvrtwdt (1289) -> jnedlwi, sexuv, vcauqo
prnno (95)
wgjst (177) -> bozfw, salxel, jrrhzc
teapi (35)
adkyx (14)
huxtvqc (16)
mznsk (11)
fcvsqp (183) -> ebjgfh, bnvjfq
iwkotv (89)
mkykc (90)
dlrznye (83)
gtxdtf (42)
ahism (144) -> gkitfsr, osbndxb, zielffk
znztzxd (29183) -> jcsjaxj, hrwtz, fcxninx
jsbug (85)
kfkhxg (51)
tcpvyfj (18)
fpdoney (16)
kfefhun (27)
iufvcm (38) -> xjejd, goapac
fzltz (8)
rukzsa (40)
doxfeq (154) -> kzumm, vurnn, fzbwmsz, bsbsdiu, pncda, rtromur
dfrzb (53)
rpbeiqg (170) -> qseqsgt, qmeawpu
ycseeag (28)
blfinsi (52)
kvsprca (65)
uzarat (35)
zzlocxd (62)
iality (53)
daxbf (805) -> iktev, xqztuq, bsvoy
hfjpir (19)
bsiwtqq (58)
qnepf (88)
dasmiiw (56)
wseim (11)
lvgrmfu (180) -> ngiol, iwidsj
nsoju (38)
zqaxyz (59)
qocnylk (41)
fhynmi (21)
xeege (12)
mfslhp (95)
alolk (75)
qtazfdw (35)
sijon (37)
zzpevgd (17) -> smqtcaj, emxwr, uezxhid, blvyrzh, lvgrmfu, vkuucpv, eivaf
glori (15)
ssmhkwq (75)
dmkhzgg (149) -> fuwekd, bwbym
xqrrpu (29)
yjowio (21)
mhrzazo (36)
jakmbx (39) -> egyfwny, khdzsr
qzgdlb (33)
lwysj (49)
czgxag (33)
drasjw (20)
pxcjw (41)
hwfzj (321)
ssxqkhq (67)
ndteuz (46)
rwhjmp (56)
xsuxhbq (1268) -> injlqnw, vdyhna, bzqhk
aufxtq (14)
nknpwkc (164) -> pwyfdan, jsbug
dqhoh (787) -> xeypnpr, quoqibc, wisdd
lqndkq (54)
vabii (89)
pmxzfd (747) -> xnaam, iaoxdmm, hsywhj
fuexyx (8)
wkxyxtf (20)
bfftnj (47)
hoqti (6514) -> jviven, znchnta, daxbf
aqrpio (24)
otsyp (54)
vgdsszs (67)
lswutyd (60)
egyfwny (73)
wyiec (56)
qeayjnt (31) -> qbaig, yhhnavm, eplltu
tjzkwy (59)
vwtsdsf (251)
jzbnq (78)
gtbmrcp (303)
pzoaqn (94) -> ierop, llepsqz
oqfiqf (185) -> nirov, pyzbqz
kjtwz (97)
gmrkqq (86)
nnkru (16)
nnpvdm (5)
rlgrkq (9) -> uakxuru, qvzjgne, xhrqzk, xatzz, hwfzj
oukuy (85)
gsiokvq (80) -> tcbxnrf, mfunt, tyqnwi, yzxqqx, ehpdfno, oqfiqf, clizzo
qluzb (58)
bzorz (66) -> ulgrn, kjmvhpa
iqckb (103) -> zuaamot, knfath
zikmmr (87)
ugplhkq (58)
vddarvs (28)
agsfbkx (40)
riuwg (63)
mmprixv (66)
pimzjjp (58) -> dresofi, riogonj, encjlzj, rvmntl
eiekcd (66)
gxuovng (38)
vfdulx (6) -> bhnwdot, qxqdyx
iizpgi (84)
ctvrea (54)
qscadxk (28) -> hrrqb, yxfmelm, roojn
qxqdyx (50)
vmkib (527) -> ltccbob, lvktp, nuoic
mwpejh (82)
gwgchq (74)
hjxzwnq (97)
wisdd (75) -> vsmdkp, vzxet, jvqfj
bsvoy (260)
pmunsu (17)
kbvzpv (24) -> vybmch, nkwisjd, ihkcorh, bmyme, pjamo
xlkvx (55)
uezxhid (58) -> brapqvt, cbmkl, ijpzp, werskvv
qoppte (52)
oxlvr (60)
fuwekd (55)
qgytb (10)
vhbtdr (5)
rtromur (217) -> qbtixl, nrphw
mmriyf (149) -> zpkhzqb, kmegj
nukpse (7)
hdvcgn (56) -> tjzkwy, arouwsi
ghatw (920) -> jezubi, kpwvh, ywonug
vcoszdq (31)
vcauqo (166) -> hfjpir, toaan
fenymdp (55)
rrnkqx (41)
bsythck (59)
uyedi (1348) -> uxhpm, rtseps, kfkhxg, byjcsn
xwydsz (85)
fecwfs (20)
vxfyyd (60)
atxfply (233) -> mckyvtt, blfinsi
skrsezs (93)
cncoep (72) -> bgudw, qbhvu
awyhreh (57) -> htuuzu, eudowc, knvxq, felksho, dcjiqny
kpwvh (146) -> kgbjthh, iljkad
gmxdpc (42)
xxleimo (37)
hjbac (80)
twblj (191) -> tbutks, indjoox
qbtixl (7)
hubzsdn (102) -> zeiqoz, ukbzl
yhadh (85) -> twqkuk, fhimhm
injlqnw (37) -> hmrzqlh, lmrzi
vwmyqub (96)
omeew (73) -> kbdnbnd, rvtus
efsanp (33) -> loaft, wkbqm, suiagk
frkjf (114) -> ziyive, mdcxis
uybuil (44) -> vabii, iawzjqd
mjrfrb (35) -> nbhdty, lluabej
xhrqzk (311) -> aktnest, ixoas
yzxqqx (66) -> acbakwi, kqqegw, hmxxv
ikyzq (4037) -> oykurjk, qfsmgqe, biemun, zatfti
akght (55)
mbzzt (877) -> kxbmr, iivwxhd, ddumyx, kcxllz
ztpawhz (52)
zzkusct (77) -> qrwzvrb, wnjjug
gujegtc (27) -> bddlvs, lcjjc
rulju (14) -> dgwrgu, iruee, awxygg
djodqp (82) -> tqepyv, huxtvqc, loykzr
vrhltmp (77)
zozcoqd (487) -> alvjc, ahism, zzkusct, tlics, rbiarxk
ymxqafr (93)
vmttcwe (2318) -> zumdwwu, lvazjz, qhiav
prcclw (18)
gicwr (21)
ukwlfcf (1818) -> twblj, vpbec, wifaf
fvhvq (32)
jvtky (25)
tcjsqp (96)
rdgowwr (18)
yfwwrkp (156)
sejncwk (626) -> sjbqzk, acfnchg, pzoaqn
edwlns (34)
qiund (36)
cmenpt (53) -> ygmnsct, xwydsz
syojg (99) -> mwpejh, myoyl
aqbnaso (91)
ovrgyv (90)
ilpjk (8)
fvydfl (68)
fxzqvoh (231) -> rmmxnk, vhbtdr, xmjpazn, sbbbog
quohxia (68)
funabvw (153) -> vkhdfmv, igceh
mvxud (79)
rttwi (35) -> tcjsqp, amslmyk, vwmyqub
yjyyq (75) -> uknqlj, trqlfrt
ulgrn (20)
sfpnzbo (16)
iiwpsx (1466) -> coxpxpj, tlxdji, euoskfi
rhtqj (249)
sdjxpp (41)
qmyohe (21)
bljppq (30)
zskam (845) -> tpabsyz, wynyd, gtmud, aqbnaso
iqhpby (1769) -> zlvjnx, iufvcm, nfwcuci
brabcb (99)
byvwheg (82)
epstabj (38)
phdeae (92) -> zwcsjgs, kdqctmq
xyjsuy (8)
owtswi (167)
htlfqi (60)
ybgdelp (24)
ehwcxy (63)
corcne (217)
tlzlq (28)
hlfmvdt (12) -> meqla, yywjam
jwmjz (5)
syhipz (76) -> qwror, rzsggfj, mjuyo, zitvhwp
nfwcuci (214)
pvniw (42)
wknmdh (836) -> thbazqq, rpbeiqg, lyvdkxe
guvto (32)
isispf (151) -> kvsprca, yoiej
hasclc (46)
kxbmr (116) -> jsdbgko, mvyzuw
akgfzo (46) -> glblkz, lpfahc
jfssr (14)
bxjqibv (44)
jxraf (15)
hfwpcsa (197)
htuuzu (30) -> cmfcqh, xvoehjz, jabfysb, rfllomn, mvybmye, rttwi
wfcqzm (95)
quolxjw (84)
rergyy (56)
awnafxx (29)
bzuago (99)
ytzdrvj (28)
yoiej (65)
ffijsc (81)
rjqjwjy (73)
wnjjug (68)
ybnsg (78)
ygmnsct (85)
qiaej (82)
gzriygp (58)
zeiqoz (14)
jqgkz (59)
iawzjqd (89)
sxwbzyj (45)
faqxj (33)
gixsbr (1173) -> qvrtwdt, wkxlf, iiwpsx, icspwbg, qhfmjrm, mspxpr, xsuxhbq
ktffksv (29)
mfunt (165) -> quolxjw, tgwiasr
lzevbng (16)
azttml (15)
hezkdc (193) -> mpieb, voawog
dsoyvp (55) -> pfxoef, eiekcd
ildgly (137) -> pvniw, ulszlax, gtxdtf
paaqws (214)
chcnreg (33)
rpyxxhm (53)
kemxmk (332) -> umtmwow, yahsymr
enmxpmj (64)
owjtoo (63)
iaoxdmm (138) -> xyjsuy, fzltz
oykurjk (868) -> hkjcnv, qscadxk, phhumfd
eawwls (73)
kiryhz (44)
janbnmh (15)
sbbbog (5)
sfjyf (210) -> xpdmegi, niavkxg, eevdo, vgkjgy
lwnlk (47)
cthyz (62)
wsrrryh (64)
yahzcyp (64) -> sddoa, yscpg
kigsmv (22)
rubvop (31)
ajgvmuy (80)
htwzu (16)
xatzz (157) -> ucahbv, qiaej
uzprj (58)
ltceq (99)
dnqdmxc (79)
pmpxq (13)
ebyfpmf (79)
qeuwgn (36)
osbndxb (23)
qunom (178) -> jxhhgvz, jjfoqtv
xinxep (1670) -> tewltq, qtmvya, gixsbr
clrhsr (19)
ierop (96)
wkxlf (1022) -> drwwnwd, finxtiu, dkwwoa
ogziig (64)
nsqiicp (27)
fkehyrg (75)
zielffk (23)
upatvy (95)
jxhhgvz (16)
swqres (26)
ndmpgss (89)
wzvsi (69)
ihkcorh (183) -> fsjvyxv, hmemann
elgvwug (67)
ujzxlx (98)
veiljb (45)
hrrqb (57)
lrlhwat (22)
xlkdss (7)
qibrsjj (60)
ytjheqk (30)
ojnxwzq (2529) -> tvoptyn, yysyjbk, kqfgnql, uwrcgnq
kbfpx (47)
afbnq (41)
yscpg (46)
yatdg (50)
acbakwi (89)
bcedyx (37)
aktnest (5)
fkmpv (31)
kgbjthh (14)
gtmud (91)
alvjc (139) -> qdemebr, xxleimo
yedvssr (205) -> fvkew, gicwr
ejlya (66)
mhkrny (672) -> bezoxx, haano, pggrr
edfxg (74)
bmyme (95) -> wsdqchf, yhtpdwu
uedozkm (5333) -> tntns, mkslglr, zgkxkj, sejncwk
hsywhj (154)
licst (9)
gtbocpw (60)
vdwutc (90)
ulkdq (82)
ceutto (21)
sivsece (73)
tntns (1094) -> djodqp, ixuvbk, hubzsdn
qhfmjrm (1628) -> xmhdsio, myzut, dfupxk
rzsggfj (317) -> udlhalx, narnhty
hlshpkq (99) -> zpuwyqp, zqaxyz
ijpzp (78)
qtmvya (14) -> gsiokvq, wanxt, kskkjn, adtpk, iqhpby, pcehxbx
ktoxuar (83) -> eawwls, tvfptpz
uwehdau (55)
advjges (20)
iuubp (62)
encjlzj (49) -> ltceq, brabcb, uyoez
pabkgnq (10)
ulxscm (35)
rcbhgw (832) -> jrott, hcvwov, akgfzo
nevhjg (17)
agtab (41) -> ztpawhz, dsiixv, gipbso, nholw
xjbtfms (33)
mfcutqz (219) -> ncbrxsy, bnwotj
txhxoib (240) -> qgytb, pabkgnq
miwjfr (20)
vkmxs (75)
hidzw (55)
whjbc (54)
ivhtlxa (17)
jgylf (98)
iydqii (55)
gkitfsr (23)
carfsnj (79)
pxkzk (5)
wlwnand (87)
khdzsr (73)
tqepyv (16)
gsdzpjh (40)
wnmnz (290) -> rywggm, hpfmhy, frkjf, ojpghb, wgjst, ivldghm
msyvs (32) -> kyhezqn, dkegbrt, enogehk
uusec (41)
ufdbsy (132) -> mrmuat, seuaftr
vwupkmh (53)
pthnz (34) -> fjkfpm, uedozkm, hoqti, efgdfa
jzwusi (188) -> edagh, xrknksz, syxdt, xeege
npblyaq (35) -> mnfknb, jdjkbwr, aixwgk, ducdc
mdvnu (42)
qcglune (68)
jafsqqu (41)
nderndc (63)
qtshuo (44)
twqkuk (66)
fcdutzs (8)
olgmto (702) -> lbwgsap, jakmbx, aufwfrp, osnpbou
pfekvok (34)
cbmkr (93) -> pjzcs, pavtnxe, nsoju
igceh (36)
blvyrzh (10) -> vdwutc, cneww, mkykc, ovrgyv
mtxzek (136) -> kfefhun, wnpkwy
bsxtebe (71) -> idnsypp, iqfnj
bntzksk (37289) -> vmttcwe, ukwlfcf, zzpevgd
eudowc (1052) -> mjrfrb, uxsisng, yawmlbb, ktoxuar
mcghosj (41)
ojpghb (156) -> prcclw, gytzi
osrdt (79)
vqrrii (60) -> zrgqfb, ffijsc
wkgouh (53)
nsvwcl (90)
eumefa (84)
zuaamot (32)
lxdji (8)
zeebqts (24)
yktye (24)
wswnja (117) -> fnkrew, mcmzs
vtqzf (17)
kmnzz (5) -> wtsqx, ocqrpkf, hasclc, kqdseyh
ednlrw (56)
yxfmelm (57)
fgeup (36)
oiufrau (43) -> ajgvmuy, kxzwel, hjbac
bdvtnul (26)
xayqwyj (168) -> wvdswpz, fvaeyq
vzxet (60)
cvvkno (56)
wctihs (31) -> ikicwez, wzvsi
cpzwgk (209) -> lwnlk, xvudg
fsoqc (24)
hkkzpzh (14)
wfeurd (165) -> nlrbcxx, kbbwe
klexq (30)
ebjgfh (34)
vctupmx (42)
psrup (53)
ngiol (95)
kryvxoc (18)
tzkgrjf (54)
gcrugvi (62)
jxhhc (17)
wntfmtn (254) -> faqxj, qzgdlb, uurqa
wuyjdn (95)
dbrcg (11)
dcwcs (42)
dsuchz (88)
hlykzp (31)
pwyfdan (85)
hmemann (27)
yjmjnm (77)
cjcytbb (55)
sutzt (169) -> fpdoney, nnkru, sfpnzbo
lvazjz (39) -> zinjsj, abjmd
bfozr (43)
gfvzrt (84)
wanxt (1603) -> lgqwxgu, shwsf, zvnzep, jwrmi
fntaap (43)
dfupxk (91)
uxsisng (95) -> elgvwug, ssxqkhq
rflrj (181) -> niklue, yjcggu
narnhty (26)
ziyive (39)
tkvip (279)
xjjvneg (19)
toaan (19)
tgoztyw (201) -> yrnjhqc, rzldn
nrphw (7)
bhnwdot (50)
negxuk (217) -> nsqiicp, xsvage
tyqnwi (155) -> kigpl, iwkotv
qbhyq (98)
qmeawpu (22)
xjejd (88)
pvbgvb (41)
snsyzbk (20)
vkile (164) -> pdkfixk, ufpdyq, lrlhwat, kigsmv
jdazgj (17)
cdaazt (54)
qtcnfy (50)
gwyrtw (52)
sgznbm (50)
gkqxb (65) -> ioyealn, rqeftjw
mgoym (83) -> kslvs, snyio
cneww (90)
fixqj (116) -> ybzqe, nhcmgrr, nevhjg
kjmvhpa (20)
sntbr (55)
bnwotj (15)
xvudg (47)
ltyxiwk (53)
brapqvt (78)
zrmzpo (95)
xcdswr (85)
erngeah (44)
zvogn (8)
ranlxct (59)
oztxjfl (239) -> eukyl, pjpbcq
bcrso (24)
ogtxa (89) -> iuubp, gcrugvi, cthyz, zzlocxd
utpyp (35)
rmmxnk (5)
nogoyp (70) -> rdgowwr, kryvxoc
afqwh (30)
nedjj (54)
lyvdkxe (42) -> ssblis, gmrkqq
ybzqe (17)
bnvjfq (34)
sklld (24)
eqkio (2131) -> eefmcrp, cmenpt, wswnja
qypsl (54)
wcfykko (60)
luiiv (898) -> vgnkq, coenr, paaqws
mjpmw (101) -> lomxh, rqvifq
wswwck (40) -> zmdvl, yatdg, sgznbm
yjcggu (18)
pjpbcq (22)
yahsymr (30)
liwvq (1960) -> axqifwm, qunom, euxvn, efsanp
euoskfi (135) -> nnpvdm, jwmjz
hpfmhy (176) -> fuexyx, fcdutzs
jczkx (55)
jvwfxp (330) -> cvcyykp, hlykzp
pyscsi (64)
jevfpj (65)
zitvhwp (75) -> tpbcg, ujzxlx, qbhyq
sndject (5)
aufwfrp (53) -> mmprixv, ejlya
riogonj (346)
dhecgkl (73)
eevdo (16)
kslvs (42)
zpuktmx (37)
nbkzscx (9)
pbvcu (73)
zwymlsj (118) -> tcpvyfj, rtiaapt, xikbq, gldvef
fzbwmsz (187) -> dbrcg, wkkkv, mznsk, etkzf
tmtfhr (30)
eukyl (22)
hmugaom (156)
ixuvbk (130)
santsu (76)
buplpb (26) -> negxuk, imuhew, izssdb
imuhew (77) -> yauryvu, kjtwz
niklue (18)
zuzhmf (137) -> pbvcu, sivsece
lgqwxgu (202)
emxwr (262) -> nedjj, hwfcy
iqfnj (94)
ixyeq (273) -> pxkzk, ylfvgv
wvgzlw (87) -> hidzw, vofrtf, yvllxxw
kbbwe (41)
jcsjaxj (2792) -> buplpb, slntf, kqohkg
tlxdji (145)
hgaoiz (283)
tgwiasr (84)
ewyrp (259) -> jevqne, ilpjk, kmpmdb
kmegj (50)
axqifwm (98) -> dasmiiw, wyiec
jrrhzc (5)
cftggo (20)
xvoyybs (56) -> ygvvvq, kemxmk, jkfrln, arjgn, fvsitx, lfrfa, jvwfxp
daiaot (60)
avemxf (63)
yzpyzu (41)
wtbst (73)
seuaftr (21)
dgwrgu (89)
kpffozq (27)
qoeviy (129) -> yxvmxzg, bfxvxpl
uwprsvh (1502) -> qjkkohe, pctkyat
ldvcrw (299) -> clrhsr, elmmtp
yywjam (86)
elmmtp (19)
coenr (56) -> edyohkw, vspquqe
khixwdd (54) -> vxfyyd, dltbolj, htlfqi
jsdbgko (73)
llepsqz (96)
smqtcaj (250) -> daiaot, lswutyd
thbazqq (180) -> pmunsu, vtqzf
kaitdu (98)
fvaeyq (34)
glblkz (97)
vmofl (39) -> eumefa, gfvzrt
dqktd (95)
mwvbcqg (58)
gbwfjf (777) -> tkvip, mbcwjt, sbimooe
hmxxv (89)
wynyd (91)
jdjkbwr (41)
elxccty (54) -> fvydfl, qcglune
bnmuprs (41)
kgfudu (45) -> otsyp, sdixs, whjbc, cdaazt
hfjtksr (39)
tlgdija (81) -> fntaap, zlxlwv
qrwzvrb (68)
nchgm (49)
gofjvi (67)
jjfoqtv (16)
tfbqaoe (53)
zzqtmxd (116) -> fecwfs, eigsdc
qhktzou (75)
wydtqax (45)
ytyhmux (84)
qqkqhzb (274)
trqlfrt (92)
eivaf (370)
njlaepf (47)
bkmepbs (46)
mpieb (34)
sbimooe (89) -> dqktd, bnmsz
dltbolj (60)
lvktp (32) -> prnno, qxsjs, wuyjdn
lcius (54)
mxelfv (75)
hrwtz (17) -> mocpa, fixysjm, cjkieim
jzcstbe (236)
mikalda (35)
xrknksz (12)
knfath (32)
pmssap (99)
eefmcrp (209) -> nukpse, xlkdss
nkwisjd (149) -> pfltnc, fblsn
ragcph (38)
eubjf (58)
snyio (42)
zquvn (108) -> nvrpd, dlrznye
uakxuru (169) -> zhpdhat, uymdj
egrit (73)
dlvttmo (95)
xikbq (18)
xgmrufk (56)
cbmkl (78)
jqwaifx (24)
qowepn (33)
clizzo (227) -> dfrzb, zjxjhwc
tbakk (935) -> wctihs, vszpkfs, iqtdzrh
qvzjgne (36) -> dlvttmo, wfcqzm, mfslhp
mvybmye (207) -> awnafxx, xqrrpu, ktffksv, csbgxs
mkslglr (189) -> dmkhzgg, sykmuwo, bsxtebe, yjyyq, znmav
jkfrln (342) -> jbhohbx, jvtky
znswber (40)
rqvifq (53)
fnkrew (53)
jabfysb (91) -> gzriygp, eubjf, qluzb, ugplhkq
dresofi (346)
zpkhzqb (50)
hwraaxu (89) -> majskr, nchgm
uebmnqa (88) -> ymxqafr, skrsezs
qeoetnp (173) -> evvfcyi, pmpxq
sddoa (46)
qdemebr (37)
kobwktw (62)
fogmaih (75)
wgevvca (79)
phhumfd (35) -> ulkdq, ulvbf
zpuwyqp (59)
txdprek (83) -> gsbmh, iizpgi
cqmvs (14) -> bntzksk, mvpqv, pthnz, xinxep, qnhvjec, znztzxd, silwwua
wazlg (92)
unpdcwm (153) -> yktye, sklld, tdrdq
uknqlj (92)
qwror (369)
awxygg (89)
uwrcgnq (1176) -> uybuil, vqrrii, arejh
nvrpd (83)
znuldtj (30)
wxyaqte (27)
xbywgft (55)
iwidsj (95)
kcxllz (43) -> mdlubuq, dhecgkl, uvpwrf
arejh (188) -> lbkrk, jxhhc
qbaig (84)
mvpqv (5522) -> ojnxwzq, qlchz, awyhreh, ikyzq
lpfahc (97)
fadkfic (36)
xvwgxm (63) -> wazlg, vmkfcpw
tewltq (4134) -> cviwy, wknmdh, bcnqhw, vmkib, ezaobs, gewlsr, yevywe
rfwgt (78)
wsjizsy (33) -> bsiwtqq, uzprj, mwvbcqg
rbbkdj (191) -> rjqjwjy, egrit
cwwwcge (20)
ejbtu (58) -> qnepf, dsuchz
hefjuue (24)
coxpxpj (5) -> cbgnzhz, uofuvf
nhcmgrr (17)
iktev (194) -> chcnreg, olnfe
vhnnnv (79)
kmwkft (88) -> edfxg, xaovjvs
kdqctmq (7)
slntf (309) -> dmxlfzb, phdeae, vfdulx, bzorz, nogoyp
ohqivu (82) -> yjmjnm, taxky
lqasevp (26)
roojn (57)
ojrixty (97)
xmjpazn (5)
salxel (5)
lhlgijf (54)
zatfti (60) -> phkzo, ghqixh, rulju, ksnxlcl, isispf
znmav (95) -> byvwheg, kefudoj
myzut (91)
cekchxh (59) -> lcwqdxx, nkdbmjv, pfekvok
ukbzl (14)
bwrpc (41) -> jzbnq, fezoyaj, birtjxh, fcjjqev
ytadaxm (26) -> nlkwsrn, qtcnfy
qlryl (10)
vytlfm (33)
jswxshd (127) -> teapi, ugssydn
emqwt (50)
ugssydn (35)
iumsmx (20)
kigpl (89)
cdfij (68)
esmbu (8)
izpta (84)
jviven (416) -> gujegtc, owtswi, haayebg, yjcevge, mgoym, iqckb, gkqxb
qhiav (99)
ixoas (5)
dmxlfzb (16) -> afqwh, klexq, tiyvea
redeub (57) -> hxhguzh, vkmxs
fymyi (35)
mdcxis (39)
lcjjc (70)
acfnchg (246) -> advjges, cftggo
ldkojcj (8)
nwlkk (84)
kzocw (2306) -> umsrz, mbzzt, uilvahq
meqla (86)
drwwnwd (139) -> vrhltmp, njaig
vspquqe (79)
uymdj (76)
eutun (192) -> iumsmx, snsyzbk, wkxyxtf
ezaobs (434) -> lngdxkd, brmvw, hdvcgn, ufdbsy, qsxqwub, rkswk
iljkad (14)
ryeiot (41)
mwhraq (86) -> lwysj, lmgxknk

In [215]:
input_data_adj_list = {}
input_data_values = {}
with open("day7_input.txt") as f:
    for line in f.read().strip().split("\n"):
        m = re.match(r"([a-z]+)\s+\((\d+)\)\s*[->\s]*(.*)",line)
        input_data_values[m.group(1)] = int(m.group(2))
        input_data_adj_list[m.group(1)] = m.group(3).split(", ") if m.group(3) else []
        
# input_data_adj_list
# input_data_values

part 1


In [216]:
def find_source1(adj_list):
    # hash table to track incoming edges
    nodes = {node:0 for node in adj_list.keys()}
    for from_node, to_nodes in adj_list.items():
        for to_node in to_nodes:
            nodes[to_node] += 1
    return [node for node,val in nodes.items() if val == 0][0]

In [225]:
sample = """pbga (66)
xhth (57)
ebii (61)
havc (66)
ktlj (57)
fwft (72) -> ktlj, cntj, xhth
qoyq (66)
padx (45) -> pbga, havc, qoyq
tknk (41) -> ugml, padx, fwft
jptl (61)
ugml (68) -> gyxo, ebii, jptl
gyxo (61)
cntj (57)
"""
sample_values = {}
sample_adj_list = {}
for line in sample.strip().split("\n"):
    m = re.match(r"([a-z]+)\s+\((\d+)\)\s*[->\s]*(.*)",line)
    sample_values[m.group(1)] = int(m.group(2))
    sample_adj_list[m.group(1)] = m.group(3).split(", ") if m.group(3) else []
    
assert find_source1(sample_adj_list) == "tknk"

In [226]:
find_source1(input_data_adj_list)


Out[226]:
'cqmvs'

part 2 (incomplete)


In [235]:
def find_unbalanced_weight(adj_list, values):
    # get sum from all the leaf nodes that map to a single parent
    for from_node, to_nodes in adj_list.items():
        # finding the leaf nodes
        if len(to_nodes) > 0 and all([len(adj_list[to_node]) == 0 for to_node in to_nodes]):
            print("----",from_node,values[from_node]+sum([values[to_node] for to_node in to_nodes]))

In [236]:
find_unbalanced_weight(sample_adj_list, sample_values)


---- fwft 243
---- padx 243
---- ugml 251

In [242]:
[(to_nodes,input_data_adj_list[to_nodes]) for to_nodes in input_data_adj_list["okzkfw"]]


Out[242]:
[('ndteuz', []), ('bkmepbs', [])]

In [237]:
find_unbalanced_weight(input_data_adj_list, input_data_values)


---- okzkfw 251
---- ydxuhqe 260
---- iqtdzrh 169
---- ddumyx 262
---- lrvmyj 187
---- sjbqzk 286
---- ywonug 174
---- vszpkfs 169
---- axawjtm 252
---- jnedlwi 204
---- sztry 303
---- anwbrxk 303
---- ghqixh 281
---- jwrmi 202
---- usmtdk 234
---- shwsf 202
---- iivwxhd 262
---- lngdxkd 174
---- dkwwoa 293
---- vurnn 231
---- ngoog 184
---- kzumm 231
---- fgnye 126
---- yjcevge 167
---- blcpm 337
---- anqas 189
---- yawmlbb 229
---- doavm 263
---- udyivld 334
---- ddqnllo 303
---- hkjcnv 199
---- jrott 240
---- unvqq 189
---- qeaqiuq 1442
---- grgkv 197
---- pggrr 314
---- zumdwwu 99
---- euxvn 210
---- pncda 231
---- zlvjnx 214
---- iljdm 303
---- kqoae 190
---- jezubi 174
---- bzqhk 211
---- mjuyo 369
---- tvoptyn 1842
---- sykmuwo 259
---- xqztuq 260
---- hszzxp 234
---- pmozz 260
---- jwrbg 274
---- obolmhh 197
---- rbiarxk 213
---- uqktn 334
---- finxtiu 293
---- vgnkq 214
---- knvxq 1968
---- kvjyw 217
---- rkswk 174
---- cmfcqh 323
---- ouypz 217
---- kcxiq 234
---- zvnzep 202
---- yysyjbk 1842
---- vybmch 237
---- brmvw 174
---- hohft 225
---- haano 314
---- fvsitx 392
---- zhjtcdl 197
---- xvoehjz 323
---- zhxnpoh 225
---- bezoxx 314
---- ivldghm 192
---- osnpbou 185
---- mgvcyl 161
---- hwjmzs 353
---- lfrfa 392
---- lbwgsap 185
---- rcfaaml 283
---- xnaam 154
---- ltccbob 317
---- qsxqwub 174
---- pdwjcd 167
---- wifaf 263
---- ehpdfno 333
---- qvpou 190
---- quoqibc 255
---- lbvfwz 197
---- tcbxnrf 333
---- qfczh 252
---- myeecwt 249
---- vkuucpv 370
---- qezvrjl 260
---- bpbwl 189
---- vdyhna 211
---- zjylql 126
---- tlics 213
---- hspqr 260
---- phkzo 281
---- haayebg 167
---- nuoic 317
---- ksnxlcl 281
---- ihadu 252
---- pjamo 237
---- xeypnpr 255
---- bsbsdiu 231
---- ipbbnp 251
---- mbcwjt 279
---- ripidvx 260
---- sexuv 204
---- uxmjgh 190
---- rywggm 192
---- izssdb 271
---- mspxpr 1901
---- rfllomn 323
---- wgjst 192
---- fcvsqp 251
---- ahism 213
---- iufvcm 214
---- rpbeiqg 214
---- lvgrmfu 370
---- dmkhzgg 259
---- jakmbx 185
---- nknpwkc 334
---- qeayjnt 283
---- pzoaqn 286
---- oqfiqf 333
---- bzorz 106
---- iqckb 167
---- vfdulx 106
---- qscadxk 199
---- wisdd 255
---- uezxhid 370
---- rtromur 231
---- mmriyf 249
---- hdvcgn 174
---- vcauqo 204
---- uyedi 1552
---- atxfply 337
---- cncoep 260
---- kpwvh 174
---- twblj 263
---- hubzsdn 130
---- yhadh 217
---- injlqnw 211
---- omeew 261
---- efsanp 210
---- frkjf 192
---- uybuil 222
---- mjrfrb 229
---- xhrqzk 321
---- yzxqqx 333
---- zzkusct 213
---- gujegtc 167
---- rulju 281
---- djodqp 130
---- cmenpt 223
---- syojg 263
---- fxzqvoh 251
---- funabvw 225
---- rttwi 323
---- yjyyq 259
---- zskam 1209
---- phdeae 106
---- hlfmvdt 184
---- isispf 281
---- kxbmr 262
---- akgfzo 240
---- mfunt 333
---- hezkdc 261
---- dsoyvp 187
---- ildgly 263
---- kemxmk 392
---- iaoxdmm 154
---- sfjyf 274
---- yahzcyp 156
---- xatzz 321
---- qunom 210
---- ihkcorh 237
---- alvjc 213
---- yedvssr 247
---- bmyme 237
---- qhfmjrm 1901
---- rzsggfj 369
---- hlshpkq 217
---- ktoxuar 229
---- encjlzj 346
---- agtab 249
---- mfcutqz 249
---- txhxoib 260
---- msyvs 167
---- ufdbsy 174
---- jzwusi 236
---- npblyaq 199
---- cbmkr 207
---- blvyrzh 370
---- mtxzek 190
---- bsxtebe 259
---- ojpghb 192
---- vqrrii 222
---- wswnja 223
---- kmnzz 189
---- oiufrau 283
---- xayqwyj 236
---- wctihs 169
---- cpzwgk 303
---- wfeurd 247
---- wntfmtn 353
---- sutzt 217
---- lvazjz 99
---- uxsisng 229
---- rflrj 217
---- tgoztyw 263
---- negxuk 271
---- tyqnwi 333
---- vkile 252
---- gkqxb 167
---- mgoym 167
---- fixqj 167
---- oztxjfl 283
---- ogtxa 337
---- nogoyp 106
---- lyvdkxe 214
---- mjpmw 207
---- wswwck 190
---- euoskfi 145
---- hpfmhy 192
---- jvwfxp 392
---- zitvhwp 369
---- aufwfrp 185
---- zwymlsj 190
---- fzbwmsz 231
---- imuhew 271
---- zuzhmf 283
---- emxwr 370
---- ixyeq 283
---- wvgzlw 252
---- ewyrp 283
---- axqifwm 210
---- qoeviy 199
---- uwprsvh 1552
---- ldvcrw 337
---- coenr 214
---- khixwdd 234
---- smqtcaj 370
---- thbazqq 214
---- vmofl 207
---- elxccty 190
---- kgfudu 261
---- tlgdija 167
---- zzqtmxd 156
---- sbimooe 279
---- lvktp 317
---- eefmcrp 223
---- nkwisjd 237
---- zquvn 274
---- uakxuru 321
---- clizzo 333
---- qvzjgne 321
---- mvybmye 323
---- jkfrln 392
---- jabfysb 323
---- hwraaxu 187
---- uebmnqa 274
---- qeoetnp 199
---- phhumfd 199
---- txdprek 251
---- unpdcwm 225
---- kcxllz 262
---- arejh 222
---- xvwgxm 247
---- wsjizsy 207
---- rbbkdj 337
---- ejbtu 234
---- coxpxpj 145
---- iktev 260
---- kmwkft 236
---- ohqivu 236
---- znmav 259
---- cekchxh 161
---- bwrpc 353
---- ytadaxm 126
---- jswxshd 197
---- dmxlfzb 106
---- redeub 207
---- acfnchg 286
---- drwwnwd 293
---- eutun 252
---- mwhraq 184

Day 8: I Heard You Like Registers


In [245]:
! cat day8_input.txt


kd dec -37 if gm <= 9
x dec -715 if kjn == 0
ey inc 249 if x < 722
n dec 970 if t > 3
f dec -385 if msg > -3
kd dec -456 if ic <= -8
zv dec -745 if gub <= 4
ic inc 705 if yp > -6
lyr dec -970 if gm != 0
lyr inc 935 if j >= 0
gm dec 716 if gm < 9
kjn inc -897 if j <= -9
j dec -824 if f != 384
x dec 741 if e <= -6
f dec 617 if msg != 9
kjn inc 184 if ic > 697
lyr dec 860 if x <= 707
ey dec -785 if msg < 2
lyr inc -226 if x != 720
t inc -689 if f != -242
riz inc -174 if f != -232
j inc 906 if lzd <= 5
yp dec 264 if zv >= 748
ic inc 578 if t != -694
ucy dec -532 if i < 10
gm inc 294 if i < 6
omz dec 384 if n < 10
ic inc 277 if e > -10
e inc -707 if j != 1740
msg inc 1 if djq > -2
gm dec 625 if ey != 1042
bxy inc 484 if e >= -709
j dec 130 if kd > 29
djq dec 276 if i == 0
ic dec -361 if bxy != 490
ic inc 516 if ey <= 1041
gub dec -382 if e == -707
kd dec 410 if i > -8
tj inc 307 if tj != 5
msg inc -26 if kjn > 186
n inc 227 if kjn <= 191
y dec -920 if lzd >= -4
ic inc -43 if i > -5
ey dec 645 if ic <= 2402
lyr dec -821 if x < 722
x dec 666 if y > 925
n inc 899 if yp < 10
f inc -627 if lzd != 6
m dec 430 if bxy <= 489
gub inc -603 if yp >= 9
ey dec 601 if ic > 2388
e inc 346 if x <= 716
t inc 292 if lzd == 0
msg inc -311 if yp <= 8
lyr dec -599 if zv < 742
n dec 720 if lzd >= -9
t dec 815 if n <= 412
omz inc 175 if msg > -315
ic dec -259 if msg == -310
x dec 250 if kd == -373
n inc 890 if tj < 315
j inc 926 if m >= -425
gub dec -497 if x == 465
f dec -965 if kjn <= 193
ey dec 126 if lyr != 1530
riz dec 95 if ey < -204
tj inc 650 if ey > -222
riz dec -780 if gm != -1041
djq inc -358 if j != 1600
gm inc -506 if gub > 888
i inc -195 if ucy != 539
ucy dec 323 if kjn <= 191
e dec 892 if kd < -368
lzd dec 465 if kjn <= 191
t inc 836 if omz > -216
e dec -994 if gm < -1041
omz dec 974 if ey != -205
kjn inc -844 if f != 99
lyr dec -572 if lyr == 1530
ucy dec 794 if kjn != -669
m dec -139 if y >= 916
f inc -949 if djq == -276
djq inc -148 if m < -289
zv dec 46 if gub == 879
zv dec 303 if bxy < 491
yp inc 145 if msg != -300
gub dec -907 if y >= 924
i inc -88 if gub < 888
tj inc -801 if kd <= -369
n dec -479 if tj == 156
i dec 308 if ucy > -586
tj inc 232 if gm != -1050
bxy dec -845 if f == -843
yp inc -33 if y != 919
ic dec -895 if i == -587
yp dec 321 if tj <= 391
bxy dec -825 if n < 1779
riz inc 497 if t == -376
ey dec -971 if f > -848
m dec -728 if f == -843
riz inc 447 if tj < 396
tj dec 689 if kjn == -662
zv dec 735 if kjn < -656
e inc -317 if djq <= -433
m dec -313 if gm <= -1053
m inc 892 if tj < 394
f inc 367 if ucy != -587
djq dec -374 if zv > -344
j inc 894 if lyr <= 2093
riz inc -802 if gub < 886
gub inc -507 if t > -379
ic dec 894 if riz < 824
gub inc 471 if djq != -57
lzd inc 370 if j >= 1595
gub dec 287 if tj > 386
kd dec 860 if n != 1771
riz inc -133 if t >= -376
msg inc 548 if msg != -310
x inc -941 if ey == 759
gm inc 442 if n == 1766
ey inc 504 if ey == 759
kjn dec 821 if f == -476
n inc -445 if ucy != -586
ic dec 779 if ucy != -577
kd inc 350 if m > 1320
tj inc -525 if msg < -304
x dec -621 if lyr <= 2106
omz dec 39 if kjn > -1485
riz inc -565 if bxy >= 2161
m dec -925 if omz <= -1219
kjn inc 531 if omz != -1224
ic inc 979 if kjn > -953
lyr dec 167 if ey > 1262
x dec 193 if lzd > -90
t dec 261 if lzd <= -102
yp inc 232 if kjn != -950
djq inc 710 if lzd < -89
msg inc 565 if bxy > 2147
yp dec -53 if j <= 1607
kjn inc 868 if x >= 143
x inc 677 if tj <= -140
bxy dec 374 if djq != 651
t inc -609 if e < -256
lyr inc -903 if lzd != -105
lyr dec -87 if omz != -1223
lzd dec -253 if y == 920
yp dec 839 if kd < -884
ic inc -339 if kjn > -83
j dec 588 if bxy <= 1786
n dec -415 if zv >= -336
yp inc -439 if x == 145
riz dec -159 if ic != 2514
lzd inc 61 if f != -476
gm inc -498 if ey < 1270
msg dec 942 if m == 2254
i inc 161 if ucy >= -590
kjn dec 446 if j >= 1006
ucy dec 609 if y > 917
omz inc 558 if ic > 2518
msg dec 675 if ucy < -1185
j dec -962 if t >= -992
n inc -248 if gub < 558
ey dec 92 if y == 920
omz dec -774 if kjn == -528
kd dec -874 if ic <= 2509
kjn inc 445 if j == 1974
j inc -459 if kd >= -884
i dec 605 if lyr < 1129
e inc 995 if zv == -339
t inc 888 if x != 143
kd inc -742 if y == 920
kjn dec 692 if tj == -137
ucy inc 650 if riz > 702
zv dec -539 if gub == 556
m inc 991 if f < -484
lyr dec -260 if riz >= 699
ey dec -916 if j == 1515
tj dec 930 if lyr < 1128
riz inc -261 if f > -470
lyr dec -392 if f != -472
m inc -845 if yp > -602
riz inc -217 if i < -1027
ey inc 35 if riz > 474
gub dec -681 if ucy >= -1198
riz inc -871 if kd < -1634
m dec 793 if y <= 912
ic dec 990 if i != -1045
x inc -178 if kjn > -766
kd dec 952 if gub < 1247
lyr dec 426 if m >= 1407
kd inc -721 if lyr != 1083
lzd dec -887 if omz <= -446
djq dec 648 if bxy >= 1775
m inc 892 if omz <= -444
y inc -757 if yp == -595
lyr inc -943 if ucy >= -1194
ic dec 466 if y < 157
lzd inc 720 if msg < -1354
f dec -746 if kjn != -774
omz inc 234 if yp >= -597
t inc 272 if ucy != -1193
yp dec -237 if y <= 168
kjn dec -360 if lyr != 141
msg inc 246 if n < 1092
djq dec 615 if msg >= -1122
e inc 44 if yp > -359
yp inc -315 if kd <= -3289
kjn inc -987 if ey != 2127
kd inc 784 if m > 2304
yp dec -262 if gub < 1228
riz inc 679 if riz != 485
gm dec -619 if msg < -1107
gm inc 968 if x < 141
zv dec 228 if djq <= -598
gub inc 773 if i == -1035
ey inc -573 if i != -1034
djq inc 791 if gm > -935
t inc -241 if f < 277
t inc 682 if omz != -211
y dec -562 if lzd >= 1760
kd dec 774 if j != 1524
djq inc 843 if lyr == 142
y dec 339 if msg == -1116
kd inc 637 if f > 263
f inc 467 if j < 1519
i inc 662 if riz > 1147
m dec -354 if f == 737
f inc -411 if tj == -1067
j inc -455 if j <= 1524
t dec 7 if j <= 1063
e dec 97 if djq <= 1040
gm dec 695 if f <= 335
gm dec 312 if t >= 614
kjn dec -877 if n > 1089
j inc 770 if t < 618
djq dec 953 if lyr <= 144
ucy inc 595 if gm <= -1620
yp inc -953 if lzd < 1770
i inc -864 if tj <= -1072
lzd dec -68 if yp <= -1622
msg dec 713 if ic == 1524
i dec -632 if yp < -1628
yp inc -779 if omz != -211
yp dec -423 if zv == -28
zv inc 41 if kjn >= -1406
e inc -366 if t != 603
f inc 288 if omz > -215
kjn dec -1 if lyr < 141
yp dec 308 if lyr == 142
lyr inc -999 if zv == 13
bxy inc 904 if kjn > -1410
lzd dec 32 if zv > 8
kd inc 930 if lyr == -857
bxy dec -635 if m < 2661
gub dec 866 if f >= 607
gub inc 163 if gm > -1628
x inc 200 if msg > -1836
e dec 296 if x == 347
e dec 667 if ey == 1549
riz inc 665 if gub == 1307
j inc 37 if zv == 13
m inc 822 if ey == 1549
ic dec 585 if lyr > -849
gub dec -194 if i >= -378
riz dec 123 if y <= 389
yp inc -59 if djq < 84
e inc -199 if djq > 68
lyr inc -685 if yp != -2352
kd inc 573 if j != 1867
n inc 659 if djq <= 86
yp inc 693 if lzd == 1792
ic inc 188 if msg < -1822
t dec 58 if zv != 19
lzd dec 402 if lyr <= -1542
ucy dec -645 if m == 3477
yp inc -47 if msg == -1829
gm dec 910 if omz <= -206
ucy inc 703 if gub >= 1497
lyr inc 907 if e <= -554
y dec 167 if ey < 1555
gm inc -663 if bxy == 3319
j dec -981 if lyr == -1542
lyr inc 638 if i != -380
ucy inc 390 if i <= -373
n dec 68 if y != 223
lyr dec -408 if ic <= 1713
tj dec -856 if n == 1673
yp inc -767 if ey > 1541
omz inc -974 if riz != 1688
j dec 411 if j < 2846
omz inc -972 if djq < 85
e inc -153 if y >= 216
n inc -53 if y < 224
j dec 287 if zv < 6
ey inc -144 if kjn <= -1410
n inc -84 if kd < -2496
bxy dec -788 if kjn != -1408
ucy dec 765 if e < -693
kd inc 846 if ic <= 1716
kjn inc -432 if gm <= -3202
i dec -290 if e > -704
ey inc 625 if x == 344
x dec -338 if msg < -1830
gm dec -621 if y >= 217
j dec 765 if f <= 616
kd inc -559 if riz < 1707
tj dec 498 if j != 2083
bxy dec -414 if gm != -2574
yp dec 365 if msg != -1823
ic inc -143 if m == 3477
ic inc -239 if i >= -88
e dec -479 if yp <= -3524
msg dec 15 if ic != 1337
gm inc -831 if gm == -2573
yp dec -198 if zv >= 12
lzd inc 982 if x != 349
m dec -80 if msg != -1844
e dec 82 if kjn > -1408
msg inc 43 if x > 337
yp dec -204 if msg == -1805
e inc 351 if yp < -3322
omz inc -785 if lyr < -493
x inc 511 if djq != 72
djq dec 686 if lzd == 2381
zv inc -188 if riz > 1692
tj inc 958 if kd == -2211
m inc 951 if gub != 1501
ucy dec 777 if e == 46
tj dec 25 if lyr < -495
ic inc -3 if lyr != -502
yp inc 839 if gm > -3412
tj dec 464 if ic != 1327
gm dec -100 if zv == -175
t dec 786 if riz != 1701
ic inc -727 if gm == -3304
omz dec 755 if yp <= -2487
zv dec -441 if kjn == -1402
yp inc -655 if tj > -240
j dec 272 if ucy <= -406
ic dec -652 if j >= 2088
lzd inc -276 if e > 41
m dec -93 if t > -237
m inc -927 if zv > 264
riz dec -977 if y > 218
n dec 608 if n != 1534
kjn inc 655 if e > 55
tj inc -570 if tj > -239
i inc -677 if t <= -242
tj inc -570 if riz != 2665
msg inc 629 if riz != 2667
bxy inc 247 if lzd < 2111
ucy dec 292 if t <= -226
djq inc -541 if x < 857
kjn dec 211 if lyr == -496
e dec -59 if kjn != -1610
t dec -879 if gm >= -3305
m inc 977 if zv == 266
t dec -103 if x >= 852
riz inc -570 if djq >= -1156
t inc -791 if gub <= 1496
t dec -68 if lzd != 2099
e inc 282 if djq > -1150
e inc -49 if e >= 383
gub inc 137 if gub <= 1503
x inc 627 if j > 2084
djq dec -434 if bxy == 4770
lyr inc -772 if lzd <= 2109
lzd inc 473 if lzd < 2107
gm inc -632 if ey != 1546
x dec -342 if omz != -3702
kd dec 108 if m > 3619
e dec -180 if i <= -76
kd dec -69 if e >= 511
e inc 286 if n >= 926
e dec -507 if t <= 815
j dec -718 if ic != 600
lzd dec -439 if tj > -1382
ic dec -876 if tj <= -1370
y inc 511 if f > 618
f inc -100 if x != 1208
t inc 671 if ucy <= -689
gm inc 47 if e > 1314
f inc 609 if gub <= 1633
gm inc 409 if y > 213
zv inc -420 if e > 1302
ic dec -304 if omz < -3696
x inc 698 if kd != -2250
n inc 805 if zv > -158
tj dec 84 if j != 2084
ucy inc 41 if ic <= 1779
j inc 597 if ey == 1549
gub inc -483 if msg != -1172
ey dec -535 if omz > -3710
riz dec -877 if gm >= -3529
riz dec 117 if f < 518
m dec 275 if i <= -79
kjn inc 742 if j <= 2680
kd inc -472 if omz != -3703
e inc -865 if lzd <= 3018
x inc 187 if omz != -3710
bxy dec -675 if tj >= -1466
zv dec -635 if tj >= -1451
riz dec 822 if f >= 508
m inc -460 if i == -76
tj dec 623 if j >= 2677
m dec 515 if djq > -1155
ic dec 392 if ucy != -695
tj inc 29 if omz < -3691
yp inc -94 if zv != -158
bxy inc -237 if ic >= 1778
n inc -204 if lzd > 3016
bxy dec 320 if x < 2086
f dec -545 if y > 216
f inc 771 if djq != -1153
i dec 94 if msg > -1175
djq inc 681 if m != 2835
kjn dec 176 if kd < -2727
i dec 559 if msg > -1172
kjn inc -475 if omz > -3708
riz inc 912 if kd < -2725
x inc -636 if tj == -2054
e inc -508 if gm >= -3528
f dec -7 if ucy != -704
ey inc -764 if y > 213
lzd inc 282 if ucy == -695
ic inc -146 if gub >= 1645
kjn dec 149 if x < 1442
bxy dec 638 if lzd >= 3296
omz inc -699 if riz >= 2952
ic dec -638 if kd == -2727
ucy dec 107 if e <= -55
kjn inc -449 if zv == -154
y dec -239 if x <= 1455
gub inc -778 if n <= 1530
omz inc -239 if riz > 2952
y dec 465 if x < 1448
n inc -916 if msg <= -1165
yp dec -10 if lzd >= 3297
kjn dec -881 if yp <= -3224
j inc -634 if ic <= 1782
msg dec 178 if ic >= 1780
ic dec 678 if ucy != -795
kjn inc -90 if n >= 610
lyr inc -396 if n <= 616
riz dec -95 if tj >= -2056
zv dec 570 if e < -55
lzd inc -437 if tj >= -2062
zv dec -453 if t <= 1487
msg dec -597 if yp == -3230
m inc -467 if kd < -2723
omz inc 662 if f < 1839
kd inc -956 if lzd > 2861
f dec 155 if x == 1443
e dec -89 if ey < 1323
t dec 694 if ucy >= -806
gm dec -345 if j <= 2055
y dec -331 if gub == 860
m inc -947 if gm < -3175
zv dec 381 if f >= 1832
msg inc 545 if yp != -3239
ucy inc 17 if gub < 862
tj inc 906 if ic < 1103
y inc 674 if lyr == -1664
omz inc 409 if x < 1451
omz dec -108 if djq == -466
kd dec -554 if gm <= -3180
f dec -178 if gm > -3186
ucy dec 186 if msg >= -208
m dec -339 if j != 2040
e dec 813 if y <= 991
lzd dec 484 if zv < -649
gub dec -639 if omz > -3576
n dec 527 if ey >= 1313
msg dec 519 if t == 792
djq inc -976 if msg >= -729
riz dec 31 if riz == 3050
kjn dec -234 if gm != -3177
bxy dec 946 if m >= 1755
yp dec -652 if x < 1455
y inc -685 if t > 788
x inc 801 if n <= 86
djq inc 251 if y > 304
kd inc 213 if lzd == 2378
gm inc 642 if tj >= -1150
n dec -560 if yp > -2574
kjn dec 380 if ucy < -965
e dec 651 if kd > -2926
ic dec -775 if y >= 306
msg dec 527 if ic <= 1881
zv inc -872 if m != 1749
tj dec -337 if f != 2022
djq dec -440 if gub <= 1489
e inc 231 if lzd != 2386
kjn inc -259 if tj <= -819
e inc -588 if djq < -1185
e inc -970 if kjn > -1327
gm inc 904 if n != 83
y dec -32 if j <= 2055
riz inc 888 if y >= 343
ucy inc -874 if kd != -2918
tj inc -154 if omz == -3567
e dec 44 if m >= 1751
msg inc -659 if n >= 87
f inc 854 if t <= 794
lzd dec 938 if f != 2872
kd inc 298 if lyr != -1658
yp inc 196 if bxy < 3311
lyr dec 328 if zv != -1520
zv dec -919 if riz >= 3904
ey dec 236 if riz >= 3900
ic dec 998 if tj >= -966
ucy inc -518 if riz < 3910
djq dec 332 if riz > 3904
m dec -853 if ic > 870
t dec -173 if tj != -962
gub inc 332 if t >= 962
t dec 366 if ey == 1084
j dec -298 if bxy < 3311
n dec 495 if y >= 338
lyr inc 283 if djq == -1525
yp dec 705 if riz != 3898
m dec 632 if zv < -598
yp inc -219 if i < -184
gub inc -865 if yp < -3080
bxy inc -940 if t >= 596
yp dec 217 if ey >= 1078
y dec -242 if ic > 870
riz inc 438 if bxy >= 2358
x dec -923 if y == 587
lzd dec -832 if kjn > -1327
y inc 25 if kjn <= -1319
kd dec 573 if m != 1976
gub dec 134 if kd == -2624
n inc 291 if zv <= -599
n dec 226 if msg == -1256
msg inc -646 if omz != -3565
i inc 454 if kjn != -1333
tj dec -123 if ey <= 1090
gub inc -428 if tj == -842
gub dec 456 if i > 283
t inc 270 if ic >= 875
x dec 671 if n != -111
lzd dec -137 if e != -2003
y dec -868 if lzd < 2414
gm inc 935 if e > -1999
j inc 981 if gub <= 538
m dec -967 if lzd != 2410
gm dec -448 if kd > -2629
f dec -625 if lzd > 2403
t dec 760 if omz >= -3559
tj inc 688 if n != -118
gm dec 351 if e <= -1994
t dec 915 if f <= 3501
riz dec 336 if gub < 541
e dec 775 if e > -2001
j dec -467 if bxy <= 2364
bxy inc -66 if riz == 4009
gm inc 979 if e == -2770
i dec 579 if ey > 1086
m inc 349 if x > 2503
zv inc -79 if lyr == -1709
riz inc -493 if ic < 888
lzd inc 308 if i != 273
gub dec 527 if yp >= -3297
t dec -667 if kd == -2620
gm dec 785 if yp > -3308
riz inc -465 if kd == -2620
kd dec 608 if n > -125
e inc -901 if gm > -411
ucy inc 23 if x > 2493
ucy dec 246 if tj <= -834
tj dec 735 if lzd == 2716
t dec 635 if gub >= 538
lyr inc 107 if gub != 538
lyr inc -624 if djq <= -1521
lzd dec -958 if msg < -1892
ic inc 648 if msg < -1892
gm dec 329 if i <= 280
y dec -335 if ey <= 1086
lyr dec 19 if x != 2504
gub dec 220 if f >= 3489
kjn dec 449 if msg == -1900
ey inc 292 if f != 3503
ey dec -671 if n <= -120
kd inc 516 if kjn <= -1780
i inc 208 if riz < 3048
x dec 737 if f >= 3500
ucy dec 767 if lyr != -2352
ey dec -958 if t == -7
yp inc 340 if gm == -739
ey inc 545 if kjn == -1775
x inc -678 if omz == -3567
n dec 862 if zv > -685
ey dec 674 if yp > -2970
y dec 31 if t > -19
ic dec 196 if lzd < 3685
t dec -470 if lyr >= -2355
msg dec -814 if f > 3492
omz inc 638 if f == 3494
ic dec -297 if bxy == 2299
y dec -185 if ey >= 1244
yp dec 462 if lyr >= -2357
j dec 777 if ucy > -1717
i dec 834 if i <= 274
kd dec 851 if m <= 2952
ey dec -738 if bxy != 2289
djq dec -702 if ic > 1328
f inc 674 if msg >= -1094
msg inc 290 if kd != -4080
gub dec -235 if yp < -3417
omz dec -750 if m > 2937
kd dec -870 if x != 1823
i dec -983 if omz <= -2171
kd inc -637 if m != 2942
ic inc 253 if x >= 1816
kd inc -790 if x == 1814
lyr dec 369 if yp > -3436
j inc 72 if riz < 3058
j inc 55 if y == 1967
msg dec 788 if ucy <= -1711
riz inc 138 if gm < -730
kd dec -953 if n == -981
i inc -225 if omz == -2179
bxy dec -21 if msg != -1574
m dec 737 if f <= 4170
ucy inc -304 if lzd != 3675
gm inc -199 if ey != 1979
tj inc -468 if m > 2204
ucy dec 143 if djq > -833
djq inc -587 if m > 2205
f inc -213 if gm <= -929
msg dec -56 if gub >= 555
gub dec -662 if msg == -1584
omz inc 94 if t != 456
kd dec 995 if msg >= -1587
ic inc 803 if t < 454
omz inc 897 if x == 1822
j inc 534 if zv > -685
ic inc -997 if riz < 3186
yp inc -903 if gm > -945
lzd inc 326 if ucy != -1862
m dec 374 if x > 1829
tj inc -655 if gm < -932
n dec 89 if x > 1812
djq dec -619 if lyr >= -2729
j dec -969 if n == -1069
lyr dec -218 if i >= 1033
gm inc -897 if i > 1031
bxy inc -615 if yp >= -4335
omz inc -147 if tj == -1964
y inc -81 if msg != -1591
j dec 569 if yp <= -4325
kd inc 715 if ic != 1590
djq inc 661 if ey > 1976
tj dec 272 if tj > -1967
x inc -72 if zv == -684
ucy dec 338 if ucy >= -1846
msg inc -542 if lyr != -2495
zv dec -535 if ey >= 1978
m inc 944 if lzd != 3992
e dec -944 if gub >= 1213
gm inc -525 if bxy >= 1701
e inc 894 if tj != -2239
f inc -237 if lzd > 4007
x dec -248 if bxy > 1706
gm inc -484 if lzd > 4008
i inc 332 if f != 3947
yp inc 853 if kd > -4125
ucy inc -743 if gm <= -2351
djq inc -901 if gm <= -2358
t inc 76 if m < 3148
msg dec 945 if gub >= 1213
tj dec 411 if zv != -149
m dec 904 if m > 3141
msg dec -416 if gub <= 1220
x inc -354 if ey >= 1994
i dec 971 if gub >= 1206
ey inc -446 if gub >= 1215
lyr dec -106 if bxy > 1697
t inc -177 if ey <= 1547
lzd inc -147 if lzd >= 4003
ey dec -765 if f == 3953
y inc -678 if gm < -2353
x inc -7 if ic <= 1591
lyr dec 449 if lyr > -2407
gub inc -58 if ucy > -2605
n dec -512 if zv >= -156
lzd inc -847 if n > -560
tj dec -136 if djq < -1022
t inc 824 if bxy <= 1709
djq dec -358 if msg != -2663
zv dec -212 if t != 1106
zv dec 6 if ey > 1538
msg dec 302 if n < -554
ic dec -784 if i == 402
m dec 450 if tj == -2101
kd inc -559 if j != 4018
n inc 611 if riz == 3179
n dec -995 if kjn > -1781
ic inc -411 if ey == 1539
kjn inc 140 if t == 1113
y inc 247 if t < 1104
omz inc -241 if djq >= -675
omz inc 463 if kjn <= -1774
kd dec -93 if bxy > 1696
ucy inc 256 if e <= -1828
j inc -134 if t > 1096
gub dec 900 if tj != -2101
ic inc 254 if yp >= -4334
n dec 416 if n <= 446
kjn dec -636 if ic >= 1434
riz dec -348 if lzd <= 3147
gm inc -604 if n <= 26
gub dec -253 if zv != 62
m dec -274 if n >= 26
tj dec 487 if gm != -2960
omz inc -1 if n >= 25
gm dec -830 if kjn > -1782
kjn inc 617 if ey != 1539
e inc 152 if msg != -2957
x inc 627 if t >= 1109
yp inc 191 if ic >= 1436
kjn dec 985 if y > 1448
f dec -899 if f > 3951
yp inc 92 if gm <= -2127
e inc -615 if yp > -4240
x inc -443 if x != 1745
lzd inc -472 if y <= 1463
t inc 421 if djq >= -677
n dec 833 if ey == 1539
e dec -168 if omz < -1050
djq dec -670 if t >= 1523
omz dec -361 if gm > -2138
i inc 918 if ucy <= -2333
e dec 946 if ey > 1534
y inc 150 if tj == -2588
y dec 740 if yp <= -4231
gub inc -4 if gub <= 1412
riz dec 778 if f < 4858
msg inc -733 if e == -3226
i dec 377 if omz >= -708
msg dec -710 if x != 1301
j dec 380 if zv >= 57
ey inc -702 if ey > 1529
e dec 830 if omz < -699
gub inc -104 if riz == 2411
j dec -501 if gm < -2130
bxy dec -176 if kjn < -2758
zv inc 603 if zv >= 57
lyr inc 921 if lyr != -2839
j inc -337 if kjn < -2755
e dec 245 if ey > 836
t inc -339 if djq < 0
ucy dec 65 if yp <= -4237
msg dec 87 if lzd < 2687
ucy inc 949 if yp < -4227
lyr inc -298 if riz < 2416
ucy dec -52 if n == -811
tj inc -776 if bxy <= 1886
msg inc 650 if djq < -6
djq inc 542 if omz > -697
y dec 131 if zv != 660
tj inc -184 if gub <= 1303
djq dec -223 if ucy != -1401
gm inc -746 if gub < 1305
m dec 726 if zv != 662
djq dec 134 if kjn != -2754
zv inc 693 if tj >= -3538
msg inc 327 if omz == -699
gub inc 913 if x != 1294
yp dec -183 if gub == 2215
bxy inc 558 if tj < -3540
msg dec 278 if m >= 1069
j dec -760 if gub < 2212
gub inc 720 if n != -820
bxy dec 458 if msg == -3018
tj inc 630 if ucy <= -1399
i inc -489 if bxy == 1978
x dec 651 if gub > 2934
f dec -23 if lyr < -2216
y inc 744 if n == -811
ucy inc -624 if j == 3661
riz inc -947 if m == 1070
y dec -103 if ic < 1430
m dec -158 if f < 4884
y inc 897 if j > 3679
kjn inc -307 if bxy == 1978
y inc 130 if kd <= -4589
msg inc -597 if bxy > 1972
tj inc -575 if t > 1185
i inc -325 if msg <= -3624
i inc 834 if gm >= -2889
ucy inc -431 if yp != -4054
t inc 499 if j >= 3669
msg dec 39 if ey == 837
lzd dec 774 if kd != -4592
x inc -468 if j < 3681
x inc 223 if gm <= -2872
t dec 74 if djq >= 95
djq inc 306 if m > 1221
i dec -669 if kjn <= -3065
omz inc 92 if bxy == 1978
gub inc 762 if tj >= -2911
gm dec -810 if kd >= -4590
ey inc 797 if i >= 1943
t inc -20 if tj != -2913
yp inc -66 if x < 395
omz inc -270 if omz > -617
x dec -365 if msg >= -3656
msg inc -443 if t >= 1662
msg inc -334 if lzd > 2674
f inc -478 if riz == 1464
m dec 551 if lyr <= -2222
yp dec 321 if m >= 684
yp inc 930 if ucy < -1400
j dec -836 if ucy >= -1404
lzd inc 941 if tj <= -2916
tj inc 890 if j > 3668
kjn inc -538 if ic > 1423
i inc 79 if ucy > -1401
kjn dec -145 if e <= -3464
ey inc 851 if i > 1948
msg inc 566 if ic >= 1423
riz dec 615 if bxy != 1988
x inc 929 if msg == -3868
ucy inc -486 if gub != 2933
ic dec -842 if t < 1663
lzd inc 453 if f < 4405
riz dec 591 if ic != 1437
lzd dec 457 if e >= -3474
gub dec 221 if n <= -802
gub inc -707 if riz > 256
bxy dec -352 if riz == 266
x inc -754 if j >= 3667
tj inc 624 if y == 1852
ey dec 96 if kjn <= -3453
j inc -682 if t > 1673
j inc -830 if zv != 652
zv dec 263 if ic > 1420
m dec -636 if ic > 1435
lzd inc 806 if yp < -3114
yp dec 886 if zv <= 402
t dec 758 if ic < 1419
riz inc -212 if omz != -876
djq dec 815 if kd == -4589
t dec -70 if gm >= -2889
ey dec 798 if gm <= -2877
i dec 879 if zv < 407
f dec -946 if i < 1082
i dec -419 if y == 1844
lyr dec -544 if kjn > -3461
gm dec -138 if kd < -4582
gub dec 371 if lzd < 4416
n dec 455 if kd <= -4583
e inc 475 if kjn <= -3457
lzd dec 393 if riz >= 45
x dec 8 if kjn > -3456
gm inc 546 if yp >= -4015
riz dec -65 if msg < -3858
lyr inc 684 if omz >= -867
tj dec 642 if j != 2833
riz inc -100 if lzd < 4025
y dec -178 if lzd <= 4024
f dec 614 if y > 1840
kd dec -708 if kd == -4592
m dec -324 if x <= 15
gub dec -402 if kd > -3893
omz inc 27 if zv > 395
bxy inc 323 if msg == -3865
ucy inc -74 if i <= 1499
kjn inc 969 if yp >= -4016
lyr inc -253 if n == -1266
msg inc -109 if riz == 111
msg dec -216 if m > 995
kd dec 767 if t >= 1726
lyr inc 689 if omz <= -843
yp inc -108 if yp >= -4001
i dec -696 if ucy == -1966
e inc -230 if gm >= -2197
omz inc -695 if msg != -3749
y dec -658 if ic >= 1430
y dec -933 if ucy == -1972
m dec -207 if tj < -2664
gub inc -537 if yp >= -4018
msg inc 324 if kjn > -2489
ey dec 165 if n > -1275
djq inc 738 if zv <= 403
m inc -432 if j <= 2848
ic inc -881 if omz < -1537
y inc 159 if gub == 1879
kjn inc 236 if djq == 1130
i dec -648 if djq > 1122
lzd dec -793 if j == 2838
bxy dec -33 if j != 2845
ucy dec 290 if kjn >= -2257
msg inc -81 if djq == 1130
t dec -466 if djq < 1129
djq dec 402 if tj == -2670
gm inc -693 if lzd != 4022
j dec -327 if zv < 403
f dec 978 if djq <= 728
djq inc -35 if y >= 1837
msg inc -609 if t == 1734
tj inc 64 if n == -1266
f dec 465 if t != 1727
f dec -48 if omz >= -1553
kd dec -533 if y < 1850
t inc 959 if y != 1850
yp inc 764 if i <= 2837
lyr dec 822 if bxy == 2334
msg inc 723 if m > 768
djq dec -846 if ic >= 555
n dec 17 if ic < 551
m dec -661 if kjn != -2254
tj dec -975 if f != 3334
bxy inc -920 if i != 2844
e inc -222 if x == 15
lzd dec -413 if yp > -3241
i inc 953 if y <= 1849
riz inc -675 if kd != -4112
zv dec 433 if e >= -3450
bxy inc -302 if gub >= 1870
x inc -645 if zv < -37
omz inc -471 if kd >= -4115
bxy dec 450 if riz >= -573
omz dec 274 if e != -3452
f dec -92 if i >= 3786
ey inc -10 if f < 3419
djq inc 120 if lzd > 4027
lzd inc 360 if yp >= -3246
n inc 175 if djq < 820
tj dec -641 if gm <= -2889
tj inc -3 if lzd != 4393
lzd inc 116 if msg == -3725
djq inc -421 if kd < -4110
e inc -509 if gm != -2880
omz inc -878 if bxy >= 655
kjn dec -877 if djq < 400
ucy inc -697 if yp < -3237
ucy inc -656 if gub <= 1874
y dec 642 if msg <= -3735
kjn dec 679 if djq <= 385
ey inc -768 if gm != -2898
ic dec -433 if kjn == -1387
x inc -150 if t < 2699
ic inc 89 if j < 3175
m dec -623 if riz != -565
msg dec -165 if omz != -2693
omz inc -668 if djq != 390
tj dec -812 if riz <= -557
zv dec 563 if f <= 3430
riz dec -319 if lzd == 4518
y dec -58 if i == 3789
ic dec 166 if riz != -562
ic inc -587 if zv != -603
riz dec -462 if ey != 664
gub inc 153 if ucy <= -3604
t dec -106 if ey <= 658
msg inc -821 if zv < -593
i inc -340 if e <= -3955
tj dec -771 if djq < 388
ic dec -437 if n < -1106
e inc -273 if lyr == -2065
bxy dec -912 if m > 2055
n dec -215 if gm == -2889
yp inc 716 if e == -4230
j inc 548 if gub > 2024
f dec -77 if x <= -126
omz dec -487 if kd < -4127
msg inc -384 if ic <= 321
j dec 97 if t > 2797
i dec -197 if x < -135
lzd dec 491 if lzd >= 4503
ucy inc -338 if f <= 3508
tj dec -932 if msg == -4765
y dec 273 if omz == -3365
y dec 50 if djq > 386
lzd inc 958 if m <= 2069
ey dec 449 if m <= 2067
lzd dec 143 if y != 1511
gm inc -413 if lzd <= 4837
n inc 129 if ucy == -3947
tj inc 527 if bxy >= 1571
msg inc 448 if i == 3440
x dec 73 if yp == -2530
t inc 608 if djq != 393
gm dec 937 if omz > -3368
kjn inc -435 if msg >= -4766
m inc 511 if m < 2067
t inc -410 if f >= 3498
x inc -137 if ucy == -3947
riz dec -965 if ic == 319
kjn inc -528 if riz <= 860
ic dec 582 if tj != 1288
msg inc 859 if m > 2564
f inc 573 if bxy != 1573
kd inc 970 if yp > -2534
f inc 390 if gm > -4248
ucy dec 0 if bxy < 1582
kd inc 814 if zv <= -591

In [280]:
input_data_registers = {}
input_inc_dec = []
input_cond = []

with open("day8_input.txt") as f:
    for line in f.read().strip().split("\n"):
        m = re.match(r"(([a-z]+)\s[a-z]+\s[-]*\d+)\sif\s(([a-z]+)\s[!><=]+\s[-]*\d+)",line)
        input_data_registers[m.group(2)] = 0
        input_data_registers[m.group(4)] = 0
        input_inc_dec += [m.group(1)]
        input_cond += [m.group(3)]
        
len(input_data_registers),input_data_registers


Out[280]:
(26,
 {'bxy': 0,
  'djq': 0,
  'e': 0,
  'ey': 0,
  'f': 0,
  'gm': 0,
  'gub': 0,
  'i': 0,
  'ic': 0,
  'j': 0,
  'kd': 0,
  'kjn': 0,
  'lyr': 0,
  'lzd': 0,
  'm': 0,
  'msg': 0,
  'n': 0,
  'omz': 0,
  'riz': 0,
  't': 0,
  'tj': 0,
  'ucy': 0,
  'x': 0,
  'y': 0,
  'yp': 0,
  'zv': 0})

part 1


In [268]:
import operator

def get_operator_fn(op):
    return {
    '<'  : operator.lt,
    '<=' : operator.le,
    '==' : operator.eq,
    '!=' : operator.ne,
    '>=' : operator.ge,
    '>'  : operator.gt,
    'inc': operator.add,
    'dec': operator.sub
    }[op]

def find_largest_reg1(data_registers, inc_dec, cond):
    for i in range(len(inc_dec)):
        cond_l = cond[i].split(" ")
        if get_operator_fn(cond_l[1])(data_registers[cond_l[0]], int(cond_l[2])):
            inc_dec_l = inc_dec[i].split(" ")
            data_registers[inc_dec_l[0]] = get_operator_fn(inc_dec_l[1])(data_registers[inc_dec_l[0]], int(inc_dec_l[2]))
    return max(data_registers.items(), key=operator.itemgetter(1))[1]

In [291]:
sample = """b inc 5 if a > 1
a inc 1 if b < 5
c dec -10 if a >= 1
c inc -20 if c == 10
"""
sample_data_registers = {}
sample_inc_dec = []
sample_cond = []
for line in sample.strip().split("\n"):
    m = re.match(r"(([a-z]+)\s[a-z]+\s[-]*\d+)\sif\s(([a-z]+)\s[!><=]+\s[-]*\d+)",line)
    sample_data_registers[m.group(2)] = 0
    input_data_registers[m.group(4)] = 0
    sample_inc_dec += [m.group(1)]
    sample_cond += [m.group(3)]

In [284]:
assert find_largest_reg1(sample_data_registers, sample_inc_dec, sample_cond) == 1

In [271]:
find_largest_reg1(input_data_registers, input_inc_dec, input_cond)


Out[271]:
4832

part 2


In [290]:
def find_largest_reg2(data_registers, inc_dec, cond):
    max_value = -float('inf')
    for i in range(len(inc_dec)):
        cond_l = cond[i].split(" ")
        if get_operator_fn(cond_l[1])(data_registers[cond_l[0]], int(cond_l[2])):
            inc_dec_l = inc_dec[i].split(" ")
            data_registers[inc_dec_l[0]] = get_operator_fn(inc_dec_l[1])(data_registers[inc_dec_l[0]], int(inc_dec_l[2]))
            max_value = max(max_value, data_registers[inc_dec_l[0]])
    return max_value

In [292]:
assert find_largest_reg2(sample_data_registers, sample_inc_dec, sample_cond) == 10

In [293]:
find_largest_reg2(input_data_registers, input_inc_dec, input_cond)


Out[293]:
5443

Day 9: Stream Processing


In [2]:
! cat day9_input.txt


{{{{{{<!>!>,<o!>},<a,"i!!!>i!!,!>,<<e<i<<>,{{{<!>},<!><!>,<!!!>!!!>!!!>{"!>},<!!!<!>},<oi!>!,'>}}}},{{<{!!!>},<!!,!!!>!!!>!!e!a!!!!<!>},<!!!>u!>,<!>!!u!!!!!>},<!>!>,<{>}},{<"a!!!!'!>},<!}"!>!!<o}i!<>,<<e,<eo!a}!!"!>,<!>!>!>,<e{"e">}},{{<!oi'<!o!>ue>,{<!>},<i!>,<i>,{<'>}}}},{{<"a,!>},<!!e!>,<e!!}!!o!!!>,<',}>,{{<i!!!!o!!!>!}!!!!!>!a!!!>!>!!a!!!!,!!u!!!>,<>}}}},{{{<{i!!<!!!!e!>>}},{{<!!!>},<ei>,{}}}}}},{{{<eaieia,!{io"{!!}eu!{{!!e'>,{<>}}},{{{{<o>},<e!!o,!>},<"u{!>,<!>},<a{}{!u>}},{{{<!!u'ioi''!>},<"u>},<'oa!!<,'!!"!!!!!>!!!!!>{!!!!aa>},{{<u}",!!i!!!>!>!!!>!>!!!>'}!o{!!{>}},{<oiau>,<!!!>!><!>!!<!!!>!!<i!a}!>},<<}a}>}},{<eeo!!}!!!>e!>,<!!!>!!<{!!<i{!>i!>,<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>!!>}},{{<!><!>,<!>},<!>},<,u<,}!>},<!!!!e,o'>,{{},{<a>}}},{}},{{{{<",<!!"o!>>},{<o"!!<{}',!><>}},{<!!!>'i!!!>,<i>}}}}},{{{}},{}},{{{<a}ei{o!>,<!!!!ui!'!<{!>,<!>},<!>i>},{<<!!!>,<}}ao!>},<!!!>},<!!!>>}},{{{<!{u!!!!!>!}!!'"!>,<<"!>,<!!!>'>},{}},{{{<!,!eu!>'u!!{!!!>e}'o!e!!!!!>o>},{<"!!!>}!<i!!!>!'!!!uooeo!a!"!iio!!>}},<o!!!{e"}!!!>!u!"{,!>!>!>},<u!'>},{<!>},<a!a}!!!>{!i!!!!auo<i>}},{<"'!>},<{e!!!>!!uu!>,<!!a>,{<o"o!>},<!>,<!"}"o!{'{,!>},<>}}}},{{{<!!{"""!!,>},<!i<<>},{{<!!o"!e>}},{{{<e}!!!}>}},{<<!!!>!>,<!>,<!u!!!!!!,u!!!!!!!!!!!>,<'!>"!!!>{>}}}},{}}}

In [5]:
input_data = None
with open("day9_input.txt") as f:
    input_data = f.read().strip()

part 1


In [45]:
def update_cancelled_chars(s):
    n = len(s)
    updated_s = ''
    i = 0
    while i < n:
        if s[i] == '!':
            i += 2
        else:
            updated_s += s[i]
            i += 1
    return updated_s

def score_stream1(s):
    matching_braces = {'{':'}', '<':'>'}
    updated_s = update_cancelled_chars(s)
    # print("----",updated_s)
    n = len(updated_s)
    # some corner cases to add the first character 
    # are not verified
    # push and pop at the end
    stack = []
    score = 0
    current_stream_score = 0
    seen_garbage_start = False
    for c in updated_s:
        if c not in ['{','}','<','>']:
            continue
        if c == '<':
            seen_garbage_start = True
        if c == '>':
            seen_garbage_start = False
            
        if seen_garbage_start is False:
            if c == '{':
                current_stream_score += 1
                stack += [('{', current_stream_score)]
                score += current_stream_score
            elif c == matching_braces[stack[-1][0]]:
                stack.pop()
                current_stream_score -= 1
            
    # print("----",score)
    return score

In [46]:
assert update_cancelled_chars("<!!!>>") == "<>" 
assert update_cancelled_chars("<{o\"i!a,<{i<a>") == "<{o\"i,<{i<a>"
assert update_cancelled_chars("<!!>") == "<>"
assert update_cancelled_chars("<{!>}>") == "<{}>"

In [47]:
assert score_stream1("{}") == 1
assert score_stream1("{{{}}}") == 6
assert score_stream1("{{},{}}") == 5
assert score_stream1("{{{},{},{{}}}}") == 16
assert score_stream1("{<a>,<a>,<a>,<a>}") == 1
assert score_stream1("{{<ab>},{<ab>},{<ab>},{<ab>}}") == 9
assert score_stream1("{{<!!>},{<!!>},{<!!>},{<!!>}}") == 9
assert score_stream1("{{<a!>},{<a!>},{<a!>},{<ab>}}") == 3

In [48]:
score_stream1(input_data)


Out[48]:
16869

part 2


In [57]:
def score_stream2(s):
    matching_braces = {'{':'}', '<':'>'}
    updated_s = update_cancelled_chars(s)
    n = len(updated_s)
    garbage_count = 0
    seen_garbage_start = False
    for c in updated_s:
        if seen_garbage_start is True:
            garbage_count += 1
        if c == '<':
            seen_garbage_start = True
        if c == '>':
            seen_garbage_start = False
            garbage_count -= 1
    return garbage_count

In [58]:
assert score_stream2("<>") == 0
assert score_stream2("<random characters>") == 17
assert score_stream2("<<<<>") == 3
assert score_stream2("<{!>}>") == 2
assert score_stream2("<!!>") == 0
assert score_stream2("<!!!>>") == 0
assert score_stream2("<{o\"i!a,<{i<a>") == 10

In [59]:
score_stream2(input_data)


Out[59]:
7284

Day 10: Knot Hash


In [19]:
! cat day10_input.txt


76,1,88,148,166,217,130,0,128,254,16,2,130,71,255,229

In [20]:
input_data = None
with open('day10_input.txt') as f:
    input_data = f.read().strip()
input_data


Out[20]:
'76,1,88,148,166,217,130,0,128,254,16,2,130,71,255,229'

part 1


In [21]:
def perform_one_round_knot_hash(l,lengths,ci=0,skip_size=0):
    n = len(l)
    # ci current index
    for length in lengths:
        #print("ci",ci,"skip",skip_size,"length",length,l)
        if ci+length > n:
            length_in_end = ci+length-n
            new_l = (l[ci:ci+length] + l[:length_in_end])[::-1]
            # print("new_l",new_l)
            # print(l[ci:ci+length],new_l[:-length_in_end])
            # print(l[:length_in_end],new_l[-length_in_end:])
            l[ci:ci+length] = new_l[:-length_in_end]
            l[:length_in_end] = new_l[-length_in_end:]
        else:
            l[ci:ci+length] = l[ci:ci+length][::-1]
        
        ci = (ci + length + skip_size)%n
        skip_size += 1
        # print("ci",ci,l)
        # print("======")
    return (l, ci, skip_size)
  
def howmany_knothashes(input_chars, lengths):
    l, _, _ = perform_one_round_knot_hash(input_chars, lengths)
    return l[0]*l[1]

In [22]:
assert howmany_knothashes(list(range(5)),[3,4,1,5]) == 12

In [23]:
howmany_knothashes(list(range(256)),list(map(int,input_data.split(","))))


Out[23]:
29240

part 2


In [24]:
def knot_hash(input_string, rounds=64):
    suffix = [17, 31, 73, 47, 23]
    lengths = [ord(ch) for ch in input_string] + suffix
    l = list(range(256))
    # round 1
    l, ci, skip_size = perform_one_round_knot_hash(l, lengths)
    for r in range(rounds-1):
        l, ci, skip_size = perform_one_round_knot_hash(l, lengths, ci, skip_size)
    
    import functools
    si,ei = 0,16
    dense_hash = ""
    for i in range(16):
        xored = functools.reduce(lambda x,y: x^y, l[si:ei])
        dense_hash += '{:02x}'.format(xored)
        si += 16
        ei += 16
    
    return dense_hash

In [25]:
assert knot_hash("") == "a2582a3a0e66e6e86e3812dcb672a272"
assert knot_hash("AoC 2017") == "33efeb34ea91902bb2f59c9920caa6cd"
assert knot_hash("1,2,3") == "3efbe78a8d82f29979031a4aa0b16a9d"
assert knot_hash("1,2,4") == "63960835bcdc130f0b66d7ff4f6a5a8e"

In [26]:
knot_hash(input_data)


Out[26]:
'4db3799145278dc9f73dcdbc680bd53d'

In [28]:
len(bin(0xa2582a3a0e66e6e86e3812dcb672a272))-2


Out[28]:
128

Day 11: Hex Ed


In [21]:
! cat day11_input.txt


se,nw,ne,s,sw,sw,sw,sw,nw,sw,nw,nw,ne,nw,nw,n,se,ne,n,n,n,n,n,n,n,n,ne,n,se,ne,n,s,n,ne,ne,ne,ne,n,se,ne,se,se,ne,se,ne,s,sw,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ne,ne,ne,ne,ne,ne,n,ne,ne,nw,ne,ne,ne,ne,ne,ne,ne,s,n,n,ne,ne,se,ne,se,ne,ne,ne,ne,ne,s,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,n,ne,n,ne,ne,nw,ne,ne,ne,ne,ne,ne,ne,ne,se,se,s,se,ne,ne,ne,ne,se,ne,se,ne,se,ne,ne,ne,se,se,ne,nw,sw,sw,se,ne,ne,s,se,se,se,nw,se,n,se,se,se,se,ne,ne,ne,ne,n,ne,ne,ne,ne,nw,se,se,se,ne,se,ne,se,ne,se,ne,se,ne,se,n,s,ne,ne,ne,s,se,ne,se,se,se,nw,ne,nw,se,n,se,se,se,se,ne,ne,se,se,se,se,se,ne,se,ne,se,se,ne,se,nw,n,se,se,se,se,se,se,se,se,n,se,nw,se,se,se,se,se,se,sw,ne,n,se,se,nw,s,s,se,nw,se,se,sw,se,se,se,ne,s,ne,se,ne,se,se,sw,se,se,nw,se,se,se,n,se,nw,n,se,sw,se,se,se,se,ne,se,se,n,se,se,se,se,se,n,se,se,se,se,s,se,se,se,sw,se,ne,se,se,se,sw,se,sw,se,se,s,se,se,s,se,se,ne,se,n,s,se,s,se,s,se,se,se,se,se,s,se,se,s,se,se,se,sw,se,se,n,se,s,ne,se,se,nw,se,se,se,n,se,se,se,se,s,se,n,se,se,se,se,se,se,nw,se,se,se,sw,se,se,se,s,se,s,ne,se,se,se,n,n,se,n,ne,s,se,nw,se,ne,se,sw,s,se,se,s,se,s,sw,se,n,se,se,se,sw,s,se,se,se,se,se,se,s,s,s,sw,ne,se,s,se,se,se,n,s,nw,s,se,n,se,s,se,s,se,s,ne,se,se,s,se,s,n,se,ne,se,se,se,s,s,se,s,se,s,nw,se,n,s,se,s,se,ne,ne,se,s,s,s,s,se,s,s,s,s,s,ne,se,se,nw,se,n,s,se,s,s,n,se,se,nw,se,s,sw,s,s,se,se,s,ne,s,s,s,s,s,s,s,ne,nw,s,s,s,s,s,s,s,s,se,s,s,n,ne,se,nw,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ne,se,ne,ne,ne,s,se,ne,ne,ne,nw,ne,ne,se,ne,ne,nw,se,ne,n,ne,ne,ne,sw,se,n,ne,ne,se,se,se,ne,ne,ne,ne,ne,ne,ne,ne,ne,n,ne,ne,se,ne,n,ne,se,ne,n,ne,s,ne,ne,s,se,ne,ne,sw,ne,ne,ne,ne,ne,se,ne,ne,ne,ne,se,se,ne,ne,ne,se,nw,ne,ne,s,n,n,se,ne,se,sw,sw,sw,s,ne,se,ne,ne,ne,se,ne,sw,sw,ne,se,ne,ne,se,se,ne,ne,ne,ne,ne,ne,ne,ne,n,ne,s,se,se,nw,se,ne,ne,ne,se,se,se,ne,ne,se,se,sw,se,se,ne,s,n,ne,ne,ne,se,se,se,se,ne,ne,se,ne,sw,se,n,se,ne,ne,ne,ne,se,se,se,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,se,se,ne,sw,se,n,n,ne,ne,nw,nw,nw,se,n,sw,ne,se,ne,se,ne,ne,se,se,s,nw,ne,sw,ne,se,nw,ne,se,ne,se,ne,nw,ne,ne,se,se,ne,ne,ne,se,se,ne,se,ne,ne,ne,ne,sw,ne,se,se,ne,ne,ne,se,se,se,sw,ne,ne,ne,nw,ne,ne,s,ne,se,se,se,nw,se,ne,ne,n,n,se,se,se,ne,se,sw,se,s,se,sw,ne,se,ne,sw,ne,se,se,se,s,ne,se,n,se,se,se,nw,se,se,se,ne,se,ne,se,se,nw,ne,n,se,ne,ne,se,ne,se,se,ne,se,se,ne,se,nw,ne,se,ne,se,se,nw,s,n,ne,ne,s,nw,ne,se,sw,ne,sw,ne,ne,ne,se,se,sw,ne,ne,se,se,se,n,se,ne,se,se,ne,ne,se,se,se,ne,se,ne,se,se,n,se,n,n,se,ne,ne,se,se,se,ne,n,se,se,se,se,ne,se,se,ne,se,se,se,se,se,ne,se,n,se,se,se,se,se,se,s,ne,se,se,sw,se,se,ne,ne,ne,ne,se,nw,ne,se,ne,ne,se,nw,ne,nw,ne,se,nw,se,se,se,nw,n,se,sw,ne,ne,ne,ne,se,sw,se,s,nw,ne,s,ne,se,se,ne,nw,n,sw,se,ne,ne,ne,se,se,ne,ne,se,se,sw,se,ne,ne,se,s,se,se,se,ne,se,se,s,se,ne,sw,sw,se,ne,se,ne,ne,se,sw,sw,ne,se,ne,se,ne,se,ne,se,sw,n,se,ne,ne,nw,s,n,se,se,s,ne,sw,se,ne,se,ne,ne,ne,ne,ne,n,se,se,ne,se,se,se,ne,se,ne,n,se,n,n,ne,ne,sw,se,ne,se,se,se,se,se,ne,se,ne,ne,ne,se,ne,nw,ne,s,se,sw,se,n,ne,ne,se,se,se,sw,se,se,se,s,se,se,se,se,ne,se,se,ne,se,sw,nw,ne,se,se,se,s,n,se,se,ne,ne,ne,se,ne,se,se,se,sw,ne,se,se,se,n,se,se,se,se,se,se,n,se,se,se,se,se,sw,se,se,se,se,se,se,n,ne,ne,se,ne,se,se,ne,ne,se,se,ne,ne,ne,se,se,se,se,se,ne,sw,ne,se,ne,se,s,se,ne,se,se,se,ne,se,se,se,se,nw,se,se,se,s,n,se,se,se,se,se,ne,sw,sw,ne,sw,se,se,ne,sw,se,se,se,s,ne,ne,se,se,se,ne,se,ne,se,n,se,n,ne,ne,se,se,se,ne,n,se,se,se,se,s,ne,sw,n,se,ne,se,se,ne,s,ne,se,se,se,ne,s,nw,s,ne,n,se,ne,s,s,s,ne,ne,ne,se,ne,ne,s,sw,se,se,se,se,sw,nw,ne,nw,se,se,se,se,s,se,se,s,se,ne,se,n,nw,s,se,se,se,se,ne,se,se,sw,ne,se,se,se,ne,ne,se,se,se,se,ne,n,se,se,se,se,se,ne,se,s,se,se,s,se,sw,se,se,se,ne,ne,se,se,s,se,n,se,se,se,se,se,se,nw,nw,se,ne,se,ne,se,se,se,se,n,se,se,se,ne,se,se,se,n,se,se,nw,se,se,ne,ne,se,se,ne,se,ne,n,s,se,se,se,sw,se,se,se,se,se,se,ne,n,se,se,ne,se,se,se,se,se,se,se,se,se,se,n,se,nw,se,se,se,se,se,se,se,ne,se,se,se,s,n,se,se,se,se,se,s,se,ne,se,se,ne,se,se,nw,n,se,se,n,se,ne,se,se,se,se,s,se,se,se,se,se,se,se,ne,s,s,se,se,sw,se,se,se,se,se,se,se,se,nw,sw,se,se,se,se,ne,se,se,n,se,ne,ne,n,se,nw,ne,se,se,ne,se,se,se,se,se,ne,se,n,ne,se,se,s,se,se,se,se,se,se,se,se,s,sw,se,ne,se,se,se,se,se,se,s,n,s,se,se,sw,se,se,se,se,se,se,se,se,se,se,se,s,se,sw,se,se,se,se,se,n,se,sw,n,se,n,se,se,nw,se,nw,se,sw,se,se,se,se,se,se,se,se,se,se,se,se,se,se,se,se,sw,se,se,se,se,se,se,se,se,se,nw,se,se,sw,ne,n,n,s,nw,nw,s,nw,n,nw,nw,sw,sw,sw,sw,s,sw,se,s,s,s,s,s,s,s,se,s,se,s,se,se,s,se,se,se,se,se,se,se,se,se,ne,se,se,se,ne,se,se,se,ne,se,se,s,sw,ne,ne,se,ne,ne,s,sw,sw,ne,ne,n,ne,ne,ne,n,ne,ne,ne,ne,ne,n,ne,ne,ne,n,s,n,n,ne,s,n,ne,sw,ne,ne,n,n,s,nw,nw,n,n,nw,n,se,n,n,sw,n,n,n,n,n,nw,n,n,n,nw,s,n,nw,n,nw,n,s,n,n,sw,sw,n,nw,s,nw,se,nw,nw,nw,nw,nw,nw,nw,n,nw,n,sw,s,nw,nw,sw,sw,nw,nw,ne,sw,nw,nw,nw,nw,nw,nw,nw,sw,nw,sw,nw,nw,nw,n,ne,nw,nw,sw,nw,nw,s,nw,nw,sw,n,nw,sw,sw,sw,nw,nw,nw,sw,s,nw,nw,nw,sw,sw,nw,sw,sw,n,nw,nw,nw,sw,nw,sw,sw,sw,sw,nw,nw,sw,ne,se,sw,sw,sw,sw,ne,n,sw,sw,sw,sw,sw,sw,se,sw,s,sw,sw,sw,sw,sw,sw,sw,n,s,sw,s,s,n,sw,s,s,sw,sw,s,s,s,n,se,sw,s,s,s,sw,n,s,sw,sw,sw,nw,nw,sw,s,sw,sw,sw,sw,sw,sw,nw,s,sw,sw,nw,s,sw,s,s,sw,s,sw,sw,s,sw,s,sw,s,n,sw,se,s,se,sw,n,s,ne,s,se,se,s,nw,s,s,sw,s,s,s,s,sw,s,s,sw,s,s,s,s,se,s,sw,s,ne,s,s,s,s,n,sw,n,sw,ne,s,s,s,s,s,s,nw,s,s,se,s,sw,se,ne,s,s,s,s,s,s,ne,s,nw,s,s,nw,se,s,s,s,s,se,ne,se,sw,s,s,s,ne,se,s,ne,se,s,se,s,se,s,s,s,se,s,s,s,n,se,ne,se,se,s,nw,s,nw,se,s,s,n,se,n,ne,se,s,se,s,se,ne,se,se,se,s,s,sw,se,s,se,se,s,s,se,s,n,nw,ne,s,se,se,se,s,s,se,s,se,n,se,s,s,sw,se,se,se,se,se,se,ne,se,s,se,se,se,se,se,se,se,se,se,se,se,nw,se,se,nw,s,n,n,n,se,n,se,se,se,se,se,se,sw,se,ne,ne,nw,se,se,se,se,n,se,se,se,n,se,se,se,nw,se,se,sw,sw,n,se,se,ne,se,n,sw,nw,se,se,se,ne,ne,se,se,se,ne,se,se,se,se,ne,se,se,se,ne,se,ne,se,se,se,n,ne,s,se,ne,se,n,n,ne,se,se,se,ne,ne,ne,ne,ne,se,n,s,se,se,nw,ne,ne,se,nw,ne,se,ne,se,ne,se,se,ne,ne,se,ne,ne,se,se,ne,ne,se,ne,se,sw,n,ne,ne,ne,ne,ne,se,ne,ne,ne,ne,se,se,ne,sw,se,ne,ne,se,ne,se,ne,se,se,ne,se,ne,se,ne,sw,ne,ne,se,se,ne,se,se,se,ne,n,ne,nw,sw,ne,ne,ne,ne,ne,n,se,se,ne,se,ne,s,nw,se,ne,se,se,ne,ne,sw,ne,sw,ne,ne,se,ne,n,sw,ne,nw,sw,ne,ne,sw,ne,ne,nw,ne,s,se,n,ne,ne,se,ne,n,ne,ne,ne,sw,ne,n,ne,nw,nw,ne,ne,nw,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,nw,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s,s,se,s,s,s,sw,s,s,s,sw,s,s,s,n,s,se,s,sw,ne,s,s,sw,s,se,sw,n,s,s,nw,n,n,nw,s,s,s,s,s,se,ne,sw,nw,s,s,s,nw,s,s,ne,s,s,s,s,s,s,n,s,s,ne,nw,n,sw,s,s,s,s,s,s,sw,se,s,nw,s,s,sw,s,s,sw,se,sw,s,s,s,s,s,s,s,s,ne,sw,s,sw,sw,s,s,s,s,s,s,s,s,sw,s,se,s,s,s,s

In [32]:
input_data = None
with open("day11_input.txt") as f:
    input_data = f.read().strip().split(",")
len(input_data)


Out[32]:
8223

In [33]:
from IPython.display import Image
Image(filename='/home/bicepjai/Projects/mypuzzles/adventofcode/2017/images/hex_grid.png')


Out[33]:

part 1


In [50]:
# hex grid directions in cube co ordinates (x,y,z)
dir_map = {"n" :(0,1,-1), "ne":(1,0,-1), "nw":(-1,1,0),
           "s" :(0,-1,1), "se":(1,-1,0), "sw":(-1,0,1)}
add_2cube_cord = lambda xyz1,xyz2:(xyz1[0]+xyz2[0],xyz1[1]+xyz2[1],xyz1[2]+xyz2[2])
distance_from_origin = lambda xyz: max(abs(xyz[0]), abs(xyz[1]), abs(xyz[2]))

def shortest_distance_to_hexgrid1(path):
    # starting at origin
    cco = (0,0,0) #current_co_ordinate
    for d in path:
        cco = add_2cube_cord(cco, dir_map[d])
    # shortest distance from origin
    return distance_from_origin(cco)

In [51]:
assert shortest_distance_to_hexgrid1(["ne","ne","ne"]) == 3
assert shortest_distance_to_hexgrid1(["ne","ne","sw","sw"]) == 0
assert shortest_distance_to_hexgrid1(["ne","ne","s","s"]) == 2
assert shortest_distance_to_hexgrid1(["se","sw","se","sw","sw"]) == 3

In [52]:
shortest_distance_to_hexgrid(input_data)


Out[52]:
784

part 2


In [53]:
def shortest_distance_to_hexgrid2(path):
    # starting at origin
    cco = (0,0,0) #current_co_ordinate
    max_distance = 0
    for d in path:
        cco = add_2cube_cord(cco, dir_map[d])
        max_distance = max(max_distance, distance_from_origin(cco))
    return max_distance

In [54]:
shortest_distance_to_hexgrid2(input_data)


Out[54]:
1558

for fun


In [55]:
def get_path_cords(path):
    # starting at origin
    path_cords = []
    cco = (0,0,0) #current_co_ordinate
    for d in path:
        path_cords += [cco]
        cco = add_2cube_cord(cco, dir_map[d])
    return path_cords

In [75]:
path_cords = get_path_cords(input_data)
fig,axes = plt.subplots(nrows=1,ncols=3)
fig.set_size_inches(18,8)

axes[0].set(title="pathxy")
axes[0].plot([t[0] for t in path_cords],[t[1] for t in path_cords])

axes[1].set(title="pathyz")
axes[1].plot([t[1] for t in path_cords],[t[2] for t in path_cords])

axes[2].set(title="pathzx")
axes[2].plot([t[2] for t in path_cords],[t[0] for t in path_cords])

plt.show()


Day 12: Digital Plumber


In [76]:
! cat day12_input.txt


0 <-> 199, 1774
1 <-> 350, 1328, 1920
2 <-> 477, 984, 1419
3 <-> 1465, 1568
4 <-> 359, 1047, 1215, 1580, 1969
5 <-> 613
6 <-> 49, 617, 1213
7 <-> 1263
8 <-> 410
9 <-> 1224
10 <-> 1157
11 <-> 304, 1168, 1875
12 <-> 868, 891, 1369, 1712
13 <-> 958, 1371
14 <-> 1814
15 <-> 261, 556
16 <-> 830, 1646, 1901, 1933
17 <-> 962, 1778
18 <-> 109, 1229
19 <-> 239, 1070, 1886, 1930
20 <-> 327, 1307, 1801, 1905
21 <-> 943, 1950
22 <-> 1310
23 <-> 659, 917
24 <-> 373
25 <-> 369
26 <-> 947, 1023
27 <-> 338, 1901
28 <-> 1691
29 <-> 132, 1219, 1699, 1962
30 <-> 424, 822, 1419
31 <-> 1444, 1464
32 <-> 702, 1517
33 <-> 1639
34 <-> 909
35 <-> 690, 1655
36 <-> 988, 1149, 1166
37 <-> 649, 1300, 1441, 1699
38 <-> 1848
39 <-> 382
40 <-> 827, 1203, 1510
41 <-> 714, 1056, 1184
42 <-> 1018, 1873
43 <-> 214
44 <-> 670, 957
45 <-> 45
46 <-> 1195
47 <-> 559, 1504
48 <-> 1958
49 <-> 6
50 <-> 50, 1248
51 <-> 1151
52 <-> 52, 521, 1791
53 <-> 304
54 <-> 601
55 <-> 1328
56 <-> 939
57 <-> 1583, 1995
58 <-> 1422, 1694
59 <-> 395, 1233
60 <-> 862, 1811
61 <-> 345, 1694
62 <-> 62, 276
63 <-> 280
64 <-> 199
65 <-> 117, 930
66 <-> 364, 697
67 <-> 1043
68 <-> 287, 504, 1554
69 <-> 498, 706
70 <-> 77, 333, 713, 972, 1299
71 <-> 1643
72 <-> 694
73 <-> 1381
74 <-> 955, 1790
75 <-> 1691, 1743
76 <-> 76, 638, 1429
77 <-> 70
78 <-> 1513
79 <-> 1397, 1716
80 <-> 897
81 <-> 968, 1841
82 <-> 649
83 <-> 522
84 <-> 84, 125, 399, 498
85 <-> 880, 1554, 1888
86 <-> 86
87 <-> 579, 1947
88 <-> 470, 1451, 1750
89 <-> 805, 1434
90 <-> 453
91 <-> 1208
92 <-> 688, 1358, 1746
93 <-> 357, 647
94 <-> 234, 1270, 1520
95 <-> 620, 1454
96 <-> 390, 869, 919
97 <-> 693, 1783
98 <-> 259, 529, 782, 1018
99 <-> 678
100 <-> 1215
101 <-> 459, 887
102 <-> 888, 1135
103 <-> 1006
104 <-> 1375, 1422
105 <-> 1657, 1730
106 <-> 216, 1434
107 <-> 333
108 <-> 468, 1654
109 <-> 18, 1791
110 <-> 372
111 <-> 111, 861, 1383
112 <-> 1359, 1937
113 <-> 414, 736, 1446
114 <-> 426, 1457
115 <-> 1605, 1672
116 <-> 116, 713, 1584, 1602
117 <-> 65
118 <-> 1611, 1897
119 <-> 541, 1569
120 <-> 412, 787
121 <-> 1344
122 <-> 698, 752, 1693
123 <-> 1173, 1576, 1634, 1802
124 <-> 735
125 <-> 84, 1032
126 <-> 126, 225, 332
127 <-> 1350
128 <-> 128, 319, 327, 1582
129 <-> 129, 654, 1260
130 <-> 1080, 1296, 1350
131 <-> 131
132 <-> 29, 856, 1064
133 <-> 659, 1367, 1776
134 <-> 648, 1147, 1450, 1910
135 <-> 411
136 <-> 353, 935, 1590
137 <-> 228
138 <-> 194, 452, 1746, 1794
139 <-> 139, 494, 1635
140 <-> 681
141 <-> 1507
142 <-> 1288
143 <-> 845
144 <-> 1516
145 <-> 502, 1146, 1155, 1809
146 <-> 146, 750
147 <-> 1600
148 <-> 1206
149 <-> 829, 1457
150 <-> 675, 915
151 <-> 651, 1678
152 <-> 888, 1503
153 <-> 498, 960, 1515
154 <-> 1468
155 <-> 751
156 <-> 528, 803, 1655
157 <-> 1486, 1937
158 <-> 590, 1876
159 <-> 159, 185, 1287, 1550, 1588
160 <-> 160, 548
161 <-> 1303, 1364
162 <-> 1855
163 <-> 1181
164 <-> 442
165 <-> 490
166 <-> 1105
167 <-> 1121
168 <-> 760, 1129
169 <-> 747
170 <-> 1890
171 <-> 1644
172 <-> 593, 665
173 <-> 1092, 1869
174 <-> 705
175 <-> 1345, 1999
176 <-> 234, 606
177 <-> 557, 688
178 <-> 373
179 <-> 1376
180 <-> 638
181 <-> 1996
182 <-> 1094, 1206, 1748
183 <-> 931
184 <-> 880
185 <-> 159, 1058, 1704
186 <-> 765, 1178, 1877
187 <-> 732
188 <-> 188
189 <-> 189, 1871
190 <-> 395, 1639
191 <-> 441
192 <-> 192, 1034
193 <-> 494
194 <-> 138, 995, 1308
195 <-> 1024
196 <-> 226, 1632, 1919
197 <-> 786
198 <-> 286, 758, 1852
199 <-> 0, 64, 1646
200 <-> 314
201 <-> 459, 658
202 <-> 321, 492, 599, 1081, 1460
203 <-> 225
204 <-> 331, 462, 600
205 <-> 898
206 <-> 734, 1321
207 <-> 558, 991
208 <-> 397
209 <-> 1145, 1886
210 <-> 1343, 1925
211 <-> 840, 1409
212 <-> 1308
213 <-> 1813
214 <-> 43, 282
215 <-> 1270
216 <-> 106, 836, 1275, 1507
217 <-> 312
218 <-> 290, 386, 639, 1920
219 <-> 784, 1001
220 <-> 220, 322
221 <-> 1681
222 <-> 1616, 1653
223 <-> 436, 1272, 1625
224 <-> 1398, 1696
225 <-> 126, 203, 1182
226 <-> 196, 1655
227 <-> 623
228 <-> 137, 923
229 <-> 253, 1387
230 <-> 1374
231 <-> 389, 1499
232 <-> 442
233 <-> 473, 1406
234 <-> 94, 176
235 <-> 235
236 <-> 607, 838, 1487, 1856
237 <-> 818
238 <-> 387, 628
239 <-> 19
240 <-> 818
241 <-> 1027, 1524
242 <-> 1085, 1971
243 <-> 1942
244 <-> 299, 390, 916
245 <-> 906
246 <-> 246, 534, 763, 1427
247 <-> 531, 1675
248 <-> 336, 1832
249 <-> 1497
250 <-> 1836
251 <-> 1309
252 <-> 581, 1104
253 <-> 229, 877, 1743
254 <-> 254, 621
255 <-> 831, 866, 874
256 <-> 1942
257 <-> 906
258 <-> 1224
259 <-> 98, 316, 419, 718, 1519
260 <-> 1223, 1516, 1547, 1845, 1944
261 <-> 15, 278, 1607, 1808
262 <-> 1112, 1172
263 <-> 424
264 <-> 680
265 <-> 1968
266 <-> 804, 1252
267 <-> 1739
268 <-> 538, 546
269 <-> 1265
270 <-> 270
271 <-> 1150
272 <-> 272
273 <-> 1208, 1537
274 <-> 1427
275 <-> 1349, 1829
276 <-> 62, 906
277 <-> 461, 634, 1887
278 <-> 261, 1224, 1904
279 <-> 303, 537
280 <-> 63, 280, 926, 931
281 <-> 862, 1041, 1119, 1863
282 <-> 214, 488, 644
283 <-> 646, 1124
284 <-> 860, 1759
285 <-> 746
286 <-> 198
287 <-> 68, 1045
288 <-> 332, 1133, 1277, 1628, 1744, 1770, 1934
289 <-> 1578, 1766
290 <-> 218, 439, 1661
291 <-> 596, 1377, 1620
292 <-> 700, 848, 1099
293 <-> 293, 1592, 1938
294 <-> 653, 1948
295 <-> 1505, 1936
296 <-> 625, 925
297 <-> 1105, 1185
298 <-> 298, 544, 1444
299 <-> 244, 933, 1012
300 <-> 300, 1461, 1883
301 <-> 880, 1698
302 <-> 1221
303 <-> 279, 375
304 <-> 11, 53, 967, 1362
305 <-> 777
306 <-> 344
307 <-> 582, 770
308 <-> 792, 1895
309 <-> 539
310 <-> 390, 1482
311 <-> 441, 1294
312 <-> 217, 743
313 <-> 1522
314 <-> 200, 502, 835, 1084, 1134
315 <-> 1970
316 <-> 259
317 <-> 1302, 1437
318 <-> 365
319 <-> 128, 976
320 <-> 1056, 1466, 1778
321 <-> 202
322 <-> 220, 1431
323 <-> 838, 1465, 1895
324 <-> 443
325 <-> 1056
326 <-> 463, 1741, 1761
327 <-> 20, 128, 681, 1797
328 <-> 328, 348
329 <-> 378, 1738
330 <-> 459
331 <-> 204, 331
332 <-> 126, 288
333 <-> 70, 107, 1747
334 <-> 517, 614
335 <-> 1259
336 <-> 248, 550, 1485
337 <-> 337
338 <-> 27, 1212, 1264
339 <-> 430, 963
340 <-> 769
341 <-> 341
342 <-> 593, 718, 895
343 <-> 569
344 <-> 306, 1440, 1650, 1742
345 <-> 61, 1006, 1664
346 <-> 448, 1928
347 <-> 1022, 1052
348 <-> 328, 1232
349 <-> 1232
350 <-> 1, 526, 1086, 1821
351 <-> 584
352 <-> 518, 686, 1324, 1437
353 <-> 136, 936
354 <-> 1470
355 <-> 1173, 1814
356 <-> 698
357 <-> 93
358 <-> 737, 986, 1169
359 <-> 4
360 <-> 363
361 <-> 417, 841
362 <-> 928
363 <-> 360, 1751
364 <-> 66, 364, 1596
365 <-> 318, 1766
366 <-> 366
367 <-> 367
368 <-> 1897
369 <-> 25, 369, 1460
370 <-> 370
371 <-> 1568
372 <-> 110, 582
373 <-> 24, 178, 1924
374 <-> 374
375 <-> 303
376 <-> 1331, 1990
377 <-> 388, 601, 837
378 <-> 329
379 <-> 623
380 <-> 671
381 <-> 938
382 <-> 39, 1458
383 <-> 383, 1490, 1763, 1844
384 <-> 832
385 <-> 745, 1673
386 <-> 218, 779
387 <-> 238
388 <-> 377, 1817
389 <-> 231, 656, 1038, 1960
390 <-> 96, 244, 310, 721, 1094, 1501
391 <-> 438, 819, 1870
392 <-> 697
393 <-> 443, 1275, 1463
394 <-> 480
395 <-> 59, 190, 1117, 1997
396 <-> 595
397 <-> 208, 397, 1727
398 <-> 1153
399 <-> 84
400 <-> 825, 1693
401 <-> 812
402 <-> 1191
403 <-> 1446, 1820
404 <-> 442, 871, 1637
405 <-> 426, 1067
406 <-> 460, 1290
407 <-> 1951
408 <-> 1335, 1391, 1897
409 <-> 984, 1217
410 <-> 8, 1607
411 <-> 135, 411, 454, 1393
412 <-> 120
413 <-> 1208
414 <-> 113
415 <-> 415, 1803
416 <-> 428
417 <-> 361
418 <-> 1129
419 <-> 259
420 <-> 628
421 <-> 1485
422 <-> 1110, 1785
423 <-> 1418
424 <-> 30, 263
425 <-> 1497
426 <-> 114, 405, 780
427 <-> 427
428 <-> 416, 782
429 <-> 429
430 <-> 339, 1513
431 <-> 886, 1408
432 <-> 586, 1725
433 <-> 889, 1753, 1881
434 <-> 1078, 1120
435 <-> 660, 1194, 1662
436 <-> 223, 1332
437 <-> 1487
438 <-> 391
439 <-> 290
440 <-> 1828
441 <-> 191, 311, 1003, 1561, 1702
442 <-> 164, 232, 404
443 <-> 324, 393
444 <-> 1215, 1251
445 <-> 792
446 <-> 1015, 1392
447 <-> 777
448 <-> 346, 1097
449 <-> 1117
450 <-> 1395
451 <-> 1414, 1845
452 <-> 138
453 <-> 90, 453
454 <-> 411
455 <-> 1801
456 <-> 456, 791, 902, 1111
457 <-> 457, 1075, 1384
458 <-> 770, 1600
459 <-> 101, 201, 330, 1108
460 <-> 406, 1529
461 <-> 277, 839, 1552
462 <-> 204
463 <-> 326, 1899
464 <-> 1098
465 <-> 764, 1630, 1779
466 <-> 627
467 <-> 904
468 <-> 108, 1849
469 <-> 469, 603, 780
470 <-> 88, 1276, 1533
471 <-> 1492
472 <-> 472, 1048, 1409, 1518, 1758
473 <-> 233, 1413, 1826
474 <-> 780
475 <-> 1005, 1968
476 <-> 809
477 <-> 2
478 <-> 753
479 <-> 479, 1296, 1615
480 <-> 394, 775, 1623
481 <-> 774, 1604
482 <-> 763
483 <-> 522, 591, 1344
484 <-> 894, 1219
485 <-> 507, 1114, 1250, 1351
486 <-> 1099, 1879
487 <-> 487
488 <-> 282, 1164, 1189
489 <-> 900, 1889
490 <-> 165, 918, 1007
491 <-> 1800
492 <-> 202
493 <-> 615, 899, 1200, 1326
494 <-> 139, 193
495 <-> 704, 1988
496 <-> 496
497 <-> 1149, 1216
498 <-> 69, 84, 153
499 <-> 1125, 1149
500 <-> 642
501 <-> 524, 1176
502 <-> 145, 314
503 <-> 1330, 1626
504 <-> 68, 699
505 <-> 672
506 <-> 1083
507 <-> 485, 1743
508 <-> 520, 1236, 1296
509 <-> 1676
510 <-> 875, 1066
511 <-> 511
512 <-> 512, 1240
513 <-> 705, 812
514 <-> 1758
515 <-> 1165, 1168
516 <-> 811
517 <-> 334, 1132, 1339
518 <-> 352, 1674
519 <-> 824, 1396, 1659
520 <-> 508
521 <-> 52, 915
522 <-> 83, 483, 1637
523 <-> 1317
524 <-> 501
525 <-> 525
526 <-> 350, 850, 930
527 <-> 527, 1338, 1449
528 <-> 156
529 <-> 98
530 <-> 691, 1175, 1505
531 <-> 247, 785, 1389, 1623
532 <-> 1159
533 <-> 1152, 1297
534 <-> 246
535 <-> 1144, 1491, 1622, 1935
536 <-> 708
537 <-> 279, 1656
538 <-> 268, 538, 1756
539 <-> 309, 802
540 <-> 1239
541 <-> 119, 1679, 1741
542 <-> 1204
543 <-> 642, 1926
544 <-> 298
545 <-> 1971
546 <-> 268
547 <-> 1465, 1613, 1614
548 <-> 160
549 <-> 820
550 <-> 336
551 <-> 1733
552 <-> 552, 1563
553 <-> 1654
554 <-> 554, 1641, 1665
555 <-> 555
556 <-> 15
557 <-> 177, 1204
558 <-> 207, 1004
559 <-> 47, 1297
560 <-> 1189, 1709
561 <-> 1013, 1709
562 <-> 762, 912
563 <-> 563
564 <-> 585
565 <-> 1333, 1494
566 <-> 566, 938
567 <-> 894
568 <-> 586, 1397
569 <-> 343, 1572
570 <-> 704, 1220, 1459
571 <-> 1451
572 <-> 651, 846, 909
573 <-> 1881
574 <-> 1866
575 <-> 1379
576 <-> 1060, 1210
577 <-> 1837
578 <-> 1346
579 <-> 87
580 <-> 1509
581 <-> 252, 1548
582 <-> 307, 372
583 <-> 624, 1599, 1753, 1908
584 <-> 351, 774
585 <-> 564, 977
586 <-> 432, 568, 773, 1789
587 <-> 826
588 <-> 1854
589 <-> 719, 845, 1214
590 <-> 158, 1259
591 <-> 483
592 <-> 743, 898
593 <-> 172, 342, 852, 943, 1053
594 <-> 594
595 <-> 396, 928
596 <-> 291, 596
597 <-> 597
598 <-> 1980
599 <-> 202, 1764
600 <-> 204
601 <-> 54, 377, 1340
602 <-> 1718, 1866
603 <-> 469, 789
604 <-> 1006, 1033, 1626
605 <-> 1535
606 <-> 176
607 <-> 236, 911, 1218
608 <-> 1193, 1825
609 <-> 1657
610 <-> 733, 841
611 <-> 747, 1892
612 <-> 1098, 1196, 1267
613 <-> 5, 1372
614 <-> 334, 1492
615 <-> 493, 798
616 <-> 1025, 1940
617 <-> 6, 666, 1155
618 <-> 762, 1621, 1895
619 <-> 1187
620 <-> 95, 1761
621 <-> 254
622 <-> 784, 1476
623 <-> 227, 379, 1081
624 <-> 583
625 <-> 296, 1222, 1882
626 <-> 905
627 <-> 466, 1692
628 <-> 238, 420, 1004, 1412
629 <-> 1532
630 <-> 630
631 <-> 977, 1092, 1458, 1713
632 <-> 777, 1049, 1404
633 <-> 994
634 <-> 277
635 <-> 635
636 <-> 703, 1756
637 <-> 840, 1585
638 <-> 76, 180, 1373
639 <-> 218, 639, 1835
640 <-> 1559
641 <-> 1800
642 <-> 500, 543
643 <-> 1808
644 <-> 282
645 <-> 1253, 1475
646 <-> 283, 646, 864
647 <-> 93, 1508
648 <-> 134, 956, 1762
649 <-> 37, 82
650 <-> 1480, 1916
651 <-> 151, 572, 1357
652 <-> 1261
653 <-> 294, 653
654 <-> 129, 1139, 1176
655 <-> 1251, 1656
656 <-> 389
657 <-> 1604
658 <-> 201, 1208
659 <-> 23, 133, 1868
660 <-> 435
661 <-> 1634
662 <-> 1667, 1701
663 <-> 974
664 <-> 664, 1167
665 <-> 172, 1370
666 <-> 617
667 <-> 1824
668 <-> 952, 1605
669 <-> 1822
670 <-> 44, 670
671 <-> 380, 1145, 1693, 1906
672 <-> 505, 693
673 <-> 1610
674 <-> 1249, 1302
675 <-> 150, 777
676 <-> 1675
677 <-> 910, 1282
678 <-> 99, 1004
679 <-> 679
680 <-> 264, 917, 1137, 1687
681 <-> 140, 327, 746
682 <-> 682
683 <-> 794, 1315
684 <-> 1000, 1342
685 <-> 1111, 1348, 1523, 1932
686 <-> 352
687 <-> 979, 1667
688 <-> 92, 177
689 <-> 937, 1939
690 <-> 35, 1608
691 <-> 530, 691
692 <-> 1871
693 <-> 97, 672
694 <-> 72, 694
695 <-> 1076
696 <-> 1954
697 <-> 66, 392, 1892
698 <-> 122, 356, 698
699 <-> 504, 1470
700 <-> 292, 1407
701 <-> 1231, 1327
702 <-> 32
703 <-> 636, 1083, 1210
704 <-> 495, 570
705 <-> 174, 513, 1332
706 <-> 69, 1088
707 <-> 1036, 1867
708 <-> 536, 805, 1958
709 <-> 709
710 <-> 915, 1578
711 <-> 711, 1478
712 <-> 813, 927
713 <-> 70, 116, 1469, 1539
714 <-> 41
715 <-> 840, 1473, 1562, 1705
716 <-> 716
717 <-> 949, 1864
718 <-> 259, 342, 1557, 1853
719 <-> 589, 781, 802
720 <-> 1125
721 <-> 390, 878
722 <-> 1026
723 <-> 1039, 1467
724 <-> 1535
725 <-> 883
726 <-> 1832, 1917
727 <-> 1245
728 <-> 1291
729 <-> 1203
730 <-> 824
731 <-> 1984
732 <-> 187, 1214
733 <-> 610, 1079, 1198
734 <-> 206, 872, 1479, 1855
735 <-> 124, 1371
736 <-> 113, 736
737 <-> 358, 1426
738 <-> 974, 1024, 1717, 1842
739 <-> 1489
740 <-> 1634
741 <-> 873, 1695
742 <-> 1700
743 <-> 312, 592, 1493
744 <-> 948, 1306, 1400
745 <-> 385, 1029, 1315, 1474
746 <-> 285, 681, 793
747 <-> 169, 611, 814, 1548
748 <-> 748
749 <-> 1134, 1498
750 <-> 146
751 <-> 155, 783, 1856
752 <-> 122, 1417
753 <-> 478, 1505
754 <-> 810, 1742, 1955
755 <-> 1735, 1847
756 <-> 978, 1095
757 <-> 1153, 1730
758 <-> 198, 1476
759 <-> 759
760 <-> 168
761 <-> 1496
762 <-> 562, 618
763 <-> 246, 482, 1258
764 <-> 465
765 <-> 186
766 <-> 1448
767 <-> 893, 896, 1019
768 <-> 1730
769 <-> 340, 1043, 1065
770 <-> 307, 458, 1453
771 <-> 1168
772 <-> 911
773 <-> 586
774 <-> 481, 584, 774, 1148
775 <-> 480, 1485, 1894
776 <-> 926
777 <-> 305, 447, 632, 675
778 <-> 1690
779 <-> 386
780 <-> 426, 469, 474
781 <-> 719, 1543
782 <-> 98, 428, 903
783 <-> 751, 1558
784 <-> 219, 622
785 <-> 531
786 <-> 197, 911, 1312
787 <-> 120, 880
788 <-> 1089, 1487
789 <-> 603, 844, 1681, 1731
790 <-> 790, 1126
791 <-> 456, 1363
792 <-> 308, 445
793 <-> 746
794 <-> 683, 951
795 <-> 1732, 1986
796 <-> 1210, 1878
797 <-> 804
798 <-> 615
799 <-> 1651
800 <-> 851, 860, 1907
801 <-> 1110, 1537, 1773
802 <-> 539, 719
803 <-> 156, 1528
804 <-> 266, 797, 1549
805 <-> 89, 708, 962
806 <-> 1429
807 <-> 1800
808 <-> 873, 1421
809 <-> 476, 809
810 <-> 754
811 <-> 516, 965
812 <-> 401, 513
813 <-> 712, 1023
814 <-> 747
815 <-> 1145
816 <-> 1413
817 <-> 1235
818 <-> 237, 240, 1506
819 <-> 391, 857
820 <-> 549, 1162
821 <-> 1410, 1607
822 <-> 30, 1485
823 <-> 1445, 1454
824 <-> 519, 730, 1824
825 <-> 400, 1381, 1472
826 <-> 587, 1040, 1198, 1618
827 <-> 40
828 <-> 1870
829 <-> 149
830 <-> 16
831 <-> 255
832 <-> 384, 1890, 1913
833 <-> 1529
834 <-> 834
835 <-> 314
836 <-> 216, 1166
837 <-> 377, 988
838 <-> 236, 323
839 <-> 461, 1825
840 <-> 211, 637, 715, 1710
841 <-> 361, 610, 841, 1815
842 <-> 1669
843 <-> 874, 1468
844 <-> 789
845 <-> 143, 589, 1053
846 <-> 572
847 <-> 1285
848 <-> 292
849 <-> 849
850 <-> 526
851 <-> 800, 1368, 1497
852 <-> 593, 1798
853 <-> 1339, 1593, 1749
854 <-> 1445, 1787
855 <-> 1026, 1356
856 <-> 132
857 <-> 819
858 <-> 1511
859 <-> 1191
860 <-> 284, 800, 1619
861 <-> 111, 1266
862 <-> 60, 281
863 <-> 1605
864 <-> 646
865 <-> 873
866 <-> 255, 924
867 <-> 871, 1707
868 <-> 12
869 <-> 96, 1278
870 <-> 1307
871 <-> 404, 867, 1482
872 <-> 734, 1200
873 <-> 741, 808, 865, 873
874 <-> 255, 843, 1201
875 <-> 510, 1325, 1797
876 <-> 1504, 1825
877 <-> 253
878 <-> 721
879 <-> 948, 1291, 1847
880 <-> 85, 184, 301, 787, 1503, 1617
881 <-> 1688
882 <-> 882
883 <-> 725, 1582, 1874
884 <-> 1352
885 <-> 885, 1974
886 <-> 431, 1650
887 <-> 101
888 <-> 102, 152
889 <-> 433, 1016
890 <-> 890
891 <-> 12
892 <-> 1402, 1923
893 <-> 767
894 <-> 484, 567
895 <-> 342, 1123, 1158, 1648
896 <-> 767
897 <-> 80, 986, 1418
898 <-> 205, 592, 1019
899 <-> 493, 1053
900 <-> 489
901 <-> 901
902 <-> 456
903 <-> 782
904 <-> 467, 904, 1924
905 <-> 626, 1881
906 <-> 245, 257, 276
907 <-> 907, 1101, 1826
908 <-> 908, 1230
909 <-> 34, 572, 1186
910 <-> 677, 961
911 <-> 607, 772, 786, 1196, 1405
912 <-> 562
913 <-> 1636
914 <-> 1892, 1963
915 <-> 150, 521, 710
916 <-> 244
917 <-> 23, 680, 1336
918 <-> 490, 1483
919 <-> 96
920 <-> 1880
921 <-> 921
922 <-> 975, 1255
923 <-> 228, 1202, 1452
924 <-> 866
925 <-> 296, 1270
926 <-> 280, 776, 1170, 1788, 1970
927 <-> 712
928 <-> 362, 595, 1103
929 <-> 929
930 <-> 65, 526, 1256, 1500, 1722
931 <-> 183, 280, 1484
932 <-> 1737
933 <-> 299
934 <-> 1387, 1851
935 <-> 136, 935, 1537, 1775
936 <-> 353
937 <-> 689, 1347
938 <-> 381, 566
939 <-> 56, 1762
940 <-> 1559, 1860
941 <-> 1504, 1671, 1723, 1724
942 <-> 1293
943 <-> 21, 593
944 <-> 1335
945 <-> 1650
946 <-> 1556
947 <-> 26
948 <-> 744, 879
949 <-> 717, 1604
950 <-> 1201, 1322
951 <-> 794
952 <-> 668, 1371
953 <-> 1272
954 <-> 954
955 <-> 74
956 <-> 648, 1870
957 <-> 44, 1769
958 <-> 13, 1388, 1660
959 <-> 959
960 <-> 153
961 <-> 910
962 <-> 17, 805
963 <-> 339, 1783
964 <-> 1100
965 <-> 811, 1677
966 <-> 966
967 <-> 304, 1029, 1269, 1910
968 <-> 81, 1091
969 <-> 1379, 1693
970 <-> 1289
971 <-> 971
972 <-> 70
973 <-> 973
974 <-> 663, 738, 1005
975 <-> 922
976 <-> 319
977 <-> 585, 631
978 <-> 756, 1628
979 <-> 687, 979
980 <-> 1151, 1317
981 <-> 1199, 1902
982 <-> 1223
983 <-> 1931
984 <-> 2, 409
985 <-> 985
986 <-> 358, 897, 1564
987 <-> 987, 1644
988 <-> 36, 837
989 <-> 1275
990 <-> 990, 1295
991 <-> 207, 1415
992 <-> 1242, 1397, 1467, 1579
993 <-> 1042, 1767
994 <-> 633, 1595, 1813
995 <-> 194
996 <-> 1096, 1369
997 <-> 1231, 1973
998 <-> 1367
999 <-> 999
1000 <-> 684, 1078
1001 <-> 219
1002 <-> 1442
1003 <-> 441
1004 <-> 558, 628, 678
1005 <-> 475, 974
1006 <-> 103, 345, 604
1007 <-> 490, 1274
1008 <-> 1708, 1819
1009 <-> 1009, 1118
1010 <-> 1223, 1803
1011 <-> 1867
1012 <-> 299, 1923
1013 <-> 561, 1187, 1477, 1926
1014 <-> 1861
1015 <-> 446, 1015, 1858
1016 <-> 889
1017 <-> 1435
1018 <-> 42, 98
1019 <-> 767, 898, 1764
1020 <-> 1020
1021 <-> 1666
1022 <-> 347, 1022, 1310
1023 <-> 26, 813, 1109, 1538, 1988
1024 <-> 195, 738
1025 <-> 616
1026 <-> 722, 855, 1337, 1415
1027 <-> 241, 1309
1028 <-> 1028
1029 <-> 745, 967
1030 <-> 1577, 1689
1031 <-> 1031
1032 <-> 125
1033 <-> 604, 1127, 1194
1034 <-> 192
1035 <-> 1992
1036 <-> 707, 1509
1037 <-> 1347
1038 <-> 389
1039 <-> 723, 1535
1040 <-> 826, 1245, 1918
1041 <-> 281
1042 <-> 993
1043 <-> 67, 769, 1142
1044 <-> 1690
1045 <-> 287
1046 <-> 1561
1047 <-> 4
1048 <-> 472, 1703
1049 <-> 632, 1816
1050 <-> 1157, 1899
1051 <-> 1818
1052 <-> 347, 1904
1053 <-> 593, 845, 899
1054 <-> 1983
1055 <-> 1599
1056 <-> 41, 320, 325, 1567
1057 <-> 1372, 1569
1058 <-> 185
1059 <-> 1112, 1939
1060 <-> 576, 1314, 1557, 1751, 1752
1061 <-> 1285
1062 <-> 1162, 1338, 1739
1063 <-> 1291
1064 <-> 132
1065 <-> 769, 1317
1066 <-> 510
1067 <-> 405, 1452, 1953
1068 <-> 1200
1069 <-> 1069
1070 <-> 19
1071 <-> 1361, 1382
1072 <-> 1307, 1534
1073 <-> 1282
1074 <-> 1323, 1653
1075 <-> 457
1076 <-> 695, 1703
1077 <-> 1180
1078 <-> 434, 1000
1079 <-> 733
1080 <-> 130, 1757
1081 <-> 202, 623
1082 <-> 1082
1083 <-> 506, 703, 1279
1084 <-> 314, 1812
1085 <-> 242
1086 <-> 350
1087 <-> 1524
1088 <-> 706, 1900
1089 <-> 788
1090 <-> 1260
1091 <-> 968, 1522
1092 <-> 173, 631, 1850
1093 <-> 1093, 1390
1094 <-> 182, 390
1095 <-> 756
1096 <-> 996
1097 <-> 448
1098 <-> 464, 612
1099 <-> 292, 486
1100 <-> 964, 1326
1101 <-> 907, 1799
1102 <-> 1927
1103 <-> 928, 1103
1104 <-> 252
1105 <-> 166, 297
1106 <-> 1106, 1896
1107 <-> 1107
1108 <-> 459
1109 <-> 1023
1110 <-> 422, 801
1111 <-> 456, 685
1112 <-> 262, 1059
1113 <-> 1267
1114 <-> 485
1115 <-> 1115, 1827
1116 <-> 1596
1117 <-> 395, 449, 1382
1118 <-> 1009
1119 <-> 281, 1670
1120 <-> 434, 1165
1121 <-> 167, 1121
1122 <-> 1809
1123 <-> 895
1124 <-> 283
1125 <-> 499, 720, 1308
1126 <-> 790, 1526
1127 <-> 1033
1128 <-> 1500
1129 <-> 168, 418, 1642, 1947
1130 <-> 1454
1131 <-> 1683
1132 <-> 517, 1784
1133 <-> 288
1134 <-> 314, 749, 1586
1135 <-> 102
1136 <-> 1136
1137 <-> 680
1138 <-> 1755
1139 <-> 654
1140 <-> 1140
1141 <-> 1141
1142 <-> 1043, 1862
1143 <-> 1550
1144 <-> 535, 1144, 1849
1145 <-> 209, 671, 815, 1268
1146 <-> 145
1147 <-> 134
1148 <-> 774
1149 <-> 36, 497, 499, 1652
1150 <-> 271, 1150
1151 <-> 51, 980, 1651
1152 <-> 533
1153 <-> 398, 757
1154 <-> 1313
1155 <-> 145, 617, 1336, 1721
1156 <-> 1838
1157 <-> 10, 1050
1158 <-> 895
1159 <-> 532, 1708
1160 <-> 1357
1161 <-> 1200, 1999
1162 <-> 820, 1062
1163 <-> 1821
1164 <-> 488, 1572
1165 <-> 515, 1120
1166 <-> 36, 836
1167 <-> 664
1168 <-> 11, 515, 771, 1967
1169 <-> 358
1170 <-> 926
1171 <-> 1666, 1827
1172 <-> 262, 1439
1173 <-> 123, 355, 1341
1174 <-> 1204, 1525
1175 <-> 530
1176 <-> 501, 654
1177 <-> 1311, 1796
1178 <-> 186, 1536, 1551, 1853
1179 <-> 1822, 1947
1180 <-> 1077, 1264
1181 <-> 163, 1181
1182 <-> 225
1183 <-> 1237, 1715, 1798
1184 <-> 41
1185 <-> 297, 1185
1186 <-> 909
1187 <-> 619, 1013
1188 <-> 1698
1189 <-> 488, 560
1190 <-> 1834, 1933
1191 <-> 402, 859, 1191
1192 <-> 1839
1193 <-> 608, 1438
1194 <-> 435, 1033, 1754
1195 <-> 46, 1828
1196 <-> 612, 911, 1975
1197 <-> 1503, 1854
1198 <-> 733, 826
1199 <-> 981
1200 <-> 493, 872, 1068, 1161
1201 <-> 874, 950
1202 <-> 923
1203 <-> 40, 729, 1719
1204 <-> 542, 557, 1174
1205 <-> 1332
1206 <-> 148, 182
1207 <-> 1207
1208 <-> 91, 273, 413, 658, 1234
1209 <-> 1995
1210 <-> 576, 703, 796
1211 <-> 1227, 1891
1212 <-> 338, 1362
1213 <-> 6
1214 <-> 589, 732
1215 <-> 4, 100, 444, 1842
1216 <-> 497, 1745
1217 <-> 409, 1354
1218 <-> 607
1219 <-> 29, 484, 1712
1220 <-> 570
1221 <-> 302, 1429
1222 <-> 625, 1412
1223 <-> 260, 982, 1010, 1591
1224 <-> 9, 258, 278, 1506, 1893
1225 <-> 1906
1226 <-> 1226
1227 <-> 1211
1228 <-> 1773
1229 <-> 18
1230 <-> 908
1231 <-> 701, 997
1232 <-> 348, 349
1233 <-> 59
1234 <-> 1208
1235 <-> 817, 1994
1236 <-> 508
1237 <-> 1183
1238 <-> 1529
1239 <-> 540, 1524, 1552
1240 <-> 512
1241 <-> 1241
1242 <-> 992, 1685
1243 <-> 1934
1244 <-> 1574, 1839
1245 <-> 727, 1040
1246 <-> 1380
1247 <-> 1506, 1923
1248 <-> 50, 1610
1249 <-> 674
1250 <-> 485
1251 <-> 444, 655, 1718
1252 <-> 266, 1862
1253 <-> 645, 1709
1254 <-> 1254
1255 <-> 922, 1255, 1341
1256 <-> 930, 1346
1257 <-> 1465, 1844
1258 <-> 763
1259 <-> 335, 590, 1259
1260 <-> 129, 1090
1261 <-> 652, 1261, 1838
1262 <-> 1262, 1912
1263 <-> 7, 1438, 1554
1264 <-> 338, 1180
1265 <-> 269, 1265
1266 <-> 861, 1281, 1423
1267 <-> 612, 1113, 1289
1268 <-> 1145
1269 <-> 967
1270 <-> 94, 215, 925, 1860
1271 <-> 1376
1272 <-> 223, 953
1273 <-> 1301
1274 <-> 1007, 1860
1275 <-> 216, 393, 989, 1275
1276 <-> 470
1277 <-> 288
1278 <-> 869
1279 <-> 1083, 1755
1280 <-> 1588
1281 <-> 1266
1282 <-> 677, 1073, 1575, 1625
1283 <-> 1571
1284 <-> 1828
1285 <-> 847, 1061, 1641
1286 <-> 1494, 1649, 1889
1287 <-> 159
1288 <-> 142, 1288
1289 <-> 970, 1267, 1668
1290 <-> 406
1291 <-> 728, 879, 1063, 1885
1292 <-> 1407
1293 <-> 942, 1318, 1459
1294 <-> 311, 1754
1295 <-> 990, 1512
1296 <-> 130, 479, 508
1297 <-> 533, 559
1298 <-> 1839
1299 <-> 70
1300 <-> 37, 1886, 1998
1301 <-> 1273, 1340
1302 <-> 317, 674, 1485
1303 <-> 161, 1624
1304 <-> 1304
1305 <-> 1410
1306 <-> 744
1307 <-> 20, 870, 1072
1308 <-> 194, 212, 1125
1309 <-> 251, 1027
1310 <-> 22, 1022, 1777
1311 <-> 1177
1312 <-> 786
1313 <-> 1154, 1706
1314 <-> 1060
1315 <-> 683, 745
1316 <-> 1793, 1898
1317 <-> 523, 980, 1065, 1787
1318 <-> 1293
1319 <-> 1319
1320 <-> 1320
1321 <-> 206
1322 <-> 950, 1957
1323 <-> 1074, 1823
1324 <-> 352
1325 <-> 875, 1740
1326 <-> 493, 1100
1327 <-> 701, 1633
1328 <-> 1, 55
1329 <-> 1633
1330 <-> 503, 1687, 1782
1331 <-> 376, 1531, 1766
1332 <-> 436, 705, 1205
1333 <-> 565
1334 <-> 1805
1335 <-> 408, 944
1336 <-> 917, 1155
1337 <-> 1026
1338 <-> 527, 1062
1339 <-> 517, 853
1340 <-> 601, 1301, 1708
1341 <-> 1173, 1255
1342 <-> 684
1343 <-> 210
1344 <-> 121, 483
1345 <-> 175
1346 <-> 578, 1256
1347 <-> 937, 1037, 1735
1348 <-> 685
1349 <-> 275, 1594
1350 <-> 127, 130
1351 <-> 485
1352 <-> 884, 1352
1353 <-> 1604, 1800
1354 <-> 1217
1355 <-> 1355, 1985
1356 <-> 855, 1840
1357 <-> 651, 1160, 1388
1358 <-> 92
1359 <-> 112
1360 <-> 1455
1361 <-> 1071, 1909
1362 <-> 304, 1212
1363 <-> 791
1364 <-> 161, 1426
1365 <-> 1365
1366 <-> 1366, 1433
1367 <-> 133, 998
1368 <-> 851
1369 <-> 12, 996, 1425
1370 <-> 665
1371 <-> 13, 735, 952, 1371, 1857
1372 <-> 613, 1057
1373 <-> 638, 1511
1374 <-> 230, 1593
1375 <-> 104
1376 <-> 179, 1271, 1639
1377 <-> 291
1378 <-> 1919
1379 <-> 575, 969
1380 <-> 1246, 1501, 1903
1381 <-> 73, 825, 1922
1382 <-> 1071, 1117, 1541, 1810
1383 <-> 111
1384 <-> 457
1385 <-> 1878, 1966
1386 <-> 1396
1387 <-> 229, 934, 1853
1388 <-> 958, 1357, 1424
1389 <-> 531
1390 <-> 1093, 1603
1391 <-> 408
1392 <-> 446
1393 <-> 411
1394 <-> 1866
1395 <-> 450, 1851
1396 <-> 519, 1386
1397 <-> 79, 568, 992
1398 <-> 224
1399 <-> 1443, 1799, 1915
1400 <-> 744
1401 <-> 1685
1402 <-> 892
1403 <-> 1714
1404 <-> 632
1405 <-> 911, 1532
1406 <-> 233, 1606
1407 <-> 700, 1292
1408 <-> 431, 1408, 1416
1409 <-> 211, 472
1410 <-> 821, 1305
1411 <-> 1653, 1993
1412 <-> 628, 1222
1413 <-> 473, 816
1414 <-> 451
1415 <-> 991, 1026
1416 <-> 1408
1417 <-> 752
1418 <-> 423, 897
1419 <-> 2, 30
1420 <-> 1420
1421 <-> 808
1422 <-> 58, 104
1423 <-> 1266
1424 <-> 1388
1425 <-> 1369
1426 <-> 737, 1364, 1847, 1913
1427 <-> 246, 274
1428 <-> 1964
1429 <-> 76, 806, 1221
1430 <-> 1430
1431 <-> 322
1432 <-> 1719
1433 <-> 1366, 1988
1434 <-> 89, 106
1435 <-> 1017, 1730
1436 <-> 1997
1437 <-> 317, 352
1438 <-> 1193, 1263
1439 <-> 1172
1440 <-> 344
1441 <-> 37
1442 <-> 1002, 1860
1443 <-> 1399
1444 <-> 31, 298
1445 <-> 823, 854
1446 <-> 113, 403
1447 <-> 1508, 1720
1448 <-> 766, 1791
1449 <-> 527
1450 <-> 134
1451 <-> 88, 571
1452 <-> 923, 1067
1453 <-> 770
1454 <-> 95, 823, 1130, 1454
1455 <-> 1360, 1533
1456 <-> 1456, 1489, 1529
1457 <-> 114, 149, 1956
1458 <-> 382, 631, 1458
1459 <-> 570, 1293
1460 <-> 202, 369
1461 <-> 300
1462 <-> 1636
1463 <-> 393, 1659, 1939
1464 <-> 31
1465 <-> 3, 323, 547, 1257, 1732
1466 <-> 320
1467 <-> 723, 992, 1706
1468 <-> 154, 843
1469 <-> 713
1470 <-> 354, 699
1471 <-> 1471
1472 <-> 825
1473 <-> 715
1474 <-> 745
1475 <-> 645
1476 <-> 622, 758
1477 <-> 1013, 1645, 1669
1478 <-> 711
1479 <-> 734
1480 <-> 650
1481 <-> 1481
1482 <-> 310, 871
1483 <-> 918, 1504
1484 <-> 931
1485 <-> 336, 421, 775, 822, 1302
1486 <-> 157, 1631
1487 <-> 236, 437, 788, 1980
1488 <-> 1560
1489 <-> 739, 1456
1490 <-> 383
1491 <-> 535
1492 <-> 471, 614
1493 <-> 743
1494 <-> 565, 1286
1495 <-> 1627
1496 <-> 761, 1496
1497 <-> 249, 425, 851
1498 <-> 749
1499 <-> 231
1500 <-> 930, 1128
1501 <-> 390, 1380
1502 <-> 1713
1503 <-> 152, 880, 1197
1504 <-> 47, 876, 941, 1483, 1945
1505 <-> 295, 530, 753
1506 <-> 818, 1224, 1247
1507 <-> 141, 216, 1565, 1726
1508 <-> 647, 1447, 1521, 1590
1509 <-> 580, 1036, 1605, 1609
1510 <-> 40, 1885
1511 <-> 858, 1373
1512 <-> 1295
1513 <-> 78, 430
1514 <-> 1772
1515 <-> 153
1516 <-> 144, 260, 1818
1517 <-> 32, 1616, 1806
1518 <-> 472
1519 <-> 259
1520 <-> 94, 1542
1521 <-> 1508
1522 <-> 313, 1091, 1631
1523 <-> 685
1524 <-> 241, 1087, 1239
1525 <-> 1174
1526 <-> 1126
1527 <-> 1835
1528 <-> 803
1529 <-> 460, 833, 1238, 1456
1530 <-> 1784
1531 <-> 1331
1532 <-> 629, 1405
1533 <-> 470, 1455, 1533, 1796
1534 <-> 1072
1535 <-> 605, 724, 1039
1536 <-> 1178
1537 <-> 273, 801, 935
1538 <-> 1023, 1734
1539 <-> 713
1540 <-> 1748
1541 <-> 1382, 1683
1542 <-> 1520
1543 <-> 781
1544 <-> 1631
1545 <-> 1910
1546 <-> 1942
1547 <-> 260
1548 <-> 581, 747
1549 <-> 804
1550 <-> 159, 1143
1551 <-> 1178
1552 <-> 461, 1239, 1846
1553 <-> 1553, 1982
1554 <-> 68, 85, 1263, 1597
1555 <-> 1713, 1931
1556 <-> 946, 1556
1557 <-> 718, 1060
1558 <-> 783
1559 <-> 640, 940
1560 <-> 1488, 1806, 1898, 1949
1561 <-> 441, 1046
1562 <-> 715, 1889
1563 <-> 552
1564 <-> 986
1565 <-> 1507, 1689
1566 <-> 1570
1567 <-> 1056
1568 <-> 3, 371
1569 <-> 119, 1057, 1852
1570 <-> 1566, 1570
1571 <-> 1283, 1736
1572 <-> 569, 1164, 1995
1573 <-> 1573, 1784, 1987
1574 <-> 1244, 1574
1575 <-> 1282, 1575, 1866
1576 <-> 123
1577 <-> 1030
1578 <-> 289, 710
1579 <-> 992, 1684
1580 <-> 4
1581 <-> 1581
1582 <-> 128, 883
1583 <-> 57
1584 <-> 116
1585 <-> 637
1586 <-> 1134
1587 <-> 1587
1588 <-> 159, 1280
1589 <-> 1915
1590 <-> 136, 1508
1591 <-> 1223
1592 <-> 293, 1891
1593 <-> 853, 1374
1594 <-> 1349, 1886
1595 <-> 994, 1595
1596 <-> 364, 1116
1597 <-> 1554
1598 <-> 1729
1599 <-> 583, 1055
1600 <-> 147, 458, 1600
1601 <-> 1894
1602 <-> 116
1603 <-> 1390
1604 <-> 481, 657, 949, 1353, 1983
1605 <-> 115, 668, 863, 1509
1606 <-> 1406
1607 <-> 261, 410, 821
1608 <-> 690
1609 <-> 1509
1610 <-> 673, 1248
1611 <-> 118, 1788
1612 <-> 1854
1613 <-> 547
1614 <-> 547, 1807
1615 <-> 479
1616 <-> 222, 1517
1617 <-> 880, 1989
1618 <-> 826
1619 <-> 860, 1807
1620 <-> 291
1621 <-> 618, 1957
1622 <-> 535
1623 <-> 480, 531
1624 <-> 1303
1625 <-> 223, 1282
1626 <-> 503, 604
1627 <-> 1495, 1933
1628 <-> 288, 978
1629 <-> 1629
1630 <-> 465, 1872
1631 <-> 1486, 1522, 1544
1632 <-> 196
1633 <-> 1327, 1329
1634 <-> 123, 661, 740
1635 <-> 139
1636 <-> 913, 1462, 1752
1637 <-> 404, 522
1638 <-> 1779, 1813
1639 <-> 33, 190, 1376, 1639
1640 <-> 1816
1641 <-> 554, 1285
1642 <-> 1129
1643 <-> 71, 1844
1644 <-> 171, 987
1645 <-> 1477
1646 <-> 16, 199
1647 <-> 1702
1648 <-> 895
1649 <-> 1286
1650 <-> 344, 886, 945
1651 <-> 799, 1151
1652 <-> 1149, 1961, 1984
1653 <-> 222, 1074, 1411
1654 <-> 108, 553
1655 <-> 35, 156, 226, 1992
1656 <-> 537, 655
1657 <-> 105, 609
1658 <-> 1658
1659 <-> 519, 1463
1660 <-> 958
1661 <-> 290, 1929
1662 <-> 435
1663 <-> 1855
1664 <-> 345
1665 <-> 554
1666 <-> 1021, 1171
1667 <-> 662, 687
1668 <-> 1289
1669 <-> 842, 1477, 1795, 1975
1670 <-> 1119, 1921
1671 <-> 941
1672 <-> 115
1673 <-> 385
1674 <-> 518
1675 <-> 247, 676
1676 <-> 509, 1987
1677 <-> 965, 1677
1678 <-> 151, 1692
1679 <-> 541
1680 <-> 1680
1681 <-> 221, 789
1682 <-> 1736, 1767, 1947
1683 <-> 1131, 1541
1684 <-> 1579
1685 <-> 1242, 1401
1686 <-> 1736
1687 <-> 680, 1330
1688 <-> 881, 1829
1689 <-> 1030, 1565
1690 <-> 778, 1044, 1900
1691 <-> 28, 75
1692 <-> 627, 1678
1693 <-> 122, 400, 671, 969
1694 <-> 58, 61
1695 <-> 741
1696 <-> 224, 1958
1697 <-> 1935
1698 <-> 301, 1188
1699 <-> 29, 37
1700 <-> 742, 1883
1701 <-> 662
1702 <-> 441, 1647
1703 <-> 1048, 1076
1704 <-> 185
1705 <-> 715
1706 <-> 1313, 1467
1707 <-> 867
1708 <-> 1008, 1159, 1340
1709 <-> 560, 561, 1253, 1976
1710 <-> 840
1711 <-> 1711
1712 <-> 12, 1219
1713 <-> 631, 1502, 1555
1714 <-> 1403, 1714, 1902
1715 <-> 1183
1716 <-> 79
1717 <-> 738
1718 <-> 602, 1251
1719 <-> 1203, 1432
1720 <-> 1447
1721 <-> 1155
1722 <-> 930
1723 <-> 941
1724 <-> 941
1725 <-> 432
1726 <-> 1507
1727 <-> 397
1728 <-> 1728, 1937
1729 <-> 1598, 1913
1730 <-> 105, 757, 768, 1435, 1730
1731 <-> 789
1732 <-> 795, 1465
1733 <-> 551, 1765, 1835
1734 <-> 1538
1735 <-> 755, 1347
1736 <-> 1571, 1682, 1686
1737 <-> 932, 1795
1738 <-> 329, 1738
1739 <-> 267, 1062, 1848
1740 <-> 1325
1741 <-> 326, 541, 1952
1742 <-> 344, 754
1743 <-> 75, 253, 507
1744 <-> 288
1745 <-> 1216
1746 <-> 92, 138
1747 <-> 333
1748 <-> 182, 1540
1749 <-> 853
1750 <-> 88
1751 <-> 363, 1060
1752 <-> 1060, 1636
1753 <-> 433, 583, 1873
1754 <-> 1194, 1294
1755 <-> 1138, 1279
1756 <-> 538, 636
1757 <-> 1080
1758 <-> 472, 514
1759 <-> 284
1760 <-> 1760
1761 <-> 326, 620
1762 <-> 648, 939, 1989
1763 <-> 383
1764 <-> 599, 1019, 1941
1765 <-> 1733
1766 <-> 289, 365, 1331
1767 <-> 993, 1682, 1767
1768 <-> 1768, 1859
1769 <-> 957
1770 <-> 288
1771 <-> 1875
1772 <-> 1514, 1772
1773 <-> 801, 1228
1774 <-> 0
1775 <-> 935
1776 <-> 133
1777 <-> 1310
1778 <-> 17, 320
1779 <-> 465, 1638
1780 <-> 1906
1781 <-> 1969
1782 <-> 1330
1783 <-> 97, 963, 1960, 1983
1784 <-> 1132, 1530, 1573
1785 <-> 422
1786 <-> 1786
1787 <-> 854, 1317
1788 <-> 926, 1611
1789 <-> 586, 1829
1790 <-> 74, 1790
1791 <-> 52, 109, 1448
1792 <-> 1860
1793 <-> 1316, 1981
1794 <-> 138
1795 <-> 1669, 1737, 1861
1796 <-> 1177, 1533
1797 <-> 327, 875
1798 <-> 852, 1183
1799 <-> 1101, 1399, 1964
1800 <-> 491, 641, 807, 1353
1801 <-> 20, 455
1802 <-> 123
1803 <-> 415, 1010
1804 <-> 1804
1805 <-> 1334, 1926
1806 <-> 1517, 1560
1807 <-> 1614, 1619
1808 <-> 261, 643
1809 <-> 145, 1122
1810 <-> 1382
1811 <-> 60
1812 <-> 1084
1813 <-> 213, 994, 1638
1814 <-> 14, 355
1815 <-> 841, 1996
1816 <-> 1049, 1640
1817 <-> 388
1818 <-> 1051, 1516
1819 <-> 1008
1820 <-> 403
1821 <-> 350, 1163
1822 <-> 669, 1179, 1927
1823 <-> 1323
1824 <-> 667, 824, 1879
1825 <-> 608, 839, 876, 1965
1826 <-> 473, 907
1827 <-> 1115, 1171
1828 <-> 440, 1195, 1284, 1913
1829 <-> 275, 1688, 1789
1830 <-> 1830
1831 <-> 1831
1832 <-> 248, 726
1833 <-> 1833
1834 <-> 1190
1835 <-> 639, 1527, 1733
1836 <-> 250, 1836
1837 <-> 577, 1970
1838 <-> 1156, 1261
1839 <-> 1192, 1244, 1298
1840 <-> 1356
1841 <-> 81
1842 <-> 738, 1215
1843 <-> 1843
1844 <-> 383, 1257, 1643
1845 <-> 260, 451
1846 <-> 1552
1847 <-> 755, 879, 1426
1848 <-> 38, 1739
1849 <-> 468, 1144
1850 <-> 1092
1851 <-> 934, 1395
1852 <-> 198, 1569
1853 <-> 718, 1178, 1387
1854 <-> 588, 1197, 1612
1855 <-> 162, 734, 1663
1856 <-> 236, 751
1857 <-> 1371
1858 <-> 1015
1859 <-> 1768
1860 <-> 940, 1270, 1274, 1442, 1792
1861 <-> 1014, 1795
1862 <-> 1142, 1252
1863 <-> 281
1864 <-> 717
1865 <-> 1865
1866 <-> 574, 602, 1394, 1575
1867 <-> 707, 1011
1868 <-> 659, 1868
1869 <-> 173, 1991
1870 <-> 391, 828, 956, 1880
1871 <-> 189, 692
1872 <-> 1630
1873 <-> 42, 1753
1874 <-> 883
1875 <-> 11, 1771
1876 <-> 158
1877 <-> 186
1878 <-> 796, 1385
1879 <-> 486, 1824
1880 <-> 920, 1870
1881 <-> 433, 573, 905
1882 <-> 625, 1954
1883 <-> 300, 1700
1884 <-> 1884
1885 <-> 1291, 1510
1886 <-> 19, 209, 1300, 1594
1887 <-> 277
1888 <-> 85
1889 <-> 489, 1286, 1562
1890 <-> 170, 832
1891 <-> 1211, 1592, 1973
1892 <-> 611, 697, 914
1893 <-> 1224
1894 <-> 775, 1601
1895 <-> 308, 323, 618
1896 <-> 1106
1897 <-> 118, 368, 408
1898 <-> 1316, 1560, 1944
1899 <-> 463, 1050
1900 <-> 1088, 1690, 1951
1901 <-> 16, 27
1902 <-> 981, 1714
1903 <-> 1380
1904 <-> 278, 1052
1905 <-> 20
1906 <-> 671, 1225, 1780
1907 <-> 800
1908 <-> 583
1909 <-> 1361, 1940
1910 <-> 134, 967, 1545
1911 <-> 1973
1912 <-> 1262
1913 <-> 832, 1426, 1729, 1828
1914 <-> 1914
1915 <-> 1399, 1589
1916 <-> 650, 1916
1917 <-> 726, 1917
1918 <-> 1040
1919 <-> 196, 1378, 1919
1920 <-> 1, 218
1921 <-> 1670, 1952
1922 <-> 1381
1923 <-> 892, 1012, 1247
1924 <-> 373, 904
1925 <-> 210, 1935
1926 <-> 543, 1013, 1805
1927 <-> 1102, 1822
1928 <-> 346, 1928
1929 <-> 1661
1930 <-> 19
1931 <-> 983, 1555
1932 <-> 685
1933 <-> 16, 1190, 1627, 1933
1934 <-> 288, 1243
1935 <-> 535, 1697, 1925
1936 <-> 295
1937 <-> 112, 157, 1728
1938 <-> 293
1939 <-> 689, 1059, 1463
1940 <-> 616, 1909
1941 <-> 1764
1942 <-> 243, 256, 1546
1943 <-> 1950
1944 <-> 260, 1898
1945 <-> 1504
1946 <-> 1946
1947 <-> 87, 1129, 1179, 1682
1948 <-> 294
1949 <-> 1560
1950 <-> 21, 1943
1951 <-> 407, 1900
1952 <-> 1741, 1921
1953 <-> 1067
1954 <-> 696, 1882
1955 <-> 754
1956 <-> 1457
1957 <-> 1322, 1621
1958 <-> 48, 708, 1696
1959 <-> 1959
1960 <-> 389, 1783
1961 <-> 1652
1962 <-> 29
1963 <-> 914
1964 <-> 1428, 1799
1965 <-> 1825
1966 <-> 1385
1967 <-> 1168
1968 <-> 265, 475
1969 <-> 4, 1781
1970 <-> 315, 926, 1837
1971 <-> 242, 545, 1971
1972 <-> 1972
1973 <-> 997, 1891, 1911
1974 <-> 885
1975 <-> 1196, 1669
1976 <-> 1709
1977 <-> 1977
1978 <-> 1978
1979 <-> 1979
1980 <-> 598, 1487
1981 <-> 1793
1982 <-> 1553
1983 <-> 1054, 1604, 1783
1984 <-> 731, 1652
1985 <-> 1355
1986 <-> 795
1987 <-> 1573, 1676
1988 <-> 495, 1023, 1433
1989 <-> 1617, 1762
1990 <-> 376
1991 <-> 1869
1992 <-> 1035, 1655
1993 <-> 1411
1994 <-> 1235, 1994
1995 <-> 57, 1209, 1572
1996 <-> 181, 1815
1997 <-> 395, 1436
1998 <-> 1300
1999 <-> 175, 1161

forming adjaceny list as provided

part 1


In [244]:
input_data = {}
with open("day12_input.txt") as f:
    for line in f.read().strip().split("\n"):
        m = re.match(r"(\d+)\s*<->(.*)",line)
        input_data[int(m.group(1).strip())] = [int(n.strip()) for n in m.group(2).strip().split(",")]
len(input_data)


Out[244]:
2000

In [245]:
def connected_componenets_dfs1(adj_list):
    # perform depth first search to count the components
    # connected to the node 0
    num_connected = 0
    visited = set()
    def helper_dfs(node):
        nonlocal num_connected, visited, adj_list
        if node not in visited:
            visited.add(node)
            num_connected += 1
            for child in adj_list[node]:
                helper_dfs(child)

    helper_dfs(0)
    return num_connected

def connected_componenets_dfs2(adj_list):
    # perform depth first search to count the components
    # connected to the node 0
    num_connected = 0
    visited = set()
    def helper_dfs(node):
        nonlocal num_connected, visited, adj_list
        visited.add(node)
        num_connected += 1
        for child in adj_list[node]:
            if child not in visited:
                helper_dfs(child)

    helper_dfs(0)
    return num_connected

In [246]:
def connected_componenets_bfs1(adj_list):
    # perform breadth first search to count the components
    # connected to the node 0
    num_connected = 0
    visited = set()
    q = [0] # enqueue->append dequeue->pop(0)
    while len(q) > 0:
        node = q.pop(0)
        if node not in visited:
            visited.add(node)
            num_connected += 1
            for child in adj_list[node]:
                q += [child]
        
    return num_connected

def connected_componenets_bfs2(adj_list):
    # perform breadth first search to count the components
    # connected to the node 0
    num_connected = 0
    visited = set()
    q = [0] # enqueue->append dequeue->pop(0)
    while len(q) > 0:
        node = q.pop(0)
        for child in adj_list[node]:
            if child not in visited:
                visited.add(child)
                num_connected += 1
                q += [child]
        
    return num_connected

In [247]:
sample_input="""0 <-> 2
1 <-> 1
2 <-> 0, 3, 4
3 <-> 2, 4
4 <-> 2, 3, 6
5 <-> 6
6 <-> 4, 5
"""
sample_data = {}
for line in sample_input.strip().split("\n"):
    m = re.match(r"(\d+)\s*<->(.*)",line)
    sample_data[int(m.group(1).strip())] = [int(n.strip()) for n in m.group(2).strip().split(",")]

In [248]:
assert connected_componenets_dfs1(sample_data) == connected_componenets_dfs2(sample_data)
assert connected_componenets_dfs1(sample_data) == connected_componenets_bfs1(sample_data)
assert connected_componenets_bfs1(sample_data) == connected_componenets_bfs2(sample_data)
assert connected_componenets_dfs1(sample_data) == connected_componenets_bfs2(sample_data)

In [250]:
assert connected_componenets_dfs1(input_data) == connected_componenets_dfs2(input_data)
assert connected_componenets_dfs1(input_data) == connected_componenets_bfs1(input_data)
assert connected_componenets_bfs1(input_data) == connected_componenets_bfs2(input_data)
assert connected_componenets_dfs1(input_data) == connected_componenets_bfs2(input_data)
connected_componenets_bfs2(input_data)


Out[250]:
175

part 2


In [159]:
def nof_connected_componenets_bfs(adj_list):
    num_groups = 0
    visited = set()
    
    # lets go thru all the nodes
    # and form connected compenents
    for root in adj_list:
        if root not in visited:
            num_groups += 1
        
        q = [root]
        while len(q) > 0:
            node = q.pop(0)
            if node not in visited:
                visited.add(node)
                for child in adj_list[node]:
                    q += [child]
                    
    return num_groups

In [161]:
assert nof_connected_componenets_bfs(sample_data) == 2

In [162]:
nof_connected_componenets_bfs(input_data)


Out[162]:
213

In [ ]: