# URL: https://theweeklychallenge.org/blog/perl-weekly-challenge-236/#TASK1
my %change is BagHash;
put so $*IN.words».&can-pay(%change).all;
my method can-pay($bill : %change --> Bool:D) {
my $remain = $bill - 5;
return False if $remain < 0;
while $remain > 0 {
my $bill_ = %change.keys.sort(-*).first(* ≤ $remain);
return False without $bill_;
--%change{$bill_};
$remain -= $bill_;
}
++%change{$bill};
True
}