CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 00:36:14 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=3debdeaff87c16462e03eb1b6b1b85d90e9e007c3660e59acb2bef7b72e056bfa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22bpkLBe-uYJWTpMJmHX-Y6M50dHE8p0rP%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d28595d9ffc167-BLR
AoC 2024, day 22 (Perl) - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature qw(say);
- use List::Util qw(max);
- my @input = map { m#(\d+)#g } <>;
- my $part1 = 0;
- my %hash;
- foreach my $num (@input) {
- my @window;
- my %tmp;
- my $last = $num % 10;
- for (my $i = 0; $i < 2000; $i++) {
- $num = (($num << 6) ^ $num) & 0xffffff;
- $num = (($num >> 5) ^ $num) & 0xffffff;
- $num = (($num << 11) ^ $num) & 0xffffff;
- push( @window, ($num % 10) - $last );
- $last = $num % 10;
- if ($i >= 3) {
- $tmp{"@window"} //= $last;
- shift @window;
- }
- }
- $part1 += $num;
- $hash{$_} += $tmp{$_} foreach (keys %tmp);
- }
- say "Part 1: $part1";
- say "Part 2: ", max values %hash;
Advertisement
Add Comment
Please, Sign In to add comment
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 7
JavaScript | 4 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 3
JavaScript | 6 sec ago | 0.25 KB
-
⭐ Free Crypto Method ⭐
JavaScript | 8 sec ago | 0.24 KB
-
📌 Swapzone +37% glitch ⭐ 6
JavaScript | 13 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ G
JavaScript | 15 sec ago | 0.25 KB
-
📝 Crypto Swap Glitch ✅ Working
JavaScript | 17 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ C
JavaScript | 25 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ U
JavaScript | 26 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand