package Ġday 0 6 Ċ Ċ import Ġjava . io . File Ċ Ċ private Ġconst Ġval ĠRE PRO DU CTION _ INTERVAL Ġ= Ġ 7 Ċ Ċ fun Ġmain () Ġ{ ĊĠĠĠ Ġval Ġfish Re production Timers Ġ= ĠFile (" src / main / kotlin / day 0 6 / input . txt "). read Lines (). first (). split ("," ). map Ġ{ Ġit . toInt () Ġ} ĊĠĠĠ Ġval Ġfish Count By Timer Ġ= Ġfish Re production Timers . fold ( Array ( 9 ) Ġ{ Ġ 0 L Ġ}) Ġ{ Ġacc , Ġfish Re production Timer Ġ-> ĊĠĠĠĠĠĠĠ Ġacc [ fish Re production Timer ] ++ ĊĠĠĠĠĠĠĠ Ġacc ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfor Ġ( day Ġin Ġ 0 .. 7 9 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcalculate Fish Count ( day , Ġfish Count By Timer ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġprintln ( fish Count By Timer . as Sequence (). sum Of Ġ{ Ġit Ġ}) ĊĊĠĠĠ Ġfor Ġ( day Ġin Ġ 8 0 .. 2 5 5 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcalculate Fish Count ( day , Ġfish Count By Timer ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġprintln ( fish Count By Timer . as Sequence (). sum Of Ġ{ Ġit Ġ}) Ċ } Ċ Ċ private Ġfun Ġcalculate Fish Count ( day : ĠInt , Ġfish Count By Timer : ĠArray < Long >) Ġ{ ĊĠĠĠ Ġval Ġreproduction Day Timer Ġ= Ġday Ġ% ĠRE PRO DU CTION _ INTERVAL ĊĠĠĠ Ġval Ġnew Fish Count Ġ= Ġfish Count By Timer [ re production Day Timer ] ĊĠĠĠ Ġfish Count By Timer [ re production Day Timer ] Ġ+= Ġfish Count By Timer [ 7 ] ĊĠĠĠ Ġfish Count By Timer [ 7 ] Ġ= Ġfish Count By Timer [ 8 ] ĊĠĠĠ Ġfish Count By Timer [ 8 ] Ġ= Ġnew Fish Count Ċ } Ċ