M 2020/days/day1.lisp => 2020/days/day1.lisp +2 -5
@@ 2,11 2,8 @@
(defvar *day1-file* "2020/inputs/day1.txt")
-(defun slurp (filename)
- (mapcar #'parse-integer (uiop:read-file-lines filename)))
-
(defun is-it-2020?-part-1 ()
- (let ((numbers (slurp *day1-file*)))
+ (let ((numbers (mapcar #'parse-integer (slurp *day1-file*))))
(dolist (numi numbers)
(dolist (numj numbers)
(unless (= numi numj)
@@ 14,7 11,7 @@
(return-from is-it-2020?-part-1 (* numi numj))))))))
(defun is-it-2020?-part-2 ()
- (let ((numbers (slurp *day1-file*)))
+ (let ((numbers (mapcar #'parse-integer (slurp *day1-file*))))
(dolist (numi numbers)
(dolist (numj numbers)
(dolist (numk numbers)
A 2020/days/day2.lisp => 2020/days/day2.lisp +44 -0
@@ 0,0 1,44 @@
+(in-package #:advent-2020)
+
+(defvar *day2-file* "2020/inputs/day2.txt")
+
+(defun split-by-space (string)
+ (cl-ppcre:split #\Space string))
+
+(defun split-by-dash (string)
+ (mapcar #'parse-integer (cl-ppcre:split "-" string)))
+
+(defun remove-colon (string)
+ (cl-ppcre:regex-replace ":" string ""))
+
+(defun count-string (s string)
+ (count-if (lambda (str) (string= s str)) string))
+
+(defun valid-password-part-1-p (string)
+ (let* ((split-space (split-by-space string))
+ (split-dash (split-by-dash (first split-space)))
+ (colon-removed (remove-colon (second split-space))))
+ (<= (first split-dash)
+ (count-string colon-removed (third split-space))
+ (second split-dash))))
+
+(defun count-valid-passwords-part-1 ()
+ (count-if-not #'null
+ (mapcar #'valid-password-part-1-p (slurp *day2-file*))))
+
+;;; Part 2
+(defun char-at-position-p (c p string)
+ (if (string= c (aref string (1- p)))
+ 1
+ 0))
+
+(defun valid-password-part-2-p (string)
+ (let* ((split-space (split-by-space string))
+ (split-dash (split-by-dash (first split-space)))
+ (colon-removed (remove-colon (second split-space))))
+ (logxor (char-at-position-p colon-removed (first split-dash) (third split-space))
+ (char-at-position-p colon-removed (second split-dash) (third split-space)))))
+
+(defun count-valid-passwords-part-2 ()
+ (count-if-not #'zerop
+ (mapcar #'valid-password-part-2-p (slurp *day2-file*))))
A 2020/inputs/day2.txt => 2020/inputs/day2.txt +1000 -0
@@ 0,0 1,1000 @@
+8-9 x: xxxxxxxrk
+5-8 f: fxffmfff
+2-5 c: ccspwpc
+1-4 g: gggg
+9-10 l: lllllllllk
+1-3 j: djjfz
+3-4 n: nnnmn
+8-9 l: llllllllc
+4-5 v: vvvvm
+3-4 t: ttnt
+4-5 w: wrwws
+12-14 x: xxxxxxxxxxxcxxxx
+9-10 q: qqqqqqqqtq
+4-5 q: qsktqncqqqdn
+2-7 h: ngkhcthb
+9-11 r: rrqrrrrpcvs
+3-6 c: rccbcc
+7-8 k: xpkmjlxkt
+1-5 l: zcwdhpkvz
+4-11 r: rhmzhrxrdrrtddj
+11-15 g: lggndgggsggggtdggg
+6-12 m: mmmmmmgmmmmmwm
+4-9 z: zzzgzzzzz
+4-9 k: kkkkkkkknk
+9-14 l: fldlllllldqllwj
+1-10 k: sbnxkmtbgdf
+2-3 v: tjzvnfv
+3-4 d: dddd
+1-2 l: ltfwjqjlqpnbqmnj
+2-5 r: rrrrr
+9-10 v: vvvvvvvvvdv
+16-17 j: jjjjnjjrjjjjhjjzqjj
+10-19 q: qqqqpqqqktqqqqqtfhq
+17-18 c: ccccccccccccccccmc
+3-7 f: kcpnxfffpv
+4-7 m: mrzmmtsmmmb
+8-10 l: lmlllllllnlb
+1-3 d: bzndm
+2-13 s: szsssjsssssssss
+3-8 b: bbbwbshbbbb
+15-18 h: hhhhhhhhghhhhhzhhh
+6-10 b: zbbbtbswrn
+12-14 t: nttttttttttstzgt
+7-12 f: vffcmffwfjpk
+3-18 r: frvkrwrlrrdbdrrrrxnr
+12-13 k: kkkpkkkkrkkxkkk
+6-11 b: bbbbblbbbbbw
+4-5 f: tfdjf
+7-8 m: cqmmmzmmmmgm
+2-4 j: jjfx
+3-5 v: xvvvsq
+9-10 s: sssmsssshgsd
+1-6 t: tptbjsttt
+4-15 z: zzzgzzzzzzzzzzz
+4-5 p: mxpnp
+2-3 n: knwfnnj
+10-11 s: sfswsbssgssvp
+12-13 d: dwndddddddlnddrdds
+14-15 k: bcvpdjkkndkmkrg
+10-13 x: xxxxxxxxxnxxz
+5-10 f: fffkffgspffffzcf
+11-12 t: ttttqtttxhtzzttt
+15-16 k: kkkkkkkkkkkkkktk
+6-8 b: bfbbbbtkbb
+2-7 h: hlhhhhgh
+3-11 q: ldbtqbsfkqqcrl
+10-15 q: qqrqqmqqqqfwqfzqqxqq
+3-5 r: ldtrrxrnqrhqnhkrv
+9-10 n: qnkvnnfnznnnnjn
+1-8 w: wwwrwwpxmwsswwzwzww
+1-4 f: zfwtzx
+1-8 w: wwwnnwfv
+9-11 r: jrrfgrrrzdr
+15-18 b: bbbbbbzbbbbbbbsgbb
+16-19 t: sfgfffhscvpdrqtvsmh
+7-8 k: kkkkkkrk
+9-11 z: fszzzzzzszzzcz
+1-14 k: lhkrkkkklkkkpkfkk
+5-6 s: sssscs
+11-13 j: jjjpnjjjjjkjjj
+1-6 x: mxhjgxbt
+9-11 t: xtltttttktg
+4-12 z: zzkdzwzzzzzfzz
+13-16 j: jjjqjjjcjjsjdjjjjj
+13-14 h: bhhhhhhhhhvhhhhhh
+6-7 k: vwllpkb
+1-5 c: sbnmbhcjlczjrc
+2-11 c: skrtgbzdklcxqrwr
+16-17 r: rvnnjknhswckcbrmr
+5-6 b: btbbbnbb
+3-5 c: ccpcm
+3-7 h: hhvhvbhfth
+2-11 d: ddbddlddvdfdwxwxd
+6-8 m: mwmmmmmmmmc
+1-5 l: lgwrlpmnfnzlczkpflt
+4-6 x: cgbncxtwsvjwtbjqxzz
+6-13 h: tnhshhkhhhjsdhrbh
+1-2 s: gpzrf
+12-14 p: pxpzpppfpppppxpp
+2-8 j: jddjjjjtjjqpj
+3-13 v: vkvvvvvvvvvvdvvvvvv
+4-16 b: bbbbbbbbbbbbbzbdb
+5-6 b: bbbbbbb
+2-4 v: vvvhv
+13-14 w: wwwcwwwwwwwwtww
+1-7 g: gdbgpncbdgk
+13-18 g: ggggskgggcgggghgsvr
+15-18 c: cckcccccccccccgccccr
+4-6 l: klflll
+17-18 g: gggzgggggggggggggg
+1-3 m: kmmmmmm
+5-10 s: qxstrsbxkssksc
+16-18 r: rrrrrrrrjrrjrrrrrvrr
+6-9 c: rgcscfjccvzgcccqc
+2-5 m: mmvmp
+1-11 z: zbsdnzstzsbzzlj
+6-7 v: vvvvtvqvpv
+11-12 x: xxxxxxqxxxfnx
+4-15 h: hnthvnjhzhqhwvwhh
+4-12 g: dggggrvvgmcldfgqbggj
+11-12 l: lllllwllllvn
+1-3 l: lpplz
+5-6 v: vzndfwd
+6-8 j: vxjjddjjjmjpjw
+6-7 k: kkkkklkk
+2-9 g: zgqmwlgfrsz
+1-2 k: kkqk
+2-13 h: clhmnhhwhpdhh
+3-14 z: zzxzzzzzzzzzzg
+9-10 v: vvvvvvvvpf
+17-18 z: zzzzzzzzzzzzzzczgz
+15-18 j: jjjjjjjjdjjjjjjjjx
+2-7 w: zqfxwwwwww
+4-11 r: qrcrrzrqnrhrn
+9-10 q: jqctxwmccqqpcqqbllq
+4-5 b: tbbbk
+1-2 r: rsvmjrbprjjvdkcfk
+9-11 v: vvvvvvvvvvv
+1-4 c: ccbjccccc
+7-8 l: llllllql
+5-8 c: cncccccwc
+3-4 d: kdzdkjdqkvhdz
+6-7 j: cjjjpqj
+11-16 t: ttttttttbttttttttt
+5-17 v: vvgvqvxvsvvvbvvvvvvv
+12-18 k: kkkgkkkkkskkkkkdkwk
+1-7 p: ppqqpjp
+1-13 v: fsvbwvvvmvtvv
+8-10 q: qqmqqqqbqmvvq
+14-16 m: mmmmmmmmmmmmmmmgm
+2-5 r: prrrmr
+6-12 j: jhjjjzjpjmjjvj
+5-6 x: xxxxdx
+4-5 n: nnnsnn
+2-6 j: jjjjztj
+3-8 j: tzjzbjbqqjlww
+13-15 z: btzzwrzbzmdcdzz
+1-2 j: ddjkbx
+4-8 b: jbbkbqsblcbhprzqtb
+3-5 b: bbkbb
+6-8 f: fffffffff
+2-4 l: lsprl
+17-18 t: ttttttttttttttttth
+1-4 p: pppf
+13-18 m: mmmmmmmmmmhmsmmmmmmm
+7-8 s: sssssssss
+18-19 t: ttjtttttttttttttttjt
+2-5 j: jjddt
+6-12 r: trrnrcrnrrrr
+6-7 h: rhhkhhthdsh
+6-7 s: vpxmpdstfdv
+9-10 p: ppppppppwpppp
+2-4 h: hhhh
+1-3 h: hhthhhhfhhhhh
+4-5 k: dkbknt
+7-10 d: kbdddddddsdd
+11-16 s: ssswksjsssgsssssspt
+5-8 b: vxlbbbzmbkktwrtlbt
+2-8 h: hhmhvszx
+6-8 g: ggzggggxgg
+3-4 q: qqqp
+4-9 v: vvfvqzbvvh
+10-13 g: xggmgglfgxpsgggggg
+1-8 b: bgsblbskxgkt
+7-10 b: dbbqhftgblbbb
+1-2 j: wjjgrdznbn
+12-13 z: mzzjzzzzzzzgzzsz
+4-9 m: psmmmmmbzmvmmm
+8-9 n: nnnmnnnnpnnn
+2-3 p: qpjhhgkp
+6-7 h: phhhwhhmfh
+2-4 b: bkrljb
+11-12 c: crccbcccccccc
+3-14 r: rrrrbrrhrrrrrzhr
+5-6 c: ccrcdcwcc
+1-17 k: kkkkkkkkkkkkkkkklkkk
+4-7 k: kkkkkkvkk
+3-4 w: rqwc
+6-12 k: kkxkklkkkkkk
+2-3 w: dpww
+15-16 h: hhhhhhhhhhshhhwhh
+2-6 x: gxxmthnbj
+3-5 s: sbhsc
+10-12 q: qfqqprqqrmqqq
+9-11 f: hkpmjfgfrcfnfz
+2-16 f: ffffffffffffnffq
+4-5 f: fffcf
+2-7 d: tdzqcdd
+1-4 h: hnxz
+16-17 g: gggggggtgggggggqx
+2-4 n: nngcd
+4-6 r: rrrkmf
+5-6 g: ggghgggg
+7-9 p: qkmpfzpptdjsbppcthpp
+9-13 t: ttttttbtttttt
+5-7 l: cldkllzgxldwlcdll
+5-8 f: ffpqrftfsjd
+6-13 t: tbtltkltttsjttkr
+6-17 w: wtbwwpwwwhwcwtwzzww
+2-8 x: nxsqbdmkqtx
+2-5 s: fsrsvss
+9-12 x: nxxxxxxxmxxxnx
+1-16 j: jjlmjrgpnkgjjwhjhxt
+6-10 k: kkxkkkkkpfkkl
+3-9 l: lhzgllglllrtt
+18-19 p: pppppsppppppppppppp
+1-8 b: bbbbdbbwbbjkbbj
+16-18 p: pppppppppspppptppgpt
+1-5 w: wnmwff
+3-4 v: vvvvm
+1-16 j: jbhjjbjhwjjgjxjw
+8-17 j: jjjjhjjjjjjjcjjjs
+3-4 n: nnnn
+17-18 t: tttttttttttttxttwtt
+3-4 k: kbpkk
+2-3 n: ndnn
+9-13 m: mmmmmmzmwmmmm
+1-10 d: djdddddldddddddd
+9-13 v: vjvvvvvvfvjvv
+13-14 m: mmmmmmmmmmmmmm
+4-10 x: xnxczxxxxxx
+17-18 h: hhhhhhhhhhhthhhhmhh
+3-13 z: zzmzzzzzzzzzzz
+3-6 w: wwtwwww
+11-14 v: ghvvvvvvvvvlvkvvvsvd
+2-9 r: qrdqvchhjgrpgj
+9-10 w: wwwwrwwwww
+3-5 c: xcgccc
+6-7 z: zzzzzfz
+16-18 b: bbbbbdbbbbbbbbbpbp
+3-5 s: ssssw
+3-4 z: zztzzzzzzz
+7-8 j: jjjjjjpj
+11-12 b: mbsjljhbbnpczlnbm
+1-4 k: tkhk
+9-10 j: jjjnjjjjjz
+3-8 v: nvrbvvmrvhcs
+1-5 z: szdcdjphttvnrd
+2-7 m: zmmmmmhvqhpmmmmsmmv
+7-8 t: tbtttttghcdptljtk
+2-9 s: slssssssss
+2-4 g: jgnn
+3-8 s: ssksssss
+6-10 t: bthxljrxhth
+4-10 d: dddddddddqddddddddd
+8-13 c: ccrjcccccqjcc
+6-8 z: tlgdknkzxrghz
+8-11 t: jttttmtbttdt
+1-2 x: xhxx
+3-4 c: cccj
+9-10 v: vvsvvvvvvv
+4-8 q: qqclqqqqtqqpzqj
+7-9 w: wwwwrwnwj
+1-3 w: cbwmzwwr
+6-7 l: llllllz
+1-8 h: rhzhhphhmhfnh
+1-5 t: ktrtv
+6-11 c: kfccccdcccvxwc
+4-7 q: qrqqzcx
+4-7 z: wcxzjrlhfbnczdj
+7-14 k: mckkdnkrkpkknkdkckfz
+1-6 v: vvvvvbv
+2-6 p: gmpszppxppp
+3-16 k: ggxkknwkkjkqskzktgk
+15-17 z: zzxqmnclzxzfvznzb
+3-6 x: xxxxxpxxx
+17-19 q: stvktzjwzbrbfmbqjsq
+4-6 b: bbbsbbb
+9-10 p: spttdpplsppdprxrvpgm
+4-5 w: wwwwn
+10-16 r: grnjxrwrrrzdrpmjtrrr
+14-15 q: qqkqqqqgqqtqqqrqhq
+4-8 q: qqqqzkzsqq
+10-16 m: mmmmmmmmmwnmmmmmmmmm
+5-10 h: hhhhzhhhhhhh
+5-11 p: mkpphppzhwqpgpsqcshz
+2-4 l: nnllsl
+2-8 q: bqjtjmfqsqgcjvgf
+2-3 w: wwsw
+12-16 s: lmsjpgzfldmrhrmf
+4-6 n: gnnnnv
+9-12 s: xmwssfsssssnssxwds
+2-4 h: vzfh
+1-2 n: ngdp
+4-7 q: sqqnhqqsvqqq
+5-6 k: zvkdkldkg
+11-12 w: wwwwwwxwwwkw
+7-11 p: hgbsfjpmbkz
+1-4 v: rwqvv
+4-6 s: pssssss
+7-10 m: mlmmmmmmmrmmx
+1-2 n: hnmqzsn
+11-12 n: nnnrnnnnnnnbn
+1-2 k: qbxhwswsxzkdsxcbtwrw
+13-15 n: nnnsnnnnnnnntnc
+17-20 n: nnnnnxtnnnnnvnndjnnn
+2-17 n: npnnnnnnnnnnnnnnnnn
+6-13 t: ttkrxzdkttltszskt
+10-15 k: mkfllgkdnvjptdh
+6-9 m: mmmmmjmmm
+14-15 w: wwxwwnwwwwzwwkgqkwww
+2-10 k: zmgrvrzlmkgcddcrxk
+12-14 c: cccczccccccjcjcccc
+11-15 m: mmmmdmmmmmmmmmqm
+18-19 r: rrrrrrrrrbrrrrrrrxbr
+6-10 b: hnbnbblvpd
+10-12 x: pwpxxqnxxxxxxvzcxx
+3-4 n: nnnpj
+4-6 n: nnnwnnjn
+3-4 k: kkmk
+12-14 j: jmjjjjjcjjjlwjjdj
+3-4 q: gqqxq
+7-10 z: zzcztxzzzzzx
+2-14 q: cqnqbvqsglczhb
+3-6 r: mrrhrn
+14-15 z: gzdzdszdkrfzzgpp
+4-10 j: jjjjjjjjjbj
+3-7 w: vrwwwwhwwkw
+6-8 s: shswpbjss
+2-4 h: ghvnhh
+3-8 m: mmmmxmmvm
+5-6 g: ggxgxg
+1-2 v: vzvv
+2-7 r: qgmgrxrgrgv
+5-15 z: zzzzbzzzzzzzzzz
+3-10 t: tttttdtttwtl
+1-4 w: kwws
+1-3 h: crxhhkhc
+5-6 f: nfffnttvfcm
+9-15 d: ddddpdqddmdjddz
+7-8 c: mjfqkmclzphkcnjrg
+4-7 l: lcblmnlpltgbnsjll
+5-8 v: rvcvvvvbvv
+3-4 b: kbblb
+12-17 v: vvzvvvdrvvvvvctspvnz
+4-9 d: dddsdddddddddsd
+6-7 s: shvgwsspmsnr
+5-10 k: dghtgjbkkk
+1-5 m: mmmcsxm
+1-3 q: bvqqk
+7-9 c: wccsccxcfkvvkctzc
+5-6 k: jdkkcqkkg
+5-8 g: tgggqpzfgfg
+19-20 t: ttttttttttttttttttth
+1-9 n: dhmnnqnnnpnnr
+4-7 w: fwmwwrz
+1-3 p: qcnppb
+1-14 f: jtrcqftxkxfmxffffhf
+10-11 z: zzpzzzzzzkzzz
+13-15 h: phhhfhhhhlhhbhhhh
+10-12 t: tttttttttmtt
+6-9 s: psssxsscssss
+3-4 p: ppbgp
+11-15 b: lpjbbbpbbbrhbbbb
+9-10 c: cchccccccl
+3-9 t: wtltcrnvtmgtf
+10-13 g: rkgggkfvcgktrhx
+16-18 k: kkkkkkkzkkkkkkkfkk
+3-8 q: txxqqjbqqd
+7-16 j: gjgxwjjwjwvhjkqvr
+4-12 t: xttzrmdtjvttcn
+3-5 c: lcvcczsjd
+14-16 n: nnnnnnnrmnnnnnnpn
+4-9 c: cccfrpclcc
+13-14 l: klllllllllllll
+2-5 l: rlxvflqllllvsm
+9-10 h: rhbhhhhhrhh
+3-4 p: pftpp
+1-3 z: zwbjlzpwldx
+12-16 s: sbqwfmsstlsqbsws
+8-9 g: gtqggjqgn
+4-14 w: twwtwwwwgvwwwwswpwr
+14-15 x: xxxxxqxxvxxxpxhxxx
+11-12 c: ccdccccxccclmcccc
+8-10 w: wwwwwwwrwwwwwww
+1-4 f: fffqfpffff
+3-4 p: pppq
+3-8 l: dglblkmlllklxqsl
+2-4 k: wkskqwkccrtv
+10-11 l: lllllllllsl
+6-11 b: qkgjbcqqhbqxw
+1-3 q: qvqpp
+10-14 d: xzhdlcwkqqzzbdtf
+14-15 f: ffffffffffffftq
+7-8 q: qqqqfqqdrqqh
+4-9 h: ljfhrhhmbr
+11-13 r: rrrrwrrrrkrhh
+7-10 z: zzzzzznkzb
+3-5 n: kvtnn
+1-3 g: ggng
+5-8 g: gggggggg
+2-9 c: csnczjctbcmcccc
+11-12 n: jnnnnxfknnndnnfnr
+1-5 d: vdmddddd
+7-8 z: zzzrztzmz
+6-8 z: zbzzsmzzjm
+1-2 r: trrrcn
+5-7 m: msmmxcm
+12-13 h: hnvhztwhhpwhqkf
+10-11 t: wprthmcttqtt
+4-6 r: tttrssfrrbxjrzgr
+3-5 r: zrsnr
+8-12 z: zjqzzzxdzzzb
+16-17 x: gxxtswfpzxxpxbvxq
+4-5 h: hhhhg
+19-20 f: ffffffffffffffffffrf
+3-4 l: llbsq
+7-15 k: knkkkkfkkkkskkklkkkk
+3-6 q: qqpqqb
+7-9 t: ctztttttpjvt
+1-2 x: xmpx
+10-12 c: cctccdcchzcppctq
+6-7 s: lssnssxns
+4-13 m: wmngjsmtmmcjmdmm
+2-9 h: jhmdxgchltdgj
+12-13 c: hcjcrrlsgcccn
+7-10 t: tsbtzttzqj
+18-19 c: sccccccccccccccccczc
+3-4 g: ggghw
+7-12 p: vdlpjjpvmrmpskp
+8-10 v: hqwvvtvvtvvvvjv
+2-4 k: nkgv
+1-3 h: hhxmhn
+11-13 d: ddddddddddcddd
+7-19 g: ggggmgggggggggggbsmm
+5-13 k: kbkkkkmkwblkdf
+1-2 j: jjjzjjjjwjjjj
+6-10 g: gfsggjgggnl
+2-3 s: cskcs
+3-11 m: mjvqhbhjgqmq
+1-11 q: qdwqqqbqjmzmdhxl
+2-12 k: kkkkkkjwkkkckkzr
+9-12 v: vvvvvvvvsvvv
+3-4 r: rjmxr
+2-7 k: kkpvkkr
+3-4 h: hnzhhhsvfbswzxkslt
+3-4 n: qbnmhhnhdchbnnvk
+1-8 v: vvvvvvvv
+3-4 j: jjmjj
+9-18 f: ffffffffzffffffffff
+4-6 f: qgfjffbfj
+1-3 m: mmmmmtmmzm
+2-5 d: qdddf
+4-5 w: wwswbkwjcw
+5-9 g: jvhgwlllgvxrfg
+1-2 p: fhvmh
+15-20 m: mmkmmmmmcmmmmmmnncmc
+13-16 l: llncvllllllllllglz
+16-17 l: llblllllkllllllndlgl
+5-8 s: ssstwvsts
+1-2 d: rddddldxdsrtddd
+6-7 d: dddkdpdddd
+4-5 w: wcwgw
+9-11 r: lrfsrhrxqrrnrjggr
+1-9 w: pxpfwbmxwdgvbhzlt
+11-14 q: lhnlmdssgvqqskr
+8-13 x: vtcxxmxswxmxd
+5-13 r: sbpdrpgbvdrrrx
+1-5 m: bmmmm
+1-2 m: fmmsrft
+2-6 v: pvvrvb
+6-7 s: sssssksf
+3-4 c: zclc
+11-17 q: qqqqqqtqgqqqqqqqmq
+1-6 j: jjgcrlm
+3-4 n: sfnn
+12-13 p: bppppppppppmkp
+6-7 q: dtgqtqqlqqqqsq
+5-6 v: vvvvqvv
+7-8 d: ddwddbjdd
+11-16 m: mmmmmtmmmmmmmmmfm
+18-19 v: vvvvvvvfvvvvvvvvvvr
+1-2 j: jljjj
+3-9 r: rrrzrnrsdrrr
+7-10 w: twslbwxwbwwwwww
+9-11 v: rpvvzvxvvvzvvv
+3-5 d: zzvtdt
+7-11 p: prldqxjtpnppx
+1-10 z: lzzzbcfgzz
+11-14 h: hhhhhshhhhhhmph
+6-12 v: sfbvvwvvjvkvvvd
+8-10 f: fffhfffffnc
+7-8 g: gqjgfwfggghggh
+8-9 x: zgxxxxmhxxxx
+12-13 z: zzzzzmnbzzzzgzzzr
+2-3 c: cvcsccfg
+3-4 s: ssws
+5-8 c: cccwcccp
+4-6 c: ccccdlxcc
+5-8 l: prlzlxcccl
+1-4 g: qlng
+8-12 c: ccccccckcccccccccc
+2-8 d: ddpddqjhbbr
+13-15 j: jjjjjjvjjjwjjjqjj
+5-8 x: xxwxcxcnxxxxfx
+4-6 t: dtfbctcgtzrtntw
+5-12 r: rrkdrrrdrrrx
+6-7 h: rhbghkhchjmbkhhm
+7-9 z: zzdzzgzpz
+4-5 v: lvnmq
+1-6 w: wwwwwwjw
+14-16 n: hpnnnnnnvnxnnnnlnn
+18-20 r: ftrrzrsrrrgsrzhwrbrr
+12-13 s: ssfbssssssssws
+2-9 g: gfvcgzgjb
+2-4 n: nntqtn
+4-5 h: vqzhzhrxhh
+4-5 g: ggqkg
+1-2 x: xzkx
+7-11 j: jjdjjmddlrjgjjjqzls
+1-3 v: vvvctbv
+4-7 s: fwmsssdss
+10-11 p: pppppppppbppp
+13-14 q: qqqqqqcqqnzqzqqqqqt
+7-14 z: rhzzwqmzzzzxzzzzcgz
+8-9 b: bgbsbbbbwbsbblbcr
+7-8 h: hhhhhhghkh
+1-2 g: ngct
+13-15 f: fffffffffffvmfg
+4-7 h: mdghhfs
+12-14 z: xzjzzzzvzzzgzz
+3-4 p: ppsp
+18-19 q: wqkqxtkfhlmrxndwsqcc
+5-14 p: ppppbppprnprwpwpp
+3-4 j: jjjcjj
+2-3 b: blbn
+4-6 g: grggvcgg
+2-4 h: hghhh
+4-6 f: fffffm
+2-4 n: qsdnxt
+2-5 q: qqqqqq
+9-12 w: whlqgwcrqxwwrvw
+6-7 z: zzzzztqzz
+7-10 l: slnzmdlslsrc
+4-8 q: jqqqjqqltd
+5-6 h: xjzbdbsfjfrxhxqlbbrt
+6-12 w: wwwlbvwwwwwwww
+2-5 c: zcpcf
+4-5 h: hhhmh
+16-17 h: hhhhhjhhhhhhhhhgh
+12-13 f: fffffffffffmk
+4-5 d: dddgd
+4-10 p: xppvfpsgpphcpppml
+3-5 w: wwtwwj
+7-10 w: twwwwgtwjwjwww
+5-10 z: zzzzzzzzzgzzz
+13-14 t: sjxsttgttttbqtthtbd
+6-8 c: ccccmdrcct
+2-4 v: vcxm
+3-7 k: dkkzfwzkn
+4-7 v: cjrvvxtsvvvv
+11-15 s: ssssssssssrssss
+1-8 j: jskfjjjj
+2-3 p: pgnpn
+4-5 p: psplppc
+1-3 n: nnnn
+11-12 x: xxxxmxxxxxzxxdrqx
+1-4 k: kpln
+6-10 p: pphppppppkp
+2-4 v: cgxvvxkzvs
+6-7 m: mmmvbmmjsrmtzkddzmxm
+5-9 s: xcshstsdslsxms
+1-17 m: vmjmmmmmgmmmmmbmst
+2-3 g: ghgg
+5-6 k: kkkkmkh
+5-6 c: lccfcccsgc
+4-6 n: nncnbnmznngnj
+8-11 j: ljffjmrjmjm
+4-9 j: rqxjwfsrfzbxjjmnflj
+3-6 s: zscszpss
+3-4 d: qldtdht
+15-17 x: xmxxxxxxxxxxxxdxx
+1-4 m: mmmmmmm
+2-9 v: vvvvnvzsvv
+3-4 n: nndn
+9-13 s: crxnbslshlbgsh
+1-10 c: cczkccchfc
+3-5 d: dddddwv
+7-9 n: hqrhnxnzfnkqnvnnnng
+3-4 c: cwcvfdc
+6-8 l: llllllltl
+4-6 q: qqqqqm
+1-5 x: xhmxxxtwxdxkk
+5-17 f: gffrffffmffcbmfffff
+15-16 x: xxxxxxxxxxxxxxcl
+3-7 z: nmjzzdzz
+9-12 v: vzvxvxvwpvvvvvcvxpmv
+4-6 w: wtwwwm
+3-12 d: dddddzdddgdw
+2-4 p: pqpk
+2-4 g: pqqgbwqzsjtcrmg
+3-5 d: xdhsdpndjhd
+9-11 t: ttbtttttqtt
+2-11 d: kddwtcwxgkclxcnfgm
+1-4 v: hgvvfvjvz
+4-5 s: ssssm
+2-11 g: gmggvgggggn
+3-6 c: ccrccvr
+1-4 n: nznfnn
+1-4 f: sfxffff
+17-18 q: qqqqqqqqqqqqqqqxhq
+2-5 l: zllhn
+7-10 v: cvcvvvvvvqxbv
+9-13 l: lllgllllllllql
+3-11 g: mlgwrbcsdflzm
+4-5 t: gtbtcfqrxfxtjptgpqr
+5-8 d: gfdzjkvd
+4-5 f: ftfff
+15-17 p: pppppppppppkjpppft
+1-3 d: tcdd
+3-12 n: tnxnnbshnndnnhbn
+5-8 q: pqlkptqqqcqbqrr
+8-9 l: lllllkllb
+10-13 j: rsfjlxjtfjrkxn
+8-9 w: wmzvwwwwdwzwwt
+12-14 w: wwwwwwwwwwwwwm
+6-7 g: qwggfqgnvrggg
+15-16 x: xxmxxqrlgnfxxsxr
+4-8 n: gnnlnnlncnrnnqnwncd
+8-11 k: kkkkpknzdkkck
+4-5 m: mmmsm
+3-4 n: nnxn
+7-11 c: cckcdzcjldcwfcr
+12-14 j: wxvjvpjjjpjkjj
+1-13 h: fhhcfzhhhhhhhh
+11-12 p: pppppwfpppspp
+3-4 t: tktptt
+1-6 n: nnnnnfnn
+6-15 l: lllllmwlllllllll
+5-6 q: qqqqqdqlqqq
+4-8 j: bjjxhjjd
+2-9 w: tdwpwdkcw
+6-8 l: llllltbr
+13-14 f: fffffffffffffj
+4-11 z: wxzkzzzzzzzt
+7-11 w: wwkvcfwfsrcw
+4-9 b: bzbjgbbbb
+17-18 k: kkkkkbmkdkmckkvbkk
+5-6 j: ngffrjspcz
+16-18 q: qqvqqqqqqqqqqqqhqqqb
+12-15 s: sszszstsgsssssdssssq
+5-6 d: dddddg
+4-8 s: ssssvnss
+16-19 g: lgzswgbfwghgggnglqg
+8-9 t: tttttttltttt
+14-20 b: bvbbjjbbbwttbbblbbbp
+4-7 c: cxcdhmm
+1-11 g: gkvjfgjlggpjb
+1-2 w: whmwwcwqgw
+6-16 p: lgwrlppdfpxbltmqlp
+4-7 r: rwrrhhrqgrr
+12-15 j: jjjjjjjjjtjnjjh
+3-5 k: kkkkkkkk
+7-9 p: wpxpphfpp
+2-3 z: zfzz
+2-3 k: nbsdwkqktssd
+7-12 g: gggggpnpdssgwggx
+6-8 r: frrrrjrr
+1-7 l: llllllll
+11-16 x: bxxsqxxxxxxktxxz
+3-5 n: nwbknpnnvnr
+8-9 t: qtttfvttqnttttmtttdv
+3-4 d: dfgk
+5-7 f: ffwffff
+9-10 c: cccccccpgr
+3-4 q: qqpq
+1-2 k: kmwvdkzwxlkk
+1-8 s: sssljrsmsx
+12-13 r: rsrrrbrnrhrrhrprrrrn
+4-16 w: kfqncxdmjlwkfjmwhw
+9-13 l: llllllllpllllll
+2-4 m: mlmmdbbqqmgkcffxw
+2-12 j: jjjjpjjjjjjrj
+9-11 x: qxxdxxxxxxqx
+2-6 v: svcsfvrfpbxpmvtscqjg
+2-12 c: dctwqfthcdbcsklb
+1-2 c: zcfrlczcpxcm
+2-8 s: nspkfsvbfsw
+5-10 m: dxvwmqmngmzd
+2-3 w: twsxwvwzw
+5-10 c: cccccccpcxrc
+8-16 j: jjjjjjjmjjjjjjjjjj
+8-16 p: ppppsppdpphppdxp
+16-18 t: tttttttttttttttttcs
+11-13 j: jjjjhjjjjbjgjjj
+14-15 d: ddddddddddddddwdd
+1-15 s: psgssjszssbssdsgds
+14-16 z: zzzzzzzzzzzzzrzqz
+8-10 v: vvvpvvvvvg
+4-5 z: zzkzf
+3-9 g: ggggggggfg
+1-4 n: ckwcnhz
+7-9 w: ckwwwwjwq
+5-12 q: qbqwcqbvvxbq
+4-10 x: xvxxxghnrk
+2-3 d: pdpmdkvsmccpnp
+3-11 f: lffffjfmzqplsfzfl
+9-10 h: hhhhhhhhhk
+1-4 x: bxxxxxmxx
+10-13 t: rnnglkrgbrrwtqjmlbn
+5-17 v: zfmxkbtjpvvvqdxcvvnv
+9-10 j: kjkzjlnjjjjjjjj
+13-15 g: gggggggggggwxsg
+2-7 l: llhrxjl
+5-6 s: hfszgwczxtsp
+1-10 v: dqqvhttqqv
+10-13 z: zctbpzzzzzpzdznzz
+6-10 p: mpplqpppfhhqptphp
+2-5 w: wwgbw
+1-4 b: sbbbbb
+6-15 z: hpzlzzzzzpzzzgdzzlzn
+2-4 r: rhfrdqrxsb
+6-16 s: crrtqsjqfssssgsssc
+17-18 h: hhhhhhhhhhhhhhhnrh
+6-8 f: xpgdffbblxxl
+2-4 h: wzfmhhl
+5-6 k: jkkkhk
+8-9 c: ccccccccc
+16-17 t: tttwttdtttttttvkttt
+9-10 f: fffffffffh
+6-10 l: zxclbtlsjlbls
+2-6 m: mmjmms
+8-11 r: rrrrrrxtrrrsqr
+1-11 v: gcvxfvdkvvs
+9-12 c: xgcjrmscgjmjfsdxcp
+10-11 g: gggggjggggdg
+5-7 s: ssssprssm
+2-3 c: nzccfjcdxc
+9-13 k: mdhkkgkkkkxkkvrkkk
+6-7 s: sssssbsssk
+12-19 n: xtlfpnxflxwblnjsnxnq
+3-4 t: tdtltttlp
+2-4 g: gggg
+11-12 k: kkkkkklkkmmk
+2-6 r: rsrrrrrl
+3-4 r: rrzq
+12-14 l: lllllplllklmlrd
+2-3 d: dkdd
+1-2 t: vttt
+7-14 l: lmdkltvllhsnllnl
+6-7 s: scssxssrsqfsjrcgdsb
+5-6 d: tndddgrv
+1-3 t: jhvtckvptnp
+14-15 g: ggggbggzqggggdvgg
+2-5 t: tvttt
+4-9 f: hfsmksgnfh
+6-14 k: kkkkkkkkkkkkkskk
+6-7 w: wwwwwwxwcc
+5-9 n: bnsvnnnqtpncn
+5-7 v: vvjvfvvv
+7-8 d: ddddddxd
+13-14 b: bbbbbbbbbbbblf
+1-4 l: lllml
+9-12 p: ppppgppgpppwpdp
+4-11 p: rpjpprbztgkxx
+4-7 g: ggggzgtg
+2-3 j: ncjjk
+14-15 v: vvvvvvvvvvvvvvfv
+9-10 l: llxllllhlzlsb
+13-14 p: ppnppppppppppz
+5-11 j: jjjvhjkjjjjzj
+14-20 b: dbbbbbbbbzbbbbbbbbgc
+5-6 m: mmdzzjmm
+3-4 t: ttft
+5-6 m: mmmmrmpmmmm
+15-17 v: qhjrfvvbvplvvvvvq
+1-15 t: gctmcdxttttvvtt
+4-5 v: pfvcvcvrvv
+13-14 n: nnnnnnnnnbnnknn
+7-9 h: hhhhhhhhh
+1-2 f: fhffgj
+1-12 b: bbbbbbbbdbbk
+6-7 n: nnnnnng
+13-18 f: fffffffffffffffffs
+11-14 b: bbbbbbbbbbbvbfb
+10-12 h: hhhhhhhhhwhq
+7-8 w: wwcwqcwwwpwbww
+1-5 m: fmmmjmm
+14-15 v: vvvhvvvvvvvvvvf
+12-17 b: bbvbbbsblwbbbbbxf
+1-5 w: stwwj
+6-10 j: jjjjjgjjjj
+1-4 l: zvcjqgqrvvfndlj
+5-7 s: tswsgws
+1-13 v: zfwvvvvpvvvvmvvvvvjv
+1-3 j: rjjvpkknmmjmxpqrmx
+5-8 s: mxgsrsssbstb
+5-14 q: qqqqqqmtjqqqqqqc
+1-7 s: sswdxsnbkj
+5-9 d: ldnbdmrtv
+7-8 w: wwwwwwww
+7-8 g: gxggggpg
+8-12 r: rrrrrrrrrrrkrr
+2-5 n: nnbnsmpml
+2-3 g: gsggggggg
+9-11 s: kssssssssxns
+15-16 m: bhsxvbrjhfzmmflm
+4-7 h: wmhhhhzh
+2-13 g: khdgzvpxgrcvgc
+5-13 n: wnnnnslnnnnnjt
+3-7 t: ttsptkgttt
+1-7 m: ffqtfmm
+8-12 p: pplppppspjpppq
+17-18 r: rrrprrrrgrrrrxrrrzrr
+3-4 f: ffzff
+10-11 x: xxxxxxxxxxw
+10-11 b: bbhbbbbwbbbbbd
+7-16 b: htbbxcbsbtjgxdvjcbc
+9-12 g: gggxggggsgvgqg
+13-15 l: dgllcqgtslfvkwlb
+10-11 f: fffvfffffffff
+2-6 d: ddqtnb
+3-11 m: mmmmsvqmmmcxkmm
+15-16 f: fffgffffffffkffqff
+3-4 s: hvgssssb
+4-5 s: jslss
+10-19 v: vvvvvvvvnvvvvvvvvvg
+1-3 c: cmcqkckzzsczn
+2-3 j: jjhm
+10-11 j: jjjjmvjjjxkjj
+2-3 r: rqrrtztrbpk
+6-7 d: dddddrd
+6-16 n: dzqnnsnmssnjznnnnnv
+7-11 f: ffqrffhfffftfffff
+2-8 z: zzzzkzddzzb
+2-7 j: nhjjjjjhjs
+7-10 l: xlltwhllrd
+10-12 w: nwrsqlwhqkcl
+15-16 w: wwwwwwwwwwwwwwwl
+11-12 h: hhhhhhhhphmh
+1-6 v: czvvwkgbvmjxvvgv
+3-14 p: pppppppppqpppxpppprp
+2-6 d: ddqrdnddddddddnddd
+8-18 j: gjghwxsjfpcfqmjxqjc
+5-11 g: ftggkgggbvsggb
+1-4 q: bqqqqqqqqqqz
+1-12 x: bgxxxxxmxxxx
+3-5 l: lllll
+3-7 c: zwccrrnfw
+3-4 q: sqdqsr
+3-4 g: gggv
+9-10 h: wnpkttckhh
+3-4 t: ttgp
+3-6 g: glcgtgg
+5-6 w: wwxxnwmpgkppwnwwj
+3-4 f: ffzf
+5-7 z: zdzzfvv
+4-6 p: ppmprgpmcdkcp
+11-12 m: mmmmmmmmmmcm
+2-7 z: zzzzwzz
+7-8 m: mmmmmmms
+4-15 z: zcsnzzfczzmczdzjdzz
+6-7 k: rkrlklk
+7-8 v: dtklkrqhv
+4-5 x: wprlxxhxbjsfx
+4-7 j: cvrjjbxxjfwjjjd
+1-2 g: ggsb
+5-7 k: kkrfgvkqxk
+3-5 q: qqpqq
+7-12 c: cccccxmncnvzbcc
+2-6 h: mhlhgl
+7-8 l: lllllzllbfl
+1-6 f: xnfssk
+12-13 d: dddddddddddgd
+3-7 p: ppkppppg
+8-11 j: mjfwjzfpjgjtnnqh
+9-10 c: qtjcccccjcfclscc
+10-12 b: bbbbbbpbbbbbcb
+1-3 p: rfppppc
+2-5 j: wjjbkbm
+14-15 k: zkkkkkkkkkkkkvk
+4-10 v: jkjslhtdvvtprslsr
+4-10 s: sklrpnszsswls
+8-11 k: dktkkkkkkkzkktq
+10-16 v: rndbqtdxwtkvhvgvhkg
+1-3 w: swwm
+7-8 z: zzpzbzjzz
+2-17 f: hfxrbqffmfdrzfzgsvmq
+1-4 c: cqclc
+5-10 x: xzxxxxxxkx
+1-3 x: xdspcrljk
+13-14 g: kwwbqcmwfwhrgzlg
+7-10 z: xpsxjczspcflhbjk
+6-12 m: sxgpgmbdmvksfpmqcjx
+9-11 c: ccncctcfcvpccxc
+9-11 t: ttxttttwttb
+2-13 x: xxdvxmxxxnxxzx
+17-18 n: nncnnnnnnnnnnnrnvn
+5-12 j: jpjzjpjjjsphjtj
+9-14 n: znnnnnnnnnnvsnnn
+3-4 v: vfdvxwlv
+2-18 w: mwfpnzwlvwmxgsprvhp
+11-13 b: bblbbbbbbbcbbrlc
+1-12 l: llllllrlhspdl
+4-6 p: pphhpp
+5-7 r: rffrwrrqzrzcv
+7-10 z: hfzzzzzzzz
+17-18 q: qqqqqqqqlqqqqqbqqqq
+9-14 s: ssstsjssbsgsss
+12-16 w: wwwwwwwwwwwwwwwgw
+1-4 h: bhhh
+1-2 g: ggggqggrn
+10-12 p: dzpzvvwppphfpl
+3-4 w: wnwp
+2-17 k: pdkknkhkskhndkvkkgwk
+10-13 w: wwwwwwwwzwwwnzw
+5-6 t: crrgctktdmtttldhdlmt
+9-11 h: hhhhhhhhthchhhhh
+2-4 k: jktxzmhhmxjmtkkbphpk
+6-9 g: ggggghggqg
+1-5 j: xjjcj
+1-5 p: xpwnp
+1-11 q: qqqqjqhqqjf
+8-16 p: pppppppnppkpppch
+1-3 k: kkkk
+4-11 s: sssbsslswss
+6-10 s: sfkssshksrsq
+2-4 v: mnvv
+5-6 l: llllllllllll
+3-5 n: nznnn
+4-5 l: nllzwml
+3-5 w: rwwqv
+4-6 x: xxbxvwxdxgbxgx
+10-16 w: wwwwswwwwwwwwwlwqw
+10-12 d: dddddddddddfd
+7-9 q: qwlqzqqsvqq
+5-7 p: fpzpkplppp
+4-11 n: xfnxfjhxvxnnzc
+3-4 x: qfxx
+18-19 g: gggqggdggggggggggmgg
+13-15 c: cccccccccccczcc
+11-12 v: qvvnvvvzcvhtvctvtb
+3-15 d: dpdgmdnfsdbgdddbdmcd
+9-13 j: jjjjcjjprjjjjj
+3-9 t: qtvttxtxtngnhdt
+12-13 d: ddddddddzdddcv
+4-8 h: hhhhhhhbhh
+2-3 x: xrxc
+2-10 l: lmlllllllll
+7-8 d: dddddddrdd
+11-13 c: ccccccccccccd
+1-3 p: pzppmvp
+4-8 b: bjbbvbbzbbbbbqbxxf
+4-5 p: hcprp
+5-9 m: mmmmvmgmmmmj
+2-8 z: zzfzxjfz
+16-17 z: kzzrdzzzwzzzzzzznzzz
+3-4 d: gddsd
+1-9 m: mmkmxmmmjh
+14-15 f: fffffffffffsfqff
+10-11 w: wwwwwwwwwhw
+5-6 q: nqcqqspqq
+2-4 b: bbbj
+8-9 l: llvnqlllwsll
+6-7 t: wttttttt
+9-10 n: nnhnnnnnjnn
+1-2 g: gdgg
+7-8 v: vmvvvvvxv
+8-13 v: vvvvvvvwgvvvvx
+6-7 m: smmfjfmscmpmmp
+3-5 m: mmhbmm
+3-4 t: tttft
+5-12 l: xslklnmkpmbl
+19-20 h: hhhhhhhhhhhhhhhhhhht
+4-8 f: ffffffhlf
+1-3 k: khkg
+15-16 s: sssssssssssssssb
+7-10 j: jzjjjjjjjw
+5-7 w: bszqxhws
+7-8 l: tknllgzl
+10-12 g: gggggggggmggg
+2-4 s: sgns
+11-17 h: bqrhkhhhjhswbhzhkhh
+8-15 d: gdddhdddddgjddddwdd
+8-12 s: gssbjtdsssjtsw
+1-3 p: pfppp
+2-4 t: tttw
+5-10 w: zzcwwwwwwkwwwqws
+1-7 c: ccrmhdchwbr
+7-11 g: xzgnggggrggrg
M 2020/package.lisp => 2020/package.lisp +3 -1
@@ 2,4 2,6 @@
(:use :cl)
(:export
:is-it-2020?-part-1
- :is-it-2020?-part-2))
+ :is-it-2020?-part-2
+ :count-valid-passwords-part-1
+ :count-valid-passwords-part-2))
M 2020/tests/2020-tests.lisp => 2020/tests/2020-tests.lisp +9 -0
@@ 7,3 7,12 @@
(deftest day1-part-2
(testing "Day one part 2 should return correct number"
(ok (= (is-it-2020?-part-2) 272423970))))
+
+
+(deftest day2-part-1
+ (testing "Day two part 1 should return correct number"
+ (ok (= (count-valid-passwords-part-1) 645))))
+
+(deftest day2-part-2
+ (testing "Day two part 2 should return correct number"
+ (ok (= (count-valid-passwords-part-2) 737))))
A 2020/utils.lisp => 2020/utils.lisp +4 -0
@@ 0,0 1,4 @@
+(in-package #:advent-2020)
+
+(defun slurp (filename)
+ (uiop:read-file-lines filename))
M advent.asd => advent.asd +3 -1
@@ 16,8 16,10 @@
(:file "day8")))))
(:module "2020"
:components ((:file "package")
+ (:file "utils")
(:module "days"
- :components ((:file "day1"))))))
+ :components ((:file "day1")
+ (:file "day2"))))))
:in-order-to ((test-op (test-op "advent/tests"))))
(asdf:defsystem :advent/tests