From c1e36e8223617849b2b9dadb1e2e4a62f596e4e9 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Sun, 16 Dec 2018 08:25:07 +0200 Subject: Day 16: Finding the opcodes on an unknown cpu --- inputs/16_1.txt | 3143 +++++++++++++++++++++++++++++++++++++++++++++++++++++ inputs/16_2.txt | 1014 +++++++++++++++++ src/bin/day_16.rs | 191 +++- 3 files changed, 4346 insertions(+), 2 deletions(-) create mode 100644 inputs/16_1.txt create mode 100644 inputs/16_2.txt diff --git a/inputs/16_1.txt b/inputs/16_1.txt new file mode 100644 index 0000000..755acda --- /dev/null +++ b/inputs/16_1.txt @@ -0,0 +1,3143 @@ +Before: [2, 3, 2, 2] +0 3 3 0 +After: [0, 3, 2, 2] + +Before: [1, 1, 2, 3] +6 0 2 0 +After: [0, 1, 2, 3] + +Before: [1, 0, 2, 2] +6 0 2 0 +After: [0, 0, 2, 2] + +Before: [1, 1, 1, 1] +11 2 1 0 +After: [2, 1, 1, 1] + +Before: [3, 0, 0, 2] +0 3 3 2 +After: [3, 0, 0, 2] + +Before: [1, 1, 2, 2] +9 1 0 2 +After: [1, 1, 1, 2] + +Before: [3, 2, 1, 1] +5 2 1 1 +After: [3, 2, 1, 1] + +Before: [1, 1, 0, 3] +7 1 3 0 +After: [0, 1, 0, 3] + +Before: [1, 2, 1, 3] +5 2 1 0 +After: [2, 2, 1, 3] + +Before: [0, 2, 2, 0] +8 0 0 0 +After: [0, 2, 2, 0] + +Before: [2, 0, 0, 1] +3 0 3 0 +After: [1, 0, 0, 1] + +Before: [3, 1, 2, 2] +4 1 3 1 +After: [3, 0, 2, 2] + +Before: [2, 2, 1, 1] +5 2 1 1 +After: [2, 2, 1, 1] + +Before: [1, 1, 2, 2] +6 0 2 2 +After: [1, 1, 0, 2] + +Before: [1, 1, 1, 2] +4 1 3 0 +After: [0, 1, 1, 2] + +Before: [2, 1, 3, 1] +13 1 3 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 2, 1] +13 1 3 1 +After: [0, 1, 2, 1] + +Before: [2, 1, 0, 2] +4 1 3 1 +After: [2, 0, 0, 2] + +Before: [2, 1, 0, 1] +2 0 1 3 +After: [2, 1, 0, 1] + +Before: [3, 1, 2, 1] +12 1 2 2 +After: [3, 1, 0, 1] + +Before: [1, 1, 3, 2] +4 1 3 3 +After: [1, 1, 3, 0] + +Before: [2, 2, 1, 3] +7 1 3 0 +After: [0, 2, 1, 3] + +Before: [1, 3, 2, 1] +6 0 2 1 +After: [1, 0, 2, 1] + +Before: [2, 1, 2, 1] +13 1 3 1 +After: [2, 1, 2, 1] + +Before: [2, 1, 3, 0] +14 2 0 3 +After: [2, 1, 3, 1] + +Before: [1, 1, 2, 3] +6 0 2 3 +After: [1, 1, 2, 0] + +Before: [1, 1, 1, 3] +11 2 1 2 +After: [1, 1, 2, 3] + +Before: [2, 2, 3, 2] +0 3 3 0 +After: [0, 2, 3, 2] + +Before: [1, 2, 0, 2] +1 0 2 3 +After: [1, 2, 0, 0] + +Before: [2, 1, 0, 0] +2 0 1 3 +After: [2, 1, 0, 1] + +Before: [0, 2, 1, 1] +5 2 1 3 +After: [0, 2, 1, 2] + +Before: [0, 3, 2, 1] +10 3 2 3 +After: [0, 3, 2, 1] + +Before: [3, 3, 2, 2] +0 3 3 0 +After: [0, 3, 2, 2] + +Before: [1, 1, 2, 0] +12 1 2 0 +After: [0, 1, 2, 0] + +Before: [0, 2, 1, 3] +5 2 1 0 +After: [2, 2, 1, 3] + +Before: [0, 3, 2, 1] +8 0 0 0 +After: [0, 3, 2, 1] + +Before: [1, 1, 1, 3] +11 2 1 1 +After: [1, 2, 1, 3] + +Before: [0, 1, 1, 2] +11 2 1 2 +After: [0, 1, 2, 2] + +Before: [1, 1, 1, 1] +13 1 3 1 +After: [1, 1, 1, 1] + +Before: [1, 3, 0, 0] +1 0 2 1 +After: [1, 0, 0, 0] + +Before: [2, 2, 3, 1] +14 2 0 1 +After: [2, 1, 3, 1] + +Before: [0, 3, 0, 3] +8 0 0 3 +After: [0, 3, 0, 0] + +Before: [0, 0, 1, 1] +8 0 0 2 +After: [0, 0, 0, 1] + +Before: [0, 3, 2, 1] +8 0 0 2 +After: [0, 3, 0, 1] + +Before: [2, 1, 2, 3] +12 1 2 1 +After: [2, 0, 2, 3] + +Before: [3, 2, 2, 3] +14 2 1 2 +After: [3, 2, 1, 3] + +Before: [2, 2, 3, 0] +15 2 2 2 +After: [2, 2, 1, 0] + +Before: [2, 3, 3, 2] +15 2 2 0 +After: [1, 3, 3, 2] + +Before: [1, 1, 0, 0] +1 0 2 3 +After: [1, 1, 0, 0] + +Before: [3, 2, 2, 2] +0 3 3 3 +After: [3, 2, 2, 0] + +Before: [1, 3, 2, 2] +6 0 2 3 +After: [1, 3, 2, 0] + +Before: [2, 1, 0, 1] +3 0 3 1 +After: [2, 1, 0, 1] + +Before: [3, 3, 1, 3] +7 2 3 0 +After: [0, 3, 1, 3] + +Before: [0, 2, 1, 0] +5 2 1 3 +After: [0, 2, 1, 2] + +Before: [1, 1, 1, 2] +4 1 3 2 +After: [1, 1, 0, 2] + +Before: [0, 3, 1, 2] +8 0 0 1 +After: [0, 0, 1, 2] + +Before: [2, 1, 3, 3] +7 1 3 0 +After: [0, 1, 3, 3] + +Before: [3, 2, 2, 1] +10 3 2 0 +After: [1, 2, 2, 1] + +Before: [2, 1, 0, 1] +3 0 3 3 +After: [2, 1, 0, 1] + +Before: [2, 1, 1, 1] +13 1 3 2 +After: [2, 1, 1, 1] + +Before: [2, 2, 0, 3] +7 1 3 1 +After: [2, 0, 0, 3] + +Before: [2, 2, 0, 1] +3 0 3 0 +After: [1, 2, 0, 1] + +Before: [2, 2, 3, 1] +3 0 3 3 +After: [2, 2, 3, 1] + +Before: [1, 2, 0, 0] +1 0 2 1 +After: [1, 0, 0, 0] + +Before: [2, 2, 2, 2] +14 3 2 1 +After: [2, 0, 2, 2] + +Before: [3, 1, 1, 2] +4 1 3 1 +After: [3, 0, 1, 2] + +Before: [2, 1, 1, 1] +2 0 1 3 +After: [2, 1, 1, 1] + +Before: [1, 1, 0, 0] +1 0 2 1 +After: [1, 0, 0, 0] + +Before: [1, 3, 0, 2] +1 0 2 1 +After: [1, 0, 0, 2] + +Before: [1, 1, 1, 3] +9 1 0 2 +After: [1, 1, 1, 3] + +Before: [3, 1, 2, 2] +12 1 2 2 +After: [3, 1, 0, 2] + +Before: [0, 1, 2, 1] +12 1 2 2 +After: [0, 1, 0, 1] + +Before: [3, 2, 0, 3] +7 1 3 3 +After: [3, 2, 0, 0] + +Before: [2, 1, 2, 3] +7 2 3 2 +After: [2, 1, 0, 3] + +Before: [3, 1, 3, 1] +13 1 3 0 +After: [1, 1, 3, 1] + +Before: [2, 1, 1, 1] +11 2 1 0 +After: [2, 1, 1, 1] + +Before: [0, 1, 1, 0] +11 2 1 3 +After: [0, 1, 1, 2] + +Before: [2, 1, 3, 3] +7 1 3 2 +After: [2, 1, 0, 3] + +Before: [2, 3, 2, 1] +10 3 2 1 +After: [2, 1, 2, 1] + +Before: [1, 1, 2, 2] +4 1 3 1 +After: [1, 0, 2, 2] + +Before: [1, 3, 0, 1] +1 0 2 0 +After: [0, 3, 0, 1] + +Before: [1, 3, 0, 3] +1 0 2 3 +After: [1, 3, 0, 0] + +Before: [2, 3, 3, 1] +3 0 3 1 +After: [2, 1, 3, 1] + +Before: [2, 1, 1, 2] +11 2 1 3 +After: [2, 1, 1, 2] + +Before: [2, 1, 1, 1] +2 0 1 1 +After: [2, 1, 1, 1] + +Before: [3, 1, 2, 2] +4 1 3 0 +After: [0, 1, 2, 2] + +Before: [2, 0, 2, 1] +10 3 2 1 +After: [2, 1, 2, 1] + +Before: [1, 3, 0, 1] +1 0 2 1 +After: [1, 0, 0, 1] + +Before: [1, 1, 0, 2] +9 1 0 0 +After: [1, 1, 0, 2] + +Before: [2, 3, 2, 1] +3 0 3 2 +After: [2, 3, 1, 1] + +Before: [1, 2, 2, 1] +0 3 3 3 +After: [1, 2, 2, 0] + +Before: [3, 1, 2, 2] +12 1 2 1 +After: [3, 0, 2, 2] + +Before: [0, 2, 3, 1] +8 0 0 1 +After: [0, 0, 3, 1] + +Before: [0, 0, 2, 1] +10 3 2 2 +After: [0, 0, 1, 1] + +Before: [3, 2, 1, 3] +15 0 0 3 +After: [3, 2, 1, 1] + +Before: [1, 3, 2, 2] +6 0 2 2 +After: [1, 3, 0, 2] + +Before: [1, 2, 2, 3] +6 0 2 3 +After: [1, 2, 2, 0] + +Before: [1, 1, 3, 2] +4 1 3 2 +After: [1, 1, 0, 2] + +Before: [1, 2, 2, 1] +10 3 2 3 +After: [1, 2, 2, 1] + +Before: [1, 2, 2, 1] +6 0 2 2 +After: [1, 2, 0, 1] + +Before: [1, 2, 1, 3] +7 2 3 1 +After: [1, 0, 1, 3] + +Before: [1, 2, 2, 1] +10 3 2 0 +After: [1, 2, 2, 1] + +Before: [2, 3, 3, 1] +3 0 3 3 +After: [2, 3, 3, 1] + +Before: [2, 3, 2, 3] +14 2 0 2 +After: [2, 3, 1, 3] + +Before: [2, 1, 3, 1] +2 0 1 3 +After: [2, 1, 3, 1] + +Before: [0, 3, 3, 0] +8 0 0 1 +After: [0, 0, 3, 0] + +Before: [2, 1, 1, 3] +7 2 3 2 +After: [2, 1, 0, 3] + +Before: [0, 2, 2, 1] +10 3 2 3 +After: [0, 2, 2, 1] + +Before: [3, 2, 1, 3] +5 2 1 3 +After: [3, 2, 1, 2] + +Before: [3, 1, 1, 2] +0 3 3 2 +After: [3, 1, 0, 2] + +Before: [0, 3, 1, 3] +7 2 3 3 +After: [0, 3, 1, 0] + +Before: [2, 0, 2, 1] +10 3 2 3 +After: [2, 0, 2, 1] + +Before: [2, 2, 1, 0] +5 2 1 2 +After: [2, 2, 2, 0] + +Before: [2, 1, 2, 2] +4 1 3 3 +After: [2, 1, 2, 0] + +Before: [1, 3, 1, 1] +0 2 3 2 +After: [1, 3, 0, 1] + +Before: [1, 1, 0, 3] +1 0 2 3 +After: [1, 1, 0, 0] + +Before: [1, 0, 0, 3] +1 0 2 2 +After: [1, 0, 0, 3] + +Before: [2, 1, 1, 0] +11 2 1 0 +After: [2, 1, 1, 0] + +Before: [2, 0, 0, 1] +3 0 3 3 +After: [2, 0, 0, 1] + +Before: [3, 3, 0, 1] +14 0 2 2 +After: [3, 3, 1, 1] + +Before: [0, 1, 2, 0] +8 0 0 1 +After: [0, 0, 2, 0] + +Before: [2, 0, 1, 1] +3 0 3 2 +After: [2, 0, 1, 1] + +Before: [1, 3, 2, 0] +6 0 2 1 +After: [1, 0, 2, 0] + +Before: [3, 3, 2, 0] +2 0 2 3 +After: [3, 3, 2, 1] + +Before: [2, 1, 0, 1] +13 1 3 2 +After: [2, 1, 1, 1] + +Before: [1, 1, 2, 1] +13 1 3 2 +After: [1, 1, 1, 1] + +Before: [1, 3, 2, 0] +6 0 2 2 +After: [1, 3, 0, 0] + +Before: [3, 1, 3, 2] +4 1 3 1 +After: [3, 0, 3, 2] + +Before: [2, 3, 2, 2] +15 0 0 3 +After: [2, 3, 2, 1] + +Before: [2, 3, 2, 1] +3 0 3 3 +After: [2, 3, 2, 1] + +Before: [2, 1, 1, 2] +4 1 3 0 +After: [0, 1, 1, 2] + +Before: [1, 1, 1, 1] +13 1 3 0 +After: [1, 1, 1, 1] + +Before: [3, 1, 1, 0] +11 2 1 2 +After: [3, 1, 2, 0] + +Before: [3, 1, 1, 1] +11 2 1 0 +After: [2, 1, 1, 1] + +Before: [3, 1, 0, 2] +4 1 3 0 +After: [0, 1, 0, 2] + +Before: [3, 3, 1, 3] +15 0 0 3 +After: [3, 3, 1, 1] + +Before: [1, 2, 2, 1] +10 3 2 1 +After: [1, 1, 2, 1] + +Before: [1, 1, 1, 0] +11 2 1 3 +After: [1, 1, 1, 2] + +Before: [1, 1, 1, 2] +11 2 1 0 +After: [2, 1, 1, 2] + +Before: [3, 2, 2, 2] +14 2 1 2 +After: [3, 2, 1, 2] + +Before: [0, 0, 3, 3] +15 2 2 3 +After: [0, 0, 3, 1] + +Before: [0, 3, 2, 2] +0 3 3 0 +After: [0, 3, 2, 2] + +Before: [1, 0, 2, 1] +10 3 2 1 +After: [1, 1, 2, 1] + +Before: [2, 1, 2, 2] +14 3 2 1 +After: [2, 0, 2, 2] + +Before: [1, 0, 0, 3] +1 0 2 1 +After: [1, 0, 0, 3] + +Before: [3, 2, 1, 3] +7 2 3 1 +After: [3, 0, 1, 3] + +Before: [3, 1, 1, 2] +11 2 1 0 +After: [2, 1, 1, 2] + +Before: [1, 3, 2, 1] +6 0 2 0 +After: [0, 3, 2, 1] + +Before: [2, 0, 3, 1] +3 0 3 0 +After: [1, 0, 3, 1] + +Before: [3, 1, 2, 2] +12 1 2 0 +After: [0, 1, 2, 2] + +Before: [3, 1, 2, 0] +12 1 2 3 +After: [3, 1, 2, 0] + +Before: [2, 1, 2, 0] +2 0 1 3 +After: [2, 1, 2, 1] + +Before: [1, 1, 3, 1] +14 2 3 2 +After: [1, 1, 0, 1] + +Before: [1, 3, 2, 3] +6 0 2 0 +After: [0, 3, 2, 3] + +Before: [1, 1, 2, 3] +12 1 2 0 +After: [0, 1, 2, 3] + +Before: [3, 0, 2, 1] +10 3 2 1 +After: [3, 1, 2, 1] + +Before: [1, 0, 2, 0] +6 0 2 1 +After: [1, 0, 2, 0] + +Before: [2, 3, 1, 3] +7 2 3 2 +After: [2, 3, 0, 3] + +Before: [1, 1, 1, 1] +11 2 1 3 +After: [1, 1, 1, 2] + +Before: [2, 1, 2, 2] +2 0 1 0 +After: [1, 1, 2, 2] + +Before: [1, 2, 1, 3] +7 2 3 3 +After: [1, 2, 1, 0] + +Before: [1, 1, 2, 2] +12 1 2 0 +After: [0, 1, 2, 2] + +Before: [2, 0, 2, 1] +10 3 2 2 +After: [2, 0, 1, 1] + +Before: [0, 1, 2, 3] +12 1 2 2 +After: [0, 1, 0, 3] + +Before: [2, 1, 1, 3] +11 2 1 0 +After: [2, 1, 1, 3] + +Before: [2, 1, 3, 1] +13 1 3 3 +After: [2, 1, 3, 1] + +Before: [0, 2, 1, 1] +8 0 0 1 +After: [0, 0, 1, 1] + +Before: [1, 0, 0, 2] +1 0 2 1 +After: [1, 0, 0, 2] + +Before: [2, 1, 3, 3] +2 0 1 1 +After: [2, 1, 3, 3] + +Before: [0, 1, 2, 2] +4 1 3 2 +After: [0, 1, 0, 2] + +Before: [1, 1, 2, 1] +13 1 3 0 +After: [1, 1, 2, 1] + +Before: [1, 1, 3, 0] +9 1 0 1 +After: [1, 1, 3, 0] + +Before: [1, 1, 0, 1] +1 0 2 1 +After: [1, 0, 0, 1] + +Before: [2, 2, 3, 1] +3 0 3 1 +After: [2, 1, 3, 1] + +Before: [3, 2, 1, 2] +5 2 1 0 +After: [2, 2, 1, 2] + +Before: [1, 1, 2, 0] +12 1 2 1 +After: [1, 0, 2, 0] + +Before: [3, 0, 2, 3] +2 0 2 3 +After: [3, 0, 2, 1] + +Before: [2, 1, 3, 3] +2 0 1 2 +After: [2, 1, 1, 3] + +Before: [3, 1, 3, 1] +15 0 0 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 3, 2] +4 1 3 1 +After: [0, 0, 3, 2] + +Before: [3, 2, 3, 3] +15 2 0 0 +After: [1, 2, 3, 3] + +Before: [1, 3, 3, 1] +0 3 3 0 +After: [0, 3, 3, 1] + +Before: [0, 0, 2, 3] +7 2 3 0 +After: [0, 0, 2, 3] + +Before: [0, 2, 1, 3] +7 2 3 2 +After: [0, 2, 0, 3] + +Before: [3, 0, 2, 1] +2 0 2 0 +After: [1, 0, 2, 1] + +Before: [2, 2, 2, 1] +10 3 2 2 +After: [2, 2, 1, 1] + +Before: [1, 2, 0, 1] +1 0 2 0 +After: [0, 2, 0, 1] + +Before: [1, 2, 0, 0] +1 0 2 2 +After: [1, 2, 0, 0] + +Before: [3, 1, 2, 1] +2 0 2 1 +After: [3, 1, 2, 1] + +Before: [0, 0, 3, 1] +8 0 0 1 +After: [0, 0, 3, 1] + +Before: [0, 1, 1, 2] +11 2 1 3 +After: [0, 1, 1, 2] + +Before: [0, 1, 3, 1] +13 1 3 2 +After: [0, 1, 1, 1] + +Before: [1, 1, 1, 2] +11 2 1 2 +After: [1, 1, 2, 2] + +Before: [2, 0, 3, 1] +3 0 3 3 +After: [2, 0, 3, 1] + +Before: [0, 2, 1, 2] +8 0 0 0 +After: [0, 2, 1, 2] + +Before: [1, 0, 2, 1] +6 0 2 1 +After: [1, 0, 2, 1] + +Before: [1, 1, 0, 2] +4 1 3 3 +After: [1, 1, 0, 0] + +Before: [2, 2, 1, 1] +3 0 3 2 +After: [2, 2, 1, 1] + +Before: [1, 2, 1, 2] +5 2 1 2 +After: [1, 2, 2, 2] + +Before: [2, 0, 2, 1] +3 0 3 3 +After: [2, 0, 2, 1] + +Before: [2, 1, 0, 1] +3 0 3 2 +After: [2, 1, 1, 1] + +Before: [2, 2, 1, 2] +5 2 1 1 +After: [2, 2, 1, 2] + +Before: [1, 1, 2, 2] +9 1 0 3 +After: [1, 1, 2, 1] + +Before: [2, 2, 1, 3] +15 0 0 3 +After: [2, 2, 1, 1] + +Before: [3, 1, 0, 1] +13 1 3 3 +After: [3, 1, 0, 1] + +Before: [3, 3, 2, 1] +10 3 2 2 +After: [3, 3, 1, 1] + +Before: [0, 1, 3, 2] +4 1 3 3 +After: [0, 1, 3, 0] + +Before: [0, 1, 1, 0] +11 2 1 2 +After: [0, 1, 2, 0] + +Before: [3, 1, 3, 1] +14 3 1 0 +After: [0, 1, 3, 1] + +Before: [0, 1, 3, 3] +8 0 0 3 +After: [0, 1, 3, 0] + +Before: [0, 1, 2, 1] +10 3 2 0 +After: [1, 1, 2, 1] + +Before: [2, 1, 2, 1] +3 0 3 2 +After: [2, 1, 1, 1] + +Before: [0, 2, 1, 3] +5 2 1 3 +After: [0, 2, 1, 2] + +Before: [1, 0, 0, 3] +1 0 2 0 +After: [0, 0, 0, 3] + +Before: [2, 3, 0, 1] +3 0 3 0 +After: [1, 3, 0, 1] + +Before: [2, 1, 2, 1] +12 1 2 1 +After: [2, 0, 2, 1] + +Before: [2, 1, 3, 2] +4 1 3 0 +After: [0, 1, 3, 2] + +Before: [1, 2, 1, 0] +5 2 1 3 +After: [1, 2, 1, 2] + +Before: [3, 1, 3, 1] +13 1 3 1 +After: [3, 1, 3, 1] + +Before: [1, 2, 1, 0] +5 2 1 1 +After: [1, 2, 1, 0] + +Before: [3, 1, 2, 1] +10 3 2 1 +After: [3, 1, 2, 1] + +Before: [1, 1, 1, 1] +13 1 3 2 +After: [1, 1, 1, 1] + +Before: [2, 1, 2, 1] +13 1 3 2 +After: [2, 1, 1, 1] + +Before: [1, 2, 1, 3] +7 1 3 1 +After: [1, 0, 1, 3] + +Before: [0, 0, 2, 2] +14 3 2 3 +After: [0, 0, 2, 0] + +Before: [2, 2, 1, 3] +15 0 0 1 +After: [2, 1, 1, 3] + +Before: [2, 1, 3, 2] +4 1 3 1 +After: [2, 0, 3, 2] + +Before: [1, 2, 1, 3] +5 2 1 2 +After: [1, 2, 2, 3] + +Before: [2, 2, 1, 0] +5 2 1 3 +After: [2, 2, 1, 2] + +Before: [2, 0, 2, 1] +3 0 3 2 +After: [2, 0, 1, 1] + +Before: [1, 0, 0, 1] +1 0 2 0 +After: [0, 0, 0, 1] + +Before: [2, 1, 1, 0] +15 0 0 0 +After: [1, 1, 1, 0] + +Before: [0, 0, 3, 3] +8 0 0 0 +After: [0, 0, 3, 3] + +Before: [1, 1, 1, 2] +4 1 3 3 +After: [1, 1, 1, 0] + +Before: [1, 2, 0, 3] +1 0 2 1 +After: [1, 0, 0, 3] + +Before: [1, 1, 0, 2] +9 1 0 1 +After: [1, 1, 0, 2] + +Before: [3, 1, 1, 1] +11 2 1 3 +After: [3, 1, 1, 2] + +Before: [1, 1, 0, 3] +7 1 3 1 +After: [1, 0, 0, 3] + +Before: [1, 1, 1, 3] +7 1 3 2 +After: [1, 1, 0, 3] + +Before: [1, 1, 2, 3] +6 0 2 1 +After: [1, 0, 2, 3] + +Before: [2, 1, 1, 2] +4 1 3 3 +After: [2, 1, 1, 0] + +Before: [2, 2, 2, 3] +7 1 3 2 +After: [2, 2, 0, 3] + +Before: [1, 3, 2, 1] +0 3 3 3 +After: [1, 3, 2, 0] + +Before: [0, 0, 3, 3] +8 0 0 3 +After: [0, 0, 3, 0] + +Before: [3, 1, 3, 1] +15 0 0 1 +After: [3, 1, 3, 1] + +Before: [1, 0, 0, 2] +1 0 2 2 +After: [1, 0, 0, 2] + +Before: [0, 0, 0, 1] +0 3 3 1 +After: [0, 0, 0, 1] + +Before: [1, 1, 1, 2] +9 1 0 0 +After: [1, 1, 1, 2] + +Before: [1, 3, 0, 1] +1 0 2 2 +After: [1, 3, 0, 1] + +Before: [1, 1, 3, 3] +9 1 0 0 +After: [1, 1, 3, 3] + +Before: [2, 1, 3, 1] +13 1 3 2 +After: [2, 1, 1, 1] + +Before: [2, 1, 3, 2] +4 1 3 3 +After: [2, 1, 3, 0] + +Before: [2, 1, 2, 1] +13 1 3 3 +After: [2, 1, 2, 1] + +Before: [1, 0, 2, 2] +6 0 2 1 +After: [1, 0, 2, 2] + +Before: [1, 1, 2, 1] +10 3 2 2 +After: [1, 1, 1, 1] + +Before: [3, 2, 1, 3] +5 2 1 2 +After: [3, 2, 2, 3] + +Before: [0, 1, 2, 0] +12 1 2 2 +After: [0, 1, 0, 0] + +Before: [2, 1, 1, 3] +2 0 1 0 +After: [1, 1, 1, 3] + +Before: [1, 2, 2, 3] +14 2 1 2 +After: [1, 2, 1, 3] + +Before: [1, 2, 0, 3] +1 0 2 0 +After: [0, 2, 0, 3] + +Before: [0, 1, 2, 2] +8 0 0 2 +After: [0, 1, 0, 2] + +Before: [0, 2, 1, 0] +5 2 1 1 +After: [0, 2, 1, 0] + +Before: [2, 0, 0, 1] +15 0 0 2 +After: [2, 0, 1, 1] + +Before: [2, 2, 1, 3] +5 2 1 0 +After: [2, 2, 1, 3] + +Before: [3, 2, 2, 1] +10 3 2 2 +After: [3, 2, 1, 1] + +Before: [0, 3, 2, 2] +14 3 2 2 +After: [0, 3, 0, 2] + +Before: [1, 2, 0, 1] +1 0 2 2 +After: [1, 2, 0, 1] + +Before: [0, 1, 1, 0] +11 2 1 0 +After: [2, 1, 1, 0] + +Before: [1, 2, 2, 3] +14 2 1 3 +After: [1, 2, 2, 1] + +Before: [2, 1, 3, 1] +3 0 3 3 +After: [2, 1, 3, 1] + +Before: [0, 1, 2, 3] +7 1 3 3 +After: [0, 1, 2, 0] + +Before: [2, 1, 2, 2] +2 0 1 1 +After: [2, 1, 2, 2] + +Before: [2, 2, 1, 0] +5 2 1 1 +After: [2, 2, 1, 0] + +Before: [3, 2, 1, 3] +5 2 1 0 +After: [2, 2, 1, 3] + +Before: [1, 1, 2, 1] +0 3 3 1 +After: [1, 0, 2, 1] + +Before: [1, 0, 2, 1] +6 0 2 3 +After: [1, 0, 2, 0] + +Before: [1, 3, 0, 2] +1 0 2 0 +After: [0, 3, 0, 2] + +Before: [0, 1, 1, 3] +11 2 1 2 +After: [0, 1, 2, 3] + +Before: [1, 1, 3, 3] +9 1 0 1 +After: [1, 1, 3, 3] + +Before: [3, 1, 2, 3] +12 1 2 1 +After: [3, 0, 2, 3] + +Before: [0, 1, 1, 1] +13 1 3 0 +After: [1, 1, 1, 1] + +Before: [1, 1, 2, 3] +9 1 0 1 +After: [1, 1, 2, 3] + +Before: [0, 3, 1, 3] +7 2 3 0 +After: [0, 3, 1, 3] + +Before: [3, 1, 2, 1] +13 1 3 2 +After: [3, 1, 1, 1] + +Before: [1, 0, 1, 3] +7 2 3 1 +After: [1, 0, 1, 3] + +Before: [1, 1, 0, 3] +1 0 2 0 +After: [0, 1, 0, 3] + +Before: [2, 1, 2, 2] +12 1 2 2 +After: [2, 1, 0, 2] + +Before: [3, 0, 1, 3] +14 3 0 0 +After: [1, 0, 1, 3] + +Before: [3, 1, 3, 3] +7 1 3 3 +After: [3, 1, 3, 0] + +Before: [1, 1, 0, 0] +1 0 2 0 +After: [0, 1, 0, 0] + +Before: [1, 1, 1, 1] +0 2 3 2 +After: [1, 1, 0, 1] + +Before: [2, 1, 0, 1] +2 0 1 2 +After: [2, 1, 1, 1] + +Before: [1, 1, 2, 1] +14 3 1 1 +After: [1, 0, 2, 1] + +Before: [0, 0, 2, 3] +7 2 3 3 +After: [0, 0, 2, 0] + +Before: [3, 2, 0, 0] +14 0 2 1 +After: [3, 1, 0, 0] + +Before: [0, 0, 2, 3] +8 0 0 0 +After: [0, 0, 2, 3] + +Before: [3, 1, 1, 0] +11 2 1 1 +After: [3, 2, 1, 0] + +Before: [1, 2, 1, 1] +5 2 1 2 +After: [1, 2, 2, 1] + +Before: [0, 2, 1, 3] +7 2 3 3 +After: [0, 2, 1, 0] + +Before: [3, 1, 2, 2] +15 0 0 3 +After: [3, 1, 2, 1] + +Before: [0, 0, 0, 2] +8 0 0 2 +After: [0, 0, 0, 2] + +Before: [3, 1, 3, 1] +13 1 3 2 +After: [3, 1, 1, 1] + +Before: [1, 1, 2, 3] +9 1 0 2 +After: [1, 1, 1, 3] + +Before: [1, 2, 0, 2] +1 0 2 2 +After: [1, 2, 0, 2] + +Before: [2, 1, 2, 3] +2 0 1 3 +After: [2, 1, 2, 1] + +Before: [1, 2, 0, 3] +1 0 2 2 +After: [1, 2, 0, 3] + +Before: [1, 0, 2, 0] +6 0 2 3 +After: [1, 0, 2, 0] + +Before: [1, 0, 3, 1] +0 3 3 2 +After: [1, 0, 0, 1] + +Before: [1, 3, 2, 1] +6 0 2 3 +After: [1, 3, 2, 0] + +Before: [1, 1, 1, 1] +9 1 0 3 +After: [1, 1, 1, 1] + +Before: [0, 3, 2, 1] +0 3 3 1 +After: [0, 0, 2, 1] + +Before: [1, 1, 3, 1] +13 1 3 3 +After: [1, 1, 3, 1] + +Before: [2, 2, 0, 3] +7 1 3 0 +After: [0, 2, 0, 3] + +Before: [0, 3, 2, 1] +0 3 3 0 +After: [0, 3, 2, 1] + +Before: [1, 0, 0, 1] +1 0 2 2 +After: [1, 0, 0, 1] + +Before: [2, 1, 2, 1] +2 0 1 2 +After: [2, 1, 1, 1] + +Before: [1, 2, 2, 2] +6 0 2 2 +After: [1, 2, 0, 2] + +Before: [0, 1, 1, 1] +13 1 3 3 +After: [0, 1, 1, 1] + +Before: [2, 1, 1, 0] +11 2 1 2 +After: [2, 1, 2, 0] + +Before: [0, 1, 3, 1] +13 1 3 1 +After: [0, 1, 3, 1] + +Before: [3, 2, 0, 2] +0 3 3 1 +After: [3, 0, 0, 2] + +Before: [1, 1, 2, 1] +10 3 2 3 +After: [1, 1, 2, 1] + +Before: [2, 1, 2, 1] +13 1 3 0 +After: [1, 1, 2, 1] + +Before: [2, 1, 0, 1] +13 1 3 1 +After: [2, 1, 0, 1] + +Before: [2, 1, 2, 2] +12 1 2 3 +After: [2, 1, 2, 0] + +Before: [0, 1, 2, 0] +12 1 2 1 +After: [0, 0, 2, 0] + +Before: [3, 1, 2, 2] +4 1 3 2 +After: [3, 1, 0, 2] + +Before: [1, 1, 0, 2] +1 0 2 1 +After: [1, 0, 0, 2] + +Before: [0, 2, 1, 1] +0 2 3 2 +After: [0, 2, 0, 1] + +Before: [1, 1, 2, 0] +6 0 2 0 +After: [0, 1, 2, 0] + +Before: [0, 3, 1, 2] +8 0 0 3 +After: [0, 3, 1, 0] + +Before: [1, 3, 0, 0] +1 0 2 2 +After: [1, 3, 0, 0] + +Before: [1, 1, 2, 0] +12 1 2 2 +After: [1, 1, 0, 0] + +Before: [2, 1, 0, 2] +0 3 3 1 +After: [2, 0, 0, 2] + +Before: [0, 3, 3, 3] +8 0 0 1 +After: [0, 0, 3, 3] + +Before: [3, 3, 0, 1] +0 3 3 0 +After: [0, 3, 0, 1] + +Before: [3, 1, 1, 2] +4 1 3 3 +After: [3, 1, 1, 0] + +Before: [2, 1, 2, 3] +12 1 2 3 +After: [2, 1, 2, 0] + +Before: [3, 1, 2, 1] +12 1 2 3 +After: [3, 1, 2, 0] + +Before: [1, 0, 2, 2] +6 0 2 3 +After: [1, 0, 2, 0] + +Before: [1, 1, 0, 1] +0 3 3 1 +After: [1, 0, 0, 1] + +Before: [1, 1, 0, 3] +9 1 0 2 +After: [1, 1, 1, 3] + +Before: [3, 0, 2, 1] +10 3 2 3 +After: [3, 0, 2, 1] + +Before: [2, 2, 3, 3] +14 3 2 3 +After: [2, 2, 3, 1] + +Before: [3, 1, 2, 2] +12 1 2 3 +After: [3, 1, 2, 0] + +Before: [0, 1, 2, 1] +10 3 2 1 +After: [0, 1, 2, 1] + +Before: [0, 1, 3, 0] +8 0 0 2 +After: [0, 1, 0, 0] + +Before: [3, 1, 2, 0] +12 1 2 1 +After: [3, 0, 2, 0] + +Before: [1, 3, 2, 0] +6 0 2 3 +After: [1, 3, 2, 0] + +Before: [2, 0, 1, 3] +7 2 3 3 +After: [2, 0, 1, 0] + +Before: [3, 2, 2, 1] +10 3 2 3 +After: [3, 2, 2, 1] + +Before: [1, 2, 0, 0] +1 0 2 3 +After: [1, 2, 0, 0] + +Before: [2, 1, 1, 1] +0 2 3 0 +After: [0, 1, 1, 1] + +Before: [3, 2, 1, 1] +5 2 1 3 +After: [3, 2, 1, 2] + +Before: [3, 1, 3, 1] +14 2 3 0 +After: [0, 1, 3, 1] + +Before: [2, 1, 1, 3] +14 2 1 1 +After: [2, 0, 1, 3] + +Before: [0, 1, 1, 2] +8 0 0 0 +After: [0, 1, 1, 2] + +Before: [2, 3, 3, 2] +15 2 2 2 +After: [2, 3, 1, 2] + +Before: [0, 1, 2, 3] +7 2 3 1 +After: [0, 0, 2, 3] + +Before: [1, 1, 0, 2] +4 1 3 2 +After: [1, 1, 0, 2] + +Before: [0, 2, 3, 0] +8 0 0 2 +After: [0, 2, 0, 0] + +Before: [0, 1, 1, 1] +11 2 1 1 +After: [0, 2, 1, 1] + +Before: [2, 1, 1, 1] +13 1 3 0 +After: [1, 1, 1, 1] + +Before: [2, 3, 1, 3] +7 2 3 0 +After: [0, 3, 1, 3] + +Before: [2, 1, 2, 3] +12 1 2 2 +After: [2, 1, 0, 3] + +Before: [2, 2, 1, 3] +5 2 1 3 +After: [2, 2, 1, 2] + +Before: [3, 1, 1, 3] +11 2 1 0 +After: [2, 1, 1, 3] + +Before: [0, 0, 1, 3] +7 2 3 1 +After: [0, 0, 1, 3] + +Before: [1, 3, 2, 1] +10 3 2 2 +After: [1, 3, 1, 1] + +Before: [3, 2, 1, 2] +15 0 0 2 +After: [3, 2, 1, 2] + +Before: [1, 2, 1, 1] +0 2 3 1 +After: [1, 0, 1, 1] + +Before: [1, 1, 1, 3] +9 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 1, 0, 3] +9 1 0 3 +After: [1, 1, 0, 1] + +Before: [0, 1, 1, 1] +11 2 1 2 +After: [0, 1, 2, 1] + +Before: [0, 1, 2, 1] +13 1 3 2 +After: [0, 1, 1, 1] + +Before: [1, 1, 2, 2] +4 1 3 2 +After: [1, 1, 0, 2] + +Before: [3, 1, 1, 2] +11 2 1 3 +After: [3, 1, 1, 2] + +Before: [2, 2, 3, 2] +0 3 3 3 +After: [2, 2, 3, 0] + +Before: [0, 0, 1, 1] +0 2 3 1 +After: [0, 0, 1, 1] + +Before: [0, 1, 2, 2] +12 1 2 1 +After: [0, 0, 2, 2] + +Before: [2, 0, 3, 1] +3 0 3 2 +After: [2, 0, 1, 1] + +Before: [1, 0, 2, 0] +6 0 2 0 +After: [0, 0, 2, 0] + +Before: [0, 2, 1, 1] +5 2 1 0 +After: [2, 2, 1, 1] + +Before: [1, 3, 3, 0] +15 2 2 0 +After: [1, 3, 3, 0] + +Before: [0, 3, 2, 0] +8 0 0 2 +After: [0, 3, 0, 0] + +Before: [2, 2, 2, 1] +0 3 3 1 +After: [2, 0, 2, 1] + +Before: [3, 1, 1, 2] +4 1 3 0 +After: [0, 1, 1, 2] + +Before: [1, 2, 1, 0] +5 2 1 0 +After: [2, 2, 1, 0] + +Before: [2, 2, 3, 3] +15 0 0 0 +After: [1, 2, 3, 3] + +Before: [2, 1, 0, 0] +2 0 1 1 +After: [2, 1, 0, 0] + +Before: [1, 2, 2, 3] +6 0 2 2 +After: [1, 2, 0, 3] + +Before: [1, 0, 0, 1] +1 0 2 1 +After: [1, 0, 0, 1] + +Before: [2, 2, 0, 1] +3 0 3 1 +After: [2, 1, 0, 1] + +Before: [3, 2, 1, 2] +5 2 1 1 +After: [3, 2, 1, 2] + +Before: [2, 1, 3, 2] +14 2 0 1 +After: [2, 1, 3, 2] + +Before: [1, 1, 0, 0] +9 1 0 2 +After: [1, 1, 1, 0] + +Before: [2, 2, 3, 3] +15 2 2 2 +After: [2, 2, 1, 3] + +Before: [0, 2, 1, 0] +8 0 0 2 +After: [0, 2, 0, 0] + +Before: [1, 1, 0, 1] +9 1 0 0 +After: [1, 1, 0, 1] + +Before: [0, 1, 2, 2] +4 1 3 0 +After: [0, 1, 2, 2] + +Before: [1, 1, 0, 0] +9 1 0 0 +After: [1, 1, 0, 0] + +Before: [2, 3, 2, 1] +3 0 3 1 +After: [2, 1, 2, 1] + +Before: [1, 2, 1, 3] +5 2 1 3 +After: [1, 2, 1, 2] + +Before: [2, 1, 1, 3] +11 2 1 2 +After: [2, 1, 2, 3] + +Before: [1, 1, 3, 0] +9 1 0 2 +After: [1, 1, 1, 0] + +Before: [2, 1, 1, 3] +11 2 1 1 +After: [2, 2, 1, 3] + +Before: [2, 1, 3, 2] +2 0 1 2 +After: [2, 1, 1, 2] + +Before: [0, 2, 1, 3] +5 2 1 2 +After: [0, 2, 2, 3] + +Before: [1, 0, 0, 2] +1 0 2 3 +After: [1, 0, 0, 0] + +Before: [1, 1, 1, 2] +9 1 0 3 +After: [1, 1, 1, 1] + +Before: [2, 1, 3, 2] +4 1 3 2 +After: [2, 1, 0, 2] + +Before: [1, 0, 2, 2] +6 0 2 2 +After: [1, 0, 0, 2] + +Before: [3, 1, 1, 3] +11 2 1 1 +After: [3, 2, 1, 3] + +Before: [3, 1, 2, 3] +2 0 2 0 +After: [1, 1, 2, 3] + +Before: [1, 2, 0, 2] +1 0 2 0 +After: [0, 2, 0, 2] + +Before: [3, 1, 2, 1] +10 3 2 2 +After: [3, 1, 1, 1] + +Before: [1, 0, 2, 3] +7 2 3 0 +After: [0, 0, 2, 3] + +Before: [3, 1, 2, 3] +12 1 2 0 +After: [0, 1, 2, 3] + +Before: [2, 1, 1, 3] +7 2 3 1 +After: [2, 0, 1, 3] + +Before: [0, 2, 1, 2] +5 2 1 3 +After: [0, 2, 1, 2] + +Before: [3, 1, 1, 0] +11 2 1 0 +After: [2, 1, 1, 0] + +Before: [1, 1, 3, 1] +9 1 0 0 +After: [1, 1, 3, 1] + +Before: [1, 1, 2, 2] +9 1 0 1 +After: [1, 1, 2, 2] + +Before: [2, 1, 1, 3] +11 2 1 3 +After: [2, 1, 1, 2] + +Before: [1, 1, 1, 2] +4 1 3 1 +After: [1, 0, 1, 2] + +Before: [3, 1, 0, 1] +13 1 3 0 +After: [1, 1, 0, 1] + +Before: [1, 2, 2, 3] +6 0 2 0 +After: [0, 2, 2, 3] + +Before: [1, 3, 0, 3] +1 0 2 0 +After: [0, 3, 0, 3] + +Before: [2, 1, 1, 0] +2 0 1 2 +After: [2, 1, 1, 0] + +Before: [0, 1, 2, 1] +12 1 2 3 +After: [0, 1, 2, 0] + +Before: [2, 3, 1, 1] +3 0 3 3 +After: [2, 3, 1, 1] + +Before: [2, 1, 3, 3] +2 0 1 3 +After: [2, 1, 3, 1] + +Before: [1, 3, 2, 1] +10 3 2 3 +After: [1, 3, 2, 1] + +Before: [1, 1, 3, 3] +9 1 0 3 +After: [1, 1, 3, 1] + +Before: [1, 1, 3, 2] +9 1 0 1 +After: [1, 1, 3, 2] + +Before: [1, 1, 0, 1] +13 1 3 2 +After: [1, 1, 1, 1] + +Before: [3, 0, 2, 0] +2 0 2 1 +After: [3, 1, 2, 0] + +Before: [2, 0, 0, 0] +14 0 1 2 +After: [2, 0, 1, 0] + +Before: [0, 1, 2, 1] +13 1 3 3 +After: [0, 1, 2, 1] + +Before: [2, 1, 3, 0] +14 2 0 1 +After: [2, 1, 3, 0] + +Before: [2, 1, 0, 1] +13 1 3 0 +After: [1, 1, 0, 1] + +Before: [2, 1, 0, 1] +2 0 1 1 +After: [2, 1, 0, 1] + +Before: [0, 3, 2, 1] +10 3 2 0 +After: [1, 3, 2, 1] + +Before: [0, 1, 3, 1] +0 3 3 2 +After: [0, 1, 0, 1] + +Before: [0, 2, 1, 1] +5 2 1 1 +After: [0, 2, 1, 1] + +Before: [2, 1, 1, 2] +15 0 0 3 +After: [2, 1, 1, 1] + +Before: [1, 1, 2, 0] +6 0 2 2 +After: [1, 1, 0, 0] + +Before: [1, 1, 2, 1] +6 0 2 0 +After: [0, 1, 2, 1] + +Before: [0, 2, 1, 3] +7 1 3 1 +After: [0, 0, 1, 3] + +Before: [1, 0, 0, 0] +1 0 2 3 +After: [1, 0, 0, 0] + +Before: [2, 1, 2, 3] +2 0 1 2 +After: [2, 1, 1, 3] + +Before: [0, 2, 0, 2] +0 3 3 1 +After: [0, 0, 0, 2] + +Before: [0, 2, 3, 0] +15 2 2 2 +After: [0, 2, 1, 0] + +Before: [1, 2, 2, 2] +14 2 1 3 +After: [1, 2, 2, 1] + +Before: [0, 1, 3, 1] +8 0 0 2 +After: [0, 1, 0, 1] + +Before: [3, 3, 3, 2] +15 0 0 3 +After: [3, 3, 3, 1] + +Before: [3, 3, 0, 2] +14 0 2 1 +After: [3, 1, 0, 2] + +Before: [0, 1, 1, 3] +11 2 1 0 +After: [2, 1, 1, 3] + +Before: [1, 1, 0, 1] +9 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 1, 2, 1] +10 3 2 3 +After: [0, 1, 2, 1] + +Before: [2, 2, 2, 1] +10 3 2 1 +After: [2, 1, 2, 1] + +Before: [0, 1, 2, 2] +4 1 3 3 +After: [0, 1, 2, 0] + +Before: [1, 2, 2, 1] +10 3 2 2 +After: [1, 2, 1, 1] + +Before: [2, 1, 1, 2] +11 2 1 1 +After: [2, 2, 1, 2] + +Before: [1, 1, 2, 1] +12 1 2 3 +After: [1, 1, 2, 0] + +Before: [3, 3, 1, 1] +0 2 3 1 +After: [3, 0, 1, 1] + +Before: [0, 1, 2, 2] +4 1 3 1 +After: [0, 0, 2, 2] + +Before: [0, 3, 2, 2] +8 0 0 3 +After: [0, 3, 2, 0] + +Before: [2, 1, 2, 1] +2 0 1 0 +After: [1, 1, 2, 1] + +Before: [1, 1, 0, 3] +1 0 2 1 +After: [1, 0, 0, 3] + +Before: [3, 3, 3, 2] +15 0 0 0 +After: [1, 3, 3, 2] + +Before: [0, 1, 1, 2] +4 1 3 2 +After: [0, 1, 0, 2] + +Before: [1, 3, 0, 3] +1 0 2 1 +After: [1, 0, 0, 3] + +Before: [1, 1, 0, 1] +1 0 2 2 +After: [1, 1, 0, 1] + +Before: [2, 1, 0, 2] +4 1 3 0 +After: [0, 1, 0, 2] + +Before: [3, 2, 2, 2] +2 0 2 2 +After: [3, 2, 1, 2] + +Before: [0, 2, 2, 1] +10 3 2 1 +After: [0, 1, 2, 1] + +Before: [0, 1, 0, 2] +4 1 3 2 +After: [0, 1, 0, 2] + +Before: [0, 1, 0, 2] +4 1 3 3 +After: [0, 1, 0, 0] + +Before: [1, 1, 2, 1] +10 3 2 1 +After: [1, 1, 2, 1] + +Before: [1, 1, 0, 1] +13 1 3 0 +After: [1, 1, 0, 1] + +Before: [1, 3, 2, 2] +6 0 2 1 +After: [1, 0, 2, 2] + +Before: [0, 1, 2, 1] +13 1 3 0 +After: [1, 1, 2, 1] + +Before: [0, 1, 1, 3] +11 2 1 1 +After: [0, 2, 1, 3] + +Before: [3, 2, 1, 0] +5 2 1 3 +After: [3, 2, 1, 2] + +Before: [2, 1, 2, 3] +7 2 3 3 +After: [2, 1, 2, 0] + +Before: [1, 1, 1, 1] +11 2 1 2 +After: [1, 1, 2, 1] + +Before: [2, 1, 1, 1] +3 0 3 2 +After: [2, 1, 1, 1] + +Before: [0, 1, 1, 3] +8 0 0 1 +After: [0, 0, 1, 3] + +Before: [3, 2, 3, 3] +7 1 3 3 +After: [3, 2, 3, 0] + +Before: [0, 3, 0, 0] +8 0 0 2 +After: [0, 3, 0, 0] + +Before: [1, 1, 2, 1] +6 0 2 1 +After: [1, 0, 2, 1] + +Before: [0, 1, 1, 2] +4 1 3 0 +After: [0, 1, 1, 2] + +Before: [1, 1, 2, 1] +9 1 0 1 +After: [1, 1, 2, 1] + +Before: [3, 1, 2, 0] +12 1 2 0 +After: [0, 1, 2, 0] + +Before: [1, 3, 0, 3] +1 0 2 2 +After: [1, 3, 0, 3] + +Before: [1, 1, 0, 3] +9 1 0 1 +After: [1, 1, 0, 3] + +Before: [0, 2, 2, 2] +8 0 0 1 +After: [0, 0, 2, 2] + +Before: [0, 1, 1, 1] +13 1 3 1 +After: [0, 1, 1, 1] + +Before: [1, 1, 3, 1] +13 1 3 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 2, 1] +8 0 0 0 +After: [0, 1, 2, 1] + +Before: [2, 1, 2, 1] +12 1 2 2 +After: [2, 1, 0, 1] + +Before: [1, 0, 2, 3] +6 0 2 1 +After: [1, 0, 2, 3] + +Before: [3, 0, 3, 1] +15 2 0 2 +After: [3, 0, 1, 1] + +Before: [0, 1, 1, 1] +0 2 3 0 +After: [0, 1, 1, 1] + +Before: [3, 0, 0, 3] +14 0 2 1 +After: [3, 1, 0, 3] + +Before: [3, 1, 1, 1] +0 2 3 1 +After: [3, 0, 1, 1] + +Before: [0, 1, 2, 3] +7 2 3 3 +After: [0, 1, 2, 0] + +Before: [3, 1, 0, 1] +13 1 3 1 +After: [3, 1, 0, 1] + +Before: [0, 0, 3, 0] +8 0 0 1 +After: [0, 0, 3, 0] + +Before: [1, 1, 0, 2] +1 0 2 3 +After: [1, 1, 0, 0] + +Before: [2, 1, 1, 2] +4 1 3 1 +After: [2, 0, 1, 2] + +Before: [3, 2, 3, 0] +15 2 2 3 +After: [3, 2, 3, 1] + +Before: [0, 2, 0, 3] +7 1 3 0 +After: [0, 2, 0, 3] + +Before: [1, 1, 3, 2] +9 1 0 2 +After: [1, 1, 1, 2] + +Before: [0, 3, 1, 3] +8 0 0 1 +After: [0, 0, 1, 3] + +Before: [3, 1, 2, 1] +2 0 2 0 +After: [1, 1, 2, 1] + +Before: [1, 1, 3, 1] +9 1 0 2 +After: [1, 1, 1, 1] + +Before: [2, 1, 3, 0] +2 0 1 3 +After: [2, 1, 3, 1] + +Before: [2, 1, 1, 0] +11 2 1 1 +After: [2, 2, 1, 0] + +Before: [3, 1, 1, 1] +13 1 3 0 +After: [1, 1, 1, 1] + +Before: [2, 2, 1, 3] +5 2 1 1 +After: [2, 2, 1, 3] + +Before: [0, 0, 2, 1] +10 3 2 3 +After: [0, 0, 2, 1] + +Before: [3, 3, 0, 2] +0 3 3 1 +After: [3, 0, 0, 2] + +Before: [0, 2, 1, 0] +8 0 0 0 +After: [0, 2, 1, 0] + +Before: [3, 3, 0, 2] +15 0 0 3 +After: [3, 3, 0, 1] + +Before: [1, 0, 2, 3] +6 0 2 0 +After: [0, 0, 2, 3] + +Before: [0, 0, 1, 1] +8 0 0 1 +After: [0, 0, 1, 1] + +Before: [1, 0, 2, 1] +10 3 2 0 +After: [1, 0, 2, 1] + +Before: [1, 2, 1, 2] +5 2 1 1 +After: [1, 2, 1, 2] + +Before: [2, 1, 3, 1] +14 2 0 1 +After: [2, 1, 3, 1] + +Before: [2, 1, 2, 0] +2 0 1 0 +After: [1, 1, 2, 0] + +Before: [1, 1, 2, 2] +6 0 2 3 +After: [1, 1, 2, 0] + +Before: [2, 1, 1, 3] +2 0 1 2 +After: [2, 1, 1, 3] + +Before: [2, 3, 3, 2] +14 2 0 2 +After: [2, 3, 1, 2] + +Before: [1, 0, 0, 2] +1 0 2 0 +After: [0, 0, 0, 2] + +Before: [3, 3, 2, 2] +15 0 0 0 +After: [1, 3, 2, 2] + +Before: [0, 1, 1, 2] +4 1 3 3 +After: [0, 1, 1, 0] + +Before: [2, 2, 1, 2] +5 2 1 3 +After: [2, 2, 1, 2] + +Before: [2, 1, 2, 0] +12 1 2 0 +After: [0, 1, 2, 0] + +Before: [3, 1, 0, 1] +13 1 3 2 +After: [3, 1, 1, 1] + +Before: [1, 2, 1, 1] +5 2 1 1 +After: [1, 2, 1, 1] + +Before: [2, 1, 2, 2] +4 1 3 2 +After: [2, 1, 0, 2] + +Before: [0, 1, 0, 2] +4 1 3 0 +After: [0, 1, 0, 2] + +Before: [3, 1, 0, 2] +4 1 3 2 +After: [3, 1, 0, 2] + +Before: [1, 1, 3, 2] +4 1 3 1 +After: [1, 0, 3, 2] + +Before: [3, 1, 1, 1] +13 1 3 2 +After: [3, 1, 1, 1] + +Before: [0, 0, 2, 0] +8 0 0 3 +After: [0, 0, 2, 0] + +Before: [1, 1, 3, 2] +9 1 0 0 +After: [1, 1, 3, 2] + +Before: [3, 2, 1, 0] +5 2 1 1 +After: [3, 2, 1, 0] + +Before: [1, 1, 0, 2] +1 0 2 0 +After: [0, 1, 0, 2] + +Before: [2, 1, 0, 1] +13 1 3 3 +After: [2, 1, 0, 1] + +Before: [3, 1, 2, 0] +12 1 2 2 +After: [3, 1, 0, 0] + +Before: [3, 2, 2, 3] +2 0 2 0 +After: [1, 2, 2, 3] + +Before: [1, 1, 1, 0] +11 2 1 1 +After: [1, 2, 1, 0] + +Before: [0, 0, 1, 2] +8 0 0 3 +After: [0, 0, 1, 0] + +Before: [1, 1, 0, 0] +9 1 0 3 +After: [1, 1, 0, 1] + +Before: [1, 1, 3, 0] +9 1 0 3 +After: [1, 1, 3, 1] + +Before: [1, 1, 1, 1] +11 2 1 1 +After: [1, 2, 1, 1] + +Before: [3, 0, 0, 0] +14 0 2 3 +After: [3, 0, 0, 1] + +Before: [2, 1, 1, 3] +7 1 3 3 +After: [2, 1, 1, 0] + +Before: [0, 3, 3, 2] +8 0 0 2 +After: [0, 3, 0, 2] + +Before: [3, 1, 2, 1] +12 1 2 1 +After: [3, 0, 2, 1] + +Before: [3, 0, 2, 3] +7 2 3 0 +After: [0, 0, 2, 3] + +Before: [3, 1, 1, 1] +14 3 1 1 +After: [3, 0, 1, 1] + +Before: [1, 1, 1, 3] +9 1 0 0 +After: [1, 1, 1, 3] + +Before: [0, 0, 3, 3] +8 0 0 2 +After: [0, 0, 0, 3] + +Before: [3, 1, 3, 3] +7 1 3 1 +After: [3, 0, 3, 3] + +Before: [1, 1, 2, 2] +12 1 2 1 +After: [1, 0, 2, 2] + +Before: [1, 1, 0, 1] +1 0 2 3 +After: [1, 1, 0, 0] + +Before: [2, 2, 2, 1] +3 0 3 2 +After: [2, 2, 1, 1] + +Before: [2, 0, 3, 0] +14 0 1 1 +After: [2, 1, 3, 0] + +Before: [1, 1, 2, 2] +4 1 3 3 +After: [1, 1, 2, 0] + +Before: [1, 1, 2, 3] +12 1 2 2 +After: [1, 1, 0, 3] + +Before: [1, 2, 1, 3] +7 2 3 2 +After: [1, 2, 0, 3] + +Before: [3, 0, 0, 1] +14 0 2 2 +After: [3, 0, 1, 1] + +Before: [3, 2, 1, 0] +5 2 1 0 +After: [2, 2, 1, 0] + +Before: [2, 3, 2, 1] +3 0 3 0 +After: [1, 3, 2, 1] + +Before: [0, 1, 3, 2] +8 0 0 3 +After: [0, 1, 3, 0] + +Before: [2, 2, 1, 1] +3 0 3 3 +After: [2, 2, 1, 1] + +Before: [3, 2, 3, 1] +0 3 3 3 +After: [3, 2, 3, 0] + +Before: [2, 1, 1, 0] +14 2 1 3 +After: [2, 1, 1, 0] + +Before: [2, 2, 1, 3] +7 2 3 1 +After: [2, 0, 1, 3] + +Before: [2, 3, 3, 1] +3 0 3 2 +After: [2, 3, 1, 1] + +Before: [1, 1, 2, 1] +9 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 3, 2, 1] +10 3 2 1 +After: [0, 1, 2, 1] + +Before: [0, 1, 0, 1] +13 1 3 3 +After: [0, 1, 0, 1] + +Before: [1, 1, 1, 3] +11 2 1 3 +After: [1, 1, 1, 2] + +Before: [3, 1, 1, 2] +11 2 1 2 +After: [3, 1, 2, 2] + +Before: [1, 3, 2, 3] +6 0 2 3 +After: [1, 3, 2, 0] + +Before: [0, 1, 2, 3] +8 0 0 2 +After: [0, 1, 0, 3] + +Before: [3, 0, 1, 3] +14 3 0 2 +After: [3, 0, 1, 3] + +Before: [2, 1, 2, 0] +12 1 2 3 +After: [2, 1, 2, 0] + +Before: [0, 1, 1, 1] +11 2 1 0 +After: [2, 1, 1, 1] + +Before: [2, 3, 2, 1] +0 3 3 2 +After: [2, 3, 0, 1] + +Before: [1, 1, 0, 2] +0 3 3 3 +After: [1, 1, 0, 0] + +Before: [1, 0, 0, 1] +1 0 2 3 +After: [1, 0, 0, 0] + +Before: [3, 2, 1, 3] +7 2 3 3 +After: [3, 2, 1, 0] + +Before: [3, 1, 1, 3] +11 2 1 2 +After: [3, 1, 2, 3] + +Before: [0, 1, 2, 2] +12 1 2 3 +After: [0, 1, 2, 0] + +Before: [3, 3, 2, 1] +10 3 2 0 +After: [1, 3, 2, 1] + +Before: [1, 1, 3, 1] +13 1 3 1 +After: [1, 1, 3, 1] + +Before: [2, 2, 1, 1] +3 0 3 1 +After: [2, 1, 1, 1] + +Before: [2, 1, 2, 2] +4 1 3 0 +After: [0, 1, 2, 2] + +Before: [1, 1, 1, 1] +9 1 0 2 +After: [1, 1, 1, 1] + +Before: [1, 3, 2, 1] +10 3 2 0 +After: [1, 3, 2, 1] + +Before: [2, 0, 2, 1] +10 3 2 0 +After: [1, 0, 2, 1] + +Before: [1, 1, 0, 3] +1 0 2 2 +After: [1, 1, 0, 3] + +Before: [1, 2, 0, 1] +1 0 2 3 +After: [1, 2, 0, 0] + +Before: [1, 3, 0, 0] +1 0 2 0 +After: [0, 3, 0, 0] + +Before: [2, 1, 1, 3] +14 2 1 0 +After: [0, 1, 1, 3] + +Before: [1, 1, 1, 2] +9 1 0 1 +After: [1, 1, 1, 2] + +Before: [1, 1, 0, 1] +13 1 3 1 +After: [1, 1, 0, 1] + +Before: [2, 0, 0, 2] +15 0 0 0 +After: [1, 0, 0, 2] + +Before: [2, 3, 1, 1] +3 0 3 0 +After: [1, 3, 1, 1] + +Before: [0, 1, 2, 0] +12 1 2 3 +After: [0, 1, 2, 0] + +Before: [1, 2, 1, 2] +5 2 1 0 +After: [2, 2, 1, 2] + +Before: [2, 0, 2, 2] +14 3 2 2 +After: [2, 0, 0, 2] + +Before: [0, 2, 2, 1] +10 3 2 0 +After: [1, 2, 2, 1] + +Before: [2, 1, 0, 2] +4 1 3 3 +After: [2, 1, 0, 0] + +Before: [1, 3, 0, 2] +1 0 2 2 +After: [1, 3, 0, 2] + +Before: [0, 0, 2, 3] +8 0 0 1 +After: [0, 0, 2, 3] + +Before: [2, 1, 1, 3] +7 1 3 0 +After: [0, 1, 1, 3] + +Before: [3, 1, 2, 1] +13 1 3 0 +After: [1, 1, 2, 1] + +Before: [2, 0, 1, 1] +3 0 3 1 +After: [2, 1, 1, 1] + +Before: [1, 1, 2, 1] +13 1 3 1 +After: [1, 1, 2, 1] + +Before: [0, 1, 2, 1] +12 1 2 1 +After: [0, 0, 2, 1] + +Before: [2, 2, 3, 3] +14 3 2 2 +After: [2, 2, 1, 3] + +Before: [3, 1, 1, 1] +13 1 3 3 +After: [3, 1, 1, 1] + +Before: [3, 3, 3, 2] +15 2 0 1 +After: [3, 1, 3, 2] + +Before: [2, 1, 2, 1] +3 0 3 1 +After: [2, 1, 2, 1] + +Before: [3, 1, 2, 0] +2 0 2 3 +After: [3, 1, 2, 1] + +Before: [1, 2, 1, 2] +5 2 1 3 +After: [1, 2, 1, 2] + +Before: [3, 2, 1, 1] +5 2 1 0 +After: [2, 2, 1, 1] + +Before: [0, 1, 2, 1] +12 1 2 0 +After: [0, 1, 2, 1] + +Before: [2, 1, 1, 1] +3 0 3 0 +After: [1, 1, 1, 1] + +Before: [3, 1, 1, 2] +11 2 1 1 +After: [3, 2, 1, 2] + +Before: [1, 1, 1, 3] +11 2 1 0 +After: [2, 1, 1, 3] + +Before: [1, 1, 2, 0] +9 1 0 3 +After: [1, 1, 2, 1] + +Before: [0, 2, 2, 3] +8 0 0 3 +After: [0, 2, 2, 0] + +Before: [0, 0, 2, 1] +10 3 2 1 +After: [0, 1, 2, 1] + +Before: [0, 2, 3, 3] +14 3 2 0 +After: [1, 2, 3, 3] + +Before: [2, 1, 0, 3] +2 0 1 2 +After: [2, 1, 1, 3] + +Before: [3, 1, 2, 0] +2 0 2 0 +After: [1, 1, 2, 0] + +Before: [3, 1, 0, 2] +14 0 2 0 +After: [1, 1, 0, 2] + +Before: [2, 1, 3, 0] +2 0 1 1 +After: [2, 1, 3, 0] + +Before: [1, 1, 1, 0] +9 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 0, 0, 0] +1 0 2 1 +After: [1, 0, 0, 0] + +Before: [0, 3, 2, 2] +8 0 0 2 +After: [0, 3, 0, 2] + +Before: [3, 3, 2, 2] +2 0 2 0 +After: [1, 3, 2, 2] + +Before: [0, 2, 1, 2] +5 2 1 1 +After: [0, 2, 1, 2] + +Before: [3, 3, 2, 2] +2 0 2 3 +After: [3, 3, 2, 1] + +Before: [0, 2, 1, 2] +5 2 1 0 +After: [2, 2, 1, 2] + +Before: [1, 0, 2, 1] +10 3 2 2 +After: [1, 0, 1, 1] + +Before: [0, 1, 0, 1] +13 1 3 2 +After: [0, 1, 1, 1] + +Before: [3, 1, 1, 1] +14 2 1 1 +After: [3, 0, 1, 1] + +Before: [0, 1, 0, 1] +13 1 3 1 +After: [0, 1, 0, 1] + +Before: [2, 2, 0, 1] +3 0 3 2 +After: [2, 2, 1, 1] + +Before: [3, 2, 1, 3] +14 3 0 0 +After: [1, 2, 1, 3] + +Before: [1, 1, 2, 2] +4 1 3 0 +After: [0, 1, 2, 2] + +Before: [3, 1, 2, 3] +7 1 3 1 +After: [3, 0, 2, 3] + +Before: [3, 0, 3, 0] +15 2 2 1 +After: [3, 1, 3, 0] + +Before: [0, 2, 2, 2] +14 2 1 3 +After: [0, 2, 2, 1] + +Before: [1, 1, 2, 3] +12 1 2 1 +After: [1, 0, 2, 3] + +Before: [3, 1, 1, 1] +13 1 3 1 +After: [3, 1, 1, 1] + +Before: [2, 1, 1, 1] +13 1 3 3 +After: [2, 1, 1, 1] + +Before: [2, 2, 2, 3] +7 2 3 3 +After: [2, 2, 2, 0] + +Before: [2, 3, 3, 3] +15 0 0 2 +After: [2, 3, 1, 3] + +Before: [3, 1, 2, 1] +13 1 3 3 +After: [3, 1, 2, 1] + +Before: [3, 3, 3, 2] +15 0 2 0 +After: [1, 3, 3, 2] + +Before: [3, 1, 0, 2] +0 3 3 0 +After: [0, 1, 0, 2] + +Before: [2, 0, 3, 2] +14 0 1 1 +After: [2, 1, 3, 2] + +Before: [1, 0, 2, 1] +10 3 2 3 +After: [1, 0, 2, 1] + +Before: [1, 3, 3, 1] +0 3 3 2 +After: [1, 3, 0, 1] + +Before: [0, 2, 2, 1] +10 3 2 2 +After: [0, 2, 1, 1] + +Before: [2, 2, 1, 0] +5 2 1 0 +After: [2, 2, 1, 0] + +Before: [2, 3, 0, 1] +3 0 3 2 +After: [2, 3, 1, 1] + +Before: [1, 2, 2, 2] +6 0 2 1 +After: [1, 0, 2, 2] + +Before: [0, 1, 2, 2] +12 1 2 0 +After: [0, 1, 2, 2] + +Before: [1, 1, 0, 2] +9 1 0 2 +After: [1, 1, 1, 2] + +Before: [0, 1, 2, 2] +12 1 2 2 +After: [0, 1, 0, 2] + +Before: [2, 1, 2, 0] +12 1 2 2 +After: [2, 1, 0, 0] + +Before: [2, 3, 3, 0] +15 0 0 3 +After: [2, 3, 3, 1] + +Before: [2, 2, 0, 1] +15 0 0 0 +After: [1, 2, 0, 1] + +Before: [2, 0, 3, 2] +0 3 3 2 +After: [2, 0, 0, 2] + +Before: [3, 0, 3, 2] +15 2 2 3 +After: [3, 0, 3, 1] + +Before: [2, 3, 2, 1] +10 3 2 3 +After: [2, 3, 2, 1] + +Before: [2, 1, 2, 1] +3 0 3 3 +After: [2, 1, 2, 1] + +Before: [1, 3, 0, 0] +1 0 2 3 +After: [1, 3, 0, 0] + +Before: [3, 1, 2, 3] +2 0 2 3 +After: [3, 1, 2, 1] + +Before: [2, 1, 1, 2] +11 2 1 2 +After: [2, 1, 2, 2] + +Before: [1, 3, 2, 3] +7 2 3 1 +After: [1, 0, 2, 3] + +Before: [0, 0, 0, 0] +8 0 0 3 +After: [0, 0, 0, 0] + +Before: [1, 0, 3, 1] +14 2 3 2 +After: [1, 0, 0, 1] + +Before: [3, 2, 0, 3] +14 0 2 3 +After: [3, 2, 0, 1] + +Before: [3, 2, 2, 1] +2 0 2 1 +After: [3, 1, 2, 1] + +Before: [2, 1, 2, 1] +3 0 3 0 +After: [1, 1, 2, 1] + +Before: [2, 2, 0, 1] +3 0 3 3 +After: [2, 2, 0, 1] + +Before: [0, 3, 3, 2] +8 0 0 0 +After: [0, 3, 3, 2] + +Before: [3, 2, 0, 1] +14 0 2 1 +After: [3, 1, 0, 1] + +Before: [1, 1, 1, 3] +9 1 0 1 +After: [1, 1, 1, 3] + +Before: [0, 1, 0, 1] +13 1 3 0 +After: [1, 1, 0, 1] + +Before: [1, 1, 1, 0] +9 1 0 1 +After: [1, 1, 1, 0] + +Before: [1, 3, 2, 2] +6 0 2 0 +After: [0, 3, 2, 2] + +Before: [2, 1, 1, 1] +14 3 1 0 +After: [0, 1, 1, 1] + +Before: [1, 1, 3, 0] +9 1 0 0 +After: [1, 1, 3, 0] + +Before: [2, 1, 3, 1] +3 0 3 2 +After: [2, 1, 1, 1] + +Before: [2, 1, 1, 1] +3 0 3 1 +After: [2, 1, 1, 1] + +Before: [3, 2, 1, 3] +7 1 3 3 +After: [3, 2, 1, 0] + +Before: [2, 0, 3, 3] +15 0 0 2 +After: [2, 0, 1, 3] + +Before: [3, 0, 2, 1] +10 3 2 2 +After: [3, 0, 1, 1] + +Before: [1, 1, 2, 3] +9 1 0 0 +After: [1, 1, 2, 3] + +Before: [1, 2, 1, 1] +5 2 1 0 +After: [2, 2, 1, 1] + +Before: [0, 1, 2, 3] +12 1 2 1 +After: [0, 0, 2, 3] + +Before: [1, 3, 0, 1] +1 0 2 3 +After: [1, 3, 0, 0] + +Before: [2, 1, 0, 1] +2 0 1 0 +After: [1, 1, 0, 1] + +Before: [3, 2, 2, 3] +2 0 2 1 +After: [3, 1, 2, 3] + +Before: [1, 2, 0, 1] +1 0 2 1 +After: [1, 0, 0, 1] + +Before: [1, 2, 2, 0] +6 0 2 0 +After: [0, 2, 2, 0] + +Before: [2, 1, 1, 2] +11 2 1 0 +After: [2, 1, 1, 2] + +Before: [3, 1, 1, 3] +7 1 3 2 +After: [3, 1, 0, 3] + +Before: [2, 2, 1, 3] +5 2 1 2 +After: [2, 2, 2, 3] + +Before: [3, 1, 1, 1] +11 2 1 1 +After: [3, 2, 1, 1] + +Before: [2, 1, 2, 2] +4 1 3 1 +After: [2, 0, 2, 2] + +Before: [1, 1, 2, 1] +12 1 2 0 +After: [0, 1, 2, 1] + +Before: [1, 1, 0, 2] +9 1 0 3 +After: [1, 1, 0, 1] + +Before: [3, 3, 2, 3] +2 0 2 0 +After: [1, 3, 2, 3] + +Before: [1, 1, 2, 3] +9 1 0 3 +After: [1, 1, 2, 1] + +Before: [2, 1, 2, 1] +12 1 2 0 +After: [0, 1, 2, 1] + +Before: [1, 1, 0, 2] +4 1 3 1 +After: [1, 0, 0, 2] + +Before: [1, 2, 2, 0] +6 0 2 3 +After: [1, 2, 2, 0] + +Before: [2, 1, 1, 0] +11 2 1 3 +After: [2, 1, 1, 2] + +Before: [1, 1, 0, 1] +13 1 3 3 +After: [1, 1, 0, 1] + +Before: [3, 1, 2, 3] +7 1 3 3 +After: [3, 1, 2, 0] + +Before: [0, 2, 1, 3] +8 0 0 0 +After: [0, 2, 1, 3] + +Before: [3, 2, 1, 3] +7 1 3 0 +After: [0, 2, 1, 3] + +Before: [1, 2, 2, 2] +6 0 2 3 +After: [1, 2, 2, 0] + +Before: [1, 1, 1, 1] +13 1 3 3 +After: [1, 1, 1, 1] + +Before: [2, 1, 3, 2] +15 2 2 1 +After: [2, 1, 3, 2] + +Before: [2, 1, 0, 3] +2 0 1 0 +After: [1, 1, 0, 3] + +Before: [1, 1, 2, 1] +12 1 2 2 +After: [1, 1, 0, 1] + +Before: [1, 1, 3, 2] +4 1 3 0 +After: [0, 1, 3, 2] + +Before: [2, 3, 2, 3] +7 2 3 2 +After: [2, 3, 0, 3] + +Before: [2, 2, 1, 1] +5 2 1 3 +After: [2, 2, 1, 2] + +Before: [0, 0, 2, 1] +10 3 2 0 +After: [1, 0, 2, 1] + +Before: [3, 1, 0, 3] +7 1 3 2 +After: [3, 1, 0, 3] + +Before: [2, 1, 3, 2] +2 0 1 1 +After: [2, 1, 3, 2] + +Before: [2, 3, 1, 1] +3 0 3 1 +After: [2, 1, 1, 1] + +Before: [2, 2, 1, 3] +7 1 3 3 +After: [2, 2, 1, 0] + +Before: [3, 3, 3, 1] +15 0 2 1 +After: [3, 1, 3, 1] + +Before: [0, 1, 1, 0] +11 2 1 1 +After: [0, 2, 1, 0] + +Before: [1, 1, 1, 0] +11 2 1 0 +After: [2, 1, 1, 0] + +Before: [3, 1, 3, 1] +13 1 3 3 +After: [3, 1, 3, 1] + +Before: [0, 1, 3, 2] +8 0 0 1 +After: [0, 0, 3, 2] + +Before: [2, 2, 0, 3] +7 1 3 3 +After: [2, 2, 0, 0] + +Before: [1, 0, 2, 1] +6 0 2 2 +After: [1, 0, 0, 1] + +Before: [1, 3, 0, 2] +0 3 3 3 +After: [1, 3, 0, 0] + +Before: [1, 1, 0, 1] +9 1 0 3 +After: [1, 1, 0, 1] + +Before: [1, 2, 2, 3] +7 1 3 1 +After: [1, 0, 2, 3] + +Before: [1, 1, 2, 2] +12 1 2 3 +After: [1, 1, 2, 0] + +Before: [1, 1, 2, 0] +12 1 2 3 +After: [1, 1, 2, 0] + +Before: [0, 1, 0, 2] +4 1 3 1 +After: [0, 0, 0, 2] + +Before: [1, 1, 1, 0] +9 1 0 0 +After: [1, 1, 1, 0] + +Before: [1, 1, 2, 0] +9 1 0 0 +After: [1, 1, 2, 0] + +Before: [1, 2, 1, 1] +5 2 1 3 +After: [1, 2, 1, 2] + +Before: [3, 0, 3, 2] +15 2 2 0 +After: [1, 0, 3, 2] + +Before: [2, 2, 1, 3] +7 2 3 3 +After: [2, 2, 1, 0] + +Before: [3, 1, 2, 2] +4 1 3 3 +After: [3, 1, 2, 0] + +Before: [3, 1, 2, 1] +15 0 0 1 +After: [3, 1, 2, 1] + +Before: [2, 3, 2, 1] +10 3 2 0 +After: [1, 3, 2, 1] + +Before: [2, 1, 2, 2] +0 3 3 1 +After: [2, 0, 2, 2] + +Before: [1, 2, 0, 2] +1 0 2 1 +After: [1, 0, 0, 2] + +Before: [3, 3, 2, 0] +2 0 2 0 +After: [1, 3, 2, 0] + +Before: [0, 1, 1, 2] +11 2 1 1 +After: [0, 2, 1, 2] + +Before: [3, 1, 2, 1] +13 1 3 1 +After: [3, 1, 2, 1] + +Before: [3, 1, 3, 3] +15 2 0 3 +After: [3, 1, 3, 1] + +Before: [0, 1, 0, 1] +8 0 0 3 +After: [0, 1, 0, 0] + +Before: [2, 3, 2, 1] +0 3 3 3 +After: [2, 3, 2, 0] + +Before: [2, 1, 1, 2] +4 1 3 2 +After: [2, 1, 0, 2] + +Before: [0, 1, 3, 1] +13 1 3 0 +After: [1, 1, 3, 1] + +Before: [2, 2, 1, 1] +5 2 1 0 +After: [2, 2, 1, 1] + +Before: [3, 1, 2, 0] +15 0 0 0 +After: [1, 1, 2, 0] + +Before: [1, 1, 1, 1] +9 1 0 0 +After: [1, 1, 1, 1] + +Before: [1, 1, 2, 2] +12 1 2 2 +After: [1, 1, 0, 2] + +Before: [1, 1, 2, 1] +10 3 2 0 +After: [1, 1, 2, 1] + +Before: [2, 0, 1, 1] +3 0 3 3 +After: [2, 0, 1, 1] diff --git a/inputs/16_2.txt b/inputs/16_2.txt new file mode 100644 index 0000000..6f6f812 --- /dev/null +++ b/inputs/16_2.txt @@ -0,0 +1,1014 @@ +8 0 0 2 +5 2 2 2 +6 3 1 1 +8 0 0 3 +5 3 0 3 +9 2 3 1 +8 1 3 1 +8 1 2 1 +11 0 1 0 +10 0 0 1 +8 0 0 2 +5 2 3 2 +6 3 0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 +6 1 2 2 +6 2 1 3 +1 0 3 2 +8 2 2 2 +11 2 1 1 +6 3 3 2 +6 2 3 0 +15 0 3 2 +8 2 2 2 +11 2 1 1 +10 1 2 0 +6 2 1 1 +6 3 3 2 +9 1 3 3 +8 3 3 3 +11 0 3 0 +10 0 2 1 +6 0 0 2 +6 2 0 0 +6 1 1 3 +1 3 0 2 +8 2 1 2 +8 2 1 2 +11 2 1 1 +10 1 0 0 +6 2 2 1 +6 0 0 3 +6 3 2 2 +13 1 2 2 +8 2 3 2 +11 0 2 0 +10 0 0 2 +6 2 2 3 +8 2 0 0 +5 0 0 0 +6 3 1 1 +6 3 0 0 +8 0 3 0 +11 0 2 2 +10 2 0 1 +6 0 1 2 +6 3 2 0 +6 0 1 3 +12 0 2 3 +8 3 1 3 +8 3 2 3 +11 3 1 1 +10 1 3 2 +6 2 2 1 +6 2 3 0 +6 3 2 3 +4 3 1 1 +8 1 2 1 +11 2 1 2 +10 2 0 0 +8 3 0 3 +5 3 1 3 +6 1 1 1 +6 3 3 2 +8 3 2 3 +8 3 2 3 +11 0 3 0 +6 2 3 2 +6 2 0 1 +6 2 0 3 +9 1 3 3 +8 3 1 3 +11 0 3 0 +10 0 1 2 +6 1 3 3 +6 2 2 0 +11 3 3 3 +8 3 2 3 +11 2 3 2 +6 2 0 3 +6 3 1 1 +15 0 3 0 +8 0 2 0 +8 0 2 0 +11 2 0 2 +10 2 2 3 +8 2 0 0 +5 0 1 0 +8 3 0 1 +5 1 1 1 +6 0 0 2 +8 1 2 2 +8 2 2 2 +8 2 1 2 +11 3 2 3 +10 3 2 0 diff --git a/src/bin/day_16.rs b/src/bin/day_16.rs index c210c22..275ec45 100644 --- a/src/bin/day_16.rs +++ b/src/bin/day_16.rs @@ -4,15 +4,202 @@ use advent_of_code_2018::*; use std::error::Error; use std::path::PathBuf; +use std::collections::{HashMap, HashSet}; + // cargo watch -cs "cargo run --release --bin day_16" +struct Instruction { + op: Op, + a: i32, + b: i32, + c: i32 +} + +impl Instruction { + fn execute(&self, registers: &[i32; 4]) -> [i32; 4] { + use Op::*; + + let mut result_registers = registers.clone(); + + result_registers[self.c as usize] = match self.op { + Addr => registers[self.a as usize] + registers[self.b as usize], + Addi => registers[self.a as usize] + self.b, + Mulr => registers[self.a as usize] * registers[self.b as usize], + Muli => registers[self.a as usize] * self.b, + Banr => registers[self.a as usize] & registers[self.b as usize], + Bani => registers[self.a as usize] & self.b, + Borr => registers[self.a as usize] | registers[self.b as usize], + Bori => registers[self.a as usize] | self.b, + Setr => registers[self.a as usize], + Seti => self.a, + Gtir => if self.a > registers[self.b as usize] { 1 } else { 0 }, + Gtri => if registers[self.a as usize] > self.b { 1 } else { 0 }, + Gtrr => if registers[self.a as usize] > registers[self.b as usize] { 1 } else { 0 }, + Eqir => if self.a == registers[self.b as usize] { 1 } else { 0 }, + Eqri => if registers[self.a as usize] == self.b { 1 } else { 0 }, + Eqrr => if registers[self.a as usize] == registers[self.b as usize] { 1 } else { 0 } + }; + + result_registers + } +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +enum Op { + Addr, + Addi, + Mulr, + Muli, + Banr, + Bani, + Borr, + Bori, + Setr, + Seti, + Gtir, + Gtri, + Gtrr, + Eqir, + Eqri, + Eqrr +} + +impl Op { + fn all() -> [Op; 16] { + use Op::*; + [ + Addr, + Addi, + Mulr, + Muli, + Banr, + Bani, + Borr, + Bori, + Setr, + Seti, + Gtir, + Gtri, + Gtrr, + Eqir, + Eqri, + Eqrr + ] + } +} + +struct UnknownInstruction { + before: [i32; 4], + after: [i32; 4], + opcode: i32, + a: i32, + b: i32, + c: i32 +} + +impl UnknownInstruction { + fn possible_matches(&self) -> HashSet { + Op::all() + .iter() + .filter(|&&op| { + let instruction = Instruction { + op: op, + a: self.a, + b: self.b, + c: self.c + }; + let result = instruction.execute(&self.before); + result == self.after + }) + .cloned() + .collect() + } +} + fn main() -> Result<(), Box> { - let input = read_file(&PathBuf::from("inputs/16.txt"))?; + let input_part_1 = read_file(&PathBuf::from("inputs/16_1.txt"))?; + + let unknown_instructions: Vec = input_part_1.chunks(3) + .map(|chunk| { + let mut before_iter = chunk[0].trim_matches(|c: char| !c.is_numeric()).split(", ").map(|c| c.parse::().unwrap()); + let before = [ + before_iter.next().unwrap(), + before_iter.next().unwrap(), + before_iter.next().unwrap(), + before_iter.next().unwrap(), + ]; + let mut after_iter = chunk[2].trim_matches(|c: char| !c.is_numeric()).split(", ").map(|c| c.parse::().unwrap()); + let after = [ + after_iter.next().unwrap(), + after_iter.next().unwrap(), + after_iter.next().unwrap(), + after_iter.next().unwrap(), + ]; + let mut instruction_iter = chunk[1].split_whitespace().map(|c| c.parse::().unwrap()); + UnknownInstruction { + before, after, + opcode: instruction_iter.next().unwrap(), + a: instruction_iter.next().unwrap(), + b: instruction_iter.next().unwrap(), + c: instruction_iter.next().unwrap(), + } + }) + .collect(); + + let matches_more_then_3 = unknown_instructions.iter() + .filter(|unknown| { + unknown.possible_matches().len() >= 3 + }) + .count(); + + debug!(matches_more_then_3); + - println!("Input: {:?}", input); + let mut opcodes: HashMap> = HashMap::new(); + for unknown in unknown_instructions { + let matches = unknown.possible_matches(); + let to_insert = match opcodes.get(&unknown.opcode) { + None => matches, + Some(existing) => existing.intersection(&matches).cloned().collect() + }; + opcodes.insert(unknown.opcode, to_insert); + } + debug!(opcodes); + let mut known_opcodes: HashMap = HashMap::new(); + + while known_opcodes.len() < 16 { + let (opcode, op) = { + let (opcode, opset) = opcodes.iter().find(|(_,set)| set.len() == 1).unwrap(); + let op = opset.iter().next().unwrap().clone(); + (opcode.clone(), op) + }; + known_opcodes.insert(opcode, op); + opcodes.iter_mut().for_each(|(_, set)| { + set.remove(&op); + }); + } + debug!(known_opcodes); + let input_part_2 = read_file(&PathBuf::from("inputs/16_2.txt"))?; + let instructions: Vec = input_part_2.iter() + .map(|line| { + let mut instruction_iter = line.split_whitespace().map(|c| c.parse::().unwrap()); + Instruction { + op: known_opcodes.get(&instruction_iter.next().unwrap()).unwrap().clone(), + a: instruction_iter.next().unwrap(), + b: instruction_iter.next().unwrap(), + c: instruction_iter.next().unwrap(), + } + }) + .collect(); + let mut registers = [0; 4]; + for instruction in instructions { + registers = instruction.execute(®isters); + } + debug!(registers); + Ok(()) } -- cgit v1.2.3