-
Notifications
You must be signed in to change notification settings - Fork 0
/
day6.u
125 lines (107 loc) · 19 KB
/
day6.u
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
type day6.RT a = Leaf | Node a [day6.RT a]
namespace day6 where
foldlRT : (b -> a -> b) -> b -> day6.RT a -> b
foldlRT f b as =
go : b -> day6.RT a -> b
go b t = case t of
day6.RT.Leaf -> b
day6.RT.Node a l -> List.foldl go (f b a) l
go b as
map : (a -> b) -> day6.RT a -> day6.RT b
map f as =
go t = case t of
day6.RT.Leaf -> day6.RT.Leaf
day6.RT.Node a l -> List.map go l |> day6.RT.Node (f a)
go as
depths : day6.RT a -> day6.RT Nat
depths as =
go d t = case t of
day6.RT.Leaf -> day6.RT.Leaf
day6.RT.Node a l -> List.map (go (d + 1)) l |> day6.RT.Node d
go 0 as
buildGraph : [(Text, Text)] -> Map Text [Text]
buildGraph l =
go l acc =
case l of
(child, parent) +: t ->
acc1 = if Map.contains child acc then acc else Map.insert child [] acc
acc2 = if Map.contains parent acc1 then acc1 else Map.insert parent [] acc1
case Map.lookup child acc2 of
Some p -> go t (Map.insert child (parent +: p) acc2)
_ -> acc2
_ -> acc
go l Map.empty
split : Char -> Text -> [Text]
split c t =
go cs accs =
case cs of
h +: t ->
if h == c then go t ([] +: accs)
else
case accs of
ha +: ta -> go t ((h +: ha) +: ta)
_ -> go t [[h]]
_ -> accs
go (Text.toCharList t) [] |> List.map (l -> List.reverse l |> Text.fromCharList)
flatten : [Optional a] -> [a]
flatten as =
go as acc = case as of
h +: t -> case h of
Some a -> go t (a +: acc)
_ -> go t acc
_ -> acc
go as []
nbOrbits : Text -> Map Text [Text] -> Nat
nbOrbits p m =
Map.lookup p m
|> Optional.orDefault []
|> List.foldl (c -> p -> c + 1 + nbOrbits p m) 0
parseInput: [Text] -> Map Text [Text]
parseInput os =
p t = case split ?) t of
[h1, h2] ++ _ -> Some (h1, h2)
_ -> None
List.map p os
|> flatten
|> buildGraph
orbits : [Text] -> Nat
orbits os =
map = parseInput os
Map.keys map
|> List.map (p -> nbOrbits p map)
|> List.foldl (Nat.+) 0
path : Text -> Nat -> Map Text [Text] -> [(Text, Nat)]
path p d m =
Map.lookup p m
|> Optional.orDefault []
|> List.foldl (l -> p -> l ++ (path p (d + 1) m)) [(p, d)]
shortestPathCost : Text -> Text -> Map Text [Text] -> Nat
shortestPathCost a b m =
aPath = path a 0 m
bPath = path b 0 m
commonToBothPaths = Set.intersect (List.map Tuple.at1 aPath |> Set.fromList) (List.map Tuple.at1 bPath |> Set.fromList)
cost e p1 p2 =
go p c = case p of
(i, j) +: t -> if i == e then c Nat.+ j else go t c
_ -> c
(go p1 0) + (go p2 0)
minCost c p =
newC = cost p aPath bPath
if newC < c then newC else c
Set.toList commonToBothPaths
|> List.foldl minCost Nat.maxNat
youToSanCost : [Text] -> Nat
youToSanCost os =
parseInput os
|> shortestPathCost "YOU" "SAN"
t = Node "COM" [ Node "B" [ Node "G" [ Node "H" [Leaf] ], Node "C" [ Node "D" [ Node "I" [Leaf], Node "E" [ Node "F" [Leaf], Node "J" [ Node "K" [ Node "L" [Leaf] ] ] ] ] ] ] ]
> foldlRT (c -> _ -> c + 1) 0 t
> depths t |> foldlRT (c -> d -> c Nat.+ d) 0
> t
> split ?) "COM)B"
> orbits ["COM)B","B)C","C)D","D)E","E)F","B)G","G)H","D)I","E)J","J)K","K)L"]
> orbits ["COM)B","B)C","C)D","D)E","E)F","B)G","G)H","D)I","E)J","J)K","K)L","Y)Z"]
input6 = ["F1B)CNY","SCH)CBH","H9N)GXP","ZP9)M5Y","7VT)VQT","82S)45G","1ZC)TMT","HYK)56V","5YG)H1W","N5Y)BNN","QM6)GXD","ZQK)VWB","PS1)J6C","BSR)9X7","19J)47G","H2Q)JHP","2FT)TLG","BBY)4TN","ZMG)3MW","2SH)SFW","4DB)R14","2T3)5YR","DGY)4GK","QKM)81D","VNQ)RDQ","R8M)JDL","2GN)CDM","V5N)3J8","1F1)3ND","ZDZ)PBP","CNY)QFN","BDF)V93","DSW)PB1","SDS)J2D","WFL)ZN2","693)23R","VLD)DWP","YVZ)H1M","8XR)LWX","CYC)ZP9","J5X)C9N","XVY)19W","VPF)9YR","CTY)2D4","LZ9)C4S","GK6)RTN","KJJ)MCG","G4B)QCS","4CH)G2D","3KW)2R9","CGG)25Y","KZJ)XCF","BBP)WXC","K98)FQG","LSV)QNJ","7L1)RR8","C7B)BYZ","ZPV)DN6","NK4)L7W","SH5)PCG","XGM)KD8","TT3)SGG","85S)5D9","QJD)KM2","769)86H","PG2)L9Y","8B3)T4R","T1M)LW7","NX9)3RP","7JW)SDS","3J7)NND","WBF)Y1T","459)HSX","V9W)DHQ","HPZ)41Z","MYP)6M8","DGC)9VB","RFH)WL9","815)6BL","FNL)DSW","55L)DCQ","VD7)M8Z","8N9)VKS","JC5)CFQ","N5Y)5V2","BTL)8PC","P1V)GNX","DKM)XQQ","BNY)412","SPM)KGB","4MM)5MJ","XQ9)3HN","KWZ)LWV","WDF)815","6DV)D59","W13)MLV","BSQ)H1L","R91)6Q9","BNX)9SH","Q8R)JFR","VDK)KHL","KBP)ZQK","ZX5)4C9","X5D)T9T","3FD)5X1","VVK)S2T","C67)XGM","W2D)M34","58W)GY9","S47)CRB","NJD)3LT","DXW)ZVJ","CT5)X5Z","GHV)D2G","6QN)LNQ","S8H)F5C","RPY)JVW","LPB)3GV","V5M)WXW","CZ2)XPD","9JL)M18","D8K)2CQ","VRF)9MX","NYB)TM2","BHS)MJ4","C6X)NMX","21Z)RYC","FJV)154","CFQ)LM4","MHM)TK6","SRP)171","FCH)MXQ","6Q9)YJ5","VS1)Y6C","VND)396","PW9)TGW","9NJ)G89","8MK)GBL","VKS)LPH","KWM)9DQ","RTQ)W13","K94)87N","CPS)DVM","G1L)VRF","2YW)ZPV","HTF)HJS","LWH)SRN","4T3)B92","J4J)4NH","ZYG)PBM","QYP)RTV","9M4)9K2","7NP)297","PBP)RZS","K8S)BLT","BHY)PW9","4L5)FRL","HKT)VF6","2Z3)QV7","Z9V)ZGB","1F2)CT5","KHL)BBQ","16R)M6W","YN5)D5L","TK6)QHD","C26)91H","86C)FFX","6QF)VCF","BCB)4GQ","TBM)RQZ","ZTH)YL8","1XD)1J7","3FX)HSN","W2W)RSC","P4K)BGZ","7HW)512","L7W)5SH","YCJ)DYJ","G8T)J8V","5TX)XNB","FKC)SPL","91Q)QC2","C88)HFR","MSL)4DB","CV9)NRZ","HZQ)57G","JM9)C3T","2MW)NJD","LGZ)1T3","QZK)82V","Y6C)MFZ","HD6)SQ4","2T6)R9B","WL3)2RL","WS3)24J","YV5)VT7","9NN)LGL","JMT)28Y","N91)SPY","R8D)MC7","56V)X24","25M)YYD","SPH)BL6","62X)K5H","471)S2G","VHQ)FSW","NMC)PQ1","3GV)J2S","VT7)7M2","32K)V4J","7L1)ZS6","4JW)3MQ","412)MDP","2D4)L3F","QYX)VT2","NY9)YN5","5PT)CJZ","52H)FHK","XXQ)4JW","HLX)48R","P1C)62X","8PC)Y3R","YKP)NYP","LHT)KV5","DVV)8RC","WXC)MZZ","9CF)W31","XJK)SXQ","VDP)YG4","HNV)2MC","3LW)9WT","RLJ)KMC","9HN)31S","5YB)3J7","7VW)Q3S","FY7)KZ6","VQX)1R2","Y3R)ZZ5","KZ6)K8S","N4Z)3H9","N6X)D55","YB3)J3X","GTJ)HZ1","S9K)2S2","Q1Q)8D3","3QN)YKD","MZZ)24Y","JFR)JQL","QSP)82N","BYL)GJN","7W7)VH6","FBX)61P","22H)QBS","M7M)389","YKD)6ZY","M3D)7XB","S66)K4X","BM6)GXQ","Z4W)XN7","NYP)JDM","VD9)LJX","5YR)S47","Q8J)YCJ","5TP)QP7","91X)4JY","XS2)HTF","12Z)BNX","NKR)SRP","37Y)5SS","SZ4)MR6","7TT)TSG","MYL)BSZ","2FF)MRF","11Y)7HW","82H)T1J","J7T)2FT","7GP)SAN","BHH)CDR","PZ7)GK9","9GH)G6S","M2Z)38C","ZLB)1S4","W1W)7JW","38W)GLX","1TH)1CV","8F8)NB7","Y1T)5H1","CJ1)G9Y","XL8)Z5M","NMX)J5X","LGJ)SPQ","F2L)Y4V","BMT)S2W","G3H)64B","PK7)3DT","MZ9)FZF","483)85S","B6B)FRM","37R)BXS","J2S)QM6","K87)8VQ","347)RXJ","VP3)JRR","YLQ)GYJ","BV4)FY7","V2V)BT5","711)Q5L","5LR)RY3","HTH)R8D","RDQ)HH4","RHS)3JX","RFZ)YC9","KV5)L9K","MJ4)LHT","LPP)N3V","RSB)CQ9","LN5)5KZ","W4D)ZHY","JDJ)ZLR","YKX)TYX","C4S)WY2","42V)8XD","W4H)9T7","RYC)FYM","CC7)38W","DHQ)CGG","L9Y)HTH","5SH)H1D","DGY)K4N","8Y5)WZW","SXQ)J75","HQS)7VT","XTF)99C","B2L)FCB","66X)HLF","95K)N1C","NY4)BXW","XPD)2MN","7TL)F31","7TL)L65","TY4)D39","XBP)1G1","RQZ)L6C","GHV)BCB","NB8)DY5","CFQ)RKP","LP8)CGH","RGD)G87","YB3)NHG","GNH)7YL","BHQ)WFL","15G)G6B","14K)5HD","2CQ)KYY","NZK)XV1","SGX)N3D","7WG)YVZ","CXN)R8S","ZL7)NL4","SN6)WR6","4NJ)Y51","676)T62","V95)H6R","LL7)4G9","DYC)NY8","9GR)Q8N","RLZ)DXP","BCD)24B","CWY)KYV","6TB)55K","PWF)SN6","6BC)6HV","GY9)PJX","1QD)TKQ","DLZ)TFB","55P)P8G","8XD)95C","CPW)S2Z","VDT)QGD","Y93)GH3","X4V)CVP","3X3)79D","1NS)1F2","KYL)1XD","3ND)G1Q","898)DDD","D6Z)JZM","Q5L)843","NSY)86C","24B)MMK","5CZ)9RS","D39)BFF","CX3)QHC","JDM)95D","SYC)P1C","J4M)ZLB","ZS6)769","XMM)1X8","ZFV)P9T","7JW)GXW","W96)ZFL","QSP)BJK","2QZ)R7H","JXH)HSJ","5W2)D66","5HD)PGC","VP3)9NJ","H6Y)DZW","L3F)Z2L","8BN)SPH","KK5)HNV","717)58W","72J)3JT","CB5)QSP","KPQ)7H4","1KG)Q4H","6SN)6BC","9TV)XMM","PBM)1KG","221)2GL","2JC)689","RRC)DKM","7DV)VDT","Q3S)4D4","VCQ)KN8","PX5)CDX","5SH)YV2","MV6)Y5R","153)YDL","9X7)LR5","BKJ)LWH","ZH5)H7Y","T6G)44D","VX1)7ZY","5SS)CC7","84R)BHH","FZF)6TB","D5L)1F1","91H)L5B","3XB)X46","FS4)5C7","TRZ)42V","G87)N4Z","7G4)S8H","T4F)1WP","NY8)CLS","C3T)NKR","Z48)XGT","VLW)DLR","DGD)GY1","NQQ)431","WVC)BMT","DB9)ZK9","84R)PKL","S2T)FP1","X59)77J","41B)JSD","QHC)4DZ","MKS)W96","XNB)GK6","7X5)7P8","X81)65D","BNN)B8G","SWG)QXK","9PT)7PC","5R4)FS4","47P)H96","1G1)VSV","6XB)KQH","BBQ)54Q","ZVJ)QTQ","9FS)HY3","ZC7)HBZ","XGR)8HK","S4P)S2R","BGZ)21Z","MFL)T1M","G6S)W1W","1X8)2Z3","LQ9)J4J","8PP)YXN","TNG)6ZN","XJP)676","Y5R)5MC","N1D)R66","BFB)XGR","DSW)QYB","Q2Z)TLH","8DG)GNH","QC2)D3Y","QYB)TG7","YQQ)SW6","KSX)GW2","B6Q)8PP","DJH)CV2","5LC)645","X31)BHR","J44)7DV","PJX)KWM","9WH)SVY","BD5)L7K","VPJ)55L","KN8)WTN","1C7)WPW","JLR)3PM","79D)M1S","CVP)QGR","FRL)153","9X7)Q21","C56)9V7","R78)37R","84H)VLW","XNP)SNZ","TDJ)C7B","FRB)R3T","DYP)P2Y","FQG)JPY","CDX)DXW","6ZD)16Z","BL1)RGL","29T)7MR","4GK)KLT","RY7)C28","7NP)VZP","SNG)4L5","1CV)BFB","9F6)8B1","X85)RR4","KM2)F4L","PXF)WNN","P2H)TZ2","8PB)K87","1WP)Z9V","7RS)SB2","C8R)H3C","KRM)TNG","BYG)G3H","9WT)GHV","WR6)FG3","B8G)LBM","C8G)2RF","XT3)DGC","8D3)SYC","YDL)KX6","8XK)YB3","XVV)Q8J","DVD)T3V","TS3)Z1D","SPL)ZTS","FZD)5RQ","7BP)ZMG","MC7)VPF","DZW)TBV","K77)C56","L5B)BW7","154)CTC","9MX)611","XBP)BXY","LVB)CXN","1JP)JFH","5MC)ZZ4","DHJ)ZMD","S8Q)JWD","LD5)T4F","MY8)BPT","R9B)L1Y","RZS)9HN","C19)T5D","6LF)S8Q","YB7)P2F","2T5)9J8","L1Y)VCM","ZCD)9WH","TSG)FF8","VWB)9F6","HJ7)513","FFL)16R","L7K)LPP","19W)CZ2","64B)KRM","VK9)GNW","FFX)RG8","V8J)RFH","HR7)LP8","JZQ)SR1","SPQ)55P","784)LZ9","QP7)3VS","GXD)SX1","PY1)FRB","N4J)2JC","RSP)8MK","6HV)PG2","DXM)VVK","9VB)7Q6","GHM)PY1","YQ2)1W8","VF6)PHB","HSQ)BJS","S8Q)7VW","FPG)2MW","VZD)W4D","QXK)2YW","9PN)NVM","ZGD)S6X","MQY)DLD","BLT)NB1","G6B)KBP","KNY)SH5","QNJ)VD9","BDF)9CF","Z2R)GTJ","WXW)6LD","QWF)FNL","ZC7)ZDZ","W31)G1G","PZQ)21X","FYM)DQX","MDP)BTL","SMR)JR9","TGY)LD5","MZ9)4FK","52Y)LT3","77J)DHJ","7MR)DVX","T31)82X","N1L)FCH","G1G)FFY","79N)RTQ","95C)19J","31S)KPQ","MR6)CMG","428)57B","T1M)HP6","BFK)JXH","Q64)CHR","VCF)VQX","SB2)8HD","MG2)N91","HP6)KGV","2X8)WFH","TLH)XJ7","LWV)JKX","G6K)WQ4","MWN)C5H","TH6)B2W","P9T)YPT","S16)XJP","KQH)586","TG7)M1N","JP2)1KX","3TR)693","LPK)QWF","7V4)B3V","JTV)H9N","YXC)WDF","BXW)Q2W","GPP)Q8R","Q2W)3R1","4BG)DHN","TFB)YOU","65D)B1X","6M6)784","3VS)1JP","GW4)7XD","F3G)9GR","HBZ)QX4","YXR)9FS","CMD)5MP","H4K)WDM","1KX)WBF","SVY)SGX","16Z)MXN","PQY)11Y","F95)FFZ","DJ3)SDF","QM2)CWZ","S1T)2QG","P7J)572","DHN)QYN","PD7)CZ8","37V)Z4H","DQL)LZK","D19)1X5","K4N)46D","JDL)5TJ","JNZ)YK2","JR9)H2M","DPW)RN3","TKY)NYB","YGJ)HZ9","RY3)BZ6","QP7)Z1J","5D9)KWF","5V6)PND","LXW)D19","SW6)F2L","W82)W4H","DMK)8F8","J4G)NHT","VCM)CW3","N1C)2QZ","XJ1)7WG","VPJ)J44","KYJ)428","XJK)WR7","57B)PKN","14C)CPS","X7K)DJH","C28)1C7","PP5)BCQ","CLS)M7M","S2G)51H","M1P)GPP","9J8)39B","3MW)1WG","XFK)3TB","FFL)CHG","FPG)XXQ","MCG)TDJ","QG5)DJ3","3F5)BB4","47G)HSQ","77J)9YL","RJZ)37Y","DBZ)9TV","9LN)8MT","3PM)6GT","572)D8N","Y27)8RX","Z6F)272","CTC)D9Q","YV2)G2R","9B1)BG9","BR6)CQB","SP9)5LR","X2N)R4P","L2G)3XB","2RF)4PV","1WG)4JM","CBH)GZK","PKL)7CF","3ZC)ZXW","T88)31H","H1J)J7W","TYX)75R","J7W)V97","XCD)JLR","8N7)FQ4","DKM)2T3","DGS)BGG","272)8XM","TZZ)C6X","HTS)YR9","611)P4D","M6W)B8H","23G)3MM","FFX)Q1Q","4RH)2T6","4SQ)C15","39X)CYM","7TN)DYP","4W6)79N","C96)NFV","4DV)C8G","9YJ)Z48","825)7GK","MMK)L2R","WNN)R4D","D88)TGY","Q8N)DGS","512)VD7","CQR)6YP","5H1)X7K","2TD)2CS","ZHY)5CZ","2VD)2YM","5TX)N1L","YP8)P5J","Z1D)27G","297)QM2","2S2)LPB","KDQ)ZTH","55P)2RD","PRG)Q1Z","DF7)XBP","SQ4)MHM","TLY)R1J","J82)6ND","7GK)CSL","SNZ)7J4","CSL)KJJ","815)BM6","NL4)XQ9","995)825","GLX)13Y","3MQ)9NN","T5B)HQS","R4P)V95","BFF)HW1","WR7)9YJ","S4P)299","BB4)6D6","DYJ)3LW","VH6)PQD","NHG)HPK","HZW)LL7","HD2)HTS","4VN)ZX4","V2V)BL1","16R)NK4","G6B)36Y","J6C)SJR","QNF)17D","1R2)CH2","BJK)HZW","FFY)95K","ZQK)4P2","CQ9)27B","FZS)DVD","LG3)C2D","FLB)NZS","HLC)R1Y","YC9)NSQ","GBM)H8P","KD8)S3H","WS6)R78","4GQ)RJZ","R1J)H9J","61P)P63","7CF)K77","HZ1)KYL","1X5)CX3","FLH)BJV","GYJ)D88","2CS)MXB","Z3G)SW5","VJ1)3X1","H7Y)HD2","DYB)4W6","BPT)NKQ","H2M)L2Y","N3D)9LN","1TN)S16","KYY)2NX","GJN)5PQ","V1X)YKP","JP2)VBW","KWF)J4M","9YJ)7C1","XGT)GGZ","VSV)9M1","ZMD)XYG","6QN)GFR","NL7)M1P","QC5)LPK","NPX)79V","NGV)71S","9T7)84H","7DF)1N7","LPH)6LG","3DT)Y93","WY2)DMK","M8Z)LYX","HR2)C6F","TBV)TLY","2TV)91X","112)12R","WL9)JNX","NBJ)PS1","BFF)CYR","KTW)CXV","KX6)52Y","86C)3F5","P63)PX5","KKQ)W2D","FTN)ZYG","BF4)BNY","GMR)2G3","T7T)G48","4G9)P7J","LJX)P1V","R3T)6M6","DCQ)SNG","Q5T)XT3","GS2)FTN","COM)9JW","QSH)TKH","B1X)9GH","RSP)JP2","TKH)R8M","DW3)V2V","XX9)594","LWX)KCT","CZ8)2T5","QYN)84R","1N7)878","2B4)898","4PV)FN6","GFR)SZ4","R66)Z6F","V93)V9K","6BL)NSY","BCY)7V4","8XM)JBB","SWH)WV8","M1S)TT3","J4G)7GP","9P3)LB7","L2Y)KXQ","V9K)Q2X","3LT)2FF","GNW)XW1","C68)X5M","VLG)6G5","B3G)Q5T","TPY)2DW","BFB)MSL","BPT)C89","38C)N84","VT2)711","VC5)3KM","CDR)MNK","F86)RDR","N4Z)Q72","3Q5)MWN","HFR)JX8","QX4)QKM","2YM)NY9","DY5)BBY","JBV)VGM","DXP)79F","X5Z)QG5","9YL)3LV","31H)DBZ","QGP)4B2","SZR)RRZ","R78)PRG","3JT)WNX","CJZ)7TN","299)KTW","NBZ)93W","SXK)Z4D","6XM)T6G","DWP)RGD","CH2)BDF","RN3)TT2","9HN)NRL","3TB)NV6","MNK)471","TLG)KZJ","RT5)VDK","BT5)3P3","CRB)2MH","22K)BSR","DQP)2VD","D4D)J4G","2RD)HR2","D4Z)DQL","4TN)SKL","DWR)3KW","1WP)X81","594)NBJ","471)TZH","KR8)PDD","47Y)7SZ","9NB)S4P","GFP)F3G","KYV)6Z7","K1G)DLL","RTN)T4H","9JW)7X5","NVM)TSL","NRL)6X3","8HD)3Q5","ZN2)995","HJZ)9NB","14W)YD1","BPL)51T","1S2)1QD","QYJ)7L1","5TJ)NX9","L9K)Q7S","JVW)DFH","VC8)WL3","CVW)41B","5YC)VJ1","LR5)47Y","24Y)WMS","6C3)YXV","C7H)X3Y","75R)MV6","JHP)FRT","MXQ)T5B","NZJ)QNF","VGM)KF6","MFZ)FJV","Q72)8LJ","H1M)1S2","BHR)VK9","711)8S9","S3H)BHS","DBZ)SVG","51H)7BP","HP6)NBZ","TGW)9M4","ZZ4)DYB","P5J)TRZ","T62)LN5","P4D)MFL","CMD)N5Y","NSQ)8B3","FDT)ZCD","YK2)JTV","LBM)39X","LPK)BD5","2T4)1TH","Z9V)6L6","L48)JNZ","6QV)NMC","GW2)D4D","C32)4NJ","NL3)KPG","XPD)R4F","S47)L48","7WG)K98","PGC)ZXS","TT2)MG2","X5M)LSV","54Y)TZZ","2WS)JNH","R4F)KS2","SZR)FLB","1QK)41X","VZP)PV5","NBJ)TS3","T4H)GJB","B12)LGJ","52T)14K","T9T)XH2","VG4)7RS","QHD)R91","PQD)FLH","PD7)DVV","RDR)NGG","YT7)XVV","QCN)88Q","MXN)Z8Z","Q6G)B63","GNX)YC3","QRV)C68","7LZ)3K4","3FH)717","3HN)TKY","SK2)HD6","Z4D)FLP","9SF)SXK","HK4)CBG","KKF)GF1","H6R)11K","YD1)YXC","G89)5KG","JGB)NPX","GXK)3QN","26S)5W2","X46)DGY","1DC)KR8","L65)H6Y","XW1)9QL","CXV)VND","586)BYL","BYZ)DYC","JPY)JXV","C6F)KDQ","BHH)NLM","SBL)BPL","QBS)VKT","KGV)K8D","T4R)S1T","3KM)7G4","91H)W7X","3MM)4QN","GZK)TBG","B2W)CXC","LT3)BPY","TSL)MBK","JKX)14C","CHG)WVC","87N)JB4","9PT)WPB","WV8)SGK","KLT)TBQ","Q1Z)HFD","BZ6)997","ZMD)8N7","YMP)6SN","SGX)WL2","K8D)Q2Z","48R)79S","DQX)221","VX9)HT3","RXJ)3X3","T3V)6PH","BW7)QCN","RPY)PD7","RT5)N6X","TMT)4VN","F3D)SWG","C3N)F86","3X1)NSJ","F5C)PG1","VFV)8XR","79S)YB7","BCD)TYD","8S9)VZD","J6G)B1Y","GJB)XFK","QCS)VHQ","QBB)ZR6","T1J)VCQ","NB1)GL4","DDD)PF1","YFJ)HGG","7X1)FPG","997)G6K","NSJ)ZWJ","LYX)X59","R4Z)M3D","HH4)NQQ","Q8K)MY8","Q8T)8WB","FHY)YKX","K4X)CB5","86J)Z4W","513)RFZ","YCG)KK5","BVZ)HCL","7J4)DQP","3MW)VS1","NY9)TJJ","KRF)Q8K","82V)J7T","82N)WS3","15G)8NS","HZZ)YVX","4D4)V1H","B12)YXR","25X)15G","LNQ)DF7","P93)47P","9KD)22H","XCF)LJG","PND)YMP","4NH)2GN","GBL)H2Q","PHB)FHY","SFW)NL3","6LD)DXM","2MC)6QN","SDF)GW4","HVX)J82","NHG)Z2R","45G)B6J","MH8)347","4JM)3FH","XJ7)RPY","NKQ)76W","847)N4J","8HT)PQY","W2K)52H","VQT)XNP","8SC)YV5","RR8)LXW","8RC)VNQ","JQL)G8T","B6J)J31","FRL)C7H","HTH)1ZC","FLP)YK5","DLD)GXK","2TV)9B1","DHQ)ZXG","Z2R)6QF","4B2)8Y5","GH3)54Y","BJV)29T","PWF)JGB","7Q6)5ZM","BSZ)ZTR","SGK)QJD","HT3)VC8","2CQ)P93","3H9)8XK","SPM)XTM","BXS)ZPX","9FN)HJZ","GV7)C7P","81D)BX3","XTM)XX9","TZ2)NY4","QGD)PZ9","BPN)HYK","PZ9)T7T","H1L)Z8R","CWZ)3TR","6L6)HK4","ZR6)JM9","GF1)XL8","4FK)SCH","412)ZX5","HY3)C26","8WB)4BG","XB6)5LC","HTJ)SK2","3LV)2TV","3K4)P3M","5MP)BCY","C65)9FN","2QG)KMM","Y6C)X4V","2G3)5R5","RG8)VP3","V1H)MQY","CPW)CMD","8VQ)MKS","S8C)F1B","CBG)LGZ","Y9Q)GV7","HFD)25X","1S2)2TD","5TG)XSS","JQN)KKL","651)VG4","RTV)V4T","Q4H)QYP","TZH)RHS","DN6)YP8","CCY)9JL","661)XB6","JWD)CYC","ZX4)4RG","BPY)FQC","689)BSQ","WPB)BPN","JZM)BV4","J3X)LN2","ZXS)M2Z","B3V)SPM","BL6)KKF","WQ4)DSP","G2R)W2K","QFX)2WM","VNQ)2B4","YG4)MYL","2MC)RT5","JM9)NGV","YK5)V1X","GXP)BHY","N84)CV9","HW1)C88","7XB)KWZ","M1N)VDP","JFH)TH6","3W1)B6B","DZ6)8HT","XLJ)T31","FCB)W35","6DY)7X1","Q21)QYJ","5TT)Y27","M5Y)X8K","88Q)BFK","29H)G1L","LJG)B3G","ZTS)XQS","S2Z)F2J","KMM)X31","389)Q7Z","Q4H)8BN","95G)HVX","4C9)R4Z","GHM)112","KPG)QC5","C89)PL1","24B)NB8","7P8)457","C5H)QRV","DVX)3ZC","YYD)K94","KBV)9PT","KST)KYJ","GL4)HZQ","C4K)L1T","ZGB)N6Z","4QN)5R4","3HJ)RY7","39B)5YB","B1Y)NZJ","W7X)6QV","KMC)SP9","N3V)XJ1","HLF)Y91","YPT)FBX","2NX)P2H","P7J)YGJ","MXN)4Y8","D4Z)VC5","9M1)5TP","HBJ)GBM","Z22)VLG","6LG)V2H","9VB)B2L","L6C)C1W","MLV)KSX","CQB)YT7","LB7)HZZ","YXV)86J","6Z7)4T3","DLL)DW3","12G)6C3","FG3)FFL","JNX)BCD","YJ5)FPM","C1W)CPW","Q38)QZK","FF8)FZS","57G)DZ6","Z1J)CMZ","82X)C3N","CV2)DLZ","P7V)52T","YH9)CQR","3JX)1NS","N6Z)Z22","Z8Z)RF6","CGH)YCG","M34)1ZD","FPM)YKV","3LT)BDB","FQ4)CTY","4P2)B12","QFN)GPB","PF1)3FX","8M1)JWR","YKV)B6Q","5ZM)W82","M48)GS2","JD4)1TN","ZMG)9P3","Z8R)JCR","F2J)QSH","D55)4DV","4JW)29H","GPB)MH8","CDM)MZ9","KD8)7YX","HPK)95G","C2D)SZR","FSW)YQC","QGR)XJK","L2R)6XM","XQQ)J6G","79V)4MM","JWR)G4B","B8H)W2W","4Y8)X2N","SVG)4Q8","57R)9SF","NRZ)4RH","JRR)2T4","JXV)FTX","YVX)JMT","QV7)S9K","HK4)7TT","TM2)RTT","Y27)5PT","8VQ)VX1","4RH)483","SC5)QXQ","8NS)LX1","VBW)661","YC3)FZL","FRM)6DV","2MH)C32","M8Z)FDT","7XD)YFJ","WDM)8M1","NB7)7KP","54Q)57R","JNH)Q64","P2Y)CVW","7SZ)D6Q","5V2)V8J","HZ9)82S","2Z7)2X8","7H4)25M","NZS)12G","XLJ)6ZD","ZK9)HLX","NVR)QFX","KKL)XTF","W35)ZGD","C9N)2Z7","G9Y)BSB","Z4H)DB9","25Y)3FD","R14)SWH","1YV)QBB","ZWJ)XLJ","55K)QS2","ZFL)QYX","LGL)RLJ","FTX)91Q","BCQ)ZH5","HSX)BR6","NRL)D4Z","46D)BBP","J62)PK7","X3Y)C67","DVM)1DC","H9J)8SC","41Z)7TL","2RL)X5D","CMG)6XB","C8G)FZD","H8P)22K","9YR)1YV","CW3)8PB","6M8)M48","WFH)P7V","YXN)JC5","SR1)DWR","K9D)5YC","6YP)6LF","FFZ)HJ7","7YL)7LZ","GXW)GMR","3JX)BXP","C15)Y9Q","DLR)YH9","XYG)PZ7","41X)GL2","17D)2SH","R9B)RSP","F31)YLQ","4Q8)KST","MBK)LVB","6ZN)VPJ","6Q9)YBC","V4T)847","BDB)2WS","VKT)5V6","SX1)VLD","G1Q)3BL","BJS)PP5","LM4)CWY","SPY)HR7","6GT)9PN","DVD)5TT","2WM)3HJ","GGZ)KNY","JB4)SVH","ZXG)SMR","44D)P4Q","7TH)T88","XSS)ZFV","BG9)S66","8B1)7DF","PB1)SC5","R4D)PZQ","71S)C4K","HNV)MYP","8MT)8N9","B92)C8R","JX8)DGD","D6Q)8LQ","ZPD)7W7","Q7Z)BKJ","Z2L)JBV","MXB)V9W","93W)JQN","95G)PXF","Q8J)S8C","X83)72J","457)VX9","7M2)F95","ZLR)FKC","TKQ)WS6","XH2)6MC","X2N)BF4","JCR)14W","TJJ)9KD","H7Y)KRF","6MC)PYF","27G)NZK","D8N)MCH","9CF)HBJ","KCT)RRC","CYR)QGP","5PQ)X85","7VW)5TG","BJS)C65","9V7)V5N","RKP)XCD","X8K)X83","B63)SBL","9SH)Q8T","LW7)HLC","P93)JZQ","YLM)RLZ","GL2)JDJ","LZ9)K1G","DWP)TBM","6GT)651","NLM)JD4","YC9)Q38","FP1)23G","V4J)XNJ","PYF)7TH","3P3)KBV","95D)X5W","TBG)LG3","BXP)83F","SRN)GHM","5R5)D8K","NGG)H1J","6D6)KKQ","5RQ)26S","5X1)RSB","GW2)NVR","9QL)C96","GXQ)Q6G","TBQ)XS2","S2W)BHQ","51T)CJ1","L6C)HPZ","BSB)GFP","5TP)1QK","L1T)D6Z","NHT)82H","RSC)3W1","KXQ)LQ9","VK9)QHN","J75)PWF","2GL)1P5","8LJ)66X","SGG)F3D","WL2)YLM","YQC)459","YGJ)XVY","6X3)4SQ","6PH)WKK","V2H)H4K","RTT)HTJ","YBC)L2G","7C1)YQ2","FZL)VFV","RF6)4CH","M18)37V","P63)DPW","S2R)ZPD","WZW)MD5","MR6)TY4","K5H)7NP","GGZ)P4K","R1Y)ZL7","46D)5YG","7H4)Z3G","RGL)BYG","7YX)6DY","MRF)C19","PL1)YQQ","QS2)J62","QHN)CCY","171)VXY","YR9)N81","FQG)K9D","JBB)BVZ","ZXW)HKT","KS2)V5M","8RX)ZC7","GY1)TPY","2GL)NL7","12R)32K","MKS)N1D","NFV)12Z","BGG)5TX","T5D)WKN","LX1)8DG"]
> orbits input6
> youToSanCost input6