From 6a843e488c7a7d0b0bebc1bba0b34c7cf38c044d Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Tue, 20 Dec 2022 06:59:48 -0600 Subject: [PATCH] 2022 Day 20 Complete! --- 2022/day15/main.go | 140 +- 2022/day16/main.go | 1 + 2022/day20/input | 5000 ++++++++++++++++++++++++++++++++++++++++++ 2022/day20/main.go | 101 + 2022/day20/problem | 151 ++ 2022/day20/testinput | 7 + 6 files changed, 5369 insertions(+), 31 deletions(-) create mode 100644 2022/day20/input create mode 100644 2022/day20/main.go create mode 100644 2022/day20/problem create mode 100644 2022/day20/testinput diff --git a/2022/day15/main.go b/2022/day15/main.go index 12d17ca..c42fed9 100644 --- a/2022/day15/main.go +++ b/2022/day15/main.go @@ -5,6 +5,7 @@ import ( "math" "os" "strings" + "time" h "git.bullercodeworks.com/brian/adventofcode/helpers" ) @@ -42,8 +43,12 @@ func main() { } } - part1(inp) - part2(inp) + if part == 1 || part == -1 { + part1(inp) + } + if part == 2 || part == -1 { + part2(inp) + } } func part1(inp []string) { @@ -74,49 +79,122 @@ func part1(inp []string) { fmt.Println(nopeCount) } +type Sensor struct { + c h.Coordinate // Sensor Position + b h.Coordinate // Beacon Position + d int // Distance +} + +func (s Sensor) isInRange(c h.Coordinate) bool { return s.c.Distance(c) <= s.d } + +func (s Sensor) String() string { return s.c.String() } + func part2(inp []string) { - min_x, max_x := math.MaxInt, math.MinInt - var spots [][]int + var sensors []Sensor for i := range inp { - s, b := strToCoords(inp[i]) - xs, ys, xb, yb := s.X, s.Y, b.X, b.Y - dist := s.Distance(b) - l, r := xs-dist, xs+dist - min_x = h.Min(min_x, l) - max_x = h.Max(max_x, r) - spots = append(spots, []int{xs, ys, xb, yb, dist}) + s := Sensor{} + s.c, s.b = strToCoords(inp[i]) + s.d = s.c.Distance(s.b) + sensors = append(sensors, s) } max := testRow * 2 - var found h.Coordinate -SEARCH: - for y := 0; y <= max; y++ { - for x := 0; x <= max; x++ { - fmt.Printf("Testing %d,%d...", x, y) - var nope bool - for _, c := range spots { - if x == c[2] && y == c[3] { - break - } - if h.ManhattanDistance(x, y, c[0], c[1]) <= c[4] { - nope = true - break + found := []h.Coordinate{} + // Check around each sensor, the beacon must be it's distance + 1 + for _, sensor := range sensors { + d := sensor.d + 1 + testEnds := []h.Coordinate{ + {X: sensor.c.X, Y: sensor.c.Y - d}, + {X: sensor.c.X + d, Y: sensor.c.Y}, + {X: sensor.c.X, Y: sensor.c.Y + d}, + {X: sensor.c.X - d, Y: sensor.c.Y}, + } + printMap(sensors, max, max, h.Coordinate{X: math.MinInt, Y: math.MinInt}) + var tstX, tstY int + for i := 0; i < 3; i++ { + // Test all spots between testEnds[i] & testEnds[i+1] + for tstX != testEnds[i+1].X && tstY != testEnds[i+1].Y { + if testEnds[i].X < testEnds[i+1].X { + tstX++ + if testEnds[i].Y < testEnds[i+1].Y { + tstY++ + } else { + tstY-- + } + } else { + tstX-- + if testEnds[i].Y < testEnds[i+1].Y { + tstY++ + } else { + tstY-- + } } } - if !nope { - fmt.Println("Yup") - found = h.Coordinate{X: x, Y: y} - break SEARCH + if tstX <= max && tstY <= max { + fmt.Print(h.CLEAR_SCREEN) + printMap(sensors, max, max, h.Coordinate{X: tstX, Y: tstY}) + fmt.Println("Testing", tstX, ",", tstY) + time.Sleep(time.Second / 10) + if testSpot(tstX, tstY, sensors) { + found = append(found, h.Coordinate{X: tstX, Y: tstY}) + } } - fmt.Println("Nope") } } + fmt.Println("# Part 2") fmt.Println(found) - fmt.Println((found.X * 4000000) + found.Y) + //fmt.Println((found.X * 4000000) + found.Y) } -func printMap(m [][]int) { +func testSpot(x, y int, sensors []Sensor) bool { + var wasInRange bool + for i := range sensors { + if sensors[i].isInRange(h.Coordinate{X: x, Y: y}) { + wasInRange = true + break + } + } + return !wasInRange +} + +func printMap(sensors []Sensor, ceilX, ceilY int, tstPos h.Coordinate) { + minX, maxX, minY, maxY := math.MaxInt, math.MinInt, math.MaxInt, math.MinInt + for i := range sensors { + minX = h.Min(sensors[i].b.X, minX) + maxX = h.Max(sensors[i].b.X, maxX) + minY = h.Min(sensors[i].b.Y, minY) + maxY = h.Max(sensors[i].b.Y, maxY) + } + for y := minY; y <= maxY; y++ { + for x := minX; x <= maxX; x++ { + wrk := h.Coordinate{X: x, Y: y} + var found bool + for _, sensor := range sensors { + if sensor.c.Equals(wrk) { + fmt.Print("S") + found = true + break + } else if sensor.b.Equals(wrk) { + fmt.Print("B") + found = true + break + } else if sensor.isInRange(wrk) { + fmt.Print("#") + found = true + break + } + } + if !found { + if wrk.Equals(tstPos) { + fmt.Print(h.FILL_CHAR) + } else { + fmt.Print(".") + } + } + } + fmt.Println() + } } func strToCoords(s string) (h.Coordinate, h.Coordinate) { diff --git a/2022/day16/main.go b/2022/day16/main.go index 19302af..155a802 100644 --- a/2022/day16/main.go +++ b/2022/day16/main.go @@ -57,6 +57,7 @@ func (v *Volcano) TrackStepCount(from *Room, to *Room, visited []*Room) int { if !IsRoomIn(t, visited) { fmt.Println(" Haven't Visited") wrk := v.TrackStepCount(t, to, append(visited, t)) + 1 + fmt.Println(" From", from, "to", to, "in", wrk) minSteps = h.Min(minSteps, wrk) } } diff --git a/2022/day20/input b/2022/day20/input new file mode 100644 index 0000000..f8fc4b2 --- /dev/null +++ b/2022/day20/input @@ -0,0 +1,5000 @@ +9688 +470 +-3016 +-5110 +3615 +3862 +6989 +-2605 +-8389 +-3372 +3935 +7241 +-8871 +-2995 +6517 +6929 +3149 +-1876 +4981 +-5525 +-1560 +3851 +-9322 +-2382 +-2710 +7573 +6449 +-1170 +-8779 +-130 +7584 +7483 +60 +7252 +1369 +3120 +9957 +1411 +6218 +-5525 +-8184 +-8998 +1635 +-3127 +-7994 +6051 +-6314 +-8057 +-3556 +6669 +-9474 +-7982 +-1399 +-4627 +-627 +-438 +5027 +-9437 +6378 +-8050 +-718 +8703 +-8195 +2547 +-3543 +3352 +-1818 +2477 +9893 +7017 +-2689 +-8515 +7791 +-1489 +6697 +4362 +-4211 +9311 +-6960 +-452 +-4984 +-9978 +-2261 +2264 +3862 +-2177 +-583 +193 +6958 +-508 +-6946 +-371 +3831 +-8558 +-1592 +3809 +8078 +-1040 +-4311 +590 +5926 +42 +-6730 +8922 +-668 +6372 +9279 +8055 +-5452 +-3522 +-9527 +-9728 +9440 +-2585 +-2473 +-691 +7958 +-4858 +1561 +-1787 +-9426 +6753 +6368 +-9739 +-7254 +8976 +-5755 +7968 +8636 +3905 +-8113 +-1894 +1483 +5427 +-2341 +4171 +-4945 +-2766 +-2991 +-1769 +-9129 +-3460 +1211 +-2444 +-380 +7885 +23 +6219 +3769 +8277 +3862 +8353 +-4585 +8165 +-3034 +6091 +-7949 +2236 +9967 +4934 +-1864 +8181 +5152 +-508 +-6934 +9416 +-7375 +-8557 +3419 +-3121 +-1551 +-2844 +-8543 +-6668 +4234 +421 +100 +-9392 +3726 +6280 +1867 +-4748 +-7323 +-3087 +4791 +1329 +3601 +-8195 +-3739 +-9931 +6449 +-2291 +6025 +-6429 +2932 +6112 +7718 +4238 +56 +7728 +6454 +-1903 +-6480 +-5321 +714 +4667 +3654 +8236 +-9196 +3298 +-3499 +-21 +-4236 +7206 +-1476 +-9582 +-4858 +-4207 +1835 +-1960 +6616 +6191 +-1271 +-2334 +1845 +-1108 +-3212 +2700 +-4887 +-859 +-735 +5188 +1581 +8008 +-6464 +2088 +3211 +-2473 +-3881 +-4125 +5218 +-2901 +-8789 +-955 +3147 +9647 +8926 +-5128 +1823 +8760 +-8185 +4397 +-7395 +3471 +8163 +7007 +1892 +-2374 +-9913 +9683 +9156 +1337 +6708 +8131 +8657 +-8100 +9625 +1025 +5467 +-3283 +-8360 +3663 +5030 +1361 +-219 +5177 +685 +-3882 +1442 +5901 +-7971 +5767 +6777 +7166 +-3191 +-2271 +-853 +5757 +96 +3164 +105 +-8997 +6240 +-9768 +200 +5486 +3427 +812 +1286 +9983 +-9807 +5549 +-3173 +-6431 +-1133 +-5850 +-6500 +-3629 +9243 +1736 +5242 +-9633 +2812 +-161 +1363 +9367 +-3556 +-1422 +-4313 +-5149 +-4252 +8342 +1423 +9522 +9949 +-8789 +-5316 +-2468 +2631 +870 +-7238 +-574 +1243 +3133 +-2433 +-8731 +8974 +-6041 +5059 +-4056 +6946 +-5864 +9597 +-3634 +7871 +258 +7551 +-2130 +9763 +-4108 +9968 +186 +9304 +4021 +6347 +3861 +-3970 +-1854 +6467 +-6305 +-742 +2934 +8959 +-5703 +7285 +-5747 +-4236 +3522 +-6884 +-6775 +1224 +-7467 +-1928 +5268 +-6617 +5977 +5179 +-3804 +3809 +-3087 +1213 +-8769 +-7399 +-3652 +492 +4551 +-9843 +-6338 +-5130 +4792 +1105 +3462 +-6236 +-586 +1442 +-6047 +7290 +-3990 +-1551 +-5730 +7961 +5499 +1925 +-7146 +-6431 +3259 +-5870 +446 +-9094 +-65 +-7418 +2861 +4822 +-4531 +-3749 +-6018 +202 +-3749 +4109 +-3888 +9256 +-4714 +8628 +-8568 +-5827 +5597 +-6251 +1915 +115 +-8146 +5908 +-1842 +-9095 +-9859 +6981 +5673 +-1910 +-7039 +532 +4131 +-6717 +-5730 +-7896 +-56 +80 +-1195 +6091 +-9200 +-8191 +-9804 +4615 +3016 +-4074 +-7397 +-5010 +-361 +5623 +1148 +716 +2743 +-6341 +7615 +-5843 +2511 +5018 +3236 +690 +-1144 +7198 +-5967 +-9696 +8994 +-2099 +-3419 +-8473 +-1746 +725 +9512 +7670 +-3752 +5865 +-7521 +-7965 +-5592 +-5407 +3085 +-1011 +1591 +-1955 +7597 +-3853 +2977 +-5159 +7925 +-2538 +3285 +-9380 +-7489 +6256 +8131 +5097 +7324 +-7624 +-5316 +-381 +4098 +-5930 +7797 +5809 +6250 +7584 +-784 +-7242 +-4056 +-374 +5591 +-74 +-6986 +-4335 +8028 +5807 +6289 +1397 +-8679 +3086 +1941 +3900 +4665 +4527 +322 +5130 +-7523 +-595 +8928 +4047 +-8892 +-9819 +-4127 +2827 +3130 +-4221 +5031 +-7143 +6061 +-5308 +2615 +9517 +2894 +-3151 +-2569 +-1377 +-2098 +13 +5427 +2500 +7689 +3038 +1691 +9424 +2051 +-6462 +-5707 +1411 +-9848 +6600 +3629 +7084 +2465 +-7184 +1172 +-2128 +-3590 +-1660 +2698 +9844 +5773 +8786 +5382 +2735 +-2019 +-8659 +-1659 +-2853 +8844 +-2825 +-2327 +-5310 +-461 +-9204 +-3731 +-1349 +8070 +8382 +9357 +4382 +1163 +-8242 +-5789 +6443 +-2261 +8973 +4213 +-4970 +-1761 +-3490 +-3926 +-5449 +-2748 +-8284 +2035 +2631 +9079 +-4366 +-2941 +3284 +-2352 +-2283 +9739 +1226 +-7227 +-752 +4821 +3263 +1818 +-2617 +-8903 +-8788 +7197 +-6777 +8116 +7417 +4696 +-6654 +1012 +-2018 +-2788 +-9963 +-876 +-9388 +1363 +-3868 +-9294 +-2813 +9949 +-4834 +8854 +8825 +-8290 +-7654 +8268 +7789 +-9033 +2926 +-7994 +3120 +-2300 +4106 +-83 +419 +1246 +-6299 +-9824 +-4475 +7847 +8919 +-678 +7841 +1418 +9902 +-7034 +-640 +8295 +301 +377 +7418 +-7806 +-9824 +-3970 +-6682 +9368 +-2889 +-6040 +9304 +-5044 +7210 +7490 +2643 +-2762 +-6842 +2176 +-8429 +4470 +5210 +9517 +-4473 +3336 +-297 +3302 +2244 +-3863 +-7698 +9522 +8916 +4047 +-261 +9849 +-4766 +-2177 +-5044 +-5923 +3569 +5259 +-962 +6471 +4421 +456 +3802 +-395 +3896 +7709 +-616 +-4054 +-904 +5097 +-5619 +8050 +6343 +-5012 +-668 +1421 +3151 +7426 +-8316 +-5874 +-4268 +3840 +-8865 +-7864 +9958 +-9523 +-9375 +5583 +-5880 +3341 +7847 +7265 +2375 +4445 +-8290 +7307 +-9564 +-4736 +2292 +-6050 +-6337 +1394 +2623 +4984 +7646 +-7219 +3654 +-3835 +-3845 +-4516 +6798 +-5988 +2847 +26 +874 +-4425 +-8088 +8002 +-1413 +7139 +-5617 +-6792 +-3084 +-6790 +-90 +-565 +7834 +5266 +5307 +-1028 +-1443 +-4091 +7619 +6332 +-9974 +4694 +-2901 +9496 +5868 +-8355 +-2996 +9888 +6885 +3439 +-4585 +9595 +2143 +3469 +-7057 +5443 +3669 +9967 +4706 +5175 +9093 +4564 +-1349 +5015 +-1935 +-1898 +-1023 +2534 +8347 +-2876 +-1202 +1725 +9804 +1348 +7240 +3755 +-378 +6051 +1087 +-7209 +-7019 +2945 +-8292 +6454 +2357 +3041 +396 +-3423 +685 +-9187 +512 +-3044 +7271 +2934 +2683 +-510 +-9633 +-3055 +1561 +8160 +2648 +5763 +-788 +8350 +-9443 +-8040 +-3282 +8328 +-44 +1056 +4866 +-7635 +-8543 +-588 +2514 +-6515 +-5221 +-7319 +4872 +6621 +7960 +6965 +-2285 +6596 +-4123 +-1371 +-4024 +8181 +-7921 +631 +5673 +8310 +280 +-4603 +5594 +-6205 +-6696 +390 +2538 +4381 +-6176 +-6857 +-3868 +1838 +1654 +7146 +8274 +-6149 +-8730 +5078 +4180 +3302 +4106 +-1863 +-2363 +7347 +2221 +7227 +-200 +8847 +1362 +2314 +3376 +8259 +-9261 +2623 +-2005 +2862 +-1047 +-6844 +-4172 +-9060 +-4851 +7143 +2065 +-6351 +9696 +-6732 +2852 +-4631 +-2244 +-4061 +-8143 +5859 +-44 +-7737 +6164 +-6259 +3023 +-9664 +5814 +-2283 +1314 +-5266 +-8907 +4180 +6374 +-310 +-9558 +-3838 +9409 +-9670 +-1593 +2964 +211 +-557 +3226 +9468 +4389 +-1712 +619 +2244 +1336 +-2615 +3382 +5330 +-7692 +8840 +7316 +9541 +-1404 +-4004 +-15 +-8543 +-3062 +-7370 +2599 +-1999 +5468 +-7475 +-5691 +7296 +-3283 +-3848 +8798 +-98 +-2266 +7105 +506 +5668 +-1674 +-8543 +-1023 +-507 +5759 +-7351 +-3058 +1746 +2245 +5602 +-564 +-6880 +6471 +8840 +-4081 +-1691 +-804 +-686 +147 +-3672 +-1707 +523 +-9997 +-235 +-8563 +3197 +-440 +-4012 +-7638 +-8173 +-803 +7355 +8182 +7332 +-8758 +-4915 +-2278 +-6629 +2160 +-9033 +5570 +-6441 +-4475 +-381 +-1879 +9723 +6600 +2022 +-4615 +-6151 +414 +-7002 +2840 +6976 +8084 +803 +-3881 +-7601 +72 +2797 +-7532 +-5137 +1548 +9622 +1223 +4127 +2759 +-5647 +-6059 +8479 +3160 +6782 +-8000 +-4133 +-1981 +132 +-6573 +-3659 +7841 +-9139 +-2447 +-773 +6658 +1172 +-3943 +1616 +2935 +-9287 +8678 +-6828 +8871 +-8597 +-6611 +9517 +6067 +4518 +-3212 +5550 +826 +7060 +7065 +-4483 +-9411 +-6718 +3510 +-4849 +-5660 +1133 +4561 +268 +-4001 +3127 +5980 +6505 +-3315 +9597 +1144 +-2954 +5485 +450 +-4873 +8920 +5735 +4390 +-9582 +-5047 +-8350 +-4050 +8375 +7542 +3896 +-1539 +9206 +3862 +-5957 +-3194 +8511 +-4631 +-2557 +-8961 +-2222 +6967 +-5770 +9157 +-6238 +-3211 +9842 +249 +-3 +-6215 +2080 +9223 +-6687 +320 +-1156 +-8615 +-2493 +-1526 +9125 +-6014 +-2557 +-4849 +9043 +-8225 +-4566 +8423 +6762 +-4297 +9841 +104 +350 +1755 +4432 +-8468 +-4128 +-6266 +7656 +-2709 +-8588 +3924 +3161 +9520 +5644 +9656 +9862 +-1629 +-5183 +-8905 +-3659 +-9828 +-5791 +-6705 +-111 +1867 +-6735 +-302 +-8884 +-2050 +-2557 +-2042 +-1998 +617 +-2066 +9298 +-6258 +780 +-9205 +-2338 +-4951 +-8155 +-9238 +6248 +1982 +8248 +3809 +4792 +-7671 +7099 +-5960 +5018 +6125 +-9576 +2814 +6154 +-1785 +4959 +-3150 +3614 +-445 +-5566 +-9888 +-7021 +9706 +7370 +8333 +4564 +2558 +-9312 +-586 +-7852 +2654 +4285 +6265 +-9354 +6198 +3646 +-5308 +-4257 +-6363 +5615 +-8041 +2766 +-5136 +8103 +-5247 +669 +-3033 +-8188 +-438 +-708 +-9367 +4448 +3073 +5383 +3183 +5549 +-3742 +2707 +7398 +2464 +4679 +8359 +-2972 +-2366 +-7921 +6828 +3041 +6237 +-4692 +4094 +-3016 +-2694 +7476 +5106 +-8636 +9053 +-7016 +9484 +3815 +2955 +6987 +-6072 +7053 +2841 +-5735 +-8620 +9986 +4023 +-135 +-93 +7677 +-6054 +-3529 +-7204 +3150 +-8233 +3808 +-1047 +7249 +-9060 +9985 +-2536 +-3713 +-2816 +-6185 +-2199 +8853 +-1336 +-901 +-642 +-4312 +7080 +-5260 +-1281 +7087 +-1224 +-3138 +-1832 +-8751 +4669 +5402 +-588 +5198 +5642 +-4607 +-9289 +9014 +-2966 +1467 +-6679 +-6311 +-3191 +-5983 +-5606 +8981 +-7882 +6981 +8061 +-1900 +4054 +3809 +-5308 +5186 +9614 +-8472 +2413 +-1388 +6528 +-4840 +2065 +2502 +2948 +106 +-6607 +-2967 +5767 +8999 +-6681 +8992 +-2571 +-3020 +-1794 +1665 +3067 +-8064 +-6335 +8002 +-4374 +4020 +-4700 +4049 +6047 +-7671 +-8742 +-9840 +5414 +-6730 +9062 +2462 +386 +-815 +-7900 +1138 +-1501 +3381 +-9133 +8258 +5549 +3822 +5322 +-2123 +-6880 +-8537 +-3096 +-8316 +-742 +-2821 +-6777 +-3200 +4119 +-5951 +-3731 +-1240 +8205 +-7624 +247 +5801 +998 +-3040 +-1002 +1329 +455 +7573 +-9432 +-40 +-1484 +6790 +2861 +-65 +4566 +44 +2977 +4218 +8171 +3321 +7476 +7894 +7918 +5170 +6060 +968 +422 +4379 +-1187 +6725 +-83 +-7219 +-7949 +-6977 +7460 +-2913 +8806 +324 +4113 +-3958 +-1677 +2011 +-6432 +-1328 +2621 +783 +-6088 +-4526 +-9254 +-6966 +221 +-8733 +1835 +-3707 +2894 +199 +-9600 +-9015 +3532 +4337 +-2851 +7904 +5008 +-2123 +-8196 +-4694 +-2053 +5990 +-8349 +7592 +-6064 +-5028 +6600 +-5939 +4431 +-5531 +-4065 +-9470 +9256 +-8108 +2407 +-2119 +-6813 +-6734 +-7588 +-5801 +9862 +4342 +5080 +-3353 +6018 +-4236 +-565 +-6034 +1104 +1663 +6228 +-1993 +-7368 +-709 +5091 +9971 +-9240 +-7646 +-1507 +-2020 +-6277 +-6681 +6125 +4207 +9957 +8958 +-9871 +-2140 +-746 +-5415 +9483 +-2748 +-5960 +-2404 +8724 +-5966 +6044 +-5939 +3055 +-769 +-5043 +7292 +-5763 +9913 +2278 +9540 +9282 +1069 +-3453 +4924 +-8913 +-1785 +8485 +6164 +8236 +-3265 +9804 +3621 +6332 +-6404 +-4984 +-435 +-1175 +-3724 +-8980 +1663 +-2677 +9670 +3860 +-7959 +4129 +-3377 +267 +-5995 +-4902 +-3552 +-9946 +-3989 +8254 +9556 +-3125 +1067 +-8706 +2743 +-4909 +6952 +-2958 +-6230 +80 +-4200 +4433 +5197 +5869 +8517 +-6349 +1085 +-5531 +8571 +-5761 +-8166 +-7418 +4816 +-1785 +3822 +-4627 +-4554 +-4457 +9478 +-7037 +4518 +-4915 +-4871 +-6926 +6979 +-8669 +2475 +-9755 +-2148 +3630 +5597 +8504 +-7781 +4206 +6217 +-8876 +-5627 +-7346 +-1869 +-6730 +1864 +-3377 +9260 +-636 +-2895 +213 +-9083 +2596 +7756 +-7995 +8341 +-1879 +976 +-1707 +-4480 +7962 +-3531 +-2552 +213 +-4712 +-9191 +9910 +-9139 +2775 +-8198 +-9014 +6466 +2722 +-7293 +-9923 +-5005 +9682 +6248 +7756 +-7395 +-4119 +-4939 +-6822 +-8971 +3133 +2885 +-1824 +-1607 +9755 +-9815 +-334 +-4884 +-7434 +2775 +-119 +-4703 +6988 +-3372 +4658 +-4090 +2604 +-8709 +1812 +1925 +1759 +-2334 +8844 +-7484 +7778 +-7798 +-2776 +-5997 +-6867 +-1311 +8258 +3516 +-6005 +-2821 +5780 +-1829 +7823 +-5610 +734 +-7862 +6179 +7166 +892 +1755 +3754 +8880 +1369 +-8816 +-7853 +-7545 +-5076 +9943 +6372 +826 +3001 +6072 +5606 +6588 +-602 +4872 +8308 +9153 +-1175 +9902 +-4343 +-72 +3646 +-1607 +-8541 +-8620 +-7291 +4206 +2695 +-735 +1151 +614 +-9012 +148 +-1750 +-5806 +-6880 +-2011 +3939 +8423 +-7635 +509 +5282 +386 +-888 +-2498 +-6409 +-2671 +3276 +-23 +-5850 +6347 +3810 +6596 +4267 +-1707 +7596 +9967 +6379 +-3343 +5413 +8973 +3604 +-5712 +1681 +-9483 +5810 +-5981 +-2577 +-2355 +-9121 +-4249 +-3296 +95 +-9724 +-1328 +4561 +-941 +4888 +-2989 +-1105 +-6390 +4078 +9696 +-3548 +3663 +-7471 +1203 +-9180 +1426 +-1942 +-6429 +-111 +2176 +4882 +-4507 +-9209 +-2500 +-8871 +5806 +2723 +8994 +-88 +1309 +9351 +-8324 +-3738 +3919 +6664 +-8188 +-2100 +1336 +-116 +-5161 +-6206 +-879 +5767 +-6305 +3662 +-7178 +-9612 +-7454 +2834 +7769 +-4873 +4874 +5763 +-9474 +-3822 +-92 +-1245 +-3302 +2568 +-4284 +-1215 +-9191 +-357 +-4978 +2826 +2419 +-8057 +1903 +-2823 +1692 +-2123 +-2199 +2321 +3751 +-7660 +-3466 +-6230 +-3902 +3723 +-4356 +6020 +-9705 +3025 +-8820 +-858 +1688 +8439 +2305 +-6225 +-1161 +-9696 +4615 +-2923 +6523 +5427 +8859 +-1728 +320 +-4671 +-7705 +-91 +6758 +-1839 +4894 +5314 +1336 +-4080 +-1999 +-7536 +444 +4950 +3140 +-5957 +-2300 +-225 +8129 +8239 +-6014 +-602 +8623 +-9953 +-9018 +7921 +-3509 +6861 +5416 +4842 +3878 +6934 +4192 +-6277 +-9180 +2827 +-1401 +-119 +-5824 +-6091 +-1768 +4994 +-317 +-1213 +3808 +1466 +-4933 +-9647 +2010 +-5332 +4466 +3896 +1081 +3123 +-6441 +2940 +-1484 +4499 +-6873 +-1319 +-1679 +-3073 +-1918 +-3300 +2179 +-7765 +-235 +-9984 +-2519 +9930 +-6390 +-8269 +-6314 +-7583 +-2028 +-3629 +-3779 +9826 +-2538 +3560 +861 +116 +-1303 +7242 +-4411 +-139 +-8707 +6292 +-3177 +-3163 +-334 +-3880 +-2056 +5115 +-1795 +-4435 +9078 +2162 +-4768 +-4529 +4160 +-5763 +8129 +8259 +8222 +495 +-4687 +4482 +-5804 +9923 +3850 +6301 +-4725 +-7949 +3248 +5416 +9468 +-8816 +-3019 +1177 +4710 +7916 +2176 +-5203 +-4963 +234 +-5101 +2589 +2223 +6154 +-7429 +1222 +5130 +6798 +1548 +-1040 +-204 +-2175 +-8129 +-9307 +-4353 +725 +6210 +4952 +3286 +2942 +-8129 +5416 +-565 +-6621 +4170 +9723 +3571 +7301 +-7350 +-9544 +-8746 +9251 +-9667 +-4769 +5845 +7777 +5059 +8247 +2154 +3510 +-4760 +2364 +-3008 +4952 +-7466 +5722 +-1560 +-4418 +-4675 +4269 +9329 +5152 +5181 +4749 +9783 +-2590 +-4393 +3971 +7250 +-1766 +-5181 +-3498 +4800 +2700 +5091 +9522 +-8907 +-5069 +-741 +6097 +1110 +-5606 +-4048 +-7695 +-7705 +4456 +-6120 +-5800 +-1858 +5655 +-8732 +2655 +1915 +9716 +5917 +-8970 +7301 +3820 +-9936 +-938 +7361 +-263 +4499 +3687 +5259 +-3815 +625 +8483 +6371 +8840 +-9322 +-660 +-5959 +4676 +6788 +-8460 +4566 +1444 +4338 +-6615 +9017 +-169 +-7583 +-4819 +2648 +-5570 +8544 +669 +3286 +-5858 +-9954 +3423 +3877 +4594 +-4527 +7516 +4431 +-3800 +6117 +-962 +3414 +7387 +-5240 +-1705 +-6821 +2903 +-8607 +-97 +-4601 +2143 +-8328 +9224 +-7569 +2095 +-205 +-2395 +415 +-444 +-7427 +-1170 +5080 +-2007 +9356 +-3310 +9969 +-4838 +1644 +7855 +8148 +7136 +-5307 +-2361 +2705 +3404 +3862 +-7143 +-2352 +-5529 +-335 +-6606 +-3740 +4170 +3955 +2496 +5865 +-4371 +-219 +7817 +3263 +-6129 +-1688 +-2066 +4710 +1014 +6767 +-3779 +5655 +1492 +-8907 +-9474 +-2485 +9567 +4477 +2219 +4170 +4875 +1263 +-5920 +-382 +9917 +9880 +4823 +-8725 +2672 +500 +-6961 +1155 +3924 +-507 +8655 +7603 +-7408 +1065 +7281 +2266 +-5252 +4854 +8034 +2411 +6018 +7743 +-9885 +5763 +-8032 +-8743 +7398 +1470 +-816 +-2606 +8471 +-9924 +-8065 +-2996 +2176 +5427 +-401 +3143 +-3260 +3358 +2948 +-4237 +-6407 +4431 +916 +3684 +2574 +-4024 +7291 +-2107 +-915 +6660 +4694 +-6089 +8174 +-5101 +6191 +-7109 +6378 +-8820 +6372 +1030 +8792 +-7330 +-9325 +5990 +-5937 +-9252 +8599 +-853 +-1140 +-8794 +799 +-9664 +-8682 +-8056 +-9111 +8522 +770 +-4842 +-4634 +-708 +-3472 +-2817 +1232 +-1746 +-3882 +8713 +9017 +3121 +-4411 +-7105 +-3656 +8258 +5644 +7954 +7725 +723 +6347 +-7169 +-1336 +-6990 +-1919 +7789 +4193 +3615 +1176 +5119 +4111 +-6660 +3495 +-9675 +-706 +4003 +-6341 +6298 +9257 +-6202 +-9282 +2593 +5278 +-7323 +4025 +7561 +7232 +9062 +-4901 +2133 +-8198 +4280 +-5967 +-6187 +-8015 +8415 +9017 +-6871 +4258 +-6411 +-503 +-8377 +8292 +-399 +-8146 +2596 +2042 +1042 +-92 +973 +7814 +-4425 +4952 +5963 +-6185 +-3848 +-5605 +-3702 +-1763 +-1161 +-3730 +-1817 +-1848 +-4687 +-2498 +31 +-1108 +6821 +-842 +-1349 +-9996 +-1462 +2434 +926 +2353 +-4257 +1103 +-8733 +5845 +5718 +7408 +2764 +8779 +-8578 +2341 +-4814 +7400 +-8736 +585 +-5161 +5427 +-8595 +-1083 +523 +-5772 +-2818 +-1377 +-2798 +-1283 +-5041 +-6668 +7314 +-9848 +-2374 +1223 +8533 +9477 +-5933 +1834 +6151 +-3482 +5992 +-8146 +-7532 +4251 +-8800 +3428 +3896 +-7857 +-2352 +3525 +-901 +-7013 +-4410 +7960 +1090 +-5712 +-399 +-2367 +8011 +924 +8366 +-6647 +-670 +-1264 +-7338 +7353 +5268 +-8620 +4218 +-7105 +1201 +5607 +-7851 +6250 +-9023 +-2050 +5720 +1698 +-4984 +9607 +9424 +-4692 +-8735 +-8669 +5638 +-1271 +-5445 +-686 +-7146 +3899 +-5923 +-9334 +-3267 +547 +7261 +-7039 +-1633 +7337 +-1782 +7989 +8122 +-3974 +3206 +-1696 +9115 +5198 +-3031 +-8258 +-376 +9296 +-2138 +7206 +3669 +4176 +1860 +-4945 +-9582 +-5487 +-926 +1305 +-5098 +554 +-52 +1062 +2958 +-2419 +2590 +1717 +-7338 +-7693 +7081 +6254 +-4001 +-8977 +-8355 +-6720 +-4645 +5905 +1482 +-1757 +-874 +6280 +-4476 +-9940 +1406 +-7002 +-7791 +-9536 +7559 +4643 +-389 +3388 +2547 +6586 +-6139 +-9673 +-7801 +364 +5225 +-8342 +-2111 +1024 +8290 +7544 +-1156 +5850 +6242 +4667 +1711 +1873 +1717 +-42 +-8418 +-5114 +388 +6357 +9510 +-817 +461 +25 +-4098 +3883 +1565 +-2793 +-5491 +-3128 +9783 +-979 +-5096 +3573 +1224 +6889 +2695 +-670 +-6611 +-9690 +-4881 +-5573 +-6023 +-9387 +-6276 +3729 +9622 +101 +-277 +4510 +7635 +3079 +9245 +197 +5477 +1963 +-7961 +6898 +4336 +-4736 +2115 +6254 +1039 +-3353 +1928 +7685 +6014 +-7930 +-5647 +5857 +5072 +9075 +9144 +-9474 +-185 +3629 +-8694 +-5007 +4485 +831 +8215 +1665 +1690 +-6184 +4432 +2033 +-8355 +4937 +-708 +5293 +2451 +-3552 +-5392 +-7480 +-3126 +-8472 +3074 +625 +5348 +-2100 +2360 +1358 +-1560 +-9923 +8175 +-88 +-1643 +-3053 +-7801 +-3559 +-5421 +9271 +-602 +-6223 +-4578 +387 +-7114 +6818 +-1754 +1924 +-2099 +7817 +-1839 +-6092 +-3881 +-7341 +-760 +9524 +-6815 +200 +6467 +7253 +-1108 +-7534 +7337 +7552 +-9662 +612 +5757 +4495 +466 +9371 +-4860 +7960 +-1272 +-7949 +6729 +-8236 +9185 +7056 +4773 +-9375 +9393 +5785 +1045 +-1067 +9137 +-588 +8519 +849 +-4221 +-8961 +-8693 +-2745 +4167 +-6742 +7135 +-1431 +1085 +7087 +-399 +5343 +2268 +-7904 +-1938 +4170 +7461 +-9096 +-8409 +-6216 +9298 +1203 +5393 +414 +8132 +4516 +-1824 +-5619 +1692 +1127 +2932 +1687 +-6092 +-4564 +4392 +-1195 +6868 +-7619 +1922 +-6431 +2286 +-5392 +-9443 +-9784 +1557 +-7628 +383 +3208 +-7553 +-1946 +-2228 +6547 +2797 +-3399 +7882 +2669 +1776 +3815 +-15 +2162 +-3289 +3170 +1518 +-1592 +-4311 +-8194 +5623 +6248 +2929 +-4723 +-9120 +-5772 +-1795 +5990 +4106 +9974 +3079 +8359 +6630 +3769 +-8082 +8803 +7009 +-5561 +4153 +-6790 +-826 +9891 +-1028 +4874 +-7447 +-2970 +-4926 +2359 +6020 +9390 +5990 +-3092 +-8466 +1561 +6819 +-4342 +-7038 +-6093 +-2011 +-1976 +-9738 +8236 +-4475 +2812 +8563 +6697 +7261 +8765 +6924 +9037 +7887 +-8318 +-5930 +-5944 +-4430 +8880 +5801 +3809 +1502 +-1155 +7405 +-7603 +-8050 +-6984 +794 +2942 +-1976 +4561 +1964 +-6919 +-5644 +-4083 +222 +-4498 +-5660 +-1064 +9723 +-1686 +1973 +-5617 +1369 +-457 +-3847 +-4579 +-8747 +8756 +-5382 +8217 +-7997 +-8748 +6367 +-9468 +1164 +-517 +-2056 +2726 +5690 +2887 +3439 +-4314 +3301 +-1131 +-2049 +-8810 +-784 +-7344 +-688 +9122 +-9205 +5414 +9983 +-5183 +-3482 +4954 +-5755 +4262 +-19 +25 +-1298 +-1582 +-3481 +748 +2643 +-371 +-8884 +-2360 +3427 +-2681 +4541 +-5660 +7347 +-6411 +-9293 +2434 +-189 +-4578 +-5380 +3730 +2929 +2940 +7726 +-3012 +1021 +8999 +6091 +-2130 +-3301 +-3989 +2511 +-8326 +-9379 +-6308 +-3635 +2769 +-1607 +-2099 +-2924 +-6139 +6929 +7426 +2743 +141 +-7537 +8275 +-7664 +3987 +7380 +7792 +337 +-2371 +3615 +-2357 +1065 +8294 +7355 +-1983 +9026 +-8688 +1021 +4669 +-1110 +2622 +-7178 +4495 +5136 +-1170 +4863 +-8277 +8151 +6762 +4929 +-4576 +-7022 +9811 +-7765 +-3384 +-4020 +-5799 +9206 +1246 +3487 +-3303 +-6639 +-5417 +9685 +1093 +539 +6081 +-8638 +-6064 +-1719 +6779 +2162 +-9839 +-5791 +-248 +1822 +-2090 +-1501 +8347 +-2199 +4470 +-3414 +1263 +5576 +-3994 +7851 +-9200 +-92 +-1098 +-5098 +-9236 +-6230 +-7046 +5249 +-3529 +-9583 +-6028 +-7090 +-1798 +-9907 +-9365 +9099 +-8248 +9504 +362 +-4312 +9422 +-1378 +-5870 +-2508 +-360 +4438 +8982 +-8079 +1171 +-7296 +-2766 +-6125 +5743 +5576 +4749 +-6245 +1647 +-1830 +1172 +-3535 +1385 +-1140 +-2585 +-4931 +-2719 +-250 +-9871 +-768 +-2892 +8953 +8318 +9465 +-6945 +-5039 +3680 +-7090 +-2608 +970 +-8129 +6848 +-4837 +9410 +8847 +669 +-5565 +6900 +9790 +-4086 +2248 +-790 +-657 +-312 +-3095 +5843 +7490 +2315 +3439 +-3012 +-6141 +3569 +7941 +1667 +6018 +-4902 +9723 +-557 +-6544 +-9292 +1287 +9429 +-8307 +8585 +-941 +-2876 +-5319 +5524 +448 +7295 +-365 +7096 +-70 +2454 +9527 +4448 +-3877 +-9197 +5773 +5992 +-768 +-2305 +-7391 +-5831 +-5062 +-7979 +-4807 +8508 +1438 +-4098 +664 +-8558 +-4252 +7939 +4172 +-1851 +1415 +3607 +9888 +5963 +6394 +9670 +6557 +4510 +5992 +8840 +6301 +7689 +732 +8845 +-5429 +-3370 +-4923 +-4935 +-9666 +-4410 +2170 +3971 +-8596 +9962 +-6299 +-4946 +9616 +7062 +8821 +7947 +-8620 +-9763 +9963 +6635 +-1660 +-4978 +-154 +5757 +7789 +-5804 +1811 +-5479 +1966 +5079 +-8076 +9326 +-3315 +-3516 +3747 +-9571 +-1337 +-5601 +6280 +-3847 +9083 +5870 +7709 +-2361 +980 +-8396 +-2251 +7240 +-4487 +-2471 +-8518 +4891 +-5565 +-74 +2850 +-4888 +-7835 +3946 +-5453 +-1035 +-3471 +5139 +-665 +-6821 +-7296 +13 +1824 +-8338 +4251 +-5308 +748 +-581 +1059 +9889 +-2641 +7237 +-6063 +-164 +9777 +8916 +-2437 +-6053 +-6411 +-7364 +4848 +-7801 +-3479 +5342 +-2378 +7241 +8800 +-3961 +-98 +9540 +-6851 +8797 +-4673 +-5887 +-9744 +2063 +1343 +-1603 +2528 +3358 +-499 +9750 +7070 +9790 +-7176 +-4954 +362 +8854 +-9106 +5729 +1844 +6892 +-7480 +5963 +-6272 +970 +5718 +-2859 +-5183 +-5601 +6917 +664 +2025 +-5739 +-9650 +2409 +6292 +5763 +2312 +-4489 +-8204 +-2338 +-3301 +115 +-5054 +6210 +2948 +-2700 +6961 +8871 +-2271 +4181 +-6607 +9260 +6546 +-8426 +9242 +6182 +-8694 +-1701 +7157 +8423 +7814 +-5028 +2080 +-6638 +-9673 +-1131 +9564 +5249 +-3464 +-1501 +6726 +2703 +-7532 +1479 +-2286 +-9736 +518 +835 +-1236 +5070 +4400 +7285 +-8494 +8178 +836 +6079 +5545 +6848 +-8730 +-8426 +-1662 +-8933 +4208 +-2713 +-363 +-9015 +4485 +7841 +115 +-3652 +5135 +8992 +-8681 +3687 +6346 +3604 +-9461 +-1798 +7859 +5167 +382 +1062 +5338 +-8341 +7859 +-1042 +6505 +-7325 +8479 +1938 +-6000 +5857 +8798 +2942 +3820 +-4582 +-5117 +-3311 +7924 +664 +-6532 +-793 +4872 +-3799 +-382 +9245 +2605 +5716 +1677 +4679 +-340 +-4834 +1241 +-2901 +21 +2986 +7916 +-1376 +-1303 +-5186 +-5804 +1568 +-2037 +-219 +4338 +2299 +6422 +1277 +7575 +627 +3724 +7381 +-4748 +-842 +365 +-5917 +-111 +-4809 +-4529 +-4054 +-7951 +-4814 +2502 +1247 +-7862 +-2572 +-8555 +-6688 +-8468 +7500 +5674 +3208 +3073 +5236 +-7678 +3946 +-3665 +-1851 +-8014 +6129 +8308 +8067 +-8350 +6859 +7962 +-4366 +7483 +7697 +-6796 +2398 +-4915 +4397 +8145 +6958 +-6794 +6374 +2143 +1862 +4527 +-6431 +-6020 +-688 +-8904 +4157 +-2786 +6029 +322 +4172 +1361 +256 +5523 +6512 +-8904 +5841 +8222 +-4264 +-2372 +-6850 +6725 +-6794 +-7073 +-5382 +-3881 +8839 +-4840 +-612 +-5942 +7723 +-8049 +37 +796 +3150 +5924 +7789 +-7206 +-317 +2979 +-1388 +134 +-486 +9959 +-297 +-781 +8069 +3717 +1836 +9929 +9910 +1812 +5288 +-7694 +1423 +1106 +-4125 +4029 +-4768 +4403 +5810 +3246 +8240 +-140 +-8292 +-2180 +-6638 +6389 +9093 +-6705 +-2404 +4650 +-3696 +4416 +-2383 +5765 +9566 +-1083 +-5750 +-103 +-6346 +4386 +7360 +6820 +7957 +-7419 +8275 +-6727 +8475 +-7711 +-9102 +-695 +6307 +-6019 +2298 +4900 +1598 +3454 +1394 +-9450 +512 +-1224 +9493 +6530 +8624 +7559 +-9564 +-5332 +-6845 +3573 +-7635 +3991 +7135 +-1377 +8822 +9987 +3953 +3615 +-4093 +6287 +-7364 +6298 +-6570 +3924 +-1946 +-1541 +1105 +6739 +8867 +-5751 +7480 +-4060 +-739 +-8543 +-5643 +2769 +7682 +-3234 +4338 +8964 +1534 +5488 +-5923 +9566 +-9642 +-6589 +-5310 +-668 +2330 +-2064 +-7486 +-9384 +4628 +-2089 +1675 +-6481 +-5865 +3794 +8423 +8724 +9958 +5623 +7384 +-7471 +-3055 +8161 +-4961 +-6836 +-4549 +-1122 +7361 +-6785 +-3811 +-5852 +-4264 +4665 +-7937 +8880 +-9697 +-5491 +2011 +-249 +4848 +8922 +8308 +-5676 +4942 +2979 +4106 +9384 +-4717 +5499 +8030 +1151 +8597 +-6141 +-8876 +-815 +7130 +-6610 +3208 +-8539 +-3960 +-5044 +-9824 +-5796 +-3093 +5841 +-9205 +7791 +-2958 +-2809 +-2979 +6677 +-4767 +5438 +-5145 +2197 +-9330 +9093 +9385 +6798 +1151 +2759 +-4909 +3084 +5814 +-4881 +-844 +-6000 +7096 +1149 +-9236 +-7105 +8915 +407 +840 +-8828 +-5482 +7789 +5718 +-3353 +4369 +-965 +-602 +6287 +-2505 +-7406 +1753 +5261 +-2936 +4743 +-4720 +-7893 +3862 +1230 +6177 +1122 +-4029 +-8465 +-5624 +5414 +2769 +-1902 +3679 +5372 +8686 +8612 +3149 +-6794 +-3464 +-9204 +9639 +-3129 +-9008 +8071 +2419 +-6691 +-8460 +2938 +2532 +2229 +5811 +3208 +-2646 +-2989 +5864 +209 +1966 +6029 +5987 +-9157 +5843 +-3101 +2043 +4292 +1908 +-6464 +9206 +-8834 +-7682 +4297 +7301 +-2594 +-3973 +5405 +-3471 +2499 +9839 +-7351 +-914 +5845 +-6515 +-9136 +-9428 +7847 +5352 +-2050 +8901 +-8620 +8333 +-5047 +-8326 +-7487 +-8709 +9994 +7148 +1964 +-1220 +4435 +-9042 +2292 +-4264 +7841 +-7650 +3263 +-1988 +5155 +3750 +396 +-9921 +7704 +336 +3924 +-9654 +3862 +-758 +-8346 +-1841 +-5261 +8334 +5595 +1230 +5746 +7645 +-2557 +2294 +-5942 +590 +-2382 +9446 +3535 +-3926 +9501 +8894 +0 +-2056 +8936 +-6730 +-8557 +6317 +-922 +1243 +-9676 +-1894 +-4115 +9424 +-5740 +-9284 +-3383 +-5866 +7084 +4452 +1263 +4023 +-9538 +-9852 +4296 +6375 +6537 +4829 +-8814 +7094 +721 +3719 +1792 +9251 +3991 +8880 +5732 +5342 +752 +7891 +-2394 +5565 +4206 +7957 +-6742 +-1507 +-7619 +7301 +5591 +-3893 +1667 +-2458 +9882 +-6462 +7849 +-2594 +5591 +-7114 +-4896 +-4268 +-6720 +1021 +8230 +-1817 +-1916 +-9421 +-7397 +9618 +-7312 +4849 +6736 +-6214 +1906 +8754 +1896 +-5694 +-9576 +7571 +-4286 +-5151 +8806 +-9997 +-5740 +1735 +7062 +3719 +-1571 +9037 +6556 +-1532 +574 +-1056 +932 +668 +-8439 +7088 +-9471 +-3096 +-8590 +1673 +3972 +7209 +4514 +-710 +-1328 +-3959 +-1102 +3183 +-5203 +-5432 +-8338 +-91 +-9846 +3263 +3539 +-3943 +5075 +-6070 +-3184 +9765 +1382 +5260 +2935 +7240 +5890 +3032 +-4884 +5446 +-5531 +-9837 +-6971 +-1404 +-773 +1572 +8519 +-9411 +-2483 +4975 +-7921 +2747 +9312 +1230 +137 +4554 +8279 +2030 +6180 +7405 +-9139 +860 +-8388 +5852 +-9495 +8613 +-1329 +-1675 +5880 +-8931 +1348 +1006 +-8519 +2221 +-8555 +8699 +8597 +-4766 +-1748 +900 +-6156 +5647 +8259 +5869 +3771 +9223 +917 +4389 +1167 +1755 +3808 +7561 +-6262 +-6705 +-135 +-5756 +-7323 +6903 +-9041 +-1067 +4269 +-6075 +1631 +-1992 +8132 +5242 +2818 +-19 +-2831 +4232 +-9017 +-3548 +9093 +-2297 +-6825 +-2941 +-3359 +6298 +3067 +6371 +5136 +335 +2841 +9409 +-4004 +6614 +-602 +4922 +-8284 +-5756 +5324 +-5739 +-2593 +-817 +9873 +6702 +746 +-5110 +4039 +3614 +953 +4386 +-374 +-8560 +-8297 +1497 +-9978 +4130 +-5619 +-6462 +2159 +6008 +-2896 +4294 +8105 +-9274 +-1045 +8871 +3002 +83 +8457 +5451 +-4634 +209 +-7506 +-3044 +-1770 +3321 +7568 +8522 +-8945 +1875 +-3460 +9468 +1151 +8423 +-6961 +-1749 +9860 +-9690 +-8543 +-8998 +4798 +-4836 +-6705 +5626 +-2793 +-5009 +9769 +3934 +338 +9804 +-484 +-6734 +4111 +3021 +7701 +8300 +419 +-7253 +-7164 +-1774 +-8016 +6384 +-3943 +-1600 +-1002 +6445 +-6945 +3921 +-3709 +812 +4458 +-3210 +-7828 +3925 +9215 +4188 +-2282 +3471 +-2556 +7175 +-7166 +5651 +2812 +-7601 +-7234 +-9180 +1549 +1155 +-2498 +4574 +-1377 +-899 +-3552 +7781 +5638 +-4939 +-2745 +-728 +9953 +8313 +8622 +1667 +-6430 +-5091 +2862 +-2901 +-4769 +-5081 +-59 +-2834 +8333 +-6705 +974 +9721 +-7532 +5637 +-6851 +5270 +7467 +-4926 +8613 +-8875 +9879 +-6177 +3222 +-240 +7391 +-3 +-1293 +6055 +1177 +-3153 +-5767 +-7434 +-378 +6125 +246 +9429 +8347 +9222 +-7726 +8097 +-5064 +-2776 +-9625 +-1589 +2834 +-9281 +476 +8618 +9414 +-5431 +-3686 +-1746 +83 +-3046 +3293 +-5606 +-3096 +9882 +3041 +-8066 +-6844 +5343 +4650 +5551 +-2820 +-8784 +-4699 +-7162 +1528 +186 +4923 +608 +-3260 +-3258 +-5205 +7559 +-6000 +44 +3022 +-3847 +8328 +2550 +-8292 +2885 +1922 +3615 +1100 +-574 +8205 +-4735 +1980 +-7391 +9074 +2275 +-2569 +-7765 +458 +-9421 +-6160 +3563 +-6262 +-9007 +-7474 +5136 +-8050 +7552 +-4698 +-2164 +6718 +-2050 +2398 +1698 +6467 +-2816 +-1856 +30 +-1155 +-5252 +-1096 +7386 +733 +3263 +-9058 +5514 +-6225 +5651 +9953 +168 +-4917 +-7730 +9477 +4615 +3319 +-6515 +-2446 +8624 +-5069 +-486 +-1787 +-5779 +2747 +-156 +-2185 +5846 +5668 +8439 +1673 +4060 +-2013 +-2015 +-3142 +5992 +-6053 +9937 +-9871 +1886 +-3184 +998 +-5435 +-3685 +3808 +-4108 +721 +-5712 +344 +-7589 +-3434 +7995 +2841 +-4128 +5115 +-664 +3877 +8129 +1786 +7680 +7385 +6889 +2054 +2998 +8921 +-843 +980 +-1853 +-6815 +9148 +-4144 +3566 +-8173 +23 +1821 +-807 +7789 +5088 +6961 +6265 +-3228 +4224 +7316 +2446 +-6705 +4049 +-8598 +1726 +-9423 +9029 +2995 +-6576 +-3147 +-2177 +4894 +4521 +-3471 +6137 +4650 +6296 +3809 +-9503 +-5348 +3687 +-5507 +1820 +5198 +3995 +4134 +-7546 +-7407 +8515 +-9242 +-6677 +382 +2712 +3804 +-2068 +723 +-415 +19 +-1707 +-4851 +-8703 +4024 +-8746 +-2746 +-4311 +3002 +2929 +6694 +-9674 +4789 +1184 +-4750 +-5221 +-5636 +899 +-7403 +-1654 +6397 +-2906 +-8016 +-658 +-1879 +-3738 +-7166 +-2505 +-9 +5668 +-3058 +5813 +-5081 +148 +4783 +3252 +-7423 +-6266 +-9154 +1958 +7816 +9407 +2345 +-2031 +-4671 +3822 +-9546 +-4599 +-3062 +6181 +-135 +511 +-4756 +-1080 +-214 +3795 +2769 +-1797 +5096 +-6604 +-857 +-7049 +-6963 +-8269 +-8998 +-9747 +4250 +-382 +5488 +-2594 +9528 +8033 +-8429 +-3812 +-1430 +3536 +7916 +6217 +7938 +5335 +9541 +-636 +3115 +-2050 +5239 +-6397 +5409 +4643 +-8067 +-9992 +1691 +252 +1226 +6179 +6287 +8723 +-1426 +-475 +-2946 +-9937 +-9322 +9074 +9341 +-3394 +3419 +-9304 +-8341 +5022 +-9553 +980 +6776 +2743 +435 +-4795 +461 +-2146 +-2719 +4253 +-3970 +208 +6938 +-7900 +1659 +6191 +8703 +-6139 +847 +-3460 +7329 +-3348 +-579 +-6137 +5768 +23 +4812 +-4419 +3147 +7534 +917 +-7505 +-1642 +-7443 +-1685 +8871 +5111 +6445 +-5712 +-6998 +5441 +3447 +1185 +-3724 +-2922 +7405 +-9245 +-1654 +9957 +9262 +-7 +-3950 +803 +2952 +-1264 +-312 +976 +-2146 +-3544 +2465 +-6466 +-6098 +-3277 +8236 +-9415 +-1697 +-6339 +625 +-248 +4922 +8434 +-1281 +-6861 +-6205 +6477 +-4765 +5732 +-44 +-8615 +7001 +-9643 +7033 +7779 +-3315 +-5339 +-7702 +-5730 +1528 +-5873 +-317 +5606 +1411 +-1282 +5673 +-9582 +9496 +3908 +1014 +-2797 +-2130 +-7270 +-1268 +-7693 +1423 +-5247 +-9689 +-3212 +-1028 +-7451 +7955 +-9086 +7960 +5977 +-3601 +3986 +-7429 +9040 +6229 +9000 +-5247 +2926 +-2896 +5963 +-1770 +-9690 +1127 +3710 +-9508 +2569 +45 +-8679 +-5552 +-565 +-88 +-1476 +-1999 +-6682 +6357 +3120 +-6670 +-1563 +3400 +4398 +3940 +-5241 +-3799 +-6780 +3443 +-1601 +-4795 +3079 +912 +-945 +-7947 +6879 +3951 +-3397 +9707 +7426 +4238 +-5081 +8334 +-8337 +4111 +2020 +-8129 +9450 +-6258 +4249 +-1892 +-2996 +5936 +7394 +-8577 +5231 +-3665 +-228 +8827 +-5315 +4336 +4766 +-2529 +8504 +4427 +-7625 +3533 +7301 +-1416 +-8842 +1672 +-7745 +7237 +7403 +9464 +-6702 +-4264 +-5978 +-6232 +9479 +631 +3896 +2962 +-8867 +-8462 +4545 +4147 +6176 +-4420 +962 +-2173 +5194 +-2363 +-4691 +5490 +-9801 +-6638 +2764 +-1045 +402 +-1521 +-6291 +-3310 +8175 +390 +-149 +4116 +-9846 +-8896 +-9450 +-3421 +-474 +-817 +6367 +5647 +-7216 +-8239 +-4642 +-811 +3896 +3636 +6449 +-7016 +7135 +37 +-2882 +-3164 +5249 +-4807 +5591 +-1623 +7070 +5742 +-9673 +4848 +4482 +-1993 +-1202 +-9655 +-3952 +-3809 +916 +-879 +9742 +1059 +-1797 +7564 +-3329 +-4696 +-3739 +-5021 +-2136 +6072 +7774 +83 +-7887 +4701 +7756 +7200 +2159 +-3789 +7101 +-8506 +-2175 +338 +-5212 +-5657 +-4426 +7947 +6072 +-1072 +-1778 +-6449 +9156 +-559 +-8047 +3211 +-1798 +2957 +-640 +8847 +574 +5623 +8145 +-3774 +-8248 +-1269 +-480 +-3794 +-2138 +8953 +3070 +-4474 +-8577 +-8679 +9032 +-3465 +1677 +9115 +974 +-106 +-3128 +2454 +9037 +4071 +3336 +-3656 +9384 +7887 +-2915 +1854 +-966 +1018 +4917 +-9095 +2027 +-1799 +557 +-1798 +-4603 +-8640 +326 +-1328 +9144 +-8987 +-5247 +-6238 +7290 +-3320 +521 +-2300 +7022 +-1322 +3630 +-1056 +-5829 +-817 +-6546 +-3428 +-8188 +-5954 +-3726 +-1352 +9142 +-3910 +2043 +9925 +2015 +-8113 +-9325 +-3471 +4111 +-6836 +-9642 +5700 +-2262 +1268 +6050 +-226 +-9106 +7613 +9659 +-6313 +-5574 +9530 +-9923 +7296 +-7590 +6847 +-2426 +-9783 +6418 +3821 +251 +-2480 +-4298 +1466 +2750 +-2500 +-1023 +3390 +380 +1797 +-7997 +-1770 +3762 +3427 +1055 +-3197 +7361 +699 +-3491 +-9129 +8953 +-7390 +3576 +3717 +-2311 +-250 +5152 +4706 +2280 +7550 +-9665 +3295 +6821 +522 +5489 +-451 +8158 +8194 +8636 +4099 +5072 +-4026 +-2732 +-2844 +-773 +-3033 +3261 +-9292 +474 +-4849 +-8671 +-201 +-8081 +7968 +-1946 +-6828 +6196 +685 +7853 +5191 +-4492 +-1308 +4565 +5977 +-6735 +4900 +2279 +-4847 +4113 +-3311 +8706 +-8680 +7418 +1421 +-1789 +-2125 +6938 +5924 +4105 +-3377 +1677 +-2594 +-7105 +-4200 +4704 +6005 +2862 +9334 +796 +-4838 +-1184 +4875 +5485 +737 +7327 +7141 +-5488 +1329 +989 +-4372 +-335 +-4809 +5208 +4026 +1438 +809 +2138 +5926 +-5874 +9256 +-2938 +7250 +6711 +-1836 +-5112 +-2130 +9256 +-4844 +-8258 +-6562 +-904 +-3527 +1794 +8175 +-4816 +9090 +1329 +5599 +-9717 +-2798 +-8269 +-1234 +-4683 +-4473 +4941 +5191 +-9062 +-9062 +-4024 +5249 +5331 +4088 +1502 +5876 +-3353 +-92 +-8611 +4048 +1170 +-234 +4936 +8347 +3988 diff --git a/2022/day20/main.go b/2022/day20/main.go new file mode 100644 index 0000000..ed380ed --- /dev/null +++ b/2022/day20/main.go @@ -0,0 +1,101 @@ +package main + +import ( + "fmt" + + h "git.bullercodeworks.com/brian/adventofcode/helpers" +) + +type Node struct { + value int + prev *Node + next *Node +} + +func main() { + inp := h.StdinToStringSlice() + part1(inp) + part2(inp) +} + +func part1(inp []string) { + var list []*Node + var first *Node + for i := range inp { + n := &Node{value: h.Atoi(inp[i])} + if n.value == 0 { + first = n + } + list = append(list, n) + } + initList(list) + mixAll(list) + fmt.Println("# Part 1") + fmt.Println(getCoords(first)) +} + +func part2(inp []string) { + key := 811589153 + var list []*Node + var first *Node + for i := range inp { + n := &Node{value: h.Atoi(inp[i]) * key} + if n.value == 0 { + first = n + } + list = append(list, n) + } + initList(list) + for i := 0; i < 10; i++ { + mixAll(list) + } + fmt.Println("# Part 2") + fmt.Println(getCoords(first)) +} + +func initList(list []*Node) { + list[0].prev = list[len(list)-1] + list[len(list)-1].next = list[0] + for i := 1; i < len(list); i++ { + list[i].prev = list[i-1] + list[i-1].next = list[i] + } +} + +func move(n *Node, count int) *Node { + for count < 0 { + n = n.prev + count++ + } + for count > 0 { + n = n.next + count-- + } + return n +} + +func mix(n *Node, listLen int) { + t := n.prev + n.prev.next = n.next + n.next.prev = n.prev + t = move(t, n.value%(listLen-1)) + n.prev = t + n.next = t.next + n.prev.next = n + n.next.prev = n +} + +func mixAll(list []*Node) { + for _, n := range list { + mix(n, len(list)) + } +} + +func getCoords(first *Node) int { + var res int + for i, n := 0, first; i < 3; i++ { + n = move(n, 1000) + res += n.value + } + return res +} diff --git a/2022/day20/problem b/2022/day20/problem new file mode 100644 index 0000000..c5c232d --- /dev/null +++ b/2022/day20/problem @@ -0,0 +1,151 @@ +Advent of Code +br0xen (AoC++) 31* + +--- Day 20: Grove Positioning System --- + + It's finally time to meet back up with the Elves. When you try to contact them, however, you get no reply. Perhaps + you're out of range? + + You know they're headed to the grove where the star fruit grows, so if you can figure out where that is, you should + be able to meet back up with them. + + Fortunately, your handheld device has a file (your puzzle input) that contains the grove's coordinates! + Unfortunately, the file is encrypted - just in case the device were to fall into the wrong hands. + + Maybe you can decrypt it? + + When you were still back at the camp, you overheard some Elves talking about coordinate file encryption. The main + operation involved in decrypting the file is called mixing. + + The encrypted file is a list of numbers. To mix the file, move each number forward or backward in the file a number + of positions equal to the value of the number being moved. The list is circular, so moving a number off one end of + the list wraps back around to the other end as if the ends were connected. + + For example, to move the 1 in a sequence like 4, 5, 6, 1, 7, 8, 9, the 1 moves one position forward: 4, 5, 6, 7, 1, + 8, 9. To move the -2 in a sequence like 4, -2, 5, 6, 7, 8, 9, the -2 moves two positions backward, wrapping around: + 4, 5, 6, 7, 8, -2, 9. + + The numbers should be moved in the order they originally appear in the encrypted file. Numbers moving around during + the mixing process do not change the order in which the numbers are moved. + + Consider this encrypted file: + + 1 + 2 + -3 + 3 + -2 + 0 + 4 + + Mixing this file proceeds as follows: + + Initial arrangement: + 1, 2, -3, 3, -2, 0, 4 + + 1 moves between 2 and -3: + 2, 1, -3, 3, -2, 0, 4 + + 2 moves between -3 and 3: + 1, -3, 2, 3, -2, 0, 4 + + -3 moves between -2 and 0: + 1, 2, 3, -2, -3, 0, 4 + + 3 moves between 0 and 4: + 1, 2, -2, -3, 0, 3, 4 + + -2 moves between 4 and 1: + 1, 2, -3, 0, 3, 4, -2 + + 0 does not move: + 1, 2, -3, 0, 3, 4, -2 + + 4 moves between -3 and 0: + 1, 2, -3, 4, 0, 3, -2 + + Then, the grove coordinates can be found by looking at the 1000th, 2000th, and 3000th numbers after the value 0, + wrapping around the list as necessary. In the above example, the 1000th number after 0 is 4, the 2000th is -3, and + the 3000th is 2; adding these together produces 3. + + Mix your encrypted file exactly once. What is the sum of the three numbers that form the grove coordinates? + + Your puzzle answer was 9687. + +--- Part Two --- + + The grove coordinate values seem nonsensical. While you ponder the mysteries of Elf encryption, you suddenly + remember the rest of the decryption routine you overheard back at camp. + + First, you need to apply the decryption key, 811589153. Multiply each number by the decryption key before you + begin; this will produce the actual list of numbers to mix. + + Second, you need to mix the list of numbers ten times. The order in which the numbers are mixed does not change + during mixing; the numbers are still moved in the order they appeared in the original, pre-mixed list. (So, if -3 + appears fourth in the original list of numbers to mix, -3 will be the fourth number to move during each round of + mixing.) + + Using the same example as above: + + Initial arrangement: + 811589153, 1623178306, -2434767459, 2434767459, -1623178306, 0, 3246356612 + + After 1 round of mixing: + 0, -2434767459, 3246356612, -1623178306, 2434767459, 1623178306, 811589153 + + After 2 rounds of mixing: + 0, 2434767459, 1623178306, 3246356612, -2434767459, -1623178306, 811589153 + + After 3 rounds of mixing: + 0, 811589153, 2434767459, 3246356612, 1623178306, -1623178306, -2434767459 + + After 4 rounds of mixing: + 0, 1623178306, -2434767459, 811589153, 2434767459, 3246356612, -1623178306 + + After 5 rounds of mixing: + 0, 811589153, -1623178306, 1623178306, -2434767459, 3246356612, 2434767459 + + After 6 rounds of mixing: + 0, 811589153, -1623178306, 3246356612, -2434767459, 1623178306, 2434767459 + + After 7 rounds of mixing: + 0, -2434767459, 2434767459, 1623178306, -1623178306, 811589153, 3246356612 + + After 8 rounds of mixing: + 0, 1623178306, 3246356612, 811589153, -2434767459, 2434767459, -1623178306 + + After 9 rounds of mixing: + 0, 811589153, 1623178306, -2434767459, 3246356612, 2434767459, -1623178306 + + After 10 rounds of mixing: + 0, -2434767459, 1623178306, 3246356612, -1623178306, 2434767459, 811589153 + + The grove coordinates can still be found in the same way. Here, the 1000th number after 0 is 811589153, the 2000th + is 2434767459, and the 3000th is -1623178306; adding these together produces 1623178306. + + Apply the decryption key and mix your encrypted file ten times. What is the sum of the three numbers that form the + grove coordinates? + + Your puzzle answer was 1338310513297. + + Both parts of this puzzle are complete! They provide two gold stars: ** + +References + + Visible links + . https://adventofcode.com/ + . https://adventofcode.com/2022/about + . https://adventofcode.com/2022/events + . https://adventofcode.com/2022/settings + . https://adventofcode.com/2022/auth/logout + . Advent of Code Supporter + https://adventofcode.com/2022/support + . https://adventofcode.com/2022 + . https://adventofcode.com/2022 + . https://adventofcode.com/2022/support + . https://adventofcode.com/2022/sponsors + . https://adventofcode.com/2022/leaderboard + . https://adventofcode.com/2022/stats + . https://adventofcode.com/2022/sponsors + . https://adventofcode.com/2022 + . https://adventofcode.com/2022/day/20/input diff --git a/2022/day20/testinput b/2022/day20/testinput new file mode 100644 index 0000000..52c68ff --- /dev/null +++ b/2022/day20/testinput @@ -0,0 +1,7 @@ +1 +2 +-3 +3 +-2 +0 +4