AoC 2023, day 4

Run Settings
LanguageRaku
Language Version
Run Command
my @lines = $*IN.lines; my @cards = 1 xx +@lines; my $sum01; for ^+@lines -> $i { my ($winning-numbers, $nums) = @lines[$i].split(/<[:|]>/)[1,2].map(*.words.Array); my $cnt = +$nums.grep(* == $winning-numbers.any); $sum01 += 2**($cnt-1) if $cnt > 0; @cards[$i+1 .. $i+$cnt] »+=» @cards[$i]; } put 'part 1: ', $sum01; put 'part 2: ', @cards.sum;
Editor Settings
Theme
Key bindings
Full width
Lines