summary refs log tree commit diff
path: root/22
diff options
context:
space:
mode:
Diffstat (limited to '22')
-rw-r--r--22/Cargo.toml11
-rw-r--r--22/input420
-rw-r--r--22/small136
-rw-r--r--22/src/main.rs293
-rw-r--r--22/tests/main.rs17
5 files changed, 877 insertions, 0 deletions
diff --git a/22/Cargo.toml b/22/Cargo.toml
new file mode 100644
index 0000000..f3441a0
--- /dev/null
+++ b/22/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "advent_22"
+version = "0.1.0"
+authors = ["Irene Knapp <ireneista@gmail.com>"]
+edition = "2018"
+
+[dependencies]
+advent_lib = { path = "../lib" }
+
+[dev-dependencies]
+assert_cmd = "0.10"
diff --git a/22/input b/22/input
new file mode 100644
index 0000000..4493584
--- /dev/null
+++ b/22/input
@@ -0,0 +1,420 @@
+on x=-25..19,y=-17..32,z=-18..27
+on x=-16..34,y=-36..15,z=-4..44
+on x=-18..33,y=-44..10,z=-1..48
+on x=-10..44,y=-24..25,z=-45..3
+on x=-49..-2,y=-44..3,z=-35..11
+on x=-5..42,y=-48..1,z=-15..35
+on x=-26..27,y=-4..49,z=-8..44
+on x=-47..-1,y=-40..6,z=-11..40
+on x=-41..12,y=-41..9,z=-12..38
+on x=-49..4,y=-27..18,z=-12..38
+off x=11..25,y=1..10,z=-6..7
+on x=-33..17,y=-22..29,z=-8..37
+off x=-39..-27,y=11..24,z=-16..-1
+on x=-28..18,y=-39..6,z=-39..13
+off x=27..41,y=-23..-10,z=35..44
+on x=-4..40,y=1..45,z=-21..25
+off x=36..49,y=16..33,z=-47..-31
+on x=-42..5,y=-43..8,z=-35..14
+off x=-39..-22,y=20..29,z=19..30
+on x=-10..34,y=-45..5,z=-30..16
+on x=58130..74792,y=4830..35228,z=39318..63561
+on x=-40466..-17822,y=-77868..-64431,z=-3886..11187
+on x=-19073..-1463,y=65422..82885,z=23304..43978
+on x=46738..71241,y=39352..59200,z=-5917..-3830
+on x=-19010..13307,y=-96005..-74582,z=-19665..-2574
+on x=-60112..-47300,y=-46572..-26967,z=-59253..-29957
+on x=-66448..-41722,y=35529..57095,z=24647..44817
+on x=-32187..-7009,y=-58802..-52885,z=-59593..-37103
+on x=-90935..-64508,y=15951..29237,z=7318..29845
+on x=7010..16589,y=65579..81354,z=-39391..-8720
+on x=38716..51593,y=-22916..9050,z=51191..72341
+on x=41708..72592,y=21789..55040,z=16830..37085
+on x=-86698..-50596,y=-14192..-2839,z=35619..46625
+on x=-46830..-27930,y=-81448..-59759,z=-6028..21764
+on x=-44016..-36639,y=-61840..-28937,z=36509..67942
+on x=13310..31955,y=-68626..-49294,z=-46784..-39318
+on x=38860..64742,y=38732..58725,z=-43510..-29002
+on x=-90461..-67594,y=-53950..-29966,z=-9548..3630
+on x=-67554..-57558,y=-54779..-44189,z=21159..31677
+on x=3757..32872,y=-80070..-60915,z=5277..16947
+on x=-72838..-48066,y=-5015..17491,z=25977..48301
+on x=23477..41778,y=15763..42256,z=-82192..-56024
+on x=52710..75131,y=-29088..-1205,z=-41381..-37580
+on x=38409..57853,y=-50857..-31314,z=-59158..-52612
+on x=-80116..-48960,y=-39594..-13419,z=-45425..-15108
+on x=65797..83032,y=-51087..-29660,z=-23996..1975
+on x=53353..80001,y=12347..28197,z=-23588..-1312
+on x=-71662..-65247,y=-53225..-30719,z=-9866..11030
+on x=49873..73770,y=-48745..-15568,z=28177..52885
+on x=69904..79221,y=26365..47073,z=-29095..-16378
+on x=70750..92569,y=-22117..-3579,z=-16440..-10396
+on x=58085..80322,y=28177..67663,z=9272..17316
+on x=9120..29041,y=35569..52486,z=49397..69227
+on x=7148..32565,y=-88490..-60413,z=-4685..13676
+on x=-4357..13624,y=57740..73053,z=-66175..-35343
+on x=-72404..-50117,y=-18666..17680,z=-52896..-39914
+on x=-9567..9523,y=-15111..8108,z=-90208..-79702
+on x=-10948..12900,y=-92952..-61380,z=8585..35744
+on x=-39691..-33001,y=-481..16835,z=-85521..-64353
+on x=-41700..-38162,y=58196..66356,z=-54670..-34351
+on x=-41782..-26325,y=30554..48802,z=43336..61539
+on x=7603..24698,y=-58399..-42038,z=-54977..-50149
+on x=-74963..-67013,y=-38190..-18104,z=-48442..-23429
+on x=-63905..-48685,y=46845..71472,z=-18004..2350
+on x=14437..49543,y=-62065..-41585,z=-49774..-37768
+on x=-5517..15643,y=-16972..20782,z=60593..96969
+on x=-92280..-58006,y=7885..39177,z=449..35282
+on x=-4290..17666,y=-90595..-63406,z=8750..23433
+on x=6979..28454,y=-22944..-3734,z=-77888..-74927
+on x=24287..50795,y=-68103..-32134,z=46841..62225
+on x=-18963..-7266,y=-68315..-53968,z=-67632..-35819
+on x=-29535..-12178,y=67827..82507,z=-29427..-28303
+on x=-15190..10688,y=62804..80708,z=37673..50924
+on x=51637..82062,y=-23425..-13849,z=25263..44367
+on x=-57999..-42079,y=-61465..-54845,z=7054..41290
+on x=61972..71946,y=-6088..14399,z=39883..57439
+on x=47066..73652,y=3289..26576,z=39216..58947
+on x=-82190..-50896,y=14389..24693,z=27922..44002
+on x=24953..52534,y=-73272..-59039,z=-19032..-8246
+on x=3134..24046,y=31174..51696,z=-66891..-61000
+on x=-79297..-65977,y=10686..30665,z=-19492..-8395
+on x=18022..42598,y=-23168..-4267,z=57820..78601
+on x=61665..84231,y=-19314..2438,z=1604..18531
+on x=-21091..-7592,y=-3117..7700,z=-78569..-65004
+on x=62684..81399,y=-35984..-5816,z=14750..34173
+on x=-26998..-6601,y=-5986..14501,z=77097..95680
+on x=-72600..-53340,y=-38496..-21227,z=-62500..-45403
+on x=31773..45502,y=-11640..4290,z=-75810..-59658
+on x=-80495..-43424,y=28216..47742,z=-46020..-19497
+on x=33917..56972,y=-71159..-50513,z=33699..53033
+on x=-4895..18133,y=-93735..-60850,z=-26226..-16640
+on x=-28630..-5186,y=-37588..-29317,z=56086..73887
+on x=-31062..-21579,y=33327..60798,z=49401..73175
+on x=-10957..1264,y=-47922..-25717,z=56267..76856
+on x=-26519..-19291,y=-80269..-58812,z=4739..21059
+on x=-73392..-68495,y=-53325..-36377,z=-22576..-10983
+on x=-57251..-42571,y=-55067..-50711,z=21956..28445
+on x=-21760..3615,y=-30637..-8269,z=-92600..-72783
+on x=-78712..-68343,y=-35631..-8253,z=-49432..-32291
+on x=-98297..-62132,y=-10182..17937,z=-21663..-2939
+on x=-49619..-20903,y=-81950..-49731,z=14331..36557
+on x=-77719..-54696,y=-4933..5387,z=-54375..-38489
+on x=18952..30044,y=-5948..8556,z=71419..79100
+on x=-14443..6073,y=9664..24826,z=65287..92698
+on x=19757..49423,y=9775..23431,z=53476..87732
+on x=-390..13958,y=78578..83672,z=-14643..5068
+on x=-17569..1231,y=-52196..-24285,z=66712..88356
+on x=22102..26555,y=-77462..-58381,z=22142..32757
+on x=22592..52007,y=29247..32200,z=54297..72364
+on x=-77059..-51695,y=-30316..-16003,z=25367..39748
+on x=42986..64693,y=35661..68372,z=-29918..-11953
+on x=-34041..-4237,y=-88022..-67620,z=-26207..-3610
+on x=-49834..-37233,y=-59504..-34261,z=34131..66365
+on x=65349..94319,y=-19835..-6545,z=-24667..-708
+on x=13050..44190,y=5167..32154,z=-89339..-58446
+on x=45597..62970,y=-9451..11044,z=-56915..-40832
+on x=-9732..11852,y=9820..30333,z=-92396..-67585
+on x=38976..54998,y=-22749..1348,z=51283..63636
+on x=73378..96435,y=-12058..18745,z=-30246..-4493
+on x=-89828..-69363,y=10042..23961,z=12175..29039
+on x=2941..12201,y=-78520..-66567,z=-26924..-14825
+on x=-68528..-60099,y=9887..25885,z=29052..59211
+on x=9315..24935,y=-88183..-57281,z=-15962..21546
+on x=-85263..-72812,y=-34542..-23564,z=-24492..-5477
+on x=-95590..-58694,y=15268..16414,z=-20338..12400
+on x=47161..61390,y=-51497..-46140,z=-54082..-41603
+on x=-24948..-860,y=65273..85686,z=3751..18779
+on x=-74872..-70466,y=-10445..20449,z=-42187..-23559
+on x=15395..36309,y=51601..79496,z=-55445..-38989
+on x=-6788..-2487,y=-88523..-71818,z=-38861..-15152
+on x=-81443..-68997,y=4713..18849,z=-2294..25453
+on x=-27684..-12475,y=-78207..-52418,z=24610..51493
+on x=-45965..-22263,y=18486..35080,z=52396..77570
+on x=-16449..-6272,y=-81117..-56749,z=-35606..-21607
+on x=10951..31839,y=55087..74608,z=-47000..-28178
+on x=-84540..-51147,y=28945..62947,z=-4032..18597
+on x=36357..50129,y=16893..23034,z=64171..74913
+on x=-3998..20566,y=59440..93316,z=22696..25488
+on x=-54915..-23612,y=-68560..-45524,z=-58054..-37867
+on x=-35598..-25037,y=-43854..-18452,z=54139..77736
+on x=-64988..-54266,y=-48957..-21857,z=28252..32986
+on x=-95466..-72491,y=-36404..-11874,z=-4259..8571
+on x=-81482..-72858,y=4863..36596,z=3393..17002
+on x=-14906..-9140,y=75824..91655,z=14158..31682
+on x=-56168..-38184,y=68009..72189,z=1057..5047
+on x=-89689..-62813,y=-13369..18363,z=9600..42828
+on x=-51440..-32934,y=31208..42008,z=-68421..-53583
+on x=-6288..16856,y=-42060..-29202,z=68124..80036
+on x=-83895..-61949,y=3336..25725,z=9552..19154
+on x=-61288..-51950,y=-55736..-44850,z=-1436..30098
+on x=-23437..-115,y=-48046..-32435,z=59063..81720
+on x=-85940..-65530,y=2023..13769,z=12538..35840
+on x=-17034..642,y=72777..94279,z=4086..24430
+on x=-29254..-7953,y=-92196..-72024,z=5829..40481
+on x=19780..33000,y=42445..63200,z=-53200..-41275
+on x=-12441..16072,y=18286..40034,z=68730..94707
+on x=-16418..4994,y=-26517..6769,z=72160..92524
+on x=-19492..1556,y=47218..72884,z=-67974..-48038
+on x=26010..60405,y=-79985..-56817,z=-10117..20209
+on x=55184..79442,y=-35184..-11981,z=27930..47203
+on x=-44505..-14453,y=69915..76169,z=-36486..-15678
+on x=47765..71553,y=-16894..8462,z=-77595..-43228
+on x=20787..35894,y=41719..63073,z=-71757..-51052
+on x=1043..34518,y=-80401..-65743,z=-12161..22280
+on x=-6882..20242,y=27697..41680,z=55075..91076
+on x=35532..49684,y=65792..80184,z=-17848..6540
+on x=58693..84924,y=15648..25639,z=-45401..-19689
+on x=-85098..-78038,y=-10846..-134,z=-5850..15444
+on x=-2730..12605,y=12851..43889,z=67815..81883
+on x=-29043..-9448,y=48093..78524,z=50467..63696
+on x=-38250..-17112,y=1181..30921,z=67073..85611
+on x=18694..45770,y=-63824..-33467,z=-65348..-32736
+on x=-48050..-12127,y=-36602..-23731,z=64057..84572
+on x=-92730..-66419,y=-15873..4455,z=-37327..-8638
+on x=-77520..-47498,y=-31489..-17959,z=38570..55019
+on x=-35101..-28002,y=-81178..-65021,z=-43410..-13765
+on x=-81154..-45690,y=3545..24492,z=-44708..-26663
+on x=-4366..11895,y=64672..90379,z=30279..50474
+on x=2570..35120,y=-72500..-66047,z=-48806..-29387
+on x=-17836..3311,y=-37959..-15427,z=58018..83171
+on x=-41222..-23220,y=-83264..-48361,z=-28535..-9809
+on x=-32657..-6854,y=-63857..-33169,z=50784..74629
+on x=31759..58009,y=58130..81062,z=-12947..19610
+on x=-77910..-70462,y=-25392..-8935,z=21699..28460
+on x=-74375..-69543,y=-39903..-11033,z=556..12066
+on x=-96260..-69319,y=-13239..15749,z=-5861..32245
+on x=-89059..-57112,y=-29085..-10293,z=4791..37832
+on x=-53908..-32723,y=41908..48893,z=43394..62135
+on x=-56878..-35991,y=-16413..16902,z=49630..72926
+on x=-23547..5628,y=62602..94384,z=-21369..6727
+on x=-53850..-37537,y=-13642..4380,z=52105..72940
+on x=31257..52545,y=-52332..-26349,z=42207..66321
+on x=2684..30781,y=28321..51558,z=-64015..-48974
+on x=-3053..917,y=60451..96694,z=5038..23673
+on x=-8930..1238,y=-80903..-64783,z=23996..37917
+on x=32035..39229,y=-63892..-44117,z=-54484..-29812
+on x=-19633..5010,y=70766..81566,z=257..11177
+on x=2204..32041,y=-13135..1289,z=58814..96086
+on x=32579..57092,y=50782..69021,z=16603..44417
+on x=24380..52350,y=-74864..-64943,z=16359..37394
+on x=5080..16681,y=34283..58295,z=-71141..-48408
+on x=65497..86700,y=-43687..-21647,z=-29471..-22694
+on x=-78966..-55978,y=-51271..-18249,z=7472..26951
+on x=-3302..20676,y=-99123..-73526,z=-4992..26620
+on x=-4361..21592,y=-63639..-52408,z=-61167..-52807
+on x=12881..29105,y=55833..65015,z=25636..50553
+on x=-22870..7514,y=44949..67069,z=-68698..-54147
+on x=4489..23016,y=46700..73193,z=42992..54291
+on x=33906..55000,y=-84469..-54728,z=-27445..-3981
+on x=-4535..23944,y=29291..58817,z=50920..67512
+on x=74404..93376,y=-28674..-4357,z=1529..21378
+on x=-42096..-39330,y=53218..68450,z=21313..49413
+on x=-79424..-46791,y=8607..30438,z=-46626..-37391
+on x=-77257..-57467,y=8975..41058,z=31151..63104
+on x=-36397..-6018,y=65533..81964,z=8100..27782
+on x=1772..13114,y=-45452..-24542,z=51315..72370
+on x=-56414..-43858,y=-15760..-1511,z=53056..65252
+on x=5178..19230,y=66264..77905,z=-37387..-20995
+on x=-44447..-28857,y=-7474..1043,z=-79436..-63272
+on x=31312..61933,y=45570..59005,z=-50556..-35448
+on x=-54070..-25768,y=-49818..-25232,z=-61393..-41248
+off x=-23531..-8752,y=-12082..15447,z=-98148..-77085
+off x=-26458..-11303,y=-14757..19158,z=-84941..-70774
+off x=67054..69860,y=10769..36987,z=-48226..-15571
+on x=48596..79742,y=43523..54624,z=1937..19705
+on x=21840..45194,y=-88151..-63952,z=23272..43757
+off x=-56180..-30105,y=-23034..-10177,z=45362..82434
+off x=-30367..-12221,y=-56677..-45797,z=41015..77005
+off x=3957..24789,y=-33453..-16504,z=75407..93827
+on x=16677..53031,y=-81001..-63422,z=-26709..5644
+on x=3897..26268,y=-80809..-58412,z=-53456..-31096
+off x=-53935..-34004,y=-64717..-30773,z=-63167..-51325
+on x=-51734..-42462,y=-31476..-29266,z=42510..61608
+on x=41714..67356,y=-56338..-39534,z=-57329..-34656
+on x=-29703..102,y=-48375..-32386,z=50956..78822
+off x=18805..29389,y=55214..61118,z=-54668..-36938
+off x=-43634..-27449,y=-44154..-40158,z=-64794..-39780
+off x=26340..46631,y=32695..56730,z=-72694..-49637
+on x=-67221..-33213,y=42396..68108,z=6296..35814
+off x=47145..74448,y=16794..27177,z=-53775..-38461
+off x=-71161..-35857,y=11495..38517,z=-69460..-49322
+off x=-51569..-34369,y=-57058..-40466,z=-48249..-35893
+on x=76969..94122,y=-9622..4260,z=-11777..9827
+off x=-25468..-9830,y=-89766..-62827,z=-23077..3267
+on x=-34914..-16785,y=43235..66914,z=47390..70799
+on x=-43047..-25405,y=29640..46573,z=58243..79904
+on x=-65414..-55209,y=30985..66345,z=-40780..-23211
+on x=-56019..-47580,y=2182..7294,z=48708..59721
+on x=30197..41111,y=54185..76003,z=-45138..-33569
+off x=30206..46343,y=-48504..-25452,z=-64948..-61437
+off x=46610..52577,y=-53600..-35507,z=36685..63416
+on x=-67663..-48131,y=-9151..14784,z=-65365..-50610
+on x=-84458..-60979,y=2763..20965,z=-50046..-31834
+off x=44885..70482,y=22096..53275,z=-47233..-35548
+off x=33735..54437,y=-64543..-50572,z=18089..42914
+on x=49649..55370,y=-59126..-51117,z=15176..38972
+on x=34525..49133,y=-74322..-51979,z=6510..45365
+off x=-67081..-43347,y=-16984..-2265,z=-54556..-44149
+on x=-18962..6882,y=-21555..-1276,z=-79408..-74695
+on x=-85431..-67417,y=20207..37574,z=-24683..1131
+on x=-87398..-57912,y=-46757..-20616,z=-1696..35333
+off x=-38761..-24011,y=56096..77032,z=-8538..7289
+off x=66762..83683,y=-26879..-2102,z=13838..46715
+on x=47061..74282,y=49221..66218,z=4113..26350
+on x=4777..21230,y=-33897..-5656,z=-87420..-71323
+on x=30099..57071,y=-21885..5161,z=-79787..-52376
+off x=-44596..-31390,y=-46512..-37910,z=-62932..-56097
+off x=-14054..12636,y=-31346..-16168,z=67008..87013
+on x=30408..66968,y=23194..37084,z=-69204..-39793
+on x=22564..36076,y=-37139..-18687,z=50359..66811
+on x=-61861..-46587,y=28526..48242,z=-32086..-24184
+on x=-82280..-50593,y=2728..22792,z=-60682..-29871
+on x=-783..16463,y=-47282..-16939,z=64502..74420
+off x=-47520..-14633,y=40759..47312,z=46161..76712
+on x=-69277..-54302,y=24768..49368,z=15566..35795
+off x=12622..41719,y=35874..58381,z=43857..67791
+off x=-799..16093,y=-1219..20716,z=67589..87424
+on x=35940..51327,y=30163..46992,z=-59947..-50999
+off x=-9321..2965,y=7853..36841,z=68030..81454
+off x=-37124..-30202,y=-80579..-51201,z=-40645..-18050
+off x=28596..52892,y=47368..72821,z=9780..31479
+on x=8990..18432,y=-36443..-12728,z=-95059..-69642
+off x=-77654..-67477,y=-2706..4112,z=28813..58150
+on x=-51071..-36543,y=41044..49939,z=42109..59713
+on x=-10079..19481,y=62783..91315,z=184..34000
+on x=-2397..3530,y=-11556..-706,z=76963..86864
+on x=6108..21196,y=-44694..-17116,z=61649..84795
+on x=46991..61627,y=-75243..-47914,z=7700..32503
+off x=59336..64609,y=-8125..11873,z=33615..71285
+off x=-85488..-61850,y=-6467..26523,z=6343..10566
+off x=-84524..-67431,y=-11010..9472,z=-22622..-2724
+off x=57508..72883,y=-50521..-39545,z=2734..6998
+off x=53809..64551,y=-35985..-23521,z=50129..54626
+on x=31383..51927,y=-47560..-26142,z=56108..59189
+on x=64838..70463,y=18960..46107,z=-5709..5891
+off x=-31932..-10900,y=62729..84704,z=-37694..-13759
+off x=40118..68033,y=-41588..-36259,z=34880..60200
+on x=39381..48090,y=-68538..-40574,z=-52761..-43347
+off x=64765..72987,y=-14028..16757,z=36141..47632
+off x=5855..25039,y=-85798..-60707,z=-30495..-20735
+on x=57912..77906,y=42168..50409,z=-28700..2962
+on x=19631..35834,y=28921..54740,z=51647..77378
+off x=-82481..-71581,y=21190..40353,z=-24926..-2552
+off x=-46450..-22899,y=-68165..-38827,z=-54999..-42378
+on x=-54128..-36413,y=8300..40253,z=48335..77869
+on x=34740..55414,y=5155..8343,z=-72542..-54001
+on x=31990..55541,y=-84291..-50415,z=-38724..-8673
+on x=-48741..-26045,y=3191..16457,z=-73525..-68070
+off x=-33831..-29433,y=-1626..17107,z=-79534..-68499
+on x=-42587..-15988,y=-83266..-62879,z=3424..23280
+on x=-38590..-25325,y=-64154..-45384,z=-54835..-40345
+on x=-13947..-1435,y=-92195..-76444,z=5699..36092
+off x=45044..57694,y=-14002..7161,z=-61158..-45716
+off x=38275..46353,y=-67689..-52479,z=-14487..1146
+on x=32016..45320,y=43682..68546,z=23400..42946
+off x=-3019..17260,y=63031..81988,z=32500..57080
+on x=-217..18895,y=-30559..-6455,z=-83475..-70541
+off x=-44798..-20533,y=-14628..4328,z=63367..89914
+on x=-66126..-51005,y=-48724..-27264,z=9877..18967
+off x=4493..39312,y=-92170..-64063,z=-32182..-4856
+on x=-12782..-1953,y=44313..64242,z=55493..60786
+off x=-83865..-61599,y=20014..32460,z=-32367..-2728
+off x=-44145..-28037,y=-74041..-63219,z=-31805..-9417
+off x=-45440..-16291,y=-58154..-37500,z=49909..61326
+on x=-52220..-20559,y=-15232..-8220,z=-71909..-62090
+on x=42800..57928,y=41072..73675,z=-12386..12198
+off x=64013..66218,y=23975..41145,z=-32405..-19771
+off x=-48747..-17911,y=59950..77703,z=-13769..7741
+off x=-63221..-42119,y=-55919..-46750,z=-41421..-40955
+off x=-48375..-12160,y=58420..80105,z=12920..24208
+on x=71072..79759,y=21125..45199,z=-4705..13837
+on x=-31352..3765,y=-94595..-58769,z=11911..23915
+off x=373..23352,y=-50895..-14246,z=-80217..-59767
+off x=7066..8657,y=-96706..-68072,z=-7088..16509
+on x=-51232..-33172,y=-40791..-25520,z=-62034..-40752
+on x=14275..34925,y=70729..81904,z=-11351..8996
+off x=-89880..-63344,y=14455..21987,z=10249..18184
+off x=-76665..-73466,y=12389..29268,z=-29705..-3064
+on x=50578..55235,y=-58508..-27331,z=-54406..-27657
+on x=67746..78075,y=3684..23596,z=-21969..2968
+on x=55755..66688,y=-60536..-37192,z=22915..44014
+on x=8038..40360,y=24131..50984,z=68348..69876
+off x=-17128..2366,y=27772..43497,z=70368..79928
+off x=54479..74773,y=38588..57296,z=2414..16691
+off x=-66541..-48861,y=-68223..-45601,z=-21915..-3036
+off x=-86928..-67200,y=-16408..13564,z=-33939..-13500
+off x=-13912..2218,y=-17671..6914,z=63164..82953
+off x=22139..35022,y=54579..61399,z=-55684..-38673
+off x=27878..48984,y=62441..82349,z=-22618..14260
+on x=-2195..21083,y=-25991..-2907,z=-96165..-70720
+off x=-38732..-21837,y=34725..51044,z=45008..70383
+on x=3848..34698,y=-60068..-41642,z=41254..65901
+on x=-61361..-44786,y=-28125..-2043,z=31526..57293
+off x=27201..34733,y=52189..89851,z=-42123..-20394
+on x=18085..42407,y=1757..15913,z=56541..85108
+on x=70893..77546,y=-20167..-13209,z=-30405..-18024
+on x=4454..28933,y=62353..92256,z=2598..34484
+off x=-30932..1089,y=-11002..-5461,z=-92865..-61938
+off x=-11090..-863,y=-45056..-29336,z=-79612..-59805
+on x=69347..90731,y=-5338..17953,z=23178..51736
+on x=-26888..2250,y=-17399..3480,z=-95553..-77039
+on x=13758..21604,y=-86651..-55244,z=-31610..-12946
+off x=-2310..22325,y=-73076..-38378,z=47549..72016
+off x=-64760..-34824,y=50715..69108,z=2880..17133
+on x=8293..37626,y=209..32795,z=69510..77903
+on x=26569..43319,y=-28837..-10605,z=-86283..-46966
+on x=15189..48460,y=56103..70924,z=-41507..-18695
+on x=50472..60820,y=36325..65141,z=-26465..3805
+off x=71475..84634,y=26761..52226,z=-18788..8211
+on x=-15498..2082,y=57975..85738,z=10032..37898
+off x=64853..80096,y=18049..39945,z=-22719..-3021
+on x=-89021..-56923,y=-37013..-5501,z=-37752..-3744
+off x=-53563..-34043,y=-13571..7215,z=51654..69601
+off x=73603..95599,y=-29185..-6592,z=-1547..7830
+off x=-89899..-58785,y=-37642..-22122,z=2100..15738
+off x=43149..48403,y=58070..61555,z=12040..21277
+off x=-77570..-44604,y=-38604..-21364,z=-49649..-30121
+off x=-6505..6293,y=-9490..20632,z=67506..99213
+on x=-26630..-3114,y=39428..53919,z=-75858..-48317
+on x=65580..89172,y=19400..27712,z=-32985..-20804
+off x=3210..27477,y=64531..97346,z=-22032..-12913
+on x=-12572..7541,y=-74421..-44890,z=-67529..-47072
+off x=-38799..-33254,y=55740..82233,z=530..24464
+off x=-3034..17204,y=-52009..-41850,z=53550..72208
+on x=75041..88551,y=-2920..16778,z=-12397..6561
+off x=-57828..-45910,y=33391..50062,z=42181..58694
+off x=64086..79980,y=-35062..-6655,z=-43005..-19072
+on x=46293..78226,y=15332..31724,z=20486..49133
+on x=10114..27622,y=-42356..-32617,z=55094..85456
+on x=-23675..-15335,y=-96639..-64457,z=-9611..8841
+off x=-66057..-61691,y=29422..39444,z=-52445..-17174
+off x=-2306..21587,y=-70513..-56859,z=48314..55486
+on x=-7693..3070,y=-67695..-61179,z=31517..61993
+on x=-42386..-29382,y=42216..64356,z=-62841..-35339
+off x=66402..74832,y=-4752..14537,z=-46085..-28352
+off x=55950..79164,y=-33399..-13600,z=-41795..-12050
+on x=-39692..-34786,y=-29052..-9990,z=-80147..-56930
+off x=-31315..-9184,y=-14651..13406,z=-91739..-78572
+on x=6656..15557,y=48620..68978,z=40125..51661
+off x=-65883..-38294,y=7846..15268,z=-75714..-60704
+off x=-48084..-17849,y=-80014..-57655,z=-14004..20143
+off x=-67339..-29231,y=51852..56222,z=-45946..-29021
+off x=33224..49365,y=-12256..9048,z=-71923..-43893
+off x=11578..19032,y=67746..88200,z=3562..28538
+on x=-33943..3274,y=-3303..6385,z=64558..82042
+off x=37371..56283,y=-71559..-59397,z=10223..38124
+off x=-20468..-3133,y=-85638..-66116,z=18723..33699
+off x=-21553..-6096,y=52051..71487,z=-60241..-44696
+on x=2119..38578,y=-55284..-16851,z=-81488..-48856
+off x=4121..23554,y=70827..83659,z=13022..29851
+off x=-7658..30282,y=32804..49109,z=-84735..-65886
+on x=42254..58740,y=-80327..-54242,z=-2455..13934
+on x=36999..55943,y=36056..71034,z=4631..30064
+on x=-16744..1244,y=60903..82252,z=-22510..-1874
+on x=-47833..-35095,y=62424..78564,z=-43716..-17319
+off x=-13531..-2144,y=-47211..-31550,z=61823..69864
+off x=33638..66759,y=-56079..-22500,z=27700..62584
+off x=17484..53809,y=-82382..-61322,z=-7780..23179
+on x=36303..56592,y=-37680..-17563,z=51742..69493
+on x=-39105..-21357,y=-20555..-8374,z=65002..74328
diff --git a/22/small b/22/small
new file mode 100644
index 0000000..4e496e9
--- /dev/null
+++ b/22/small
@@ -0,0 +1,136 @@
+--- scanner 0 ---
+404,-588,-901
+528,-643,409
+-838,591,734
+390,-675,-793
+-537,-823,-458
+-485,-357,347
+-345,-311,381
+-661,-816,-575
+-876,649,763
+-618,-824,-621
+553,345,-567
+474,580,667
+-447,-329,318
+-584,868,-557
+544,-627,-890
+564,392,-477
+455,729,728
+-892,524,684
+-689,845,-530
+423,-701,434
+7,-33,-71
+630,319,-379
+443,580,662
+-789,900,-551
+459,-707,401
+
+--- scanner 1 ---
+686,422,578
+605,423,415
+515,917,-361
+-336,658,858
+95,138,22
+-476,619,847
+-340,-569,-846
+567,-361,727
+-460,603,-452
+669,-402,600
+729,430,532
+-500,-761,534
+-322,571,750
+-466,-666,-811
+-429,-592,574
+-355,545,-477
+703,-491,-529
+-328,-685,520
+413,935,-424
+-391,539,-444
+586,-435,557
+-364,-763,-893
+807,-499,-711
+755,-354,-619
+553,889,-390
+
+--- scanner 2 ---
+649,640,665
+682,-795,504
+-784,533,-524
+-644,584,-595
+-588,-843,648
+-30,6,44
+-674,560,763
+500,723,-460
+609,671,-379
+-555,-800,653
+-675,-892,-343
+697,-426,-610
+578,704,681
+493,664,-388
+-671,-858,530
+-667,343,800
+571,-461,-707
+-138,-166,112
+-889,563,-600
+646,-828,498
+640,759,510
+-630,509,768
+-681,-892,-333
+673,-379,-804
+-742,-814,-386
+577,-820,562
+
+--- scanner 3 ---
+-589,542,597
+605,-692,669
+-500,565,-823
+-660,373,557
+-458,-679,-417
+-488,449,543
+-626,468,-788
+338,-750,-386
+528,-832,-391
+562,-778,733
+-938,-730,414
+543,643,-506
+-524,371,-870
+407,773,750
+-104,29,83
+378,-903,-323
+-778,-728,485
+426,699,580
+-438,-605,-362
+-469,-447,-387
+509,732,623
+647,635,-688
+-868,-804,481
+614,-800,639
+595,780,-596
+
+--- scanner 4 ---
+727,592,562
+-293,-554,779
+441,611,-461
+-714,465,-776
+-743,427,-804
+-660,-479,-426
+832,-632,460
+927,-485,-438
+408,393,-506
+466,436,-512
+110,16,151
+-258,-428,682
+-393,719,612
+-211,-452,876
+808,-476,-593
+-575,615,604
+-485,667,467
+-680,325,-822
+-627,-443,-432
+872,-547,-609
+833,512,582
+807,604,487
+839,-516,451
+891,-625,532
+-652,-548,-490
+30,-46,-14
diff --git a/22/src/main.rs b/22/src/main.rs
new file mode 100644
index 0000000..bc61faf
--- /dev/null
+++ b/22/src/main.rs
@@ -0,0 +1,293 @@
+use advent_lib::prelude::*;
+
+
+#[derive(Debug, Clone)]
+struct Step {
+  set_to: bool,
+  min: Point,
+  max: Point,
+}
+
+#[derive(Debug, Clone)]
+struct Region {
+  min: Point,
+  max: Point,
+}
+
+#[derive(Debug, Clone)]
+struct Point {
+  x: i64,
+  y: i64,
+  z: i64,
+}
+
+#[derive(Debug, Clone, Eq, PartialEq)]
+struct Span {
+  min: i64,
+  max: i64,
+}
+
+
+fn main() -> Result<()> {
+  let mut args = std::env::args();
+  if args.len() != 2 {
+    eprintln!("Usage: advent input");
+  }
+  let _ = args.next();
+  let filename = args.next().unwrap();
+
+  let input = advent_lib::read_lines_file(&filename)?;
+
+  let mut directions = Vec::new();
+  for line in &input {
+    let mut step = Step {
+      set_to: false,
+      min: Point { x: 0, y: 0, z: 0 },
+      max: Point { x: 0, y: 0, z: 0 },
+    };
+
+    let words: Vec<&str> = line.split_whitespace().collect();
+
+    step.set_to = match words[0] {
+      "on" => true,
+      "off" => false,
+      _ => panic!("hm"),
+    };
+
+    let components: Vec<&str> = words[1].split(",").collect();
+
+    let parts: Vec<&str> = components[0].split("=").collect();
+    let ends: Vec<&str> = parts[1].split("..").collect();
+    step.min.x = ends[0].parse::<i64>().unwrap();
+    step.max.x = ends[1].parse::<i64>().unwrap();
+
+    let parts: Vec<&str> = components[1].split("=").collect();
+    let ends: Vec<&str> = parts[1].split("..").collect();
+    step.min.y = ends[0].parse::<i64>().unwrap();
+    step.max.y = ends[1].parse::<i64>().unwrap();
+
+    let parts: Vec<&str> = components[2].split("=").collect();
+    let ends: Vec<&str> = parts[1].split("..").collect();
+    step.min.z = ends[0].parse::<i64>().unwrap();
+    step.max.z = ends[1].parse::<i64>().unwrap();
+
+    directions.push(step);
+  }
+
+  let mut total_on = 0;
+  for x in -50 .. 51 {
+    for y in -50 .. 51 {
+      for z in -50 .. 51 {
+        let point = Point { x, y, z };
+        if test_cube(&point, &directions) {
+          total_on += 1;
+        }
+      }
+    }
+  }
+
+  println!("{}", total_on);
+
+  let total_on_everywhere = count_everywhere(&directions);
+  println!("{}", total_on_everywhere);
+
+  Ok(())
+}
+
+
+fn test_cube(point: &Point, directions: &Vec<Step>) -> bool {
+  for step in directions.iter().rev() {
+    if (point.x >= step.min.x) && (point.y >= step.min.y)
+      && (point.z >= step.min.z) && (point.x <= step.max.x)
+      && (point.y <= step.max.y) && (point.z <= step.max.z)
+    {
+      return step.set_to;
+    }
+  }
+
+  false
+}
+
+
+fn count_everywhere(directions: &Vec<Step>) -> i64 {
+  let mut lit_regions: Vec<Region> = Vec::new();
+
+  for step in directions {
+    if lit_regions.len() == 0 {
+      if step.set_to {
+        lit_regions.push(Region {
+          min: step.min.clone(),
+          max: step.max.clone(),
+        });
+      }
+      continue;
+    }
+
+    let mut new_lit_regions = Vec::new();
+    for lit_region in lit_regions.into_iter() {
+      /* Depending on whether set_to is true or false, we may be doing union
+       * or difference. However, we implement union as difference followed by
+       * also including the entire subtracted volume. So difference is the
+       * only operation that needs the per-axis breakdown of cases.
+       *
+       * Start by determining whether it's overlapping or not. The
+       * non-overlapping cases are:
+       *
+       *         A==========B                          (lit region)
+       *                         C=========D           (step)
+       *
+       *                         A=========B           (lit region)
+       *         C==========D                          (step)
+       *
+       * Now eliminate cases where the step entirely covers the lit region:
+       *
+       *                     A======B                  (lit region)
+       *               C==================D            (step)
+       *
+       * The following cases remain:
+       *
+       *               A==================B            (lit region)
+       *                     C======D                  (step)
+       *
+       *               A==========B                    (lit region)
+       *                     C=====.......?            (step)
+       *
+       *               A==========B                    (lit region)
+       *        ?......=====D                          (step)
+       */
+      let mut lit_spans = Vec::new();
+      let mut step_spans = Vec::new();
+      let mut differenced_spans = Vec::new();
+      for axis in 0 .. 3 {
+        let mut relevant_spans = Vec::new();
+
+        let (lit_min, lit_max, step_min, step_max) = match axis {
+          0 => { (lit_region.min.x, lit_region.max.x, step.min.x, step.max.x) },
+          1 => { (lit_region.min.y, lit_region.max.y, step.min.y, step.max.y) },
+          2 => { (lit_region.min.z, lit_region.max.z, step.min.z, step.max.z) },
+          _ => { panic!("run in circles scream and shout"); },
+        };
+
+        lit_spans.push(Span { min: lit_min, max: lit_max });
+        step_spans.push(Span { min: step_min, max: step_max });
+
+        if (lit_max < step_min) || (lit_min > step_max) {
+          // Non-overlapping
+          relevant_spans.push(Span { min: lit_min, max: lit_max });
+        } else if (step_min <= lit_min) && (step_max >= lit_max) {
+          // Step entirely covers lit
+          // It is intentional that nothing is done here.
+        } else if (lit_min < step_min) && (lit_max > step_max) {
+          // Step is a segment in the middle of lit
+          relevant_spans.push(Span { min: lit_min, max: step_min - 1 });
+          relevant_spans.push(Span { min: step_max + 1, max: lit_max });
+        } else if lit_min < step_min {
+          relevant_spans.push(Span { min: lit_min, max: step_min - 1 });
+        } else {
+          relevant_spans.push(Span { min: step_max + 1, max: lit_max });
+        }
+
+        differenced_spans.push(relevant_spans);
+      }
+
+      if ((differenced_spans[0].len() == 1)
+        && (differenced_spans[0][0] == lit_spans[0]))
+        || ((differenced_spans[1].len() == 1)
+            && (differenced_spans[1][0] == lit_spans[1]))
+        || ((differenced_spans[2].len() == 1)
+            && (differenced_spans[2][0] == lit_spans[2]))
+      {
+        new_lit_regions.push(Region {
+          min: Point {
+            x: lit_spans[0].min,
+            y: lit_spans[1].min,
+            z: lit_spans[2].min,
+          },
+          max: Point {
+            x: lit_spans[0].max,
+            y: lit_spans[1].max,
+            z: lit_spans[2].max,
+          },
+        });
+      } else {
+        for z_span in &differenced_spans[2] {
+          let region = Region {
+            min: Point {
+              x: lit_spans[0].min,
+              y: lit_spans[1].min,
+              z: z_span.min,
+            },
+            max: Point {
+              x: lit_spans[0].max,
+              y: lit_spans[1].max,
+              z: z_span.max,
+            },
+          };
+          new_lit_regions.push(region);
+        }
+
+        let z_min = std::cmp::max(lit_spans[2].min, step_spans[2].min);
+        let z_max = std::cmp::min(lit_spans[2].max, step_spans[2].max);
+
+        for y_span in &differenced_spans[1] {
+          let region = Region {
+            min: Point {
+              x: lit_spans[0].min,
+              y: y_span.min,
+              z: z_min,
+            },
+            max: Point {
+              x: lit_spans[0].max,
+              y: y_span.max,
+              z: z_max,
+            },
+          };
+          new_lit_regions.push(region);
+        }
+
+        let y_min = std::cmp::max(lit_spans[1].min, step_spans[1].min);
+        let y_max = std::cmp::min(lit_spans[1].max, step_spans[1].max);
+
+        for x_span in &differenced_spans[0] {
+          let region = Region {
+            min: Point {
+              x: x_span.min,
+              y: y_min,
+              z: z_min,
+            },
+            max: Point {
+              x: x_span.max,
+              y: y_max,
+              z: z_max,
+            },
+          };
+          new_lit_regions.push(region);
+        }
+      }
+
+    }
+
+    if step.set_to {
+      let region = Region {
+        min: step.min.clone(),
+        max: step.max.clone(),
+      };
+      new_lit_regions.push(region);
+    }
+
+
+    lit_regions = new_lit_regions;
+  }
+
+  let mut total_lit = 0;
+  for region in &lit_regions {
+    let x_extent = region.max.x - region.min.x + 1;
+    let y_extent = region.max.y - region.min.y + 1;
+    let z_extent = region.max.z - region.min.z + 1;
+    let volume = x_extent * y_extent * z_extent;
+    total_lit += volume;
+  }
+
+  total_lit
+}
+
diff --git a/22/tests/main.rs b/22/tests/main.rs
new file mode 100644
index 0000000..5012dd4
--- /dev/null
+++ b/22/tests/main.rs
@@ -0,0 +1,17 @@
+use assert_cmd::prelude::*;
+//use predicates::prelude::*;
+use std::process::Command;
+
+
+#[test]
+fn personal_input() -> Result<(), Box<dyn std::error::Error>> {
+  let mut command = Command::cargo_bin("advent_22")?;
+
+  command.arg("input");
+  command.assert().success().stdout(
+      "612714\n\
+      1311612259117092\n");
+
+  Ok(())
+}
+