From aae15ebf28c75b6a0834b4859ff48401da0264d3 Mon Sep 17 00:00:00 2001 From: Thomas Ruggeri Date: Tue, 31 Dec 2024 14:21:12 -0800 Subject: [PATCH] feat: Solving day 19 --- docs/day19.md | 49 +++++ src/day19/day19.go | 95 +++++++++ src/day19/day19_test.go | 441 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 585 insertions(+) create mode 100644 docs/day19.md create mode 100644 src/day19/day19.go create mode 100644 src/day19/day19_test.go diff --git a/docs/day19.md b/docs/day19.md new file mode 100644 index 0000000..10aa005 --- /dev/null +++ b/docs/day19.md @@ -0,0 +1,49 @@ +--- +url: "https://adventofcode.com/2024/day/19" +--- + +## Day 19: Linen Layout + +Today, The Historians take you up to the hot springs on Gear Island! Very suspiciously, absolutely nothing goes wrong as they begin their careful search of the vast field of helixes. + +Could this finally be your chance to visit the onsen next door? Only one way to find out. + +After a brief conversation with the reception staff at the onsen front desk, you discover that you don't have the right kind of money to pay the admission fee. However, before you can leave, the staff get your attention. Apparently, they've heard about how you helped at the hot springs, and they're willing to make a deal: if you can simply help them arrange their towels, they'll let you in for free! + +Every towel at this onsen is marked with a pattern of colored stripes. There are only a few patterns, but for any particular pattern, the staff can get you as many towels with that pattern as you need. Each stripe can be white (`w`), blue (`u`), black (`b`), red (`r`), or green (`g`). So, a towel with the pattern `ggr` would have a green stripe, a green stripe, and then a red stripe, in that order. (You can't reverse a pattern by flipping a towel upside-down, as that would cause the onsen logo to face the wrong way.) + +The Official Onsen Branding Expert has produced a list of designs - each a long sequence of stripe colors - that they would like to be able to display. You can use any towels you want, but all of the towels' stripes must exactly match the desired design. So, to display the design `rgrgr`, you could use two `rg` towels and then an `r` towel, an `rgr` towel and then a `gr` towel, or even a single massive `rgrgr` towel (assuming such towel patterns were actually available). + +To start, collect together all of the available towel patterns and the list of desired designs (your puzzle input). For example: + +```txt +r, wr, b, g, bwu, rb, gb, br + +brwrr +bggr +gbbr +rrbgbr +ubwu +bwurrg +brgr +bbrgwb +``` + +The first line indicates the available towel patterns; in this example, the onsen has unlimited towels with a single red stripe (`r`), unlimited towels with a white stripe and then a red stripe (`wr`), and so on. + +After the blank line, the remaining lines each describe a design the onsen would like to be able to display. In this example, the first design (`brwrr`) indicates that the onsen would like to be able to display a black stripe, a red stripe, a white stripe, and then two red stripes, in that order. + +Not all designs will be possible with the available towels. In the above example, the designs are possible or impossible as follows: + +* `brwrr` can be made with a `br` towel, then a `wr` towel, and then finally an `r` towel. +* `bggr` can be made with a `b` towel, two `g` towels, and then an `r` towel. +* `gbbr` can be made with a `gb` towel and then a `br` towel. +* `rrbgbr` can be made with `r`, `rb`, `g`, and `br`. +* `ubwu` is impossible. +* `bwurrg` can be made with `bwu`, `r`, `r`, and `g`. +* `brgr` can be made with `br`, `g`, and `r`. +* `bbrgwb` is impossible. + +In this example, `6` of the eight designs are possible with the available towel patterns. + +To get into the onsen as soon as possible, consult your list of towel patterns and desired designs carefully. How many designs are possible? diff --git a/src/day19/day19.go b/src/day19/day19.go new file mode 100644 index 0000000..c589f72 --- /dev/null +++ b/src/day19/day19.go @@ -0,0 +1,95 @@ +package day19 + +import ( + "slices" + "strings" +) + +const THREAD_POOL = 32 + +type trie struct { + chr rune + next map[rune]*trie + end bool +} + +type thread struct { + next map[rune]*trie + pattern string +} + +func Solve(input string) uint { + a, patterns := parseInput(input) + t := buildPossibilities(a) + var cnt uint = 0 + for _, p := range patterns { + if isPatternPossible(t.next, p) { + cnt++ + } + } + return cnt +} + +func parseInput(input string) ([]string, []string) { + lines := strings.Split(input, "\n") + return strings.Split(lines[0], ", "), lines[2:] +} + +func buildPossibilities(towels []string) trie { + t := trie{next: make(map[rune]*trie)} + for _, pattern := range towels { + var prevT *trie = &t + for i, r := range pattern { + if _, ok := prevT.next[r]; !ok { + tmp := trie{chr: r, next: make(map[rune]*trie)} + prevT.next[r] = &tmp + } + prevT = prevT.next[r] + if i == len(pattern)-1 { + prevT.end = true + } + } + } + return t +} + +func isPatternPossible(possibilities map[rune]*trie, pattern string) bool { + threads := []thread{{next: possibilities, pattern: pattern}} + coldStorage := make([]thread, 0) + for { + if len(threads) == 0 { + if len(coldStorage) > 0 { + x := THREAD_POOL + if len(coldStorage) < x { + x = len(coldStorage) + } + threads = coldStorage[:x] + coldStorage = slices.Delete(coldStorage, 0, x) + } else { + return false + } + } + + next := make([]thread, 0) + for i, t := range threads { + if i > THREAD_POOL { + coldStorage = append(coldStorage, t) + continue + } + + if v, ok := t.next[rune(t.pattern[0])]; ok { + if len(t.pattern) == 1 { + return true + } + + thr := thread{pattern: t.pattern[1:], next: v.next} + next = append([]thread{thr}, next...) + if v.end { + thr := thread{pattern: t.pattern[1:], next: possibilities} + next = append([]thread{thr}, next...) + } + } + } + threads = next + } +} diff --git a/src/day19/day19_test.go b/src/day19/day19_test.go new file mode 100644 index 0000000..ad4b1f3 --- /dev/null +++ b/src/day19/day19_test.go @@ -0,0 +1,441 @@ +package day19 + +import ( + "testing" +) + +func TestSampleOne(t *testing.T) { + input := `r, wr, b, g, bwu, rb, gb, br + +brwrr +bggr +gbbr +rrbgbr +ubwu +bwurrg +brgr +bbrgwb` + result := Solve(input) + if result != 6 { + t.Errorf("Calculated solution was not expected") + } +} + +func TestPart1(t *testing.T) { + input := `gub, wuu, uwur, uru, uuw, wgug, grg, ru, gbggurw, brwwu, wr, bgguw, wurbgwug, rgbrb, bguguub, uug, guggr, wgrubr, bwuwr, ubgw, ubu, gruub, bbwguug, gubgbrbb, bwgg, bgr, bwg, uuwgw, uuub, rbg, uwbgw, bg, rruuwgr, brb, rbrg, brrbwur, wuwgb, rg, rgwg, ugg, wubu, ggurrr, rrw, burwubub, gggu, bwwg, ggwr, gwr, ug, urgw, gwb, bruu, brr, rgg, rwrr, gwbr, wrg, uugr, bbrbb, bbur, uwuub, wrbbgb, bwb, wuburbw, gwbuw, wuuugb, urrw, gwwwur, wwwrrg, wrrrr, gwbgb, guw, wub, wgbbb, ub, gbg, rrbbgwgb, bwubru, brub, urwur, uruu, wwgubb, ubgbbgu, gwgwwbu, guubwr, bbwwb, ggrw, uwr, wbrubu, wwu, gbuu, rbgrguw, bbb, bwgw, gur, rruwgu, rrb, rrrg, ggbw, gugugwr, rbw, gbr, rbu, brgbw, uubgb, rw, ugwgwr, bbu, ugwub, wwr, rwg, bur, uubr, bubgu, guurr, wbwggwgu, brbguug, wgr, bgrwu, bgbrugw, rguggw, gbubb, wwg, rbrgb, wurww, ggbg, bbgu, wgurg, uwwr, rbr, rgrw, uggbug, brrbw, uwg, bururg, wrubgu, gbgbu, wrru, rurbg, gb, gubwbg, uguur, uggw, uurrwrgg, uwwgrgw, ubugu, wwwu, gbrrbg, wrwb, rur, wubugr, rbb, wbbubgw, rugguwb, rwu, rgwwbg, brw, wbg, b, uuwu, rgw, gurrbu, gwrw, bgwuw, ubgwu, rgu, ggubbguu, rruwb, gbww, gugbg, rww, wuw, wburrb, bgb, grgwwbgw, bubrrww, bgu, ugwu, wruw, wgur, bbgb, ugwbwrr, rgr, ubbg, grr, uu, wu, wwrwrw, rbgwb, gww, ugu, uurubb, gruwb, buuuw, urg, ur, bwu, bbwu, ruw, ubguwrgb, bggug, wuwu, brrbrbr, gbubwrrr, bwwwrg, ggg, grw, rbwbgggw, ubr, ggr, grbbrw, brgg, ubrww, urb, wgbr, urr, bgrr, rgb, buu, ubg, bub, rwbgwbw, buuu, buuwbg, wbu, ggu, gwgrb, rwr, wwuu, bru, uuugbw, gwrbbgb, gbrrbbr, brwgwurw, rbgb, rubwrub, uwguuuu, wbgu, ruwu, wwbbwg, bgwrgb, wuwbwb, rbrr, bbrgr, wgrub, guwggw, rggwugw, rggubrr, wgurgg, rgbr, wbur, ubuu, urrbuu, ruuwgwuu, uguw, wgbrg, bgwr, wrgub, wrub, wrbuuwu, wgb, ubw, wrrg, uww, burggwgu, uwu, rgwwr, wru, wgg, br, wwb, urbw, wwrwu, gguguw, r, bbrwrw, buurr, gwgu, rr, rrr, ugw, bug, bubr, wgrwwr, ugb, brg, guwuw, rgrggw, bgrguwuu, gwg, guug, ubgguwu, grrwg, grwr, bbggruu, buru, ww, uwgggwu, wbrur, wrgr, u, bbgg, rwugw, wgu, wbbbug, gwwwb, bwwuu, ruwr, urbb, wurrr, gug, uw, ubgrgw, rbbr, grb, wrr, bww, bb, rguwwb, rru, ubbgwu, bgbr, gbwu, buuw, ubww, wrb, ugrwr, g, rbug, gbbgbuug, bu, wwrb, ubwg, ugr, rburub, bgugr, wug, ubbugbgg, gbur, uuu, grrwrw, guu, ggww, rrrgbb, gugrgu, www, wur, uugg, bgurb, gu, uwuurgu, rbuurwwr, rurw, wbrbb, bgg, bwbgbbw, ubgwb, wgbg, gwrbr, rwwur, rbrgw, uggur, wgw, uwb, grrgr, ruu, bwug, uwwwwu, ruguu, buw, buug, bbr, gugwg, gbb, guwgr, gbbrbbb, wuggwb, ugwrwbg, gwrr, urgb, gwu, rbwrbgbr, bwrbbww, rrbwr, wbr, rggrur, ggb, gwrgr, gbggu, rruubw, ggrubb, rbgg, bwwbu, wwgbuwu, gbu, wg, rwbwr, rub, brgu, uuug, uub, rbgwr, urgu, wbb, gbw, bbrggrw, bw, rrug, wwwrubrr, gbgu, bubwbgu, ggbb, gwbu, rb, rug, urwgb, gru, rwwrg, wuuugr, uuburu, urw, ruug, uwwuwuu, bggg, bwr, ubb, gr, rbbgg, bbugw, bbruub, bgw, rgurgu, rrg, ubgugr, bgrb, bwrugb, bubw, gw, wbuugr, rwb, brgurw, rbbuwg, gbbwwub, wrw, rrubb, gwgw, ruburru + +wuuburubwuwwbwrwgugrrbubrgrruwwbbrubbwrbgbgwwwu +wbwbbwbgbrbgbbguuwwguruuggbgbrrgburgwugbubggwbbgubbbwrg +wbwwrgguwrwgbwwuwbwbgwubrwuurbgrwguubuugwwrbgbrwwgubrw +uwbwwuggwrwbggururwbgbuguwbuuwwwurbwrwrbwrgbggubw +rrrbgrwuwubrrrgwwbbgburbuwrwgwrubrggbrugugwwrbwubrgggwuwbu +wbwwwbwgbubguwbruburgrwbbubugbggugbgwgubr +wbwbbwuuwrbbgbwugubbwwwwrrgrbggruuwguuurggubwwurbubuuggrw +wbbwbwuwrbggwbbrbrguwbrbbrbrwrrwgubburbgbwggbggrbgugwwwg +wuruwwbrbwbrwwrggrbwugrbwbuwwgwbrrwggggbwgwugbwbuguw +ugurburugbgurwbwwuubrburgubgwbgwwwwwwwbwggubgbrbbw +wbwrgbrwgwurwrggbrwwbgwwwbrbwubrwrrruubgrgrur +wbwggurrggwbrgbrrwgwggururbwruguuwwrgruwrwwurwwwbbb +bbrugwwwuguurrwrggrbwubuubguwggruubbgrwuuwbrurb +wrruuurruugbubgbbgwgurwggbbwuwgrgrguguurwwbwgrgrbgrgrwu +rrurwurgubwwbbbrbuwwwrggrruwguugwruurbrbwgbrbrrwgrwguugrw +ubgbguwbbgrwgwubbubrrrgwbwguggugbrgguurwrb +uuwbuwgwgrgrwgrgwwbgwbubrrruurgwuurbgurgugbrrwwwwgurr +wbwwwwbrggggwbwggbrbbwuwuuwrrbggrrwurgrbrrgwbrgrwgu +wrrbbwbgbbbugwbrgurrrugbwguubgbbgbrgrbrwbgugwrwgrrrrubrb +wbwurgrbrrrgggrwrrgwwbgbrwrwrwbgbguwrubruuwgb +wbwwwbbgbwrwrrrgwurubwwrggbwubwbgubuguwrbuwgrgwwuubuwrbggw +ggbuubggbbrbbrwuuwrwuwrwuwubrurubgguuugbuguurwrrugrbwgw +wbwrbrwgwbuugbgrwgrwbrrwuwggrrgrgwwgruwgbu +urbbuugrburbbwbwbgurgbwbuuwbbrgbbrgwuuurggrbwrwr +rurbuwubgruurwgwubrrburgubbbbgwbwrburgrgbgbrbgbrwrwru +wbwgwgrbgbwwgruggrbbgrugbbbwrrwwrgbwrbgwrbrrgrggb +wbwgwwwgwrbrrwrwurrbgrwgrbbwbrggrbgrburugbuwgbugbuwrrbggwwrw +uwwbwwwbbuuggwrrubgrurwrwgguguuwgugwgggbbubrubwwg +wbrburbgurrwwgwrurbubwurrbuwruburrwrwwggwb +wbwggbgrgbbuwwgwbruwrbbubrbbwuubrbwwbugb +wbwuwbgbugrwgubgbgwbbgwurbbrgbbrgbwrrbwgrrgwg +wbwubwgubrguubrbgrgrrwbwggwgubbuuuwwwgubww +wbwruwbwruwggrwwrguwrbrgrwwggwwwbwubgwbuwbwrubw +gbubrrbgrbggrwurgwruwrwgbbubgburuuuugbbgrrgubrwgbgbwrwrugw +ugrubuguugrbbuwbrwggwurugrggwgbrgrwbgubbwubbguuuuurru +wbwuwubwbruuurugwrbuuwwugrbgrggurggrgbbugurrg +wbwwwubrrurubruwrruuuubbgurwrrwwbuwruwubugurruguww +wbwrbbwwbgggwuwwrgrbwurbgugrguwwwggruugubrbwrgruwr +wbburwrubwrbuuwrbrgrgbbrrgubgggbrbwbbgbgugurguwrw +brwuwuwuugurbrubbwbwbruggwrrgwbrbbgrgbgrruwurrwr +grrburggwuubwguwgrubuwgbbbgbgubwggrrrrrbbwbbbb +wbwggwrwbbrgggrrggbwgrwrrwbuwrggrruburugrwrwrbrbwurwuggrw +wbwubuwgbrgbwrgrbguwrbbwgwuuubgrguwuuwrggbwgugbrg +wbwurrwuuurrggubuubgbwbwgwurrbbrwububwbgrwgrrbru +wbwrwwwgwrwguwrrrbrbwubrrbwgwugrrugrbbuuruubwb +wrwrrrwbwbgwbggwrrgbugguuuuwuubuurrggbwuwuur +brubbruurbwuwrwgwuuggbwrgubwgrrrwruwruuurrwruwbrwur +wbwuwburwgruururggrwwguuwrbbwwgwrgrugwguwwbwwbuwwrwgwrrru +buwbgwgbwrgbbuwuggrbwgwbwbgbbrgwuwrrgbuwwwgbrurwwb +rurbwbrwggggbgwgugbruuburrwuwuugrbgwuubguwg +wbwgbwwwgrruubwrrrbwrguburrubwbwwuuwwbbrwbrurwggrgwwbgwr +ubgbwgurrburgggwbgbrugrgrwgrwwruguggwubwbbwbgggub +wbwgguurwuuwbrbwrggggurwggrgbwrbrbrrwwrbbbwrubruuwgbu +rbubbrbrgwrgbbbrbbwggwbwwrggbbbwuuwbugwbgwuuwwwgruug +wbwuuwrgbbgruuguuruwwugbwubbggrurwwrwubbbbr +wbwbugubwwrwubgbrwrbruwbbbugggurrrbbwbrrugurbrbgbrbub +uwubggguwruwruuubguruuwgwuubwbrbwwrbbgguuuguwbruww +ubrwbgbbgwggggwbgwrggrrburuwugurrbrgwuurruwbbbbrwrbw +ugggggrbrggrrbwwubrbubbbwwbuwugwgbbrbbbrbuuwuuuuwurbbgrbbw +wbwwbwwbwbrurrgwwrgggrwubgruururwbwwrwurbuur +buwurrrbggwbwbrgbwugguuugwwrbwwrbwurbgwugwrbubggugbg +bguwuuguurwgrgbgugrbrbrwgwbrrgbugguwbbbggwruwgrrgb +brwbbrgbbuwrrrbrbgrrwwwrrgrugbugwuubbwgruguuuurugr +wbwwbrguwrbuwuurbwburbbbgwwggubbbwuugurwgbrubggruwgbwrugr +wbwgrbbwwbgbrgbgggbrgbrwbrgurbgbbuwugbbgr +rrburwbuwwwwrgrggrgubwbgrgbwurgbbgggugrwgrrbwbgrgrrbgrb +bgbruburugbbububugrbwrbgbrwgbwwgbbbgwugrbgrgwrrrrurr +brgggrgbwugbgbwwburwwburrgurbwbgrwbgruubrwwggbugbwb +wbwrggwrrurwbugbgwgwrbuwwugbgrruwgrbgbwurwwgrgwwgbwbrwgubgwr +ugguuwwwgubbbuuguggrgbwrbwwgwuwwwurrbrgugurgugbrubururgug +wbwrrgurrbuburgbuwggggwwwugbggwbwgururuwgrbrburr +rububggwrwrbwuruubruguurwuurrgwbrrbuugggrwbuburwuwgbwrw +wbrrgburbbubrubbubrgggwrrrbwuwrbburbuguurwu +wbwrgrrurwbrbrgrgrwgwubgugwgguwbrggwbwbwbubwgwuwub +wbbwrgrwgrwrbrbuwwuuuwgrwrwbbrugurbubwrbrubwbrubwuubgbwr +wbwugrbgrrrwrgbguuruggbbbrgbrbwbbguuuggu +brbrwbgrrgugubrgbubrwbwgwruwbgwgggrbrbugrubrbwwgbuwb +gwgwgrbbguugurubbwbugwugrrwrgugrurwrbrgwbu +wbwubrrbbruwguuuwugwbwrurwwurwgbwrbwruwrrwgbrrw +wuggbugrwbuubbwuwbwggwuwugrggrurubbwwrrugrrrrb +wbwgurrrurbbbuuuuugbrrwuuuwbrrbwrbgbrrgbgbrgubwwbrwbburb +wrugbbrgrgubgwwwrggurbwuugwgubuwrbgrbwwwbwgr +guubrurwwgwbrguggbgbubgrwuruubbbgrgubbwuwuubbrbbubwguwrwub +wbwburwuwggbgrbuurugurrwurwggrgbwgwwrwuwuwbrwubwbwguwbbr +wbwgbwbrubbbrwuuuwbbwgwgbwuwrrbguwwuburrrrw +wbwuggugubbwwggbwrubguuuugrrubgrwurbuugwwgwruuuugugu +wbwbbguggurgbbrwwuugwruruurggrwbbggwrguwuuwugrbwbbg +gwbbwgwgruuwwugubrwggwwwbwwgubgwurgbruuuug +wbwgrbbrggruuwwgwrbgggrwwbbgbrgugrbuubwbbbbwuwbrgwgbwgru +brruwggwburwgrbwgbwrgrrgwrwwbbwurrubuuwbggru +bwgrbuggbrrwwuwwgubbruruubugwrrwwwbuugbugwrurrr +wbwugubwbbgbubrggbugbubbuubbubuuwgwwuguwbuurgwuguubguwrgbbw +urbggggrurbwrruwwbbwuwbrwrbugrbbuwrburgubbrgwwuwurbrrg +uwwwubgwwbgbuuuuubguggubbwbwuuurruwuuwwgbr +wbwubwrrbuguurwwwgrrbrggrrbuuruwgwrrurbggrurrrg +burgugbggwrubwgrrguuugrwbbgubbrbubbgbuuruugrrwrgbwgw +guruugwrbuwuubbwguuwugbwrgbgbubgwrrrrwbugurrgb +rbgrugurguuwwbuugrbbubugwwbbubbugbggwuubuuwuubbbrbggwbggu +gbbgwbbwwgwbbbrwuwuwwbbuubwbwrrbwgububrwbbgwuwuuggr +rbrgbwrrubbbbrrgrwbgrbwwbuugwguwwgrggruwrrbubwubururbrrrrw +wbgbugbrrwbrwruruuugurwgwgurrbrgwgbuburuubgwbrgwuwrbrw +rgrrubbgrwbugrwrrwbgwbruwubburuurwwwubrbubrubwrrwgbuurrugr +wbwuugwgggbbwbbwgbubrbuuuwrruurbrwggruruu +uwgguwbwwwrubrruuguuubrrubgbwbbrbgrwbwgbwbw +wrwgbwbbrbuwwrbguwwuwuwbrbwggubrbuuwrggwwbwuwuwwuubwbuub +wurwrrrubrbbuwwbggrrwrbuguwbbbbwwwbbbbubgwgwwuurbwbbuuwr +ubrwwgrwwgwrgrrbgwgwruwwurgwuruwrwurbrrbuwubbbugwbu +ruwbbrrbgrrggbubwgurbwrgwbwgrrrbgrgrggrrggwbrurrubbrgu +rgwgwrugwrrggrgwgwbwbugwgbgwbrrwugbbgbuuguurrurru +gugbrwrruuguuggugbruuwrbrrggrrgguurrurbuubwrguubbrr +wrwbrugwgwgggbguugubbubgrrbbgwgbbwrrbgrgbbwur +ggubwgbrgurbuggruuubuwwbbuwuwrrbruurgguwuwugbrgwburgw +wbwbgbrrwggwubgrgrgugbburbwbgwgbwgubgugbubgguww +wruwurgrwubgruuubbwggubwrrwuurwggrburuububr +urrrbwbwbrwgwurwbgwrrwrbwbrrrrwbbgwbggwurrwbwubgrbbwugw +wwurgwwgugrbbbrurbwrwrwggugbuwwuwwbwrgguwguburwurbw +wbwgrguwrubbbgrwwgwrurbuwwwgguurrwugwgwbgwrwwgruuwwuubr +grugrwbwgwbbrubbwwwugbrrubruwurwrurgbrgrbrrwruur +wbwurrbbbgrurwggwwbbgwbbgbgbguugwbbuwwbb +wbwgubwugwrwuurbwbruwuuuwbbwgrbwgwgggrrrubburrgrrg +urgburubbwrgguwbgwrgbrurrrrgrrgurruugbwuwgrrwrgggrubgwg +rwwbwrbwwrurwbrrrgbrwgguwbugugbwgrbwwgwuwgbrbgbguwuubur +grrbrgbbwwbwwwruggwbwgrrgruurrubwwrgugurrugugbrr +wbwgbrbbrwbbuwububuggbwgbrwwwwrgbbwbgugrgruurbwu +wrrwwuubggbwgbgwrubuwrbbguubrbbwbgwuggrwguwrbg +wbwbuwrubguuugwbbubggwbwuburuwbuuruguwbru +bgwwuubwwgbrggwubggwwruwuwurwrwrrbrggubrrubrggrrwwrwbg +burggwgrbwuwubrwbwuwgbwuuwwwwgwgrwbbbgggrguburgugrwg +wbwggwwwrurrguuwbuwwburgggwwbuwbrwubrrwrbrrubgwwrr +bwubwwuwgrbuwrbrburwrgbbrububbgwrwuuwrwubbububrggg +wbwuwguuburgbrgugrrubwwrbruwwbbrruugrwbbbwgwwbg +gwwbwwwrburbwgwwrguubwurguwwrrwgbbruuubrrrwrgbgruu +urrbrgwwuubugrbbwuwgrgubwgrgwbwwrgbwbgrwgbrugbbuuwgwrw +gubbruwgguggwgubggrbrgrbugurgrrbrbugbwggwwurggbrubbbrrrw +wwwubwbbbugbruubwurwwuwuububwbgwwbwwrwwwwrggggbuuu +gbwwruwgugwbbgguwrbburwrgrwwbbwwuububbwggrgwguubugugwgwbw +wbbwbwbubwbuuggwwbbrwwwgrbbrubgbgwbuuwruuwgwuuguwwrgrrwwrbwb +wbwbbgbggrubwuubrbwwbwbwgwurgwbrgwgbwwbrbuwbbwwrrurubgwuu +wbgwrwuuwwwggurwrbwbwbbwrwwrbbwwgururrwrggwrg +rgbuuubbgrwrurrrugwgbwurbrugrrbbuubrbgurggrbwrwubb +wbwburbuurwwrbugruburgwubwrbbrrgwwbwrwbgggwwgwgggburrrrbwurr +wbwgugbgbwgubbgrbguuugbrrbgwbwrruwguuwrwuwrrrugwwwbrggwrugb +wbwuggbrwgwgbggbugburgbgwbrubrgwrrruggwuurbbrgu +wbwggguwuwguugruwwububwbrrwwwgrwbwbuwrurrggrrbrrgggw +rwrwuurbrurwwuuwrbggbgbbururrbrrrwbwuwruwbbuurgbgbbu +wbwuuwgwwuwrwurwwrurwguuubgwwwbbrrgruuuugugbw +rrgwgrgwrbrwrbwbuwwuurbrbuubrwggwrgruguurbuurgugu +wbwuugwwrgrgurwgurgrwrurwbwbggbubbugbggrrguwuurwgrbguruu +wbwrbuwwubwuwuuggwrrwwrgbbrwbwwruuurbuurbuwgguwruuubbb +uggrbwwrgrgbubrwurggrwrwurwrbbrrbgbrgbuwguruub +wbwwwggrwuubgwbrrgbrbrbuwgbwggurguggbuwgwuurgb +bwgrugurgurbruruugurugbburwububwwrbwubgbbggwww +wbwgwurwrurbrubbgubuwrwggwgrrugubrwbubwuw +wbwwwgbbugbgbbbwgwrwggbrugbgrruubgwbwgbbbub +rwwwwuuwugwwbgbwrbwwurrugugbwwruwrwubwrbggrbrgw +wgbubrwwrwrgbuwrgbrubbrubwburgrbwguwwruurwubwugrguwu +wbwrgwrgbwwgugurrgbgrgwubwurgbwbuwwwguwgrrbwbrrrwwgbwbrbb +rbugrwwwbwwgggrubwuuwrguubrggrwuwbbrrwbwwuwgbrgguuu +wbwgruwuggrbgrbrgrrbuguwwwwwrubrrbbugurubggrbwrgugbrbbbw +wbwugwbbuwruwrrgwuugguugguurwrguuwgbrrurrurwuwrrurrbbgrw +gwruuurbuurbrgbbuuugruuubrurbggwurgrurwrrgbwwgwggbrgrgbr +wbwwwwrgguwgbuuwwgwwuguuwurwwgrwgwugwubburbg +wbwbggrggrwuuwbwbwubggrrwubugrwgwbuwwbrgugrrubugburu +uubbbgrbgwrbrrbbwgbubwrguwugburuuuugguwgrrbrgubbrbrgrgg +wbwbbwugrgwrbgbrbgubbrurwrbwburgrgbrugru +grgrwrubwuuwruwwwburgbrbwrwwwgurgwugubuugruguwrbbrbbw +uururwubggwwggwgwgwrgburrrwruwbwurugbrwwrubgrgubrgwrwurwru +wbwgwuuwwuwgwgurwurbgwuguwrrwrgbggbrwwbrwuububrguwg +ruurgguruguguuruggbugbwuugubuwugguggrbguuwbbgguggubbrrg +wbwbwrbrurbuuggbgbbbwrwrbrgbwwgwrubrwwubwgbubwrrr +wbwbguuwurrgrguurbgwubwwwwbbrrwwgugburbb +bgrrurgubwubwrwbwgwwwurubgugbgbbwbwwugbrurggwgbuwu +wbwgruwbwrbgugwbbggbugubbbrwwwurrgwurwbg +wbwrgrwbubrgrbrbggbuugbbuwbuwbrwwrurgwgwrbww +wbwgububguwgruuurwgwrwuggubbbruugbrbgbrug +wbwbbbggrrbwbgbbruugbrubugurbbwgwrwwrwwuuugbrbrggubrbguwbr +wbwuggrubuugbwgwrggbuggrruuburrrgwruwwgrwb +wgrrburggubuguubwgguwwbgbwbubgwuguuuwuurruurrbbgrbu +wubuwbwbwgwubwubuubwurwbguuwggugrbuwwgggrwwrrgrgu +rurwwwgwbgwgwwbbwgwbrrbrgwurwbbrgbrbgbuubbwrgurguuguru +wbwrgggruggrrruwugubrwruuwwwuwgbbruburbuuwurburgbww +wbwgrggruwrbugubggbugbwuwugggwruruwubbwgugbwr +wbwwbrwwbubbrbwwbgbbbgwgrgrbrrbwwbwuwwuubgu +burrrgwwubrgrubgbwurwbwwbgbgburrbgwbwwbruggubbgrbubuuw +wrgrbuuwubwbgrubbrrrbgrbgrbuwgubwrgwurwbbbwurwrbuwwguwb +wbwbwbbugrguubrbbwuubwrubruwguubrguuugwwbruwruuwruwugr +ggwbuwwgbbwuubwgbrbrwwwbbburuuurbwrugubgrwubuurwrrwgwgrbwu +ubuwbgrrugugwbwwrubgwggubbrggwggrgwgbgurubwrwbbwwwbrrruw +wbgwbwuuwbgwbwrgrubwgbwrgrrubguuwubbgrgrrg +wbwgwwrrgbgggrwburgwgwggrwbgrbugbgrurwwwbbwbrbgu +wbwwwwwuwrwrwugwgrgwgwwuwrwwggbgugwrwbrw +urwuggugbrwrbrgwwwubwgubwrrwbwwrguwbwubbbwb +ugbwbuwubgbwbwbrbbbbrubwurgbgwbwrbrgbgbburgrbw +wbwwbbubrruwbrbgugurbubrwuuuguwwugrubbgwubrrbbrubbgggb +wuwbgwgrrubruwruggbuuwurwgrgwbbwwggrgwwwrwgbburwwgbggwguu +wbwrurbuuwuwuwgrruggubgwuuwbuggggwubwwbgrwgruwbu +wuurubbwgbrguugwwbbbbwuruwurbwubwgruurggbbgbbrrrbu +wrguwuwrbbrrrrurgrgwurbuwbbbgubgbwubbrgguwbbbru +rrwgguguwbburgwbrrrwbbgrguwuuugrbwwrwugbwgurwrg +uurbbguggurbugbrwugbuwbgrrubwrrurgrrwrbggu +wbwgwrbgrrbwguwrwrwwgbbwbuwuggrbruggbgwuugubrrruuwgbwgguwugu +rwgrubwbwbwubbubbrwrbwbrrgbbbrbrrubbguuguuwurugruguruw +buuggurrbuwruuuuuggbwwwbbbrbwbrbbwugrrgurrr +rbubububrwwgbgguuurbwgwbugbbbggugwwwgrurrwwuurbwwwrwuub +wbwgurrwrrrwgbgwggrgugwuggrgugbuuguurggbwgwuruugwuwgwwbgrub +rubuggbbwwbuwgubbubgwrbgwbgbuuwubuwrwrwgggwbbbgbwgbrw +wbwuwbbgubbubrurugwwrwubwrguurrrwurwwuwuguruguubruwubw +grurwbggbbwbbbbrwwurwrrrwgbguwrwubwgrruwuuuwgbbwrgbgr +wbwbbwugbbrrwgburguuwwgwwuwwbuuurruggugrguggrugwwwbwrgrggg +wgwrrbbgwwrrrwbwbwwggwwuruuuwruuurgwubugwugugubbgugrwbgbub +brbuurrrwurwubwuuruwwbuurwbbbuubwbgbubwbgrwurubbgruw +gwgbbgrubgwwbrgrwuwgwurrururgrwggbguwwggrwwgbr +rrgrwrrurgggwbrwrbbuwrrwuwwuwwrrbbwrguugrbwgbggbrwwbr +ugbuurrrgwbrgubrubbbugbubwgwbwuuwwuubwggggwrwwwuggg +gwrbruwwgggwuuwrrbrggubwrgwguwbwguuuuwggbuugugrrwgbbbgug +uggwbbwggbugurrrrwubrbuwgbuubgurbrbrbrbuwbuwbrg +wuurbgugwuuwrruugwbrwrbgguuwugrwugwrbuugbwwgrbrgubwgww +grwruwgugrwugrbrwbrbgrbwgwrbbrrbrwwwgugggbrruwwbgrrbwg +uguugggbbruggrbrrwwgrrubugbbbgwbbgguwbrurwuwguugrbrubgw +wbwwrbgrgwwbwgrwugbwgwurrugbrubwuwruwbgug +wbwugrurrgburbbgbbuggrbrwrbwbgrwgrrugrgwruubgwbuubu +wbwrrwuurbggbubrwwrbruwwgbrgubrbrrubbbgwr +wbwwrbgrrbbbbgruwubrguwbggwurwwrwwruwwgbrwwgggbgggggrrwgwgr +bwbwurbbgubrbrbbgrgbggbrrurgburgrwuubwrgwrrgrrwwwrurwug +wbwwugbwgbuubrrbwwubbwbbwwbwugbrugbwugggwbuwwwubggr +rrgwbbubgrwbbgrrggbbuguwbwrbuwuwrgrbwgruwwwubgubgubrw +wbwrwggbbgbggbgbubbuuuwuwubwgbruwrwbgbuubuggwuwrbrgruguubwu +wbwubwgbwgwbbgrwgbwbwwuwrwgugggwuwbbwwgrgguwubbuurggg +grrguurwrggbbguwwrrwwuwwgwrugubuuggwrwugwbbgwbw +uguwbgugrbrrwrubrgubwbugbbrgrgrbburwbgbbbrugru +wbwrgwrrugwbbbbrubgggbwbwugubrbrurbruwurgbwggwwg +burguggurrggugguugbrwrwguuwbubggwbuuwwgbrrwgg +wbwwrwruwgrrgbbgrbbrbubwwwbgwubbggwuurww +wbwugubbugrrrugurbgwrgurgrguggwbgwwbgwrwbwbrbwuwgww +ggggrgrrbrbbrwwrgrwbgbrrwugwbwgbugrrbbbwbguurrubwwgwbwuw +wbwrrruurwrrurbgubgbggwwbgbwwwbrurrrugugugu +wbwwgrwrwrbrburuuwbwwbuguuugbubuwgugugrrbrw +rrgururbbubrwbwubbbbruurgggwubgwgbgwbgrbggguuugg +uubrrwuwbgwuuggbggrbubggbwrgruwgwrurwbgwwubgrwbguubru +uggwuwbwuurguwbbrrbgwburugrubgrwbugrwrbwbwbuuwwuuwubururuw +ubwwwgbuugurrbgbubrwrbugrgrbbwrwbwuwgubgwrbgwbgu +wbwbuwgwgbrgguugbwrgugrbburrgrrrgwrgbbbrrgrwgubbwggbrggw +gbwuwgurwwuggrrbbgwuwruwbwrbbuwgbwubbrbbbrguurbwbgggw +wbwbgbwwbggwbgwuwgwbgbrurruwrrruggwgrgwruubb +wbwbgggrguwgbrwubwbgwurggubburbwubuwubugwrgwguguggrwruwub +uwbubwbrgbrwbrgrwgwwbwugrwgrrgwwgwuubuwrwgrg +rurbuwbuwgbwrwwrurggugbgubggrgrbgrrbrrrburbwrbwguwgb +rubwurgguwugrburbgrbuwrbwrbuugbwbubrruwggwwrru +wbgbbwbrwubguwrgbrbrugwurwuwwbbgbwwrwbguuub +wbrrbggubwubwbgbrgwwbgwgurrbuguruwwrgwubww +uuwgbwwgwubrrburbuugbrwbuugrwuuwbwggwgugwgbr +wubrwbwubbwrbrwrbwgwbbbbgwbrbwrrwubgrgbuuubbubwwuwu +wbwbrubwuwbuggrgwrbrubrwggbbgrurwgrwwrrgwuruggrwrwrgbwguggww +wbwbuubwrubgbuwbbbwrrwggrgrbwrgugbwuwwrbgbuwbrgbg +ubrrbruwgrwrurgwggwbuuuurwuwuwbububbwurggg +wbggwurggrgrrwburrwgwrrgbggurgwgguwbrugguwb +gbbwgwrwggrubuuwrbbbgrburwwrbbggwrurubuwgubgbbwurwg +gbuwwuuburgurugburgugubbbbwwuggrgbgwgwbbub +ugwbggbrrubuwrrbgwbggwrgugrwbrggwbrgwurrgb +wugruwrgubwwrwbbrrwgrwbuuwwbrugwbgbbwwwugruurrgg +wbwwwgrrrrwggurrurbwrgwgggrrbuggbwuwwubwrubbbgbgbggbwwwu +gbrwugrgbrbrwbbwgwwuwwgugubuwwrggggwbwurrbgurbrbwu +wbwgbbgrwwwuuwgggwgrwugrwrguugugbubwuuwubgr +wbwuuuwwwrrrbubwruggbrbuggbubbrrurrgubbwurgwgubbwbgwuwwrwww +bggwwgbrbbwwuwbbugbwuwrgbbuwurbugwgrubugubuubgu +wbwuubbguugruuwubbgbuggggguubbbrrrgrgguruubug +brbrwgurrugwwbwuuuuwuwguugbgugbuuwuuggguuubugggg +wgwubgwbwwgwurbruwbubgwurbwggugbgwbbwgggrwrgbr +ruwbggbuuguwbbwgwrwruugwrrwgrurgwburggwuuuuwwr +wbwrbruuwgurbgubgbrbbbrwuwbruwgugbwuuugruurbrwugurrgggrr +gbbuugurbwbwggwwuubuuurggrrgrwgggwwuggwuruwrwugbg +rggwbrbbrbrgbrrbruwwburwugguuguggwwbgwrwgu +wbwrggbrwuwrwguggwurrbruugbwwbgwrwguwwrwbbruwburgwbgbrwwggur +wbwbbrrgwrgrurrwuugwwrrgwwrrggwbwwbrbuww +ubgurubgbuuruwwgggugururwwbbuwubrbuwgbugwruubbrbrbb +wbwgwuwrrgruugrrrbggrguwgggrbbrwgrwggwgbgrbw +wbwrrrwbwwgrrwruwgugurggbubrwwurwburggwgugbwrwr +urrbgwbrburgwuuwbwgugrgrurbbrgubuwububbrbrwbwugurbgbuu +wbwrgwubbbugggrrbburwugwgubbwuuugbrgwbuug +uggrguwwwuuwuwwwgwgubburwrrgruggrwrwbwgubwgrbuuwrww +wbwuggbugwwuggwbgbbrgbrguwwubrurwgwrrrwgwwbgwrguwgbugwruwbb +wbwbrbgbwbgrwbrrubwugbwrgrruubgbgrgbgrur +uuwwgbwbggwrwugburwggwrurbgwwwbuurwruwwwwbrwbgbggr +rwrbwrwwburggwgurbwgubgrwbbgrrrbuwuuuwugwuwugrwbrg +wbwugurbubgbwuwbwuuruwbgwruwgwrgwgbgrbuuuubrubruwrgrwuwu +wbwwwgwruugrwuggwgwuuwuwgrurgubrgwgbgrwubrubgrwbrwb +gbugubgbruwrgwrbrurbguuwwuwgwgbubrwgurrrwwgruwrwu +rgbbrguruuwrbrwgwbrgbuuwugbrwubuurgbbruububg +uwwgubrrrwurwggwwgbggbwggrubruwuwgwrgggrbbbrrgg +wubbbuwruwuwwguwgbgubwggbbrbwuuurbwbgugbwuruuwuwbgwgrrg +rbwwgwbuuwrgwwuurbuwwuubwwuubguurbwubguuwwburwbrbg +wugurruuurubgrgwbuurbwbwgbbgugbbbgggwggwwgwrbgwubugubrwr +gwbrbgrgwrugbugwruwwrugrrugbwrwbwwbuuruuwrugbwugrbu +urwbgrubuwgrrwwwwwuwgbbwburuwgrggugggrwbgugwurbrgub +wbwrrurrwbwwuwgubuwwbgwwuwubwgwwguwwugbrrbrwbugb +wbwugugbgrwggwbgrugbugurbruuubrbbbgrwugub +wbwrwurbgggrgbrugbbrwgbubuwwgwwwbwwwrrgrrrww +bbuwruubuuggubbguururwbbrrrgurrwrgubbrubuwwbbbu +wbwbwgbugrrbrwwrwwwrgwwrgrrrwwuggrrburwur +grrrggurrrbwrwbwwurwugbuwwggbwbbbrwggurugrruwbuuuuu +wbwrgrwugubbubbgrwgbrwwrbrbbwwurburgwrggbbbugubwgwugbrrwbr +wbwwgrgwrgwwbrrruuwbguwubruwburrwbwbgwrrgbrwbbbgu +ruwwgubrrruwurruwggrubuwgwugrbwuggbwuurbggwbbrubwr +gbguubbbugwwuwggrgubwwrruburwrbugguuuwwgwbgurbgguugugwrw +wbwwbgwubrgbgubwruburbwuwggrrwbbggrgwgbub +wbwwubbwbbuurbburgwgguwrwurwbrbgrgrrggru +bugbbrwugurubrwbgubgwuubugbuwwwwrgrwrgbgbbugrrgbgrgbbg +bwgrbgwurggubggugbwbggrrwgwuwubwwurwwgwwrggbg +wbwwgggguwbwubbggurubggbrbububruubgwuguubruwbrbrwugrr +rrgwugwgwbrwgruwgbrrwwgrrwurggrgwgrbubuggrrbgurwbbrub +bugrrwgwbgrbwgrgurgrrgbrbgwuwbggrbwbbbuwgwgrbugrwwgggwrgw +wbwuurrrwubgggwbwrrgbwgugbuuwuugugwwwgwbbbbgwbruguwgw +wgrbrgwuuwgwuuwuggrwbbwbwwuwgwbgbwbbrruggrbuwgrb +wbwwwuurwuugurbwrubgwrbwuwggwbrwrrgugrgwuuwbwrrwwbbb +ruguwrrbwgubugrgubrubgrrrwrwrubbbbgbubwrrrbguwbbbu +gwrgwuwbwrgbgubbwugwrgwgurrrgrwrbbrrugrgububrrrruuwgrurbb +ggbbgugggruwgubrwbbggwrrrbwwurbguburgrrbrggwwwubgbbbbwruwr +wbwgbubguubgbwrrbbgwgbgwwbgwggubruwbbburgbbbrwwubwgbgbruuu +wbwbgrubbrggubbgrgbrgwbuwrwgbgbgwbrgbwbbbgwg +wbwwwgwrugbuwwgururwuuuurgwbubwrwbrwurgbgbbguurrwgbbbbrwwrr +wbuubwrruwguguwuubwbuwwuburwwuguggugrbuugbg +bgwbwgwrrggbwrgwbggbrbrgwurubwrggbgrwuuuugguwrbgruwbr +rbuurwwrurrwggbubwrbgrruwuuugurgwuurrggrrrgurbuw +wbwrgugbubrgwrwguruguurrwrggugrrgburrruuubgr +wrrwrurbrugwwbwwbwwbubuwugggrwgwbbuwwrgurwwwuwbgrwwrguu +wbwwgrgbgbbgbuugwrrrurgugwwubbwbbbgrbuwrbwuruwbrbbrubwgr +bbguggrgwwwgwbrbwwwwggrubwrrgbwwwwuwbbbwrbbbrrrrrruubgbwwr +burubwrwbwwgrbwruggwwggburgbwuuggrwuggggrrwrgbrbrwr +bgwguubuwbbgrgwwbrwruuwgubuurrwbwgwrwwrbgbgrgbwbuggg +wbgwbwgbbugggruubbuuuuwwgbuuggwggbbrrgrwwgrrbbugbgrb +wbwuwbbgbbwbrbuugrggwbugggwbrrrwruwbwwbuwgbwrbbur +wbwruwubwwwrwruwgwburrgrruurgbbuuugrguwgbgwwbgwrggg +wwuubwggugggwwgubgubgubgrgubbgurbgguwwgwrrrg +wbwrbrrurwrgbubrbbbguggrbugrubbwbuugburugbwgrurwrrgrrgrrbgr +wbgwbwwguguwbrbbwwuwrggwubwruggrgrruggbbrbrbwrrrgu +wbwwburuwwgwbrubuggubbgubgugggbubbwwrurubwgrurburgugbrrbbub +gguburbgwbbwgugggbuwbrgurbrwrgwuwwrgbgguubggwbwwgr +ruwugruguwruubuggubuuwgwbbbrbuuwwugbbugrwwgwr +wbwgrwwbgurbrrrwwuwgbwbrwrrurbbrugwbuwugububwgbbwbbbgbb +wbwrrwgubugrurbggwurgwggubbgbuwrbwrwugrbruburwbbwuwuugwgwr +wbwrgwburwububwububwwgwgruuwwruurubrwuwbugb +urgwgbuuwgrgbubrguwruubuuggbbbbwrwbgrbubuggwwgbug +wbwuwwggrgwruwwgwbwbuggbggubuwuuwbgurgbubbgrbgwrbrubwubg +rugbuurwrrbgrbugrwwwgwrbburbguugubbuggrbbuguubgbgb +wbwurruguurgubbugwguwwrbbwuuwuwubburuuurwbguuuwb +wbrwbwrubugbwrrwgwbbgguwrrubrwuuwwwwwgrrbgrbb +wbwuwgbwuggbwwwrgwwubugubbbgrrwwugbbrwgbwwbgwgbwbrugbur +grwugrruwgwggwrgubbuwuuwrgwbbwbrbrugrggwbgururwwubwubgrbbu +wbwwwguubgbgggggrrgwrbbrubggbbbbbuwbubbu +wbwwrrbwrggggubuubrrrgubuwgwgbbbuwurwuggbgwubwrwu +bbwwugbwwgurgbrwbugruugrurgguwburbubrbuwwwugrg +wbwwwbrrwbggguuuruwrbuuurwuwgbbrwgrbwubrguggwgurwb +wbwgwubwwgwgrrbugrrwggbrbwrgwwbbgbrrwruburgr +brrbubuggubugwrrguwwuuwwbugwburbruburbwrrrrurrrbwrugwgubbr +ububbrrbrurrugbrrwbrwurrgrwbrgwrruugrwbbuwub +wbwwwgrrwrrgbwwbbbbuuwbbuuwgurgwwuubbrbggwrrbbbuubgugwbur +wbgwurwwgubrgwwbbwurgwurrggguwwbrurbuwugrbbwbuugruwbb +wbwuugwgbbrubuubuwgrubugbgbrrggbrrrbgwbgwubwggwruugwwb +rubbrgwurrbbrgurwwuwuwgruwwwbuuggbuuwrrwubwb +wbwbrrbrrugwuurwwrwwuurrggurwubwwbgwwbgbbwwrbrgwugbrg +wbwrrbguugbwrrwgruubuwgurrbwbgggwgbrwrgwgubrwgrgwgrggugrgrur +rgwgrubwwwwrubgrwgbgbwgburrwrbbgbrguruuuwrbrbgwrbgguwgur +uugwrrbururuuggbgrrbuuwrwgrwbbuwrggguubrwbgubuuubgbguurbg +gwugurrbgruuwbbwruwburwubrruruuuugwrbwwrurwuwbggurruwurww +wbwwbrrwggwbwrugrrgurubrrubrgwrbrwgurrwwugu +wruwrrwbugbrwgwgrgruuwrubrbrrwwubrrbwwuuwgbbubrgw +gbrwgwurrwrurgwrrwggrugubwggbwwwwugbuwubwgb +urwbrwbggrrugguwuubggubbbbrrugwugwgubuuurgbggrwwrggg +wbwbgrrwurburbrgwrrgwuwrbruuuuwgrgggbguburbrgwuuwgbwug +wbwwgwwuuggurwwwbburuwrugrruwugrbwuuuwrrrwguubwgwr +wbwgrbubbgbrrurgbwbgubgruwgbugbgrbggwbbgwurwg +gbwugwurugrubgurgwugrgrwwrrbguwbbugrgbrurwu +wguuurbwbuurrgwuwrggguuwgwgwgbwuwrrrrgurgwwuguubb +wbwbggbwuggbwuggwbruubwuwbgugbuggbrrbgwgwg +wbwubuubrwgwgbbugbbuwbwubuuugwgwgrwwbbbrgbrurbggubbguu +wbwgururuwgubruwgugwbwbbruugwubrwbruwwrrwururgburuw +bwggubbbwbgrgrwbwbbubbrwrwugrrbbwuwuwbggwb +wbwubggrgrgbbwwbgugbbrwrgrugwggwbwuwubgrrbgg +wbwbwbggrgwbuwgrrrgggugwbrwrrrubwbuwwubgg +uggwrgggrggwwgbbbgburbgbbuuggbrwbwwbbggggbwgggu +bggbwrrwwgwuwguurgurbwwbubwrurgwrbuwgggbruub +wbwrggurwwuwgwbrbbwuugrwubwgbrrwwburrwuwwgw +wbwbgbrbwwbubwbuurgwgbrguwgugubrubwbuwgrugrrbwubgwgbbwwurbwb +wbwggwuggbbbwrgugrbbuuubrwuururugbbgguburg +ugggwrgbruubbbrwgrbbbwguwuubuuwubwrwgbrgrg +wwbrrrbrwgwrrwuurrubbrurbwgbrgrgbrbggrbubbbb +gugggwwuwrbbwrrwbwrurguwgwbubrrugbuuuuuuburwbrggrgbgbugw +wbwwbuururuurbbrwbrubggrgwggwbggrbwuwwrruggrurwgbbwwwr +buuuwwrrgrbgbuwurwuurrwggwwbggwbbwbbubwgbgubggrbuwwbubgrg +wwuurgrrrwbgwwwbrwrrbrburwwrbgrbwuurwgbgbwwbuubbgwgrggw +wbwrwubwuruwrrrrguuwrurgwwbrruuwuwbugugubugguru +urrwbgwrbbrgugbwbbgrgrwuugwuubrubbwggwgruuggwburgbwgru +wbwwwuwugbbugugbbwrgubbrbbguwruwgwbburwgwgbrrurbwbwrrrurgurg +wbwgguwgrurrguuburgugurbgbrrgrgurgbgugrbug +gbrguuburrgwbrwrwrbbwubbrubgwgrwgrwrbrgwrbwuww +wbwgwgwbuurubgugrgbrrbbbwrurgrbrbwwgbrbrbrwgwubwuwwwbbbr +rrgbbbbrguwbgubgbuwbgbubububrwgwgbbwwbbwgrubrurbrwrrw +wbwguwgwrbrbwruuwwuwguuguuubgbuwrwubuuugggrrgwrwgwrbgwubg +wbwwgwggwwgurrwrwwwgugrrggwrbgbrgwgggbuugrwub +wggbbrguwwwgbrgrguggwrgwgubbruwubbubrbrwggbuwgrwbrur` + result := Solve(input) + if result != 220 { + t.Errorf("Calculated solution (%d) was not expected", result) + } +} + +func TestPart1L1(t *testing.T) { + input := `gub, wuu, uwur, uru, uuw, wgug, grg, ru, gbggurw, brwwu, wr, bgguw, wurbgwug, rgbrb, bguguub, uug, guggr, wgrubr, bwuwr, ubgw, ubu, gruub, bbwguug, gubgbrbb, bwgg, bgr, bwg, uuwgw, uuub, rbg, uwbgw, bg, rruuwgr, brb, rbrg, brrbwur, wuwgb, rg, rgwg, ugg, wubu, ggurrr, rrw, burwubub, gggu, bwwg, ggwr, gwr, ug, urgw, gwb, bruu, brr, rgg, rwrr, gwbr, wrg, uugr, bbrbb, bbur, uwuub, wrbbgb, bwb, wuburbw, gwbuw, wuuugb, urrw, gwwwur, wwwrrg, wrrrr, gwbgb, guw, wub, wgbbb, ub, gbg, rrbbgwgb, bwubru, brub, urwur, uruu, wwgubb, ubgbbgu, gwgwwbu, guubwr, bbwwb, ggrw, uwr, wbrubu, wwu, gbuu, rbgrguw, bbb, bwgw, gur, rruwgu, rrb, rrrg, ggbw, gugugwr, rbw, gbr, rbu, brgbw, uubgb, rw, ugwgwr, bbu, ugwub, wwr, rwg, bur, uubr, bubgu, guurr, wbwggwgu, brbguug, wgr, bgrwu, bgbrugw, rguggw, gbubb, wwg, rbrgb, wurww, ggbg, bbgu, wgurg, uwwr, rbr, rgrw, uggbug, brrbw, uwg, bururg, wrubgu, gbgbu, wrru, rurbg, gb, gubwbg, uguur, uggw, uurrwrgg, uwwgrgw, ubugu, wwwu, gbrrbg, wrwb, rur, wubugr, rbb, wbbubgw, rugguwb, rwu, rgwwbg, brw, wbg, b, uuwu, rgw, gurrbu, gwrw, bgwuw, ubgwu, rgu, ggubbguu, rruwb, gbww, gugbg, rww, wuw, wburrb, bgb, grgwwbgw, bubrrww, bgu, ugwu, wruw, wgur, bbgb, ugwbwrr, rgr, ubbg, grr, uu, wu, wwrwrw, rbgwb, gww, ugu, uurubb, gruwb, buuuw, urg, ur, bwu, bbwu, ruw, ubguwrgb, bggug, wuwu, brrbrbr, gbubwrrr, bwwwrg, ggg, grw, rbwbgggw, ubr, ggr, grbbrw, brgg, ubrww, urb, wgbr, urr, bgrr, rgb, buu, ubg, bub, rwbgwbw, buuu, buuwbg, wbu, ggu, gwgrb, rwr, wwuu, bru, uuugbw, gwrbbgb, gbrrbbr, brwgwurw, rbgb, rubwrub, uwguuuu, wbgu, ruwu, wwbbwg, bgwrgb, wuwbwb, rbrr, bbrgr, wgrub, guwggw, rggwugw, rggubrr, wgurgg, rgbr, wbur, ubuu, urrbuu, ruuwgwuu, uguw, wgbrg, bgwr, wrgub, wrub, wrbuuwu, wgb, ubw, wrrg, uww, burggwgu, uwu, rgwwr, wru, wgg, br, wwb, urbw, wwrwu, gguguw, r, bbrwrw, buurr, gwgu, rr, rrr, ugw, bug, bubr, wgrwwr, ugb, brg, guwuw, rgrggw, bgrguwuu, gwg, guug, ubgguwu, grrwg, grwr, bbggruu, buru, ww, uwgggwu, wbrur, wrgr, u, bbgg, rwugw, wgu, wbbbug, gwwwb, bwwuu, ruwr, urbb, wurrr, gug, uw, ubgrgw, rbbr, grb, wrr, bww, bb, rguwwb, rru, ubbgwu, bgbr, gbwu, buuw, ubww, wrb, ugrwr, g, rbug, gbbgbuug, bu, wwrb, ubwg, ugr, rburub, bgugr, wug, ubbugbgg, gbur, uuu, grrwrw, guu, ggww, rrrgbb, gugrgu, www, wur, uugg, bgurb, gu, uwuurgu, rbuurwwr, rurw, wbrbb, bgg, bwbgbbw, ubgwb, wgbg, gwrbr, rwwur, rbrgw, uggur, wgw, uwb, grrgr, ruu, bwug, uwwwwu, ruguu, buw, buug, bbr, gugwg, gbb, guwgr, gbbrbbb, wuggwb, ugwrwbg, gwrr, urgb, gwu, rbwrbgbr, bwrbbww, rrbwr, wbr, rggrur, ggb, gwrgr, gbggu, rruubw, ggrubb, rbgg, bwwbu, wwgbuwu, gbu, wg, rwbwr, rub, brgu, uuug, uub, rbgwr, urgu, wbb, gbw, bbrggrw, bw, rrug, wwwrubrr, gbgu, bubwbgu, ggbb, gwbu, rb, rug, urwgb, gru, rwwrg, wuuugr, uuburu, urw, ruug, uwwuwuu, bggg, bwr, ubb, gr, rbbgg, bbugw, bbruub, bgw, rgurgu, rrg, ubgugr, bgrb, bwrugb, bubw, gw, wbuugr, rwb, brgurw, rbbuwg, gbbwwub, wrw, rrubb, gwgw, ruburru + +wuuburubwuwwbwrwgugrrbubrgrruwwbbrubbwrbgbgwwwu` + result := Solve(input) + if result != 1 { + t.Errorf("Calculated solution (%d) was not expected", result) + } +}