From 7d95539e665758162575fc827a7ec2fa8e7f3022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Mon, 7 Dec 2020 20:08:39 +0100 Subject: [PATCH] day7 --- data/day7/input | 594 ++++++++++++++++++++++++++++++++++++++++++++++++ src/bin/day7.rs | 123 ++++++++++ 2 files changed, 717 insertions(+) create mode 100644 data/day7/input create mode 100644 src/bin/day7.rs diff --git a/data/day7/input b/data/day7/input new file mode 100644 index 0000000..79b111b --- /dev/null +++ b/data/day7/input @@ -0,0 +1,594 @@ +light chartreuse bags contain 1 mirrored yellow bag, 2 vibrant violet bags. +dotted silver bags contain 2 dotted orange bags, 3 bright fuchsia bags, 5 bright tomato bags, 3 faded turquoise bags. +plaid indigo bags contain 1 pale violet bag, 4 mirrored violet bags. +faded turquoise bags contain 5 faded lavender bags. +striped yellow bags contain 5 vibrant black bags, 1 mirrored gold bag. +dull tan bags contain 1 vibrant aqua bag. +striped brown bags contain 1 vibrant orange bag, 1 posh bronze bag, 4 dim purple bags. +bright teal bags contain 3 muted cyan bags, 2 drab white bags, 1 drab gray bag. +wavy tan bags contain 4 wavy tomato bags, 1 dim tan bag. +light lavender bags contain 1 dotted black bag, 1 wavy maroon bag, 5 pale white bags, 1 clear tan bag. +dull orange bags contain 5 bright brown bags, 1 muted gold bag, 4 vibrant black bags, 4 posh bronze bags. +posh cyan bags contain 2 mirrored tomato bags, 5 light salmon bags, 1 faded brown bag, 4 vibrant red bags. +dark lavender bags contain 2 faded purple bags. +dark white bags contain 5 muted green bags. +striped olive bags contain 1 muted chartreuse bag. +bright crimson bags contain 3 drab salmon bags, 1 faded plum bag, 4 shiny brown bags, 5 pale orange bags. +dark tomato bags contain 5 dim aqua bags. +light olive bags contain 2 drab blue bags, 1 plaid purple bag. +muted gray bags contain 1 mirrored plum bag. +bright salmon bags contain 3 striped plum bags, 1 dull silver bag, 4 striped indigo bags, 4 striped cyan bags. +wavy gold bags contain 3 drab tomato bags, 5 pale gold bags, 1 plaid tan bag, 5 vibrant gold bags. +muted fuchsia bags contain 3 vibrant plum bags, 1 clear chartreuse bag, 1 pale white bag. +light purple bags contain 5 vibrant olive bags, 4 bright maroon bags, 3 posh tomato bags. +vibrant gray bags contain 5 shiny silver bags. +vibrant beige bags contain 2 pale crimson bags, 5 pale olive bags, 4 posh yellow bags, 3 dotted orange bags. +drab beige bags contain 3 faded gold bags, 5 mirrored fuchsia bags. +light white bags contain 1 vibrant fuchsia bag, 3 posh tomato bags, 4 muted chartreuse bags. +posh lavender bags contain 3 dim fuchsia bags, 2 light violet bags, 3 wavy aqua bags, 5 vibrant lime bags. +vibrant fuchsia bags contain 2 wavy tomato bags, 3 plaid purple bags. +bright fuchsia bags contain 1 faded tomato bag, 4 bright salmon bags, 2 bright red bags. +dim bronze bags contain 5 drab blue bags. +wavy brown bags contain 3 dotted crimson bags. +striped plum bags contain 1 bright tomato bag. +posh coral bags contain 1 mirrored gray bag, 1 posh silver bag. +wavy teal bags contain 5 dark bronze bags. +posh crimson bags contain 3 bright tomato bags, 3 wavy violet bags, 1 striped olive bag. +dark beige bags contain 2 drab turquoise bags. +dull green bags contain 2 vibrant purple bags, 5 dark red bags. +wavy violet bags contain 5 faded lavender bags, 2 faded turquoise bags, 4 shiny brown bags. +wavy crimson bags contain 3 muted lavender bags. +light maroon bags contain 1 bright magenta bag, 5 dim yellow bags, 1 faded violet bag. +muted white bags contain 4 muted purple bags, 2 plaid gray bags, 2 vibrant maroon bags. +striped silver bags contain 4 shiny red bags, 5 vibrant coral bags. +clear chartreuse bags contain 3 pale gold bags. +posh silver bags contain 3 vibrant aqua bags, 5 muted coral bags, 4 drab crimson bags, 4 clear tan bags. +plaid green bags contain 1 striped lavender bag, 2 dim fuchsia bags, 5 vibrant black bags. +muted turquoise bags contain 3 faded green bags, 1 striped silver bag. +faded blue bags contain 3 pale crimson bags. +dull magenta bags contain 2 striped brown bags, 4 posh black bags, 4 dark teal bags. +dotted white bags contain 3 dotted magenta bags, 2 bright lavender bags, 5 drab crimson bags, 5 drab silver bags. +shiny orange bags contain 4 pale violet bags. +vibrant blue bags contain 2 clear yellow bags, 1 muted beige bag. +dull blue bags contain 3 pale violet bags, 3 dotted orange bags. +bright olive bags contain 4 dotted teal bags, 3 dotted violet bags. +faded gray bags contain 3 bright maroon bags, 2 shiny crimson bags, 2 plaid lavender bags. +clear tomato bags contain 1 vibrant white bag, 4 bright gold bags, 3 vibrant chartreuse bags, 1 posh violet bag. +bright indigo bags contain 3 wavy gold bags, 1 vibrant indigo bag, 1 mirrored chartreuse bag. +clear indigo bags contain 1 plaid gray bag, 3 faded gold bags, 2 clear beige bags. +dotted crimson bags contain 2 pale gold bags, 2 vibrant salmon bags, 5 posh maroon bags. +drab red bags contain 3 vibrant chartreuse bags, 5 wavy beige bags, 2 pale olive bags, 2 clear white bags. +clear black bags contain 3 faded chartreuse bags, 2 striped brown bags, 4 wavy crimson bags, 3 pale tomato bags. +shiny bronze bags contain 4 dark tan bags. +posh indigo bags contain 1 clear plum bag, 2 dotted red bags, 1 dull crimson bag, 4 dotted bronze bags. +dark cyan bags contain 3 plaid tan bags, 5 dim bronze bags. +shiny chartreuse bags contain 4 dark tomato bags, 2 striped salmon bags. +dim brown bags contain 1 pale olive bag, 4 posh tomato bags. +faded green bags contain 2 drab violet bags, 5 vibrant gray bags. +dull salmon bags contain 5 muted coral bags, 2 muted brown bags, 2 striped coral bags, 5 dark white bags. +wavy white bags contain 5 muted lime bags, 5 striped purple bags. +dim aqua bags contain 2 striped beige bags, 3 striped silver bags, 1 bright cyan bag, 5 clear blue bags. +dim salmon bags contain 5 mirrored lime bags, 1 vibrant plum bag, 5 mirrored fuchsia bags, 1 shiny gold bag. +dotted fuchsia bags contain 4 striped indigo bags, 4 wavy coral bags. +faded tan bags contain 5 dotted gold bags. +drab white bags contain 3 posh violet bags. +muted teal bags contain 4 dotted purple bags, 5 dark maroon bags, 3 dotted magenta bags, 1 pale beige bag. +dark magenta bags contain 3 posh red bags. +shiny cyan bags contain 3 dull red bags, 1 light coral bag. +plaid blue bags contain 3 shiny gold bags, 3 dull salmon bags, 4 vibrant silver bags, 4 light salmon bags. +dim orange bags contain 5 vibrant salmon bags, 2 dotted teal bags. +vibrant bronze bags contain 5 striped blue bags, 2 clear magenta bags. +faded olive bags contain 2 muted beige bags, 3 wavy beige bags. +dotted lime bags contain 2 mirrored tan bags. +dark silver bags contain 5 vibrant plum bags, 4 shiny gold bags, 3 light crimson bags, 2 dark cyan bags. +mirrored orange bags contain 5 shiny blue bags, 4 faded olive bags, 3 posh gold bags. +clear magenta bags contain 4 pale olive bags. +wavy blue bags contain 4 light gray bags. +pale maroon bags contain 1 dim aqua bag, 3 dotted fuchsia bags, 1 clear brown bag, 1 drab turquoise bag. +muted purple bags contain no other bags. +vibrant plum bags contain 5 wavy beige bags. +mirrored gray bags contain 3 dull plum bags, 5 pale blue bags. +striped lavender bags contain 3 wavy tomato bags, 1 striped tan bag, 5 posh silver bags. +dark violet bags contain 1 muted olive bag, 3 drab crimson bags. +bright tomato bags contain 4 pale violet bags. +posh white bags contain 5 clear white bags, 2 striped plum bags, 1 drab crimson bag, 5 wavy beige bags. +striped bronze bags contain 3 shiny teal bags, 5 bright lavender bags, 5 dark beige bags. +clear beige bags contain 2 mirrored magenta bags, 4 muted olive bags, 4 mirrored violet bags. +striped teal bags contain 5 mirrored cyan bags, 3 posh crimson bags, 4 vibrant tan bags. +bright blue bags contain 2 faded indigo bags, 4 wavy green bags. +striped orange bags contain 4 vibrant coral bags, 5 faded lavender bags, 2 vibrant maroon bags, 2 plaid cyan bags. +dim yellow bags contain 5 pale violet bags, 4 muted plum bags, 5 pale coral bags, 4 pale yellow bags. +dark bronze bags contain 5 posh gray bags. +wavy purple bags contain 5 faded tomato bags, 4 striped green bags, 1 striped tan bag, 5 dotted fuchsia bags. +light fuchsia bags contain 5 shiny lime bags, 1 dotted teal bag, 2 muted brown bags. +muted orange bags contain 3 striped chartreuse bags, 4 dim salmon bags, 2 pale indigo bags. +dotted green bags contain 5 dotted maroon bags, 4 vibrant beige bags, 3 striped beige bags. +wavy gray bags contain 2 mirrored fuchsia bags, 2 mirrored chartreuse bags, 3 mirrored blue bags. +dotted yellow bags contain 4 light tomato bags, 3 dull indigo bags. +light aqua bags contain 2 shiny brown bags, 2 bright coral bags. +muted cyan bags contain 5 faded olive bags, 5 pale white bags, 4 plaid tan bags. +pale tan bags contain 4 bright cyan bags. +vibrant magenta bags contain 3 light magenta bags. +light turquoise bags contain 3 dim bronze bags, 3 faded olive bags, 1 light orange bag, 2 shiny green bags. +light bronze bags contain 2 vibrant black bags, 2 clear indigo bags. +vibrant purple bags contain 3 bright red bags, 3 vibrant violet bags. +vibrant red bags contain 4 mirrored fuchsia bags, 1 drab tomato bag. +mirrored crimson bags contain 1 posh purple bag, 3 dotted magenta bags. +wavy olive bags contain 3 dark fuchsia bags. +pale beige bags contain 5 striped coral bags, 1 shiny violet bag. +posh teal bags contain 5 dull violet bags, 2 drab gold bags, 5 muted chartreuse bags, 1 drab turquoise bag. +faded tomato bags contain 5 mirrored salmon bags, 3 wavy coral bags. +muted salmon bags contain 4 vibrant gray bags. +dim lavender bags contain 4 clear lavender bags, 5 dotted coral bags. +shiny yellow bags contain 3 dim purple bags. +light tan bags contain 5 vibrant plum bags, 3 dim tomato bags. +shiny violet bags contain 1 mirrored salmon bag. +drab black bags contain 2 dark coral bags, 1 muted beige bag, 5 plaid orange bags, 1 dark tan bag. +wavy bronze bags contain 3 wavy lime bags, 3 striped white bags, 1 drab gray bag, 1 light orange bag. +bright green bags contain 1 vibrant gold bag, 2 vibrant tomato bags, 2 dim teal bags. +striped gold bags contain 5 striped purple bags, 1 faded purple bag, 2 dark beige bags, 1 mirrored silver bag. +wavy green bags contain 4 mirrored tan bags, 3 muted cyan bags, 4 plaid turquoise bags, 4 drab gray bags. +striped salmon bags contain 3 light yellow bags. +bright orange bags contain 2 shiny orange bags. +mirrored white bags contain 1 clear fuchsia bag. +striped coral bags contain no other bags. +light magenta bags contain 4 faded gold bags, 1 drab lime bag. +dull tomato bags contain 4 pale indigo bags, 4 pale white bags, 5 wavy silver bags, 3 faded indigo bags. +light black bags contain 5 dark lavender bags, 3 light blue bags, 3 dull turquoise bags. +posh fuchsia bags contain 1 wavy gold bag, 1 vibrant plum bag, 3 posh white bags. +shiny indigo bags contain 3 posh plum bags, 2 pale lime bags, 5 muted blue bags, 4 clear tan bags. +mirrored blue bags contain 3 dark indigo bags, 1 vibrant coral bag, 4 mirrored salmon bags. +pale tomato bags contain 3 plaid purple bags, 1 wavy violet bag. +dull silver bags contain 4 striped beige bags, 2 shiny lime bags, 1 muted olive bag, 5 dull blue bags. +mirrored silver bags contain 2 wavy coral bags, 3 dark lavender bags, 3 dull violet bags. +drab turquoise bags contain 2 dim purple bags, 5 clear white bags, 4 dull brown bags. +drab violet bags contain 1 pale white bag, 1 bright cyan bag. +pale indigo bags contain 4 striped blue bags, 1 plaid turquoise bag, 4 striped beige bags. +shiny fuchsia bags contain 1 striped olive bag, 1 vibrant orange bag, 2 striped indigo bags, 4 vibrant lime bags. +bright maroon bags contain 3 clear chartreuse bags. +shiny tomato bags contain 5 pale gold bags, 5 plaid gold bags, 2 dark white bags. +dotted olive bags contain 4 vibrant silver bags, 1 posh crimson bag. +drab teal bags contain 1 faded indigo bag. +muted plum bags contain 5 mirrored gray bags, 1 wavy maroon bag, 1 mirrored tomato bag, 3 drab crimson bags. +muted violet bags contain 5 drab crimson bags. +dark brown bags contain 1 shiny violet bag, 5 bright coral bags, 4 vibrant plum bags, 3 plaid silver bags. +posh purple bags contain 3 dull silver bags, 2 posh salmon bags, 5 dull chartreuse bags. +light yellow bags contain 5 striped olive bags, 2 mirrored tomato bags, 2 wavy plum bags. +bright silver bags contain 4 pale bronze bags, 2 drab turquoise bags, 2 striped coral bags. +dotted indigo bags contain 2 mirrored brown bags, 5 dim teal bags. +bright lavender bags contain 3 dark indigo bags, 4 wavy brown bags, 3 dotted tomato bags, 5 plaid beige bags. +drab purple bags contain 5 mirrored bronze bags. +clear olive bags contain 3 wavy red bags, 4 muted bronze bags, 2 dotted chartreuse bags. +mirrored coral bags contain 4 shiny salmon bags, 1 light orange bag, 4 faded yellow bags, 5 shiny maroon bags. +clear fuchsia bags contain 4 pale blue bags, 2 light lavender bags, 4 clear blue bags, 2 posh maroon bags. +drab fuchsia bags contain 4 drab bronze bags, 2 shiny bronze bags. +pale blue bags contain 2 dim purple bags, 3 plaid purple bags, 4 vibrant coral bags. +clear violet bags contain 1 muted chartreuse bag. +clear brown bags contain 3 faded chartreuse bags, 5 dotted plum bags, 2 mirrored plum bags, 4 plaid red bags. +muted maroon bags contain 1 muted chartreuse bag, 4 striped silver bags, 1 posh yellow bag, 4 dark indigo bags. +dim olive bags contain 5 clear beige bags, 5 pale blue bags. +bright violet bags contain 3 shiny salmon bags, 2 dull teal bags, 4 shiny blue bags, 2 posh teal bags. +drab green bags contain 5 wavy aqua bags, 5 dark lavender bags, 1 dull tan bag. +dim turquoise bags contain 2 dark brown bags, 3 dotted crimson bags, 3 dull salmon bags. +vibrant teal bags contain 2 dotted coral bags, 5 dim white bags. +posh maroon bags contain 3 muted purple bags, 2 bright tomato bags. +faded aqua bags contain 4 posh white bags, 2 mirrored violet bags. +vibrant violet bags contain 2 vibrant crimson bags, 2 drab crimson bags. +dotted salmon bags contain 3 faded violet bags, 4 clear beige bags, 2 bright coral bags. +dull chartreuse bags contain 1 dotted fuchsia bag, 5 posh black bags, 4 bright green bags. +vibrant orange bags contain 1 shiny green bag, 5 dull blue bags. +mirrored indigo bags contain 2 dull beige bags. +drab lavender bags contain 3 striped lime bags. +bright gold bags contain 5 posh silver bags. +dull fuchsia bags contain 2 striped tomato bags. +light lime bags contain 3 striped orange bags. +wavy magenta bags contain 3 clear fuchsia bags, 4 muted brown bags, 3 plaid lavender bags, 4 clear green bags. +faded beige bags contain 2 mirrored plum bags, 2 light blue bags, 4 dim purple bags, 5 plaid violet bags. +dark plum bags contain 2 shiny red bags, 5 shiny blue bags, 2 striped blue bags, 4 drab gray bags. +wavy turquoise bags contain 1 dim turquoise bag, 5 striped lavender bags, 3 drab aqua bags. +shiny white bags contain 4 shiny violet bags, 1 muted bronze bag, 3 clear tomato bags. +plaid yellow bags contain 4 vibrant indigo bags, 2 light gray bags. +dim crimson bags contain 5 dim brown bags, 3 dim white bags, 1 vibrant silver bag, 3 drab teal bags. +dim tomato bags contain 4 dull silver bags, 5 light gray bags. +wavy cyan bags contain 5 dark chartreuse bags, 1 dark maroon bag, 4 mirrored brown bags, 5 dotted fuchsia bags. +dim green bags contain 5 striped lime bags, 4 bright gold bags, 2 vibrant violet bags, 2 muted beige bags. +striped maroon bags contain 1 mirrored plum bag, 1 drab lavender bag, 5 posh teal bags. +dotted gray bags contain 3 vibrant white bags, 1 pale violet bag. +dotted beige bags contain 2 drab aqua bags. +clear crimson bags contain 2 dim white bags, 2 faded magenta bags, 1 dim tomato bag. +pale olive bags contain 2 posh tomato bags. +posh orange bags contain 3 muted cyan bags, 4 faded turquoise bags. +posh yellow bags contain 2 dotted orange bags, 2 striped crimson bags. +striped black bags contain 5 dark black bags, 2 faded magenta bags, 3 pale lavender bags. +faded orange bags contain 4 bright bronze bags. +pale turquoise bags contain 1 posh maroon bag, 4 faded violet bags, 2 faded lavender bags, 1 vibrant lime bag. +clear gray bags contain 4 posh gray bags, 4 shiny silver bags, 3 vibrant purple bags, 3 faded lavender bags. +shiny olive bags contain 4 vibrant lime bags, 5 faded coral bags. +vibrant maroon bags contain 5 light gray bags. +drab silver bags contain 3 vibrant salmon bags, 5 clear tan bags, 2 light white bags. +posh turquoise bags contain 5 plaid green bags, 2 light bronze bags, 4 shiny turquoise bags, 5 clear gray bags. +mirrored cyan bags contain 3 clear white bags. +shiny silver bags contain 4 vibrant coral bags. +clear plum bags contain 5 muted lavender bags, 5 striped coral bags. +dark crimson bags contain 4 posh violet bags. +muted red bags contain 1 dim maroon bag, 1 bright fuchsia bag, 3 dotted green bags, 3 striped gold bags. +clear lime bags contain 3 plaid cyan bags, 4 dim gray bags, 1 muted violet bag. +faded purple bags contain 3 muted beige bags, 1 posh white bag, 5 drab turquoise bags. +mirrored yellow bags contain 2 striped tan bags. +dim gray bags contain 3 bright green bags, 2 muted black bags, 5 mirrored maroon bags, 3 mirrored violet bags. +mirrored tomato bags contain 5 muted olive bags, 2 mirrored lime bags. +faded coral bags contain 3 bright brown bags, 4 vibrant purple bags, 3 posh coral bags. +wavy fuchsia bags contain 4 dim salmon bags, 4 vibrant violet bags, 5 muted beige bags, 2 dotted black bags. +light plum bags contain 1 wavy black bag. +dark tan bags contain 5 wavy green bags, 4 faded turquoise bags, 2 dark bronze bags, 3 light violet bags. +wavy beige bags contain no other bags. +dotted aqua bags contain 1 mirrored turquoise bag, 4 clear blue bags, 1 dotted teal bag, 3 bright bronze bags. +clear tan bags contain 3 clear gold bags, 3 plaid purple bags, 1 striped indigo bag, 5 bright tomato bags. +dark red bags contain 3 vibrant maroon bags, 3 vibrant fuchsia bags, 4 pale lavender bags, 4 dim purple bags. +dim violet bags contain 1 drab tomato bag, 2 vibrant white bags, 3 faded lavender bags. +dull gray bags contain 3 vibrant black bags. +mirrored aqua bags contain 4 clear fuchsia bags, 1 muted chartreuse bag. +pale violet bags contain no other bags. +faded silver bags contain 1 mirrored lime bag, 5 muted beige bags, 3 mirrored black bags, 1 clear gold bag. +posh tomato bags contain 3 dim purple bags, 1 vibrant maroon bag. +mirrored bronze bags contain 3 mirrored gold bags, 4 faded purple bags, 1 plaid cyan bag, 5 faded gold bags. +light red bags contain 3 muted black bags. +wavy salmon bags contain 1 light white bag, 1 clear white bag, 4 dark maroon bags. +posh lime bags contain 2 drab gold bags. +wavy chartreuse bags contain 4 muted teal bags, 3 plaid salmon bags. +dotted tomato bags contain 2 striped white bags, 4 dark lavender bags. +vibrant crimson bags contain no other bags. +posh violet bags contain 1 shiny lavender bag, 2 striped coral bags, 2 mirrored tan bags. +shiny lime bags contain 5 mirrored lime bags, 1 drab blue bag. +dotted magenta bags contain 5 bright salmon bags. +pale white bags contain 1 faded olive bag, 5 vibrant tomato bags. +muted lime bags contain 3 muted aqua bags. +dotted lavender bags contain 2 dim chartreuse bags, 2 vibrant olive bags. +faded crimson bags contain 4 bright plum bags, 5 dotted cyan bags. +drab tan bags contain 1 dim orange bag, 2 light teal bags, 2 light indigo bags. +pale black bags contain 2 posh silver bags. +dark orange bags contain 3 muted black bags, 2 pale violet bags, 4 faded cyan bags. +mirrored violet bags contain 1 faded olive bag, 3 vibrant crimson bags. +posh plum bags contain 3 vibrant maroon bags. +clear turquoise bags contain 1 dim purple bag. +plaid gray bags contain 1 dotted crimson bag. +pale salmon bags contain 4 vibrant aqua bags, 2 wavy blue bags, 5 striped violet bags. +pale gold bags contain 1 striped coral bag. +bright plum bags contain 5 faded aqua bags. +pale red bags contain 5 dotted silver bags, 3 clear chartreuse bags, 4 vibrant salmon bags. +striped tan bags contain 1 drab crimson bag. +mirrored red bags contain 3 striped gold bags, 1 mirrored gray bag. +bright turquoise bags contain 2 plaid blue bags, 4 clear tomato bags, 1 drab yellow bag, 5 vibrant black bags. +dark maroon bags contain 5 shiny magenta bags, 5 dotted fuchsia bags, 5 dull brown bags, 5 posh violet bags. +plaid chartreuse bags contain 5 drab gold bags, 1 vibrant white bag, 3 muted coral bags, 2 clear plum bags. +posh black bags contain 5 shiny brown bags, 5 posh white bags, 4 dim gray bags. +dotted teal bags contain 1 plaid bronze bag, 2 light violet bags, 1 muted beige bag. +plaid lime bags contain 4 mirrored black bags, 4 muted plum bags, 2 shiny maroon bags, 5 dim beige bags. +dim teal bags contain 2 muted coral bags. +vibrant aqua bags contain no other bags. +dotted turquoise bags contain 3 posh violet bags. +vibrant lime bags contain 5 dark bronze bags, 3 vibrant maroon bags, 5 mirrored cyan bags. +shiny gray bags contain 3 muted coral bags, 2 bright coral bags. +clear white bags contain 1 dim purple bag. +shiny salmon bags contain 5 dull tan bags, 1 posh violet bag, 4 mirrored magenta bags, 5 plaid tan bags. +dark gold bags contain 5 mirrored gray bags, 4 vibrant coral bags. +drab salmon bags contain 1 dull indigo bag. +faded salmon bags contain 2 bright blue bags. +vibrant salmon bags contain 4 muted purple bags, 4 striped plum bags. +dull red bags contain 2 pale white bags. +muted yellow bags contain 3 pale beige bags, 2 dim indigo bags. +bright beige bags contain 1 muted lavender bag, 1 dotted silver bag, 1 shiny bronze bag. +dull gold bags contain 4 posh gold bags. +striped crimson bags contain 5 dull blue bags, 4 bright gold bags, 2 shiny lavender bags. +drab maroon bags contain 1 wavy fuchsia bag. +wavy plum bags contain 4 posh tan bags, 1 muted maroon bag. +bright black bags contain 4 dark white bags, 5 dull maroon bags. +plaid aqua bags contain 3 wavy gray bags, 4 shiny blue bags. +wavy silver bags contain 1 bright tomato bag. +clear orange bags contain 1 dark brown bag, 3 wavy bronze bags, 5 bright tomato bags, 2 faded olive bags. +shiny lavender bags contain 4 dim purple bags. +dull crimson bags contain 5 bright plum bags, 1 pale yellow bag. +vibrant brown bags contain 2 dull tan bags, 1 pale yellow bag, 5 striped orange bags. +striped white bags contain 5 pale orange bags. +light blue bags contain 1 vibrant red bag, 3 bright cyan bags, 5 vibrant brown bags, 5 dim beige bags. +dark green bags contain 4 dotted black bags. +plaid black bags contain 5 dotted chartreuse bags, 1 wavy yellow bag, 4 faded cyan bags, 5 posh orange bags. +shiny turquoise bags contain 5 vibrant tan bags, 1 vibrant salmon bag, 1 muted olive bag. +clear silver bags contain 3 drab crimson bags, 3 bright magenta bags, 5 shiny blue bags, 4 drab lavender bags. +muted chartreuse bags contain 2 mirrored tan bags. +mirrored brown bags contain 5 clear yellow bags, 3 clear violet bags, 1 wavy plum bag. +dull white bags contain 5 shiny blue bags, 2 plaid tan bags, 3 vibrant silver bags, 4 pale orange bags. +clear lavender bags contain 2 posh bronze bags. +light gold bags contain 3 striped cyan bags, 5 dark lime bags. +plaid coral bags contain 1 posh salmon bag, 1 striped purple bag, 4 bright blue bags. +faded magenta bags contain 1 posh yellow bag, 2 bright plum bags. +faded maroon bags contain 2 plaid gray bags. +clear green bags contain 5 vibrant silver bags, 4 shiny gold bags. +mirrored tan bags contain 2 plaid purple bags, 4 dim purple bags, 5 vibrant crimson bags. +striped red bags contain 2 clear salmon bags. +dull aqua bags contain 1 plaid red bag, 3 vibrant aqua bags. +bright coral bags contain 4 muted fuchsia bags, 4 wavy beige bags. +wavy black bags contain 3 drab crimson bags, 3 vibrant white bags, 4 vibrant aqua bags. +dim white bags contain 1 dull olive bag, 5 vibrant white bags. +striped turquoise bags contain 2 drab turquoise bags. +shiny gold bags contain 2 mirrored blue bags, 1 muted brown bag, 3 dim purple bags. +bright gray bags contain 1 faded cyan bag, 3 dark plum bags, 1 light violet bag. +mirrored olive bags contain 5 vibrant gray bags, 1 plaid blue bag, 5 clear black bags, 2 dotted black bags. +posh red bags contain 5 muted olive bags, 2 dotted coral bags, 1 striped crimson bag. +clear teal bags contain 4 bright gold bags, 5 striped gray bags, 2 mirrored lime bags, 4 wavy indigo bags. +faded lime bags contain 4 plaid beige bags. +dull yellow bags contain 1 clear indigo bag, 1 drab beige bag, 2 plaid bronze bags. +muted beige bags contain no other bags. +wavy orange bags contain 3 shiny lime bags, 4 striped gold bags. +drab brown bags contain 1 bright red bag, 1 posh yellow bag, 3 dotted gray bags, 2 plaid green bags. +muted olive bags contain 4 posh maroon bags, 4 bright maroon bags, 3 faded olive bags. +dotted cyan bags contain 5 dotted purple bags, 5 pale olive bags, 5 dull plum bags. +vibrant olive bags contain 2 light violet bags, 2 dim violet bags, 4 mirrored black bags. +pale lime bags contain 4 dark purple bags, 1 shiny chartreuse bag. +dull purple bags contain 1 faded blue bag, 4 dull violet bags, 2 dim bronze bags, 2 vibrant crimson bags. +dotted red bags contain 4 bright magenta bags, 1 mirrored cyan bag, 1 wavy green bag, 4 dotted cyan bags. +vibrant silver bags contain 4 faded purple bags, 3 shiny yellow bags, 4 mirrored tan bags. +dark fuchsia bags contain 3 dark cyan bags. +muted crimson bags contain 3 bright tomato bags, 4 dark gold bags. +dark coral bags contain 3 faded magenta bags. +dull teal bags contain 3 drab turquoise bags, 5 dim salmon bags, 2 striped coral bags. +light brown bags contain 5 bright tomato bags, 4 mirrored salmon bags, 2 vibrant violet bags, 5 dark bronze bags. +bright brown bags contain 3 muted purple bags, 2 vibrant yellow bags, 3 pale fuchsia bags, 3 posh violet bags. +faded bronze bags contain 2 bright bronze bags, 2 dim tomato bags, 3 mirrored beige bags. +dim indigo bags contain 2 vibrant gold bags. +drab cyan bags contain 5 muted orange bags, 4 dotted orange bags, 3 striped tan bags, 5 dull turquoise bags. +mirrored plum bags contain 1 dotted black bag, 2 faded silver bags, 1 plaid red bag. +dull maroon bags contain 5 dark violet bags, 2 bright brown bags, 4 clear blue bags. +light silver bags contain 3 bright blue bags, 1 muted brown bag. +dim blue bags contain 5 dim purple bags, 5 pale orange bags. +clear blue bags contain 2 plaid tan bags, 3 muted chartreuse bags, 2 faded lavender bags. +mirrored salmon bags contain 2 striped coral bags, 2 plaid purple bags. +faded violet bags contain 3 clear gold bags, 2 posh white bags. +light beige bags contain 5 vibrant tan bags, 4 muted lavender bags, 3 plaid bronze bags. +shiny black bags contain 3 vibrant violet bags, 1 wavy brown bag. +dotted plum bags contain 4 faded yellow bags, 5 light lavender bags. +vibrant chartreuse bags contain 1 mirrored fuchsia bag. +striped green bags contain 2 wavy lime bags, 5 mirrored turquoise bags, 2 muted aqua bags, 3 wavy gold bags. +plaid plum bags contain 5 plaid tan bags, 2 pale gold bags, 5 mirrored salmon bags. +dark chartreuse bags contain 1 bright orange bag, 5 bright lavender bags, 2 light black bags. +muted indigo bags contain 2 posh fuchsia bags. +posh tan bags contain 3 dull silver bags, 2 clear tan bags, 4 drab beige bags. +shiny brown bags contain 5 shiny gold bags. +pale orange bags contain 2 striped gray bags, 5 clear beige bags. +pale lavender bags contain 1 shiny lime bag, 1 bright cyan bag. +pale bronze bags contain 2 faded blue bags, 4 pale yellow bags, 5 shiny red bags. +muted bronze bags contain 3 light beige bags, 4 muted fuchsia bags, 5 striped chartreuse bags. +light crimson bags contain 2 faded coral bags. +drab coral bags contain 4 faded black bags, 4 drab white bags, 5 wavy maroon bags, 4 muted violet bags. +vibrant lavender bags contain 2 striped crimson bags. +posh magenta bags contain 1 bright chartreuse bag, 3 drab white bags, 4 dull violet bags. +dim maroon bags contain 1 drab lime bag, 4 faded aqua bags, 5 dark lavender bags. +clear purple bags contain 1 pale lavender bag. +dim magenta bags contain 3 dull violet bags, 4 pale red bags. +plaid red bags contain 5 clear indigo bags. +light gray bags contain 2 dark white bags, 5 posh green bags, 1 wavy silver bag. +plaid beige bags contain 2 dotted brown bags, 2 clear white bags. +faded gold bags contain 2 clear white bags, 1 muted purple bag, 1 striped plum bag. +drab yellow bags contain 3 striped lime bags, 5 muted fuchsia bags, 1 wavy black bag, 3 pale white bags. +dark indigo bags contain 4 striped indigo bags, 4 mirrored violet bags, 3 muted brown bags. +muted black bags contain 1 plaid tan bag, 2 bright tomato bags. +shiny beige bags contain 5 dark bronze bags. +bright cyan bags contain 2 dark lavender bags, 5 striped plum bags, 3 mirrored tan bags, 5 plaid teal bags. +dotted gold bags contain 2 pale gold bags, 1 drab silver bag. +wavy tomato bags contain 4 dotted crimson bags, 4 mirrored lime bags, 2 dim indigo bags. +muted aqua bags contain 3 muted beige bags. +plaid white bags contain 2 bright green bags, 3 mirrored blue bags, 3 dull maroon bags, 2 dotted chartreuse bags. +plaid teal bags contain 1 plaid tan bag, 3 wavy beige bags. +light salmon bags contain 5 faded turquoise bags, 5 muted green bags, 2 plaid bronze bags, 3 plaid indigo bags. +dark aqua bags contain 2 wavy plum bags, 2 dotted red bags, 2 light red bags. +pale aqua bags contain 4 light aqua bags, 4 clear cyan bags, 5 dull tan bags, 5 bright olive bags. +posh green bags contain 5 pale blue bags. +faded chartreuse bags contain 2 shiny red bags. +pale purple bags contain 2 mirrored cyan bags. +striped magenta bags contain 1 muted aqua bag, 1 plaid turquoise bag, 5 dim purple bags, 3 wavy red bags. +plaid crimson bags contain 5 muted brown bags, 5 mirrored tomato bags. +plaid orange bags contain 1 dotted salmon bag, 2 pale aqua bags, 4 shiny tomato bags, 1 dull salmon bag. +faded red bags contain 1 clear tan bag. +plaid fuchsia bags contain 1 dark black bag, 1 dotted teal bag, 2 dark aqua bags, 2 dull bronze bags. +pale crimson bags contain 5 dull brown bags, 3 vibrant coral bags. +muted lavender bags contain 2 posh silver bags, 1 plaid cyan bag. +dull violet bags contain 5 posh coral bags, 5 shiny red bags, 5 drab gold bags, 4 posh white bags. +dull coral bags contain 5 bright lime bags. +posh gold bags contain 1 vibrant violet bag, 1 muted lavender bag. +drab lime bags contain 4 shiny salmon bags, 1 plaid plum bag, 1 wavy tomato bag, 1 wavy red bag. +plaid tan bags contain 3 muted purple bags. +posh chartreuse bags contain 5 clear white bags, 2 dotted violet bags, 5 light teal bags, 5 vibrant gold bags. +faded yellow bags contain 1 muted coral bag, 3 shiny yellow bags, 4 shiny lime bags. +vibrant cyan bags contain 3 muted purple bags, 4 pale tomato bags, 4 vibrant beige bags, 2 muted black bags. +plaid tomato bags contain 3 faded fuchsia bags. +dotted maroon bags contain 4 dull tan bags, 4 plaid cyan bags, 5 bright gold bags, 4 drab blue bags. +drab gray bags contain 4 faded olive bags, 3 vibrant crimson bags. +wavy maroon bags contain 1 wavy red bag, 4 posh white bags, 4 wavy tomato bags. +dull lavender bags contain 2 dim salmon bags, 3 dotted aqua bags, 2 dim turquoise bags, 4 muted gold bags. +dim chartreuse bags contain 4 muted yellow bags, 1 muted violet bag, 2 shiny orange bags, 4 drab salmon bags. +bright red bags contain 1 dull red bag, 1 muted fuchsia bag. +clear yellow bags contain 2 dim violet bags, 5 dim tomato bags, 4 pale indigo bags. +wavy aqua bags contain 5 shiny red bags, 1 pale gold bag, 2 mirrored blue bags, 4 dull violet bags. +bright lime bags contain 5 posh tomato bags, 2 faded fuchsia bags, 4 posh yellow bags, 5 dull brown bags. +bright chartreuse bags contain 2 posh fuchsia bags, 1 posh yellow bag, 3 dotted chartreuse bags. +mirrored magenta bags contain 1 shiny teal bag, 1 mirrored maroon bag, 3 drab turquoise bags. +pale yellow bags contain 3 plaid purple bags, 2 vibrant black bags. +dark teal bags contain 4 clear salmon bags, 3 mirrored blue bags, 3 pale blue bags. +clear coral bags contain 2 dark indigo bags, 5 dark plum bags, 5 plaid beige bags. +muted brown bags contain no other bags. +dotted purple bags contain 1 posh bronze bag, 1 vibrant chartreuse bag, 5 striped indigo bags. +plaid violet bags contain 2 posh white bags. +dull turquoise bags contain 1 drab red bag, 5 muted aqua bags, 4 drab violet bags, 2 muted purple bags. +light coral bags contain 3 posh bronze bags, 5 vibrant silver bags. +striped lime bags contain 5 muted olive bags. +pale cyan bags contain 2 mirrored tomato bags, 3 dull red bags, 4 striped indigo bags, 2 dark maroon bags. +muted tomato bags contain 2 posh tomato bags, 3 dim teal bags, 4 drab indigo bags. +shiny coral bags contain 4 mirrored beige bags, 1 muted magenta bag, 2 light green bags, 3 mirrored olive bags. +vibrant black bags contain 2 dotted black bags, 4 dull red bags, 2 light lavender bags. +vibrant green bags contain 5 mirrored bronze bags, 5 dotted teal bags, 5 plaid tomato bags, 2 muted purple bags. +clear aqua bags contain 2 plaid teal bags, 3 posh tomato bags, 3 light bronze bags, 3 posh teal bags. +dotted brown bags contain 5 pale white bags, 2 dim indigo bags, 1 shiny yellow bag, 3 plaid gray bags. +striped beige bags contain 3 striped indigo bags, 4 faded lavender bags, 1 drab crimson bag, 1 vibrant tomato bag. +plaid cyan bags contain 4 shiny gold bags, 1 wavy beige bag. +mirrored gold bags contain 3 vibrant coral bags. +plaid turquoise bags contain 5 striped coral bags. +pale magenta bags contain 1 drab tomato bag, 4 dark chartreuse bags, 4 striped tan bags, 5 vibrant white bags. +pale green bags contain 4 shiny tan bags. +faded indigo bags contain 3 bright plum bags, 3 posh teal bags. +dim red bags contain 2 striped silver bags, 4 dim blue bags. +bright tan bags contain 1 vibrant cyan bag, 5 mirrored magenta bags. +dotted violet bags contain 1 bright bronze bag, 4 dotted silver bags, 1 drab silver bag, 4 plaid indigo bags. +dim black bags contain 1 dark magenta bag, 4 vibrant tan bags, 5 light magenta bags. +bright aqua bags contain 2 muted gold bags, 3 dotted gray bags. +plaid salmon bags contain 2 vibrant gold bags, 2 bright maroon bags, 2 shiny lime bags, 2 mirrored salmon bags. +drab chartreuse bags contain 3 shiny crimson bags. +shiny magenta bags contain 2 striped plum bags. +dotted blue bags contain 2 muted salmon bags. +bright white bags contain 2 pale olive bags, 2 dotted black bags. +clear red bags contain 2 bright chartreuse bags, 5 striped magenta bags. +mirrored chartreuse bags contain 2 vibrant crimson bags, 2 drab blue bags. +striped fuchsia bags contain 2 muted salmon bags, 2 posh bronze bags. +posh blue bags contain 2 faded bronze bags, 4 striped purple bags. +mirrored fuchsia bags contain 5 mirrored tan bags, 4 muted coral bags. +posh beige bags contain 5 drab violet bags. +striped violet bags contain 2 wavy plum bags, 1 pale crimson bag. +vibrant turquoise bags contain 4 plaid gray bags. +dotted bronze bags contain 2 drab maroon bags, 4 posh plum bags, 2 dotted brown bags, 5 mirrored cyan bags. +dim cyan bags contain 2 pale orange bags, 2 posh white bags, 3 plaid salmon bags. +vibrant gold bags contain 1 bright coral bag, 2 mirrored black bags. +posh bronze bags contain 3 bright green bags, 5 faded turquoise bags, 5 plaid plum bags, 3 dull tan bags. +pale chartreuse bags contain 3 vibrant gray bags, 5 posh coral bags, 5 bright white bags, 4 faded white bags. +drab crimson bags contain 2 wavy beige bags, 3 striped coral bags, 1 dim purple bag, 3 pale gold bags. +mirrored lime bags contain 5 striped coral bags, 2 wavy beige bags. +shiny green bags contain 4 plaid silver bags, 2 dim teal bags, 2 dotted teal bags, 2 drab turquoise bags. +light tomato bags contain 4 dark gold bags. +mirrored beige bags contain 5 posh gray bags, 5 dull olive bags, 3 drab crimson bags, 4 striped silver bags. +vibrant indigo bags contain 2 pale brown bags, 2 vibrant tomato bags, 3 dim violet bags. +dim plum bags contain 1 plaid aqua bag, 1 wavy plum bag, 1 wavy aqua bag. +light indigo bags contain 4 mirrored purple bags. +faded brown bags contain 2 dim gold bags. +dim gold bags contain 4 dotted purple bags, 5 dotted black bags, 4 vibrant beige bags, 4 clear magenta bags. +clear cyan bags contain 1 mirrored blue bag, 5 clear gray bags. +dark yellow bags contain 3 dull violet bags, 3 dotted crimson bags, 1 dark bronze bag, 3 vibrant tomato bags. +plaid silver bags contain 5 drab gray bags. +vibrant yellow bags contain 5 plaid teal bags, 1 shiny silver bag, 1 mirrored black bag. +dull olive bags contain 1 dark bronze bag, 5 wavy green bags, 2 muted cyan bags. +plaid brown bags contain 3 drab indigo bags. +faded cyan bags contain 3 light lavender bags. +drab orange bags contain 5 plaid teal bags, 1 clear fuchsia bag. +muted tan bags contain 4 faded bronze bags, 4 vibrant green bags. +dull cyan bags contain 5 striped maroon bags, 2 dim plum bags. +wavy red bags contain 3 mirrored fuchsia bags, 5 vibrant salmon bags. +wavy lime bags contain 5 faded lavender bags, 1 posh maroon bag. +dotted tan bags contain 2 shiny teal bags, 2 plaid gray bags, 2 pale silver bags, 3 dim violet bags. +clear salmon bags contain 4 striped white bags, 3 light coral bags, 1 mirrored white bag, 5 dotted silver bags. +dark purple bags contain 1 shiny lime bag, 3 dull salmon bags. +dim purple bags contain 5 wavy beige bags, 5 vibrant aqua bags, 5 muted purple bags. +striped gray bags contain 5 muted lavender bags, 1 clear blue bag. +bright yellow bags contain 4 bright fuchsia bags, 3 drab brown bags, 5 shiny lime bags. +light teal bags contain 5 faded olive bags. +wavy yellow bags contain 2 striped cyan bags, 5 dim indigo bags. +vibrant tomato bags contain 2 shiny violet bags, 2 mirrored blue bags, 1 pale violet bag, 2 faded olive bags. +pale silver bags contain 2 dotted magenta bags, 2 mirrored salmon bags, 2 dim blue bags. +mirrored lavender bags contain 3 pale teal bags, 2 posh gray bags. +striped chartreuse bags contain 3 plaid bronze bags. +dotted chartreuse bags contain 1 pale white bag, 1 striped tan bag, 1 striped beige bag, 1 dull brown bag. +muted silver bags contain 2 shiny tan bags, 5 mirrored red bags, 3 drab brown bags. +clear maroon bags contain 1 shiny gray bag, 4 posh purple bags, 5 pale silver bags. +light cyan bags contain 3 vibrant yellow bags. +plaid magenta bags contain 3 bright olive bags, 2 faded violet bags, 1 bright salmon bag. +drab gold bags contain 1 dull blue bag, 5 mirrored gold bags, 3 striped cyan bags, 3 mirrored cyan bags. +light green bags contain 3 dotted brown bags. +dim silver bags contain 2 pale cyan bags, 3 muted gold bags, 2 faded fuchsia bags. +faded black bags contain 5 dim orange bags, 2 shiny green bags, 2 faded cyan bags, 3 dull yellow bags. +bright bronze bags contain 5 plaid indigo bags. +light orange bags contain 4 wavy beige bags, 5 mirrored blue bags, 5 faded turquoise bags. +dark black bags contain 1 posh maroon bag, 1 faded turquoise bag, 2 drab violet bags, 4 mirrored white bags. +dark gray bags contain 3 dotted coral bags, 3 plaid bronze bags. +shiny aqua bags contain 1 muted coral bag. +striped aqua bags contain 2 posh bronze bags. +dull plum bags contain 4 drab gray bags, 5 posh maroon bags. +posh salmon bags contain 2 mirrored bronze bags, 5 plaid aqua bags. +muted blue bags contain 1 drab yellow bag. +dim lime bags contain 4 plaid teal bags, 5 dotted orange bags, 5 wavy silver bags, 3 muted purple bags. +striped cyan bags contain 1 mirrored chartreuse bag. +dull beige bags contain 3 drab red bags, 4 vibrant olive bags. +wavy indigo bags contain 4 pale orange bags, 1 vibrant salmon bag, 5 wavy red bags, 2 plaid indigo bags. +drab tomato bags contain 3 clear gold bags. +shiny crimson bags contain 2 vibrant lime bags, 5 shiny lavender bags, 3 dark purple bags, 3 light beige bags. +bright magenta bags contain 4 striped gray bags, 5 dim cyan bags. +plaid maroon bags contain 1 bright magenta bag, 2 dark olive bags. +faded white bags contain 2 faded turquoise bags. +pale plum bags contain 3 clear beige bags, 1 mirrored violet bag. +dim fuchsia bags contain 1 posh maroon bag, 1 dull tan bag. +dark olive bags contain 4 clear chartreuse bags, 5 light cyan bags, 5 striped magenta bags. +dull lime bags contain 1 striped lavender bag, 1 shiny lavender bag, 2 faded cyan bags. +faded fuchsia bags contain 4 wavy aqua bags, 3 dark brown bags, 1 pale orange bag, 3 striped indigo bags. +posh olive bags contain 3 drab maroon bags, 1 vibrant white bag, 2 wavy lime bags, 5 drab purple bags. +dull black bags contain 4 posh tomato bags, 4 wavy aqua bags, 2 dull tomato bags, 2 clear orange bags. +striped blue bags contain 5 pale crimson bags, 5 clear chartreuse bags. +shiny blue bags contain 1 plaid tan bag, 1 plaid silver bag. +drab bronze bags contain 5 faded fuchsia bags. +posh aqua bags contain 3 dull turquoise bags, 5 dim olive bags. +plaid lavender bags contain 5 mirrored red bags, 1 striped salmon bag, 2 mirrored turquoise bags, 4 dotted cyan bags. +shiny purple bags contain 1 vibrant coral bag, 1 striped blue bag. +mirrored purple bags contain 3 plaid teal bags. +vibrant coral bags contain 1 striped coral bag, 4 pale gold bags. +drab blue bags contain 4 drab gray bags, 4 vibrant coral bags, 1 plaid teal bag. +mirrored green bags contain 2 dull brown bags, 1 faded white bag. +dim beige bags contain 3 clear blue bags, 1 shiny magenta bag. +striped tomato bags contain 4 vibrant silver bags, 2 bright yellow bags. +clear bronze bags contain 5 striped coral bags, 3 wavy green bags, 1 bright violet bag. +shiny teal bags contain 1 drab white bag. +faded lavender bags contain 5 dim teal bags, 2 faded olive bags, 2 dim purple bags, 2 pale gold bags. +posh gray bags contain 2 mirrored tan bags. +pale brown bags contain 5 dull tan bags, 2 posh tomato bags. +shiny plum bags contain 2 mirrored blue bags, 5 dark cyan bags, 2 dark teal bags. +wavy lavender bags contain 1 wavy gold bag, 2 wavy maroon bags, 2 dark black bags. +shiny tan bags contain 3 bright bronze bags, 1 posh fuchsia bag, 1 dark maroon bag, 4 wavy salmon bags. +dim coral bags contain 3 faded indigo bags, 5 clear white bags. +mirrored turquoise bags contain 4 vibrant coral bags, 4 pale gold bags, 1 clear blue bag. +muted coral bags contain no other bags. +drab plum bags contain 4 drab gray bags, 4 dotted green bags, 2 bright gray bags. +muted gold bags contain 3 shiny red bags, 5 light white bags, 3 mirrored maroon bags. +light violet bags contain 1 plaid tan bag, 2 plaid turquoise bags. +dotted coral bags contain 4 dark crimson bags, 3 muted plum bags, 2 vibrant black bags, 4 drab gray bags. +pale fuchsia bags contain 3 dark brown bags. +dark turquoise bags contain 3 plaid teal bags, 5 dull orange bags. +dark blue bags contain 4 drab silver bags, 2 shiny brown bags. +muted green bags contain 1 mirrored violet bag, 3 posh silver bags, 2 bright coral bags, 4 clear chartreuse bags. +posh brown bags contain 2 mirrored turquoise bags. +vibrant tan bags contain 3 drab gray bags. +dull indigo bags contain 1 dim tomato bag, 3 pale brown bags. +pale teal bags contain 3 light beige bags, 1 plaid indigo bag, 3 striped tan bags, 5 vibrant white bags. +striped purple bags contain 2 drab white bags. +pale coral bags contain 3 plaid teal bags. +clear gold bags contain 1 muted purple bag, 4 muted coral bags. +faded teal bags contain 1 pale tan bag, 4 dark indigo bags, 1 posh olive bag. +dotted orange bags contain 5 shiny brown bags, 3 striped plum bags, 3 plaid silver bags. +plaid olive bags contain 1 posh white bag, 2 striped bronze bags, 2 dark gold bags, 3 plaid teal bags. +dark lime bags contain 4 mirrored gray bags, 2 pale aqua bags. +mirrored maroon bags contain 5 muted beige bags. +shiny red bags contain 5 posh silver bags, 5 shiny blue bags. +drab magenta bags contain 4 muted plum bags, 4 light yellow bags. +plaid purple bags contain no other bags. +drab indigo bags contain 1 dull blue bag, 3 wavy maroon bags, 5 pale gold bags, 3 pale crimson bags. +vibrant white bags contain 1 dim salmon bag. +mirrored teal bags contain 4 dotted chartreuse bags, 4 dim brown bags, 5 striped yellow bags. +plaid gold bags contain 2 posh crimson bags, 5 muted green bags, 5 muted salmon bags, 1 pale plum bag. +striped indigo bags contain 2 muted beige bags, 4 mirrored fuchsia bags. +bright purple bags contain 4 dim violet bags. +dark salmon bags contain 2 clear silver bags, 5 wavy fuchsia bags, 5 bright salmon bags. +muted magenta bags contain 5 bright bronze bags, 1 dark red bag, 4 faded fuchsia bags. +drab olive bags contain 1 dim gold bag, 5 clear gold bags, 4 muted white bags. +mirrored black bags contain 4 dim teal bags. +dull bronze bags contain 3 dull white bags, 1 striped yellow bag, 1 striped crimson bag, 1 pale teal bag. +dotted black bags contain 3 faded purple bags, 3 vibrant coral bags, 2 posh silver bags, 5 vibrant aqua bags. +drab aqua bags contain 1 striped lavender bag, 5 shiny lavender bags. +shiny maroon bags contain 5 posh crimson bags, 4 drab blue bags, 1 pale black bag. +faded plum bags contain 2 posh tomato bags, 1 vibrant fuchsia bag, 2 faded black bags. +wavy coral bags contain 5 shiny gold bags. +dull brown bags contain 4 mirrored tan bags. +pale gray bags contain 5 dim maroon bags. +dim tan bags contain 5 clear blue bags, 1 wavy bronze bag. +plaid bronze bags contain 4 bright coral bags, 1 dotted crimson bag, 1 mirrored black bag. diff --git a/src/bin/day7.rs b/src/bin/day7.rs new file mode 100644 index 0000000..0c5a39a --- /dev/null +++ b/src/bin/day7.rs @@ -0,0 +1,123 @@ +use std::collections::{HashMap, HashSet, VecDeque}; + +const INPUT: &str = include_str!("../../data/day7/input"); + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +struct BagId(usize); + +#[derive(Clone, Debug)] +struct Bag { + name: String, + contained_by: HashMap, + contains: HashMap, + contained_bags: Option, +} + +impl Bag { + fn new(bag: &str) -> Self { + Self { + name: bag.into(), + contained_by: HashMap::new(), + contains: HashMap::new(), + contained_bags: None, + } + } +} + +#[derive(Clone, Debug)] +struct Bags { + name_to_id: HashMap, + bags: Vec, +} + +impl Bags { + fn get_bag_id(&mut self, bag: &str) -> BagId { + let bags = &mut self.bags; // for access in closure + *self.name_to_id.entry(bag.to_string()).or_insert_with(|| { + let id = BagId(bags.len()); + bags.push(Bag::new(bag)); + id + }) + } + + fn add_bag_spec(&mut self, bag: &str, contains: &[(&str, usize)]) { + let bag_id = self.get_bag_id(bag); + let contains: HashMap = contains.into_iter().map(|(name, amount)| { + (self.get_bag_id(name), *amount) + }).collect(); + for (&id, &amount) in &contains { + assert!(amount > 0); + self.bags[id.0].contained_by.insert(bag_id, amount); + } + let bag = &mut self.bags[bag_id.0]; + assert!(bag.contains.is_empty()); + bag.contains = contains; + } + + fn add_bag_spec_str(&mut self, line: &str) { + use std::convert::TryInto; + + let line = line.trim().strip_suffix(".").expect("need trailing dot"); + let [bag_name, specs]: [&str; 2] = line.splitn(2, " bags contain ").collect::>().try_into().expect("invalid line"); + let specs = if specs != "no other bags" { + specs.split(", ").map(|spec| { + if let Some(spec) = spec.strip_suffix(" bag") { + let spec = spec.strip_prefix("1 ").expect("singular bag requires amount 1"); + (spec, 1) + } else { + let spec = spec.strip_suffix(" bags").expect("either singular or plural required"); + let [amount, spec]: [&str; 2] = spec.splitn(2, " ").collect::>().try_into().expect("invalid spec"); + (spec, amount.parse::().unwrap()) + } + }).collect::>() + } else { + Vec::new() + }; + self.add_bag_spec(bag_name, &specs); + } + + fn parse(data: &str) -> Self { + let mut this = Self { + name_to_id: HashMap::new(), + bags: Vec::new(), + }; + for line in data.lines() { + this.add_bag_spec_str(line) + } + this + } + + fn find_bag(&self, name: &str) -> Option { + self.name_to_id.get(name).cloned() + } + + fn contained_bags(&mut self, bag: BagId) -> u64 { + if let Some(n) = self.bags[bag.0].contained_bags { + return n; + } + let contains = self.bags[bag.0].contains.clone(); + let n = contains.into_iter().map(|(inner_bag, amount)| { + (amount as u64) * (self.contained_bags(inner_bag) + 1) + }).sum::(); + self.bags[bag.0].contained_bags = Some(n); + n + } +} + +fn main() { + let mut bags = Bags::parse(INPUT); + let shiny_gold = bags.find_bag("shiny gold").unwrap(); + + let mut walk = VecDeque::new(); + let mut contain_shiny_gold = HashSet::new(); + walk.push_back(shiny_gold); + while let Some(bag_id) = walk.pop_front() { + if contain_shiny_gold.insert(bag_id) { + for contains in bags.bags[bag_id.0].contained_by.keys() { + walk.push_back(*contains); + } + } + } + println!("Bags containing shiny gold: {}", contain_shiny_gold.len() - 1); + println!("shiny gold contains: {}", bags.contained_bags(shiny_gold)); +}