import Ġmodels . Binary Number Ċ Ċ fun Ġmain () Ġ{ ĊĠĠĠ Ġval Ġpuzzle Input : ĠList < Binary Number > Ġ= Ġread Input (" Day 0 3 . txt "). map Ġ{ Ġit . to Binary Number () Ġ} ĊĊĠĠĠ Ġval Ġo xygen Generator Rating : ĠInt Ġ= Ġfind O xygen Generator Rating ( pu zzle Input ) ĊĠĠĠ Ġval Ġco 2 Sc rub ber Rating : ĠInt Ġ= Ġfind Co 2 Sc rub ber Rating ( pu zzle Input ) ĊĠĠĠ Ġval Ġlife Support Rating : ĠInt Ġ= Ġo xygen Generator Rating Ġ* Ġco 2 Sc rub ber Rating ĊĊĠĠĠ Ġprintln (" O xygen Ġgenerator Ġrating : Ġ$ oxy gen Generator Rating ") ĊĠĠĠ Ġprintln (" Co 2 ĠScr ub ber Ġrating : Ġ$ co 2 Sc rub ber Rating ") ĊĠĠĠ Ġprintln (" Life Ġsupport Ġrating : Ġ$ life Support Rating ") Ċ } Ċ Ċ fun Ġfind O xygen Generator Rating ( input : ĠList < Binary Number >): ĠInt Ġ{ ĊĠĠĠ Ġval Ġfiltered : ĠList < Binary Number > Ġ= Ġfilter By Most Sign ificant Bit ( input , Ġ 0 ) ĊĠĠĠ Ġcheck ( filtered . size Ġ== Ġ 1 ) ĊĊĠĠĠ Ġreturn Ġfiltered [ 0 ]. to Numeric () Ċ } Ċ Ċ fun Ġfind Co 2 Sc rub ber Rating ( input : ĠList < Binary Number >): ĠInt Ġ{ ĊĠĠĠ Ġval Ġfiltered : ĠList < Binary Number > Ġ= Ġfilter By Least Sign ificant Bit ( input , Ġ 0 ) ĊĠĠĠ Ġcheck ( filtered . size Ġ== Ġ 1 ) ĊĊĠĠĠ Ġreturn Ġfiltered [ 0 ]. to Numeric () Ċ } Ċ