use crate::aoc_2021::day_22_part_1::parse_input;
use crate::aoc_2021::day_22_part_1::process_cuboids;

#[allow(dead_code)]
fn day_22_part_2(input: &str) -> i64 {
    let cuboids = parse_input(input);

    let ans = process_cuboids(&cuboids);

    return ans;
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn example_day_22_part_2() {
        let input =
r#"on x=-5..47,y=-31..22,z=-19..33
on x=-44..5,y=-27..21,z=-14..35
on x=-49..-1,y=-11..42,z=-10..38
on x=-20..34,y=-40..6,z=-44..1
off x=26..39,y=40..50,z=-2..11
on x=-41..5,y=-41..6,z=-36..8
off x=-43..-33,y=-45..-28,z=7..25
on x=-33..15,y=-32..19,z=-34..11
off x=35..47,y=-46..-34,z=-11..5
on x=-14..36,y=-6..44,z=-16..29
on x=-57795..-6158,y=29564..72030,z=20435..90618
on x=36731..105352,y=-21140..28532,z=16094..90401
on x=30999..107136,y=-53464..15513,z=8553..71215
on x=13528..83982,y=-99403..-27377,z=-24141..23996
on x=-72682..-12347,y=18159..111354,z=7391..80950
on x=-1060..80757,y=-65301..-20884,z=-103788..-16709
on x=-83015..-9461,y=-72160..-8347,z=-81239..-26856
on x=-52752..22273,y=-49450..9096,z=54442..119054
on x=-29982..40483,y=-108474..-28371,z=-24328..38471
on x=-4958..62750,y=40422..118853,z=-7672..65583
on x=55694..108686,y=-43367..46958,z=-26781..48729
on x=-98497..-18186,y=-63569..3412,z=1232..88485
on x=-726..56291,y=-62629..13224,z=18033..85226
on x=-110886..-34664,y=-81338..-8658,z=8914..63723
on x=-55829..24974,y=-16897..54165,z=-121762..-28058
on x=-65152..-11147,y=22489..91432,z=-58782..1780
on x=-120100..-32970,y=-46592..27473,z=-11695..61039
on x=-18631..37533,y=-124565..-50804,z=-35667..28308
on x=-57817..18248,y=49321..117703,z=5745..55881
on x=14781..98692,y=-1341..70827,z=15753..70151
on x=-34419..55919,y=-19626..40991,z=39015..114138
on x=-60785..11593,y=-56135..2999,z=-95368..-26915
on x=-32178..58085,y=17647..101866,z=-91405..-8878
on x=-53655..12091,y=50097..105568,z=-75335..-4862
on x=-111166..-40997,y=-71714..2688,z=5609..50954
on x=-16602..70118,y=-98693..-44401,z=5197..76897
on x=16383..101554,y=4615..83635,z=-44907..18747
off x=-95822..-15171,y=-19987..48940,z=10804..104439
on x=-89813..-14614,y=16069..88491,z=-3297..45228
on x=41075..99376,y=-20427..49978,z=-52012..13762
on x=-21330..50085,y=-17944..62733,z=-112280..-30197
on x=-16478..35915,y=36008..118594,z=-7885..47086
off x=-98156..-27851,y=-49952..43171,z=-99005..-8456
off x=2032..69770,y=-71013..4824,z=7471..94418
on x=43670..120875,y=-42068..12382,z=-24787..38892
off x=37514..111226,y=-45862..25743,z=-16714..54663
off x=25699..97951,y=-30668..59918,z=-15349..69697
off x=-44271..17935,y=-9516..60759,z=49131..112598
on x=-61695..-5813,y=40978..94975,z=8655..80240
off x=-101086..-9439,y=-7088..67543,z=33935..83858
off x=18020..114017,y=-48931..32606,z=21474..89843
off x=-77139..10506,y=-89994..-18797,z=-80..59318
off x=8476..79288,y=-75520..11602,z=-96624..-24783
on x=-47488..-1262,y=24338..100707,z=16292..72967
off x=-84341..13987,y=2429..92914,z=-90671..-1318
off x=-37810..49457,y=-71013..-7894,z=-105357..-13188
off x=-27365..46395,y=31009..98017,z=15428..76570
off x=-70369..-16548,y=22648..78696,z=-1892..86821
on x=-53470..21291,y=-120233..-33476,z=-44150..38147
off x=-93533..-4276,y=-16170..68771,z=-104985..-24507"#;

        let ans = day_22_part_2(&input);

        assert_eq!(ans, 2758514936282235);
    }

    #[test]
    fn test_day_22_part_2() {
        let input =
r#"on x=-8..38,y=-15..37,z=-49..5
on x=-35..13,y=-26..26,z=-47..-2
on x=-44..9,y=-47..7,z=-18..35
on x=-24..20,y=-46..8,z=-10..38
on x=-32..21,y=-27..18,z=-43..6
on x=-36..18,y=-7..44,z=1..45
on x=-48..2,y=-38..16,z=-45..6
on x=-47..-3,y=-8..42,z=-4..49
on x=-26..25,y=-26..19,z=-37..17
on x=-8..36,y=-48..4,z=-26..19
off x=-22..-6,y=0..11,z=4..18
on x=-5..47,y=-41..12,z=-26..27
off x=10..29,y=2..18,z=-22..-10
on x=-41..4,y=-33..17,z=-43..10
off x=23..39,y=34..43,z=0..18
on x=-22..31,y=-28..17,z=-46..-2
off x=-34..-20,y=10..27,z=-39..-24
on x=-19..34,y=-5..48,z=-36..8
off x=-22..-3,y=6..23,z=-33..-23
on x=-31..14,y=-41..6,z=-42..11
on x=15335..50364,y=23326..35316,z=55710..82802
on x=-45558..-26562,y=-2400..4809,z=63478..81702
on x=-32547..-2093,y=-80247..-60455,z=-38776..-12398
on x=3464..34355,y=-53573..-44765,z=-72270..-45885
on x=-9807..20039,y=-68478..-43761,z=-57797..-44099
on x=40079..61797,y=-61859..-31418,z=38360..45565
on x=62170..82174,y=8028..39169,z=-12590..14034
on x=-38651..-30945,y=27847..31103,z=61105..82258
on x=37522..61641,y=37254..59332,z=-25804..-10671
on x=-60797..-42266,y=-41852..-22898,z=33729..67815
on x=-16830..10919,y=-85429..-52622,z=38655..47942
on x=-79023..-63744,y=-29720..-25509,z=-13690..6232
on x=-4302..17673,y=65726..84939,z=-24802..-1510
on x=51984..58644,y=-50863..-29318,z=-62134..-38340
on x=17315..32243,y=-78736..-61172,z=-48782..-36452
on x=43538..74153,y=-64825..-48158,z=-2168..17349
on x=-88874..-56782,y=31756..39638,z=-6822..22577
on x=-32751..-16062,y=21829..33445,z=-80369..-58366
on x=-53991..-37739,y=24044..41509,z=-63198..-60191
on x=45511..57768,y=-60217..-38779,z=4772..14616
on x=582..26199,y=-84737..-68753,z=-30138..-10832
on x=-76660..-44924,y=-45685..-28606,z=-45497..-26288
on x=-16527..7531,y=71113..90437,z=-31015..963
on x=-45308..-33442,y=-55174..-46890,z=-62805..-38852
on x=-97917..-77721,y=-14020..19196,z=-9834..12916
on x=9547..37293,y=47382..79218,z=-40988..-38084
on x=11900..40311,y=-88398..-73419,z=-16149..17264
on x=-76272..-57431,y=9110..28569,z=-43875..-35650
on x=44316..75678,y=49414..51289,z=-16923..614
on x=-31873..-16382,y=-86726..-59516,z=-35550..-16645
on x=-2001..12126,y=-74226..-66970,z=27937..35348
on x=22600..38219,y=-89770..-65203,z=-2468..27615
on x=-29020..-18296,y=-40849..-28739,z=-76954..-49958
on x=-69947..-45370,y=-26764..-3205,z=-62596..-39633
on x=11106..25350,y=-10816..603,z=61373..88869
on x=-44616..-19892,y=-58959..-34216,z=58473..65795
on x=-8795..947,y=-13768..11224,z=62325..94888
on x=65157..94625,y=13584..36634,z=-19744..409
on x=8842..29765,y=-76600..-64290,z=-53640..-20221
on x=72119..80400,y=-10518..17427,z=-21981..-8210
on x=-5366..6510,y=59148..78095,z=24053..43978
on x=13458..29969,y=54416..76907,z=-41187..-26771
on x=-93261..-60882,y=-24991..-8501,z=12612..18878
on x=-65813..-47821,y=-63936..-49169,z=-19769..7195
on x=-64400..-34269,y=-35835..-33505,z=46829..66233
on x=50461..83244,y=-18960..-12216,z=-50711..-23716
on x=30337..47289,y=13642..33900,z=48160..76508
on x=-8112..10344,y=1355..15516,z=71137..84477
on x=51524..63806,y=17375..48797,z=28977..50170
on x=58448..76178,y=21032..43228,z=-27666..-23037
on x=-72668..-59446,y=31279..44252,z=25311..54211
on x=-27331..-6649,y=-75402..-45015,z=39353..52026
on x=-83915..-52531,y=-56122..-21235,z=-15204..8932
on x=20340..34983,y=13459..45255,z=67208..82734
on x=52204..80044,y=-56662..-21103,z=-6139..5434
on x=48343..56665,y=-66449..-46287,z=9391..32105
on x=18326..43597,y=63443..65306,z=-58929..-19969
on x=-2999..2718,y=-61788..-32532,z=52591..69302
on x=35428..65034,y=-55534..-39929,z=29073..56505
on x=-564..14337,y=73556..93104,z=-1379..20976
on x=-81741..-61409,y=17237..33536,z=44407..50551
on x=-87050..-59613,y=-11189..3245,z=-53237..-24697
on x=34259..54145,y=20441..36300,z=45810..58640
on x=34106..47786,y=61578..84112,z=-12070..1856
on x=20918..24706,y=-79156..-61039,z=-9799..16667
on x=35957..45020,y=29650..58514,z=-64107..-44220
on x=3605..23761,y=-87881..-67369,z=28828..38438
on x=-70621..-52430,y=37486..66736,z=-4981..30
on x=-33825..-12291,y=-44236..-16695,z=61030..69673
on x=-49593..-18848,y=-23981..-11323,z=-79284..-57866
on x=-94854..-58471,y=624..16087,z=-31578..-20200
on x=-56555..-41220,y=-30410..-5416,z=-78098..-48820
on x=-29310..-5333,y=-377..16272,z=-92588..-64906
on x=10354..36468,y=45324..65408,z=31417..60527
on x=28022..48159,y=61268..65663,z=12438..25427
on x=-62602..-33068,y=51567..61033,z=-35345..-28008
on x=59685..96646,y=-17225..7947,z=-21655..-929
on x=2571..26494,y=-34041..-16342,z=-79107..-62634
on x=-69128..-43671,y=37174..57503,z=3638..28066
on x=-67589..-48147,y=-73385..-56850,z=-1860..2972
on x=-13132..7845,y=-45253..-22219,z=73332..87814
on x=14643..27911,y=66417..87671,z=6926..42452
on x=55546..59770,y=-68349..-35183,z=13526..42706
on x=46458..71581,y=-64188..-39183,z=-37594..-5557
on x=52337..87886,y=3073..40107,z=25199..53681
on x=-27570..-18038,y=-89728..-75569,z=-8551..19893
on x=45880..62073,y=-68855..-56920,z=-18677..7736
on x=53736..62220,y=40703..59813,z=23257..45038
on x=-76911..-44696,y=-69813..-45549,z=3081..35367
on x=31747..54285,y=3689..9419,z=49901..76396
on x=41306..59150,y=-61184..-38861,z=29420..47064
on x=-3789..19982,y=-70405..-50781,z=36583..62090
on x=60232..72621,y=28595..58182,z=7302..23655
on x=29066..55476,y=50427..80610,z=17279..37108
on x=-74130..-48051,y=9698..30887,z=-55533..-38019
on x=20776..22496,y=49080..74957,z=-54917..-24479
on x=-42551..-29740,y=-55103..-24976,z=-75473..-58134
on x=-513..10228,y=-61404..-54603,z=-56400..-40844
on x=4767..24714,y=68526..93217,z=-25864..-16813
on x=33270..56249,y=-12736..15165,z=59025..73794
on x=56648..94625,y=4068..28093,z=-26382..-8130
on x=-42182..-28592,y=31930..50414,z=-72371..-46985
on x=35452..53665,y=-40979..-7896,z=50032..72566
on x=20439..46512,y=60602..69683,z=10315..32311
on x=29946..49103,y=60304..85429,z=-6857..15097
on x=-44981..-28124,y=-75770..-62139,z=-41957..-39213
on x=1642..15993,y=-74459..-43849,z=46076..65639
on x=24231..28876,y=-46470..-27532,z=49508..84952
on x=58988..97791,y=-8990..14314,z=-1595..37717
on x=66367..88861,y=-35194..-9267,z=-25451..-17485
on x=-60774..-33099,y=-72195..-51492,z=-36479..-16367
on x=32005..49362,y=30998..48503,z=-63298..-32160
on x=-14142..10186,y=-61898..-51952,z=-59283..-47394
on x=-19407..11513,y=32878..69244,z=55828..80284
on x=45876..77690,y=-58055..-41201,z=-29044..5749
on x=-11468..18864,y=75328..84069,z=-4503..25380
on x=-35711..-29917,y=-32456..-23606,z=-82918..-55517
on x=27301..48443,y=-69479..-34724,z=26664..49480
on x=23315..42528,y=-86791..-57800,z=30250..51456
on x=60965..90946,y=-14685..10468,z=20339..49517
on x=15832..37891,y=-52792..-39704,z=39855..71748
on x=-59280..-47097,y=-39141..-17157,z=33266..47528
on x=-57855..-35283,y=-39073..-13640,z=-80444..-56846
on x=-86133..-58057,y=-27636..-4311,z=-32792..-18848
on x=-444..13278,y=22909..49708,z=58690..72477
on x=-13881..12856,y=36632..69292,z=56982..70686
on x=10985..24603,y=25636..55287,z=-79921..-61711
on x=10776..29554,y=4929..33616,z=-82193..-56014
on x=17025..38285,y=-47077..-14251,z=-77553..-54577
on x=46531..63240,y=-15497..3408,z=56333..68319
on x=-64068..-46550,y=-49066..-35557,z=-59104..-37575
on x=-66587..-39636,y=2921..14996,z=-73004..-58075
on x=-57862..-46129,y=-39458..-13965,z=52019..57063
on x=32195..41584,y=-58378..-45157,z=47203..64230
on x=59743..64863,y=-24800..7,z=47840..51569
on x=-42549..-33653,y=70071..85597,z=-16479..7317
on x=-37353..-26663,y=37926..66858,z=34514..62276
on x=15487..32009,y=-17818..-4587,z=-88133..-63626
on x=39272..60009,y=21713..53410,z=29838..55064
on x=14645..18233,y=70285..80160,z=-45717..-26265
on x=-59969..-38119,y=-32490..-11158,z=-72565..-48356
on x=-37063..-12372,y=34981..61053,z=45674..63318
on x=23505..31659,y=-17878..3435,z=69208..88411
on x=-28414..-11477,y=75258..76840,z=-18186..-298
on x=-49615..-36443,y=47524..71379,z=24823..52483
on x=41128..68342,y=42269..56032,z=13167..49004
on x=-73556..-62069,y=39819..54100,z=10014..26182
on x=11963..29197,y=-16582..13981,z=-94711..-63934
on x=-34689..-25577,y=-197..15669,z=-86772..-64172
on x=3563..21507,y=64920..83056,z=-38937..-25267
on x=61303..75862,y=-22101..-7085,z=30482..64859
on x=12131..33975,y=64409..83656,z=-5563..5502
on x=-17530..-7065,y=18505..53237,z=69195..78103
on x=-10021..16570,y=-55375..-27834,z=-78754..-51628
on x=24827..60557,y=-15264..1953,z=51972..86146
on x=-71187..-34824,y=-44254..-14207,z=-52397..-35707
on x=57352..77735,y=-37604..-15263,z=7507..27978
on x=-23726..-7292,y=-55950..-32850,z=-69245..-57628
on x=-90975..-70535,y=9138..33894,z=-25893..-10071
on x=6070..31408,y=64814..80652,z=22591..57794
on x=8916..26303,y=-95224..-59955,z=-10149..8506
on x=-68641..-46067,y=34429..59881,z=-39031..-32389
on x=-11824..-2711,y=-83201..-74852,z=-14639..7401
on x=-53274..-39232,y=35055..53726,z=30474..57011
on x=7629..42203,y=50468..73063,z=-55094..-36272
on x=70158..83416,y=20571..43112,z=4674..16257
on x=-80368..-57194,y=-4962..11968,z=19404..24821
on x=13369..36182,y=-17233..3448,z=-75917..-71135
on x=64365..90943,y=6390..33440,z=8988..21083
on x=-52699..-21144,y=-38040..-854,z=-68245..-58362
on x=-65094..-37684,y=-51612..-25807,z=-72281..-53830
on x=-79276..-46327,y=-50076..-25744,z=8635..28328
on x=-12990..8865,y=41955..75365,z=-62193..-41527
on x=58354..78654,y=-11122..4884,z=23338..45638
on x=-15424..-6958,y=-81028..-61925,z=-2456..27206
on x=-46208..-42140,y=-24044..-384,z=66095..84101
on x=37816..60739,y=22510..43834,z=38468..66426
on x=33152..40141,y=51888..89118,z=13685..23818
on x=-17317..12870,y=47330..75254,z=46415..68934
on x=-70083..-47556,y=-16559..9186,z=43131..65529
on x=-50028..-37229,y=31881..55480,z=53206..75635
on x=-63924..-52170,y=-9878..11562,z=51524..77943
on x=52578..79541,y=42477..67139,z=1927..20882
on x=12599..36298,y=68728..91625,z=11807..22954
on x=-40614..-12787,y=-85532..-54821,z=23444..39179
on x=-74256..-57498,y=-43085..-23159,z=-31465..-13370
on x=39798..71449,y=48045..59886,z=-2613..24872
on x=-68498..-45090,y=25992..41044,z=34996..70831
on x=-35911..-17641,y=57891..78052,z=-35503..-20182
on x=19600..36506,y=-60275..-34413,z=46970..62424
on x=10445..32543,y=72116..79041,z=-26199..-10783
on x=29792..52526,y=17488..40185,z=-76990..-57136
on x=-15086..-965,y=71043..82224,z=-18100..-6923
on x=-66153..-53596,y=45695..50572,z=15633..27979
on x=-3842..19280,y=-94095..-71467,z=-2671..21892
on x=-20058..-15993,y=75074..85769,z=-4154..29602
on x=63662..82628,y=-44024..-18652,z=-42230..-25693
on x=-25464..-1609,y=-95242..-69652,z=-16402..-1625
on x=-45562..-19451,y=46735..69543,z=42501..55057
on x=-63606..-45182,y=-16688..4854,z=57066..69670
on x=48099..58149,y=-19817..13065,z=58517..61835
on x=60301..78442,y=-31292..-9212,z=-9501..5043
on x=-45997..-32832,y=-71865..-55120,z=5197..9635
off x=7801..18090,y=-9284..9018,z=70611..90782
on x=-12595..18229,y=-95412..-76864,z=-25174..-12583
on x=-77795..-50794,y=26612..36830,z=-57817..-32361
off x=45538..72963,y=-7083..18302,z=-58100..-48077
on x=57536..78656,y=15793..40718,z=-18344..-4567
on x=-17242..-13743,y=19611..29304,z=73728..76397
off x=55644..86166,y=-29938..908,z=31294..50663
off x=37393..52270,y=-7712..7531,z=69523..78383
off x=-957..9043,y=77480..91163,z=-33767..-6820
off x=-63298..-46056,y=-41261..-28461,z=-65194..-36474
off x=-6670..15368,y=64523..98069,z=-13420..-5226
off x=-49582..-30819,y=-1458..18304,z=-81337..-44780
on x=-58160..-41058,y=-33405..-27020,z=53440..60477
on x=-36387..-29527,y=63471..69022,z=24542..35223
off x=-55808..-47012,y=-22908..-13468,z=-66925..-53559
on x=1465..15220,y=45037..58791,z=57533..81180
on x=5172..32790,y=-66253..-52994,z=39031..64718
off x=13197..19510,y=68201..87371,z=-20249..-6899
off x=8166..26390,y=67577..88576,z=-45114..-31391
off x=-58895..-34583,y=-69098..-49904,z=-47979..-14615
off x=-40782..-6576,y=67129..85050,z=-37317..-21437
on x=-39763..-26856,y=7977..24549,z=-75663..-52000
off x=-21464..-6049,y=57481..81630,z=31659..40693
off x=-4254..10435,y=33207..56014,z=55750..69967
on x=12035..31707,y=-62120..-45336,z=-56717..-28839
on x=-65942..-52696,y=-45998..-25934,z=-51194..-32621
off x=-90231..-66833,y=-13323..5602,z=29385..35537
off x=-54405..-24273,y=52292..77711,z=5027..20918
off x=-64432..-51362,y=-47643..-33861,z=-38386..-13148
off x=35485..61206,y=-24743..-300,z=50470..64190
on x=-64616..-44407,y=-64266..-32556,z=14623..38546
on x=22913..41733,y=-69991..-52079,z=-48649..-20477
off x=8685..31733,y=2760..9002,z=74103..76071
on x=35956..60262,y=49169..87126,z=-6572..12137
on x=-43172..-20564,y=-15916..3410,z=55126..75394
off x=46980..55817,y=-59630..-43170,z=-39465..-15197
off x=12335..28938,y=55440..86727,z=22223..31474
off x=-69238..-33811,y=-35451..-11427,z=-68568..-56162
on x=9529..30152,y=-62396..-39190,z=-54970..-41011
off x=-44344..-15201,y=-24778..6622,z=-75251..-63023
off x=-8237..24648,y=-98122..-76129,z=-16626..-11718
off x=56007..68228,y=17457..46813,z=27499..47379
off x=-25536..3313,y=27091..50818,z=-76013..-70562
off x=-867..22452,y=-60444..-40519,z=-71818..-65756
on x=-55629..-48209,y=21944..53526,z=-51930..-33309
on x=-50200..-32080,y=-26886..-8210,z=-73679..-51881
on x=48080..58229,y=42242..66852,z=19778..31076
off x=-29293..-9721,y=30767..43132,z=59998..72415
on x=-3114..5283,y=53598..77422,z=-36834..-25165
off x=-42747..-34862,y=27967..59155,z=46571..59298
on x=24734..41081,y=-68020..-55325,z=25073..44789
on x=60951..73145,y=-40729..-22896,z=-40218..-24980
off x=44699..75378,y=-22976..-725,z=41665..63229
on x=-10258..20788,y=-86210..-64265,z=12003..42342
on x=53947..72320,y=7162..37399,z=-39895..-13029
off x=-39542..-35561,y=56618..75009,z=-48379..-30500
off x=-64968..-43128,y=40418..53482,z=15313..28178
off x=7725..26338,y=-78820..-72695,z=5793..36253
on x=63870..92917,y=-31227..-5907,z=-11799..10524
on x=5051..24106,y=-60601..-34349,z=-70347..-50781
off x=-49242..-30233,y=1032..28964,z=49055..79885
off x=-7682..-1197,y=-2276..3227,z=-83960..-73167
off x=-41142..-19190,y=-8859..-4149,z=69429..86603
off x=-77189..-65526,y=10147..24751,z=6547..18732
off x=61931..87618,y=9150..26031,z=-2891..13845
off x=35442..49448,y=-24212..803,z=62461..69557
off x=-19670..-1028,y=-58834..-44115,z=-67684..-44360
off x=-27003..-6291,y=-90151..-56543,z=-36412..-17679
on x=-61239..-56325,y=-28363..-20980,z=-55652..-30421
off x=-42704..-15950,y=-24945..-8619,z=-85074..-57059
on x=-38301..-22514,y=15426..33207,z=68542..86355
off x=-47333..-40889,y=-23607..-16074,z=-75438..-61498
off x=-41292..-28792,y=-82764..-50053,z=-18368..1547
off x=9879..18027,y=-88040..-55114,z=-31569..-21687
on x=29370..47558,y=-89453..-60476,z=-7077..24097
off x=-61367..-50375,y=-46813..-36824,z=26048..47897
on x=53088..71926,y=33364..61477,z=-32978..-3454
off x=42008..72354,y=29685..47325,z=28537..41099
on x=-12144..-4590,y=-86532..-70213,z=-27908..-18632
on x=45535..66832,y=30184..50465,z=40383..65657
on x=-27137..-3917,y=-82970..-73972,z=-7640..2780
off x=-62516..-34096,y=-69186..-46618,z=-16989..7170
off x=67487..86474,y=2409..32050,z=-57219..-26630
on x=-37510..-23310,y=-1063..24320,z=61094..75764
on x=-82076..-62319,y=-23916..3119,z=31484..59801
on x=-49806..-28744,y=69790..84976,z=-19227..9783
on x=19984..27116,y=-92868..-55692,z=-32604..2749
off x=-33077..-9530,y=29925..49080,z=45757..72939
on x=21129..41298,y=-63064..-48210,z=27986..62228
off x=-29272..-15085,y=-41347..-6680,z=-86541..-54306
on x=-22795..4538,y=-86979..-68617,z=-33571..-16035
on x=37493..54597,y=-12454..3419,z=56314..71570
on x=-82969..-54144,y=-48102..-18977,z=-10241..-6489
on x=-65493..-38452,y=-69069..-38053,z=-18803..11092
off x=-51751..-40206,y=-75215..-47769,z=27129..44917
on x=7855..31889,y=-81272..-59497,z=-52331..-25947
off x=-58537..-47134,y=-27170..3264,z=-77101..-61961
off x=22788..37690,y=-80464..-65932,z=10149..28249
off x=56450..90867,y=23748..45680,z=-16199..-4962
off x=65348..72838,y=19671..42377,z=-32562..-2385
off x=39520..70668,y=-60566..-46164,z=3768..38139
off x=31909..43625,y=34147..58043,z=31955..55216
off x=-35845..-22464,y=34709..48917,z=-76334..-55144
off x=-57710..-22597,y=-89725..-55980,z=455..8523
on x=61232..79103,y=-35590..-17557,z=36396..53914
on x=13364..37325,y=-52392..-24413,z=49963..75907
off x=55123..77795,y=-31348..-5365,z=-35659..-1695
on x=-85690..-73087,y=4545..28216,z=17466..35157
on x=-62978..-36031,y=44126..49517,z=29388..58437
off x=28461..40315,y=-76360..-58542,z=-32869..-2925
off x=-55904..-48803,y=56768..61520,z=-18281..7953
on x=-75152..-64663,y=-27266..-1204,z=-49037..-29471
on x=14996..36802,y=29915..61434,z=-81327..-56940
on x=-26058..-12028,y=4310..10903,z=77438..92107
on x=-85981..-63107,y=2263..21108,z=27866..47309
off x=-23339..-4819,y=-51522..-43086,z=-80984..-57493
on x=-80721..-75279,y=-13399..5890,z=6038..32519
off x=-4839..4185,y=42901..53425,z=52703..69554
off x=-63892..-31605,y=-56660..-42554,z=22041..56754
off x=-61974..-48179,y=-76512..-48649,z=19449..28897
off x=52908..86032,y=-40433..-26401,z=18629..35218
off x=-73770..-61498,y=-22285..-15190,z=15118..47822
on x=-26995..-225,y=36166..64844,z=52253..69697
on x=-40432..-19434,y=28105..55728,z=45417..66440
on x=-36183..-5691,y=2779..35551,z=74466..87231
on x=-24042..-7050,y=-38745..-17947,z=71254..91570
on x=64292..82292,y=8725..38040,z=16406..46007
on x=57881..83142,y=-32026..-25553,z=-12007..9727
off x=-60455..-40678,y=-855..18270,z=-54122..-37486
off x=34796..51886,y=47838..54855,z=-59782..-36447
off x=27962..53686,y=-65713..-39620,z=-39332..-24577
off x=23257..38929,y=68865..81212,z=-2301..7985
off x=-28125..-11560,y=65596..78401,z=6019..27451
off x=-35635..-9089,y=-63378..-32616,z=52224..70756
off x=-51366..-40609,y=42282..59056,z=-53065..-31525
on x=-65517..-53788,y=45653..57602,z=-9739..5684
off x=9928..30886,y=55791..63498,z=39507..58962
on x=20773..33156,y=-66617..-45193,z=-55674..-38600
off x=-19345..15432,y=-49640..-29673,z=45268..77586
off x=-37554..-4675,y=-83671..-65891,z=12746..37002
on x=7340..30039,y=26358..37183,z=-72501..-56224
off x=23682..38691,y=-57390..-41912,z=36898..59852
off x=37320..53907,y=-37056..-30571,z=-68192..-42459
off x=76347..91710,y=-14687..16646,z=-25859..-5873
on x=10847..41288,y=-91590..-58641,z=15651..35606
on x=-3833..3543,y=-29112..-2048,z=69842..91959
off x=69115..95898,y=-25974..-2038,z=-4973..3980
off x=39989..66412,y=-55818..-49092,z=3921..28857
on x=-31644..-6237,y=7358..28925,z=73970..84934
off x=-15542..-4489,y=61337..76684,z=-41765..-29786
off x=-52932..-51838,y=21389..25746,z=49616..71107
off x=-91328..-65484,y=-7351..22080,z=11605..46924
off x=26027..32857,y=58474..78674,z=36221..62891
off x=-26694..-12337,y=56020..70984,z=-50254..-30734
on x=-74728..-50762,y=49755..73800,z=-887..19784
off x=11750..40798,y=5403..34501,z=69392..76971
off x=-39481..-24584,y=-70257..-44782,z=-51748..-21001
on x=-16041..6369,y=-15349..-1878,z=-82221..-72485
on x=-26734..-13763,y=-39372..-13681,z=61820..76267
off x=-3367..7668,y=46321..72714,z=-69036..-53898
on x=-15257..-3788,y=19261..25499,z=-75959..-59000
on x=23102..56887,y=50179..87663,z=-7946..18812
on x=-40390..-20111,y=-33493..-11133,z=-75926..-62093
on x=5722..27917,y=-88605..-65010,z=-9730..6950
on x=-760..25848,y=-43841..-27183,z=-73637..-58524
on x=-11739..10211,y=2568..29021,z=65720..78213
off x=-71222..-55392,y=-13076..5838,z=42985..52804
on x=18279..38683,y=-25545..1289,z=58367..91219
on x=-70367..-62420,y=22678..57526,z=-25443..-2114
off x=52159..80534,y=-35573..-32955,z=-28539..-5813
on x=46209..52888,y=54145..79273,z=8459..31178
on x=-78062..-41769,y=-43142..-26892,z=28495..50400
on x=23299..32235,y=-77803..-61730,z=4898..28371
on x=-17235..14679,y=-61639..-27409,z=-72401..-59482
off x=54590..78944,y=-25301..2668,z=14280..43390
off x=-56259..-38764,y=-70482..-39475,z=-47107..-31976
on x=-45205..-34148,y=-81460..-58216,z=22465..49489
on x=-21779..-9350,y=6017..19432,z=-77323..-70204
on x=58226..72150,y=-61315..-36618,z=-15388..15652
on x=-48752..-28573,y=-67697..-60024,z=-32021..-22511
off x=43704..67741,y=38024..65329,z=8318..33137
on x=-77517..-52505,y=29349..57611,z=-41988..-23676
on x=-27878..-6554,y=-88564..-51459,z=-37415..-29030
off x=67651..85341,y=-31556..-19564,z=-40554..-13758
off x=43857..71515,y=-34759..283,z=36263..60654
on x=-32227..-8515,y=-53304..-39055,z=-74694..-49222
on x=-69040..-42013,y=-81201..-46547,z=-3366..5445
on x=-61411..-46616,y=58820..77348,z=-7626..13600
off x=-41475..-28755,y=27623..55447,z=47265..74316
on x=-75096..-46289,y=23758..44103,z=31640..48277
on x=-54799..-33455,y=39873..75938,z=-43929..-27506
off x=-43241..-22153,y=-27047..-185,z=-74727..-63620
on x=-47646..-22540,y=2352..5448,z=50643..86636
on x=21369..38066,y=-89655..-58838,z=-8317..12371
off x=-20000..1689,y=56945..74646,z=35179..51812
off x=30874..47890,y=-76709..-52956,z=-33033..-4279
off x=-35411..-12807,y=-83057..-59139,z=7854..26851"#;

        let ans = day_22_part_2(&input);

        assert_eq!(ans, 1254011191104293)
    }
}