From b1dc693fbf7df01affbd38933516b90e3d831965 Mon Sep 17 00:00:00 2001 From: James Hogge Date: Tue, 9 Dec 2025 04:18:46 +0000 Subject: [PATCH] Days 1-5 --- .direnv/bin/nix-direnv-reload | 19 + .../9rf7z9hhnxqvbf5i04labfsxill2zhyl-source | 1 + .../ribr3gc7kazm282bxiqpmjy9j2h4jaxk-source | 1 + ...e-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa | 1 + ...5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc | 2126 ++++++++ .envrc | 1 + .gitignore | 1 + 1-input.txt | 4432 +++++++++++++++++ 2-input.txt | 1 + 3-input.txt | 200 + 4-input.txt | 140 + 5-input.txt | 1175 +++++ Cargo.lock | 7 + Cargo.toml | 26 + flake.lock | 25 + flake.nix | 21 + src/1-secret-entrance.rs | 34 + src/2-gift-shop.rs | 52 + src/3-lobby.rs | 37 + src/4-printing-department.rs | 64 + src/5-cafeteria.rs | 49 + 21 files changed, 8413 insertions(+) create mode 100755 .direnv/bin/nix-direnv-reload create mode 120000 .direnv/flake-inputs/9rf7z9hhnxqvbf5i04labfsxill2zhyl-source create mode 120000 .direnv/flake-inputs/ribr3gc7kazm282bxiqpmjy9j2h4jaxk-source create mode 120000 .direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa create mode 100644 .direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 1-input.txt create mode 100644 2-input.txt create mode 100644 3-input.txt create mode 100644 4-input.txt create mode 100644 5-input.txt create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 src/1-secret-entrance.rs create mode 100644 src/2-gift-shop.rs create mode 100644 src/3-lobby.rs create mode 100644 src/4-printing-department.rs create mode 100644 src/5-cafeteria.rs diff --git a/.direnv/bin/nix-direnv-reload b/.direnv/bin/nix-direnv-reload new file mode 100755 index 0000000..bcbb382 --- /dev/null +++ b/.direnv/bin/nix-direnv-reload @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e +if [[ ! -d "/home/james/Repositories/aoc-2025" ]]; then + echo "Cannot find source directory; Did you move it?" + echo "(Looking for "/home/james/Repositories/aoc-2025")" + echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' + exit 1 +fi + +# rebuild the cache forcefully +_nix_direnv_force_reload=1 direnv exec "/home/james/Repositories/aoc-2025" true + +# Update the mtime for .envrc. +# This will cause direnv to reload again - but without re-building. +touch "/home/james/Repositories/aoc-2025/.envrc" + +# Also update the timestamp of whatever profile_rc we have. +# This makes sure that we know we are up to date. +touch -r "/home/james/Repositories/aoc-2025/.envrc" "/home/james/Repositories/aoc-2025/.direnv"/*.rc diff --git a/.direnv/flake-inputs/9rf7z9hhnxqvbf5i04labfsxill2zhyl-source b/.direnv/flake-inputs/9rf7z9hhnxqvbf5i04labfsxill2zhyl-source new file mode 120000 index 0000000..7e65879 --- /dev/null +++ b/.direnv/flake-inputs/9rf7z9hhnxqvbf5i04labfsxill2zhyl-source @@ -0,0 +1 @@ +/nix/store/9rf7z9hhnxqvbf5i04labfsxill2zhyl-source \ No newline at end of file diff --git a/.direnv/flake-inputs/ribr3gc7kazm282bxiqpmjy9j2h4jaxk-source b/.direnv/flake-inputs/ribr3gc7kazm282bxiqpmjy9j2h4jaxk-source new file mode 120000 index 0000000..61ae10c --- /dev/null +++ b/.direnv/flake-inputs/ribr3gc7kazm282bxiqpmjy9j2h4jaxk-source @@ -0,0 +1 @@ +/nix/store/ribr3gc7kazm282bxiqpmjy9j2h4jaxk-source \ No newline at end of file diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa new file mode 120000 index 0000000..36a461e --- /dev/null +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa @@ -0,0 +1 @@ +/nix/store/pmrs06lr66isa51v3jygxh14hnj9fnj0-qmk-default-env \ No newline at end of file diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc new file mode 100644 index 0000000..49274b2 --- /dev/null +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc @@ -0,0 +1,2126 @@ +unset shellHook +PATH=${PATH:-} +nix_saved_PATH="$PATH" +XDG_DATA_DIRS=${XDG_DATA_DIRS:-} +nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS" +AR='ar' +export AR +AS='as' +export AS +BASH='/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash' +CC='gcc' +export CC +CONFIG_SHELL='/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash' +export CONFIG_SHELL +CXX='g++' +export CXX +HOSTTYPE='x86_64' +HOST_PATH='/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8/bin:/nix/store/av4xw9f56xlx5pgv862wabfif6m1yc0a-findutils-4.10.0/bin:/nix/store/20axvl7mgj15m23jgmnq97hx37fgz7bk-diffutils-3.12/bin:/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/bin:/nix/store/x3zjxxz8m4ki88axp0gn8q8m6bldybba-gnugrep-3.12/bin:/nix/store/y2wdhdcrffp9hnkzk06d178hq3g98jay-gawk-5.3.2/bin:/nix/store/yi3c5karhx764ham5rfwk7iynr8mjf6q-gnutar-1.35/bin:/nix/store/d471xb7sfbah076s8rx02i68zpxc2r5n-gzip-1.14/bin:/nix/store/qm9rxn2sc1vrz91i443rr6f0vxm0zd82-bzip2-1.0.8-bin/bin:/nix/store/3fmzbq9y4m9nk235il7scmvwn8j9zy3p-gnumake-4.4.1/bin:/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin:/nix/store/qrwznp1ikdf0qw05wia2haiwi32ik5n0-patch-2.8/bin:/nix/store/v0rfdwhg6w6i0yb6dbry4srk6pnj3xp0-xz-5.8.1-bin/bin:/nix/store/paj6a1lpzp57hz1djm5bs86b7ci221r0-file-5.45/bin' +export HOST_PATH +IFS=' +' +IN_NIX_SHELL='impure' +export IN_NIX_SHELL +LD='ld' +export LD +LINENO='79' +MACHTYPE='x86_64-pc-linux-gnu' +NIX_BINTOOLS='/nix/store/xwydcyvlsa3cvssk0y5llgdhlhjvmqdm-binutils-wrapper-2.44' +export NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' +export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES='16' +export NIX_BUILD_CORES +NIX_CC='/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0' +export NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' +export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE=' -frandom-seed=pmrs06lr66' +export NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE='1' +export NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE='bindnow format fortify fortify3 libcxxhardeningextensive libcxxhardeningfast pic relro stackclashprotection stackprotector strictoverflow zerocallusedregs' +export NIX_HARDENING_ENABLE +NIX_LDFLAGS='-rpath /home/james/Repositories/aoc-2025/outputs/out/lib ' +export NIX_LDFLAGS +NIX_NO_SELF_RPATH='1' +NIX_STORE='/nix/store' +export NIX_STORE +NM='nm' +export NM +OBJCOPY='objcopy' +export OBJCOPY +OBJDUMP='objdump' +export OBJDUMP +OLDPWD='' +export OLDPWD +OPTERR='1' +OSTYPE='linux-gnu' +PATH='/nix/store/4sj19dch0zhnhhdsbrz9pxz55bc2xhb9-rustc-wrapper-1.91.1/bin:/nix/store/742kq790y4nd92s4l4arg7ij8h7is5ar-cargo-1.91.1/bin:/nix/store/5y00kqp8qlmjwvm5h607n6jnmqr75dnk-clippy-1.91.1/bin:/nix/store/8q2582rd22xp8jlcg1xn1w219q5lx5xa-patchelf-0.15.2/bin:/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin:/nix/store/kzq78n13l8w24jn8bx4djj79k5j717f1-gcc-14.3.0/bin:/nix/store/q6wgv06q39bfhx2xl8ysc05wi6m2zdss-glibc-2.40-66-bin/bin:/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8/bin:/nix/store/xwydcyvlsa3cvssk0y5llgdhlhjvmqdm-binutils-wrapper-2.44/bin:/nix/store/dc9vaz50jg7mibk9xvqw5dqv89cxzla3-binutils-2.44/bin:/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8/bin:/nix/store/av4xw9f56xlx5pgv862wabfif6m1yc0a-findutils-4.10.0/bin:/nix/store/20axvl7mgj15m23jgmnq97hx37fgz7bk-diffutils-3.12/bin:/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/bin:/nix/store/x3zjxxz8m4ki88axp0gn8q8m6bldybba-gnugrep-3.12/bin:/nix/store/y2wdhdcrffp9hnkzk06d178hq3g98jay-gawk-5.3.2/bin:/nix/store/yi3c5karhx764ham5rfwk7iynr8mjf6q-gnutar-1.35/bin:/nix/store/d471xb7sfbah076s8rx02i68zpxc2r5n-gzip-1.14/bin:/nix/store/qm9rxn2sc1vrz91i443rr6f0vxm0zd82-bzip2-1.0.8-bin/bin:/nix/store/3fmzbq9y4m9nk235il7scmvwn8j9zy3p-gnumake-4.4.1/bin:/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin:/nix/store/qrwznp1ikdf0qw05wia2haiwi32ik5n0-patch-2.8/bin:/nix/store/v0rfdwhg6w6i0yb6dbry4srk6pnj3xp0-xz-5.8.1-bin/bin:/nix/store/paj6a1lpzp57hz1djm5bs86b7ci221r0-file-5.45/bin' +export PATH +PS4='+ ' +RANLIB='ranlib' +export RANLIB +READELF='readelf' +export READELF +RUST_SRC_PATH='/nix/store/x4lzvdhcz439jm1clb41hnx3xa2cqvli-rust-lib-src' +export RUST_SRC_PATH +SHELL='/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash' +export SHELL +SIZE='size' +export SIZE +SOURCE_DATE_EPOCH='315532800' +export SOURCE_DATE_EPOCH +STRINGS='strings' +export STRINGS +STRIP='strip' +export STRIP +XDG_DATA_DIRS='/nix/store/742kq790y4nd92s4l4arg7ij8h7is5ar-cargo-1.91.1/share:/nix/store/8q2582rd22xp8jlcg1xn1w219q5lx5xa-patchelf-0.15.2/share' +export XDG_DATA_DIRS +__structuredAttrs='' +export __structuredAttrs +_substituteStream_has_warned_replace_deprecation='false' +buildInputs='' +export buildInputs +buildPhase='{ echo "------------------------------------------------------------"; + echo " WARNING: the existence of this path is not guaranteed."; + echo " It is an internal implementation detail for pkgs.mkShell."; + echo "------------------------------------------------------------"; + echo; + # Record all build inputs as runtime dependencies + export; +} >> "$out" +' +export buildPhase +builder='/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash' +export builder +cmakeFlags='' +export cmakeFlags +configureFlags='' +export configureFlags +defaultBuildInputs='' +defaultNativeBuildInputs='/nix/store/8q2582rd22xp8jlcg1xn1w219q5lx5xa-patchelf-0.15.2 /nix/store/l2xk4ac1wx9c95kpp8vymv9r9yn57fvh-update-autotools-gnu-config-scripts-hook /nix/store/0y5xmdb7qfvimjwbq7ibg1xdgkgjwqng-no-broken-symlinks.sh /nix/store/cv1d7p48379km6a85h4zp6kr86brh32q-audit-tmpdir.sh /nix/store/85clx3b0xkdf58jn161iy80y5223ilbi-compress-man-pages.sh /nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh /nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh /nix/store/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh /nix/store/x8c40nfigps493a07sdr2pm5s9j1cdc0-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh /nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh /nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh /nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0' +depsBuildBuild='' +export depsBuildBuild +depsBuildBuildPropagated='' +export depsBuildBuildPropagated +depsBuildTarget='' +export depsBuildTarget +depsBuildTargetPropagated='' +export depsBuildTargetPropagated +depsHostHost='' +export depsHostHost +depsHostHostPropagated='' +export depsHostHostPropagated +depsTargetTarget='' +export depsTargetTarget +depsTargetTargetPropagated='' +export depsTargetTargetPropagated +doCheck='' +export doCheck +doInstallCheck='' +export doInstallCheck +dontAddDisableDepTrack='1' +export dontAddDisableDepTrack +declare -a envBuildBuildHooks=() +declare -a envBuildHostHooks=() +declare -a envBuildTargetHooks=() +declare -a envHostHostHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) +declare -a envHostTargetHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) +declare -a envTargetTargetHooks=() +declare -a fixupOutputHooks=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi' 'if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi' 'if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi' '_moveLib64' '_moveSbin' '_moveSystemdUserUnits' 'patchShebangsAuto' '_pruneLibtoolFiles' '_doStrip' ) +initialPath='/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8 /nix/store/av4xw9f56xlx5pgv862wabfif6m1yc0a-findutils-4.10.0 /nix/store/20axvl7mgj15m23jgmnq97hx37fgz7bk-diffutils-3.12 /nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9 /nix/store/x3zjxxz8m4ki88axp0gn8q8m6bldybba-gnugrep-3.12 /nix/store/y2wdhdcrffp9hnkzk06d178hq3g98jay-gawk-5.3.2 /nix/store/yi3c5karhx764ham5rfwk7iynr8mjf6q-gnutar-1.35 /nix/store/d471xb7sfbah076s8rx02i68zpxc2r5n-gzip-1.14 /nix/store/qm9rxn2sc1vrz91i443rr6f0vxm0zd82-bzip2-1.0.8-bin /nix/store/3fmzbq9y4m9nk235il7scmvwn8j9zy3p-gnumake-4.4.1 /nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3 /nix/store/qrwznp1ikdf0qw05wia2haiwi32ik5n0-patch-2.8 /nix/store/v0rfdwhg6w6i0yb6dbry4srk6pnj3xp0-xz-5.8.1-bin /nix/store/paj6a1lpzp57hz1djm5bs86b7ci221r0-file-5.45' +mesonFlags='' +export mesonFlags +name='qmk-default-env' +export name +nativeBuildInputs='/nix/store/4sj19dch0zhnhhdsbrz9pxz55bc2xhb9-rustc-wrapper-1.91.1 /nix/store/742kq790y4nd92s4l4arg7ij8h7is5ar-cargo-1.91.1 /nix/store/5y00kqp8qlmjwvm5h607n6jnmqr75dnk-clippy-1.91.1' +export nativeBuildInputs +out='/home/james/Repositories/aoc-2025/outputs/out' +export out +outputBin='out' +outputDev='out' +outputDevdoc='REMOVE' +outputDevman='out' +outputDoc='out' +outputInclude='out' +outputInfo='out' +outputLib='out' +outputMan='out' +outputs='out' +export outputs +patches='' +export patches +phases='buildPhase' +export phases +pkg='/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0' +declare -a pkgsBuildBuild=() +declare -a pkgsBuildHost=('/nix/store/4sj19dch0zhnhhdsbrz9pxz55bc2xhb9-rustc-wrapper-1.91.1' '/nix/store/742kq790y4nd92s4l4arg7ij8h7is5ar-cargo-1.91.1' '/nix/store/5y00kqp8qlmjwvm5h607n6jnmqr75dnk-clippy-1.91.1' '/nix/store/8q2582rd22xp8jlcg1xn1w219q5lx5xa-patchelf-0.15.2' '/nix/store/l2xk4ac1wx9c95kpp8vymv9r9yn57fvh-update-autotools-gnu-config-scripts-hook' '/nix/store/0y5xmdb7qfvimjwbq7ibg1xdgkgjwqng-no-broken-symlinks.sh' '/nix/store/cv1d7p48379km6a85h4zp6kr86brh32q-audit-tmpdir.sh' '/nix/store/85clx3b0xkdf58jn161iy80y5223ilbi-compress-man-pages.sh' '/nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh' '/nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh' '/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh' '/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh' '/nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh' '/nix/store/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh' '/nix/store/x8c40nfigps493a07sdr2pm5s9j1cdc0-patch-shebangs.sh' '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh' '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh' '/nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh' '/nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh' '/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0' '/nix/store/xwydcyvlsa3cvssk0y5llgdhlhjvmqdm-binutils-wrapper-2.44' ) +declare -a pkgsBuildTarget=() +declare -a pkgsHostHost=() +declare -a pkgsHostTarget=() +declare -a pkgsTargetTarget=() +declare -a postFixupHooks=('noBrokenSymlinksInAllOutputs' '_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' ) +declare -a postUnpackHooks=('_updateSourceDateEpochFromSourceRoot' ) +declare -a preConfigureHooks=('_multioutConfig' ) +preConfigurePhases=' updateAutotoolsGnuConfigScriptsPhase' +declare -a preFixupHooks=('_moveToShare' '_multioutDocs' '_multioutDevs' ) +preferLocalBuild='1' +export preferLocalBuild +prefix='/home/james/Repositories/aoc-2025/outputs/out' +declare -a propagatedBuildDepFiles=('propagated-build-build-deps' 'propagated-native-build-inputs' 'propagated-build-target-deps' ) +propagatedBuildInputs='' +export propagatedBuildInputs +declare -a propagatedHostDepFiles=('propagated-host-host-deps' 'propagated-build-inputs' ) +propagatedNativeBuildInputs='' +export propagatedNativeBuildInputs +declare -a propagatedTargetDepFiles=('propagated-target-target-deps' ) +shell='/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash' +export shell +shellHook='' +export shellHook +stdenv='/nix/store/s3w5m3spa1g71hx0yb82lvk6394j3w5j-stdenv-linux' +export stdenv +strictDeps='' +export strictDeps +system='x86_64-linux' +export system +declare -a unpackCmdHooks=('_defaultUnpack' ) +_activatePkgs () +{ + + local hostOffset targetOffset; + local pkg; + for hostOffset in "${allPlatOffsets[@]}"; + do + local pkgsVar="${pkgAccumVarVars[hostOffset + 1]}"; + for targetOffset in "${allPlatOffsets[@]}"; + do + (( hostOffset <= targetOffset )) || continue; + local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + activatePackage "$pkg" "$hostOffset" "$targetOffset"; + done; + done; + done +} +_addRpathPrefix () +{ + + if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then + export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; + fi +} +_addToEnv () +{ + + local depHostOffset depTargetOffset; + local pkg; + for depHostOffset in "${allPlatOffsets[@]}"; + do + local hookVar="${pkgHookVarVars[depHostOffset + 1]}"; + local pkgsVar="${pkgAccumVarVars[depHostOffset + 1]}"; + for depTargetOffset in "${allPlatOffsets[@]}"; + do + (( depHostOffset <= depTargetOffset )) || continue; + local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; + if [[ -z "${strictDeps-}" ]]; then + local visitedPkgs=""; + for pkg in "${pkgsBuildBuild[@]}" "${pkgsBuildHost[@]}" "${pkgsBuildTarget[@]}" "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}" "${pkgsTargetTarget[@]}"; + do + if [[ "$visitedPkgs" = *"$pkg"* ]]; then + continue; + fi; + runHook "${!hookRef}" "$pkg"; + visitedPkgs+=" $pkg"; + done; + else + local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + runHook "${!hookRef}" "$pkg"; + done; + fi; + done; + done +} +_allFlags () +{ + + export system pname name version; + while IFS='' read -r varName; do + nixTalkativeLog "@${varName}@ -> ${!varName}"; + args+=("--subst-var" "$varName"); + done < <(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }') +} +_assignFirst () +{ + + local varName="$1"; + local _var; + local REMOVE=REMOVE; + shift; + for _var in "$@"; + do + if [ -n "${!_var-}" ]; then + eval "${varName}"="${_var}"; + return; + fi; + done; + echo; + echo "error: _assignFirst: could not find a non-empty variable whose name to assign to ${varName}."; + echo " The following variables were all unset or empty:"; + echo " $*"; + if [ -z "${out:-}" ]; then + echo ' If you do not want an "out" output in your derivation, make sure to define'; + echo ' the other specific required outputs. This can be achieved by picking one'; + echo " of the above as an output."; + echo ' You do not have to remove "out" if you want to have a different default'; + echo ' output, because the first output is taken as a default.'; + echo; + fi; + return 1 +} +_callImplicitHook () +{ + + local def="$1"; + local hookName="$2"; + if declare -F "$hookName" > /dev/null; then + nixTalkativeLog "calling implicit '$hookName' function hook"; + "$hookName"; + else + if type -p "$hookName" > /dev/null; then + nixTalkativeLog "sourcing implicit '$hookName' script hook"; + source "$hookName"; + else + if [ -n "${!hookName:-}" ]; then + nixTalkativeLog "evaling implicit '$hookName' string hook"; + eval "${!hookName}"; + else + return "$def"; + fi; + fi; + fi +} +_defaultUnpack () +{ + + local fn="$1"; + local destination; + if [ -d "$fn" ]; then + destination="$(stripHash "$fn")"; + if [ -e "$destination" ]; then + echo "Cannot copy $fn to $destination: destination already exists!"; + echo "Did you specify two \"srcs\" with the same \"name\"?"; + return 1; + fi; + cp -r --preserve=timestamps --reflink=auto -- "$fn" "$destination"; + else + case "$fn" in + *.tar.xz | *.tar.lzma | *.txz) + ( XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn"; + true ) | tar xf - --mode=+w --warning=no-timestamp + ;; + *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) + tar xf "$fn" --mode=+w --warning=no-timestamp + ;; + *) + return 1 + ;; + esac; + fi +} +_doStrip () +{ + + local -ra flags=(dontStripHost dontStripTarget); + local -ra debugDirs=(stripDebugList stripDebugListTarget); + local -ra allDirs=(stripAllList stripAllListTarget); + local -ra stripCmds=(STRIP STRIP_FOR_TARGET); + local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET); + stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin Applications Library/Frameworks}; + stripDebugListTarget=${stripDebugListTarget[*]:-}; + stripAllList=${stripAllList[*]:-}; + stripAllListTarget=${stripAllListTarget[*]:-}; + local i; + for i in ${!stripCmds[@]}; + do + local -n flag="${flags[$i]}"; + local -n debugDirList="${debugDirs[$i]}"; + local -n allDirList="${allDirs[$i]}"; + local -n stripCmd="${stripCmds[$i]}"; + local -n ranlibCmd="${ranlibCmds[$i]}"; + if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null 1>&2; then + continue; + fi; + stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S -p}"; + stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s -p}"; + done +} +_eval () +{ + + if declare -F "$1" > /dev/null 2>&1; then + "$@"; + else + eval "$1"; + fi +} +_logHook () +{ + + if [[ -z ${NIX_LOG_FD-} ]]; then + return; + fi; + local hookKind="$1"; + local hookExpr="$2"; + shift 2; + if declare -F "$hookExpr" > /dev/null 2>&1; then + nixTalkativeLog "calling '$hookKind' function hook '$hookExpr'" "$@"; + else + if type -p "$hookExpr" > /dev/null; then + nixTalkativeLog "sourcing '$hookKind' script hook '$hookExpr'"; + else + if [[ "$hookExpr" != "_callImplicitHook"* ]]; then + local exprToOutput; + if [[ ${NIX_DEBUG:-0} -ge 5 ]]; then + exprToOutput="$hookExpr"; + else + local hookExprLine; + while IFS= read -r hookExprLine; do + hookExprLine="${hookExprLine#"${hookExprLine%%[![:space:]]*}"}"; + if [[ -n "$hookExprLine" ]]; then + exprToOutput+="$hookExprLine\\n "; + fi; + done <<< "$hookExpr"; + exprToOutput="${exprToOutput%%\\n }"; + fi; + nixTalkativeLog "evaling '$hookKind' string hook '$exprToOutput'"; + fi; + fi; + fi +} +_makeSymlinksRelative () +{ + + local symlinkTarget; + if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + while IFS= read -r -d '' f; do + symlinkTarget=$(readlink "$f"); + if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then + continue; + fi; + if [ ! -e "$symlinkTarget" ]; then + echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; + fi; + echo "rewriting symlink $f to be relative to $prefix"; + ln -snrf "$symlinkTarget" "$f"; + done < <(find $prefix -type l -print0) +} +_makeSymlinksRelativeInAllOutputs () +{ + + local output; + for output in $(getAllOutputNames); + do + prefix="${!output}" _makeSymlinksRelative; + done +} +_moveLib64 () +{ + + if [ "${dontMoveLib64-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then + return; + fi; + echo "moving $prefix/lib64/* to $prefix/lib"; + mkdir -p $prefix/lib; + shopt -s dotglob; + for i in $prefix/lib64/*; + do + mv --no-clobber "$i" $prefix/lib; + done; + shopt -u dotglob; + rmdir $prefix/lib64; + ln -s lib $prefix/lib64 +} +_moveSbin () +{ + + if [ "${dontMoveSbin-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then + return; + fi; + echo "moving $prefix/sbin/* to $prefix/bin"; + mkdir -p $prefix/bin; + shopt -s dotglob; + for i in $prefix/sbin/*; + do + mv "$i" $prefix/bin; + done; + shopt -u dotglob; + rmdir $prefix/sbin; + ln -s bin $prefix/sbin +} +_moveSystemdUserUnits () +{ + + if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then + return; + fi; + if [ ! -e "${prefix:?}/lib/systemd/user" ]; then + return; + fi; + local source="$prefix/lib/systemd/user"; + local target="$prefix/share/systemd/user"; + echo "moving $source/* to $target"; + mkdir -p "$target"; + ( shopt -s dotglob; + for i in "$source"/*; + do + mv "$i" "$target"; + done ); + rmdir "$source"; + ln -s "$target" "$source" +} +_moveToShare () +{ + + if [ -n "$__structuredAttrs" ]; then + if [ -z "${forceShare-}" ]; then + forceShare=(man doc info); + fi; + else + forceShare=(${forceShare:-man doc info}); + fi; + if [[ -z "$out" ]]; then + return; + fi; + for d in "${forceShare[@]}"; + do + if [ -d "$out/$d" ]; then + if [ -d "$out/share/$d" ]; then + echo "both $d/ and share/$d/ exist!"; + else + echo "moving $out/$d to $out/share/$d"; + mkdir -p $out/share; + mv $out/$d $out/share/; + fi; + fi; + done +} +_multioutConfig () +{ + + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${setOutputFlags-1}" ]; then + return; + fi; + if [ -z "${shareDocName:-}" ]; then + local confScript="${configureScript:-}"; + if [ -z "$confScript" ] && [ -x ./configure ]; then + confScript=./configure; + fi; + if [ -f "$confScript" ]; then + local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; + fi; + if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; + fi; + fi; + prependToVar configureFlags --bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin --includedir="${!outputInclude}"/include --mandir="${!outputMan}"/share/man --infodir="${!outputInfo}"/share/info --docdir="${!outputDoc}"/share/doc/"${shareDocName}" --libdir="${!outputLib}"/lib --libexecdir="${!outputLib}"/libexec --localedir="${!outputLib}"/share/locale; + prependToVar installFlags pkgconfigdir="${!outputDev}"/lib/pkgconfig m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal +} +_multioutDevs () +{ + + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${moveToDev-1}" ]; then + return; + fi; + moveToOutput include "${!outputInclude}"; + moveToOutput lib/pkgconfig "${!outputDev}"; + moveToOutput share/pkgconfig "${!outputDev}"; + moveToOutput lib/cmake "${!outputDev}"; + moveToOutput share/aclocal "${!outputDev}"; + for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; + do + echo "Patching '$f' includedir to output ${!outputInclude}"; + sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; + done +} +_multioutDocs () +{ + + local REMOVE=REMOVE; + moveToOutput share/info "${!outputInfo}"; + moveToOutput share/doc "${!outputDoc}"; + moveToOutput share/gtk-doc "${!outputDevdoc}"; + moveToOutput share/devhelp/books "${!outputDevdoc}"; + moveToOutput share/man "${!outputMan}"; + moveToOutput share/man/man3 "${!outputDevman}" +} +_multioutPropagateDev () +{ + + if [ "$(getAllOutputNames)" = "out" ]; then + return; + fi; + local outputFirst; + for outputFirst in $(getAllOutputNames); + do + break; + done; + local propagaterOutput="$outputDev"; + if [ -z "$propagaterOutput" ]; then + propagaterOutput="$outputFirst"; + fi; + if [ -z "${propagatedBuildOutputs+1}" ]; then + local po_dirty="$outputBin $outputInclude $outputLib"; + set +o pipefail; + propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; + set -o pipefail; + fi; + if [ -z "$propagatedBuildOutputs" ]; then + return; + fi; + mkdir -p "${!propagaterOutput}"/nix-support; + for output in $propagatedBuildOutputs; + do + echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; + done +} +_nixLogWithLevel () +{ + + [[ -z ${NIX_LOG_FD-} || ${NIX_DEBUG:-0} -lt ${1:?} ]] && return 0; + local logLevel; + case "${1:?}" in + 0) + logLevel=ERROR + ;; + 1) + logLevel=WARN + ;; + 2) + logLevel=NOTICE + ;; + 3) + logLevel=INFO + ;; + 4) + logLevel=TALKATIVE + ;; + 5) + logLevel=CHATTY + ;; + 6) + logLevel=DEBUG + ;; + 7) + logLevel=VOMIT + ;; + *) + echo "_nixLogWithLevel: called with invalid log level: ${1:?}" >&"$NIX_LOG_FD"; + return 1 + ;; + esac; + local callerName="${FUNCNAME[2]}"; + if [[ $callerName == "_callImplicitHook" ]]; then + callerName="${hookName:?}"; + fi; + printf "%s: %s: %s\n" "$logLevel" "$callerName" "${2:?}" >&"$NIX_LOG_FD" +} +_overrideFirst () +{ + + if [ -z "${!1-}" ]; then + _assignFirst "$@"; + fi +} +_pruneLibtoolFiles () +{ + + if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \; +} +_updateSourceDateEpochFromSourceRoot () +{ + + if [ -n "$sourceRoot" ]; then + updateSourceDateEpoch "$sourceRoot"; + fi +} +activatePackage () +{ + + local pkg="$1"; + local -r hostOffset="$2"; + local -r targetOffset="$3"; + (( hostOffset <= targetOffset )) || exit 1; + if [ -f "$pkg" ]; then + nixTalkativeLog "sourcing setup hook '$pkg'"; + source "$pkg"; + fi; + if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then + addToSearchPath _PATH "$pkg/bin"; + fi; + if (( hostOffset <= -1 )); then + addToSearchPath _XDG_DATA_DIRS "$pkg/share"; + fi; + if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then + addToSearchPath _HOST_PATH "$pkg/bin"; + fi; + if [[ -f "$pkg/nix-support/setup-hook" ]]; then + nixTalkativeLog "sourcing setup hook '$pkg/nix-support/setup-hook'"; + source "$pkg/nix-support/setup-hook"; + fi +} +addEnvHooks () +{ + + local depHostOffset="$1"; + shift; + local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; + local pkgHookVar; + for pkgHookVar in "${!pkgHookVarsSlice}"; + do + eval "${pkgHookVar}s"'+=("$@")'; + done +} +addToSearchPath () +{ + + addToSearchPathWithCustomDelimiter ":" "$@" +} +addToSearchPathWithCustomDelimiter () +{ + + local delimiter="$1"; + local varName="$2"; + local dir="$3"; + if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" != *"${delimiter}${dir}${delimiter}"* ]]; then + export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; + fi +} +appendToVar () +{ + + local -n nameref="$1"; + local useArray type; + if [ -n "$__structuredAttrs" ]; then + useArray=true; + else + useArray=false; + fi; + if type=$(declare -p "$1" 2> /dev/null); then + case "${type#* }" in + -A*) + echo "appendToVar(): ERROR: trying to use appendToVar on an associative array, use variable+=([\"X\"]=\"Y\") instead." 1>&2; + return 1 + ;; + -a*) + useArray=true + ;; + *) + useArray=false + ;; + esac; + fi; + shift; + if $useArray; then + nameref=(${nameref+"${nameref[@]}"} "$@"); + else + nameref="${nameref-} $*"; + fi +} +auditTmpdir () +{ + + local dir="$1"; + [ -e "$dir" ] || return 0; + echo "checking for references to $TMPDIR/ in $dir..."; + local tmpdir elf_fifo script_fifo; + tmpdir="$(mktemp -d)"; + elf_fifo="$tmpdir/elf"; + script_fifo="$tmpdir/script"; + mkfifo "$elf_fifo" "$script_fifo"; + ( find "$dir" -type f -not -path '*/.build-id/*' -print0 | while IFS= read -r -d '' file; do + if isELF "$file"; then + printf '%s\0' "$file" 1>&3; + else + if isScript "$file"; then + filename=${file##*/}; + dir=${file%/*}; + if [ -e "$dir/.$filename-wrapped" ]; then + printf '%s\0' "$file" 1>&4; + fi; + fi; + fi; + done; + exec 3>&- 4>&- ) 3> "$elf_fifo" 4> "$script_fifo" & ( xargs -0 -r -P "$NIX_BUILD_CORES" -n 1 sh -c ' + if { printf :; patchelf --print-rpath "$1"; } | grep -q -F ":$TMPDIR/"; then + echo "RPATH of binary $1 contains a forbidden reference to $TMPDIR/" + exit 1 + fi + ' _ < "$elf_fifo" ) & local pid_elf=$!; + local pid_script; + ( xargs -0 -r -P "$NIX_BUILD_CORES" -n 1 sh -c ' + if grep -q -F "$TMPDIR/" "$1"; then + echo "wrapper script $1 contains a forbidden reference to $TMPDIR/" + exit 1 + fi + ' _ < "$script_fifo" ) & local pid_script=$!; + wait "$pid_elf" || { + echo "Some binaries contain forbidden references to $TMPDIR/. Check the error above!"; + exit 1 + }; + wait "$pid_script" || { + echo "Some scripts contain forbidden references to $TMPDIR/. Check the error above!"; + exit 1 + }; + rm -r "$tmpdir" +} +bintoolsWrapper_addLDVars () +{ + + local role_post; + getHostRoleEnvHook; + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then + export NIX_LDFLAGS${role_post}+=" -L$1/lib64"; + fi; + if [[ -d "$1/lib" ]]; then + local -a glob=($1/lib/lib*); + if [ "${#glob[*]}" -gt 0 ]; then + export NIX_LDFLAGS${role_post}+=" -L$1/lib"; + fi; + fi +} +buildPhase () +{ + + runHook preBuild; + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile or custom buildPhase, doing nothing"; + else + foundMakefile=1; + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray; + echoCmd 'build flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postBuild +} +ccWrapper_addCVars () +{ + + local role_post; + getHostRoleEnvHook; + local found=; + if [ -d "$1/include" ]; then + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include"; + found=1; + fi; + if [ -d "$1/Library/Frameworks" ]; then + export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks"; + found=1; + fi; + if [[ -n "" && -n ${NIX_STORE:-} && -n $found ]]; then + local scrubbed="$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${1#"$NIX_STORE"/*-}"; + export NIX_CFLAGS_COMPILE${role_post}+=" -fmacro-prefix-map=$1=$scrubbed"; + fi +} +checkPhase () +{ + + runHook preCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom checkPhase, doing nothing"; + runHook postCheck; + return; + fi; + if [[ -z "${checkTarget:-}" ]]; then + if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then + checkTarget="check"; + else + if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then + checkTarget="test"; + fi; + fi; + fi; + if [[ -z "${checkTarget:-}" ]]; then + echo "no check/test target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget; + echoCmd 'check flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postCheck +} +compressManPages () +{ + + local dir="$1"; + if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then + return; + fi; + echo "gzipping man pages under $dir/share/man/"; + find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | xargs -0 -n1 -P "$NIX_BUILD_CORES" gzip -n -f; + find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | sort -z | while IFS= read -r -d '' f; do + local target; + target="$(readlink -f "$f")"; + if [ -f "$target".gz ]; then + ln -sf "$target".gz "$f".gz && rm "$f"; + fi; + done +} +concatStringsSep () +{ + + local sep="$1"; + local name="$2"; + local type oldifs; + if type=$(declare -p "$name" 2> /dev/null); then + local -n nameref="$name"; + case "${type#* }" in + -A*) + echo "concatStringsSep(): ERROR: trying to use concatStringsSep on an associative array." 1>&2; + return 1 + ;; + -a*) + local IFS="$(printf '\036')" + ;; + *) + local IFS=" " + ;; + esac; + local ifs_separated="${nameref[*]}"; + echo -n "${ifs_separated//"$IFS"/"$sep"}"; + fi +} +concatTo () +{ + + local -; + set -o noglob; + local -n targetref="$1"; + shift; + local arg default name type; + for arg in "$@"; + do + IFS="=" read -r name default <<< "$arg"; + local -n nameref="$name"; + if [[ -z "${nameref[*]}" && -n "$default" ]]; then + targetref+=("$default"); + else + if type=$(declare -p "$name" 2> /dev/null); then + case "${type#* }" in + -A*) + echo "concatTo(): ERROR: trying to use concatTo on an associative array." 1>&2; + return 1 + ;; + -a*) + targetref+=("${nameref[@]}") + ;; + *) + if [[ "$name" = *"Array" ]]; then + nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future"; + targetref+=(${nameref+"${nameref[@]}"}); + else + targetref+=(${nameref-}); + fi + ;; + esac; + fi; + fi; + done +} +configurePhase () +{ + + runHook preConfigure; + : "${configureScript=}"; + if [[ -z "$configureScript" && -x ./configure ]]; then + configureScript=./configure; + fi; + if [ -z "${dontFixLibtool:-}" ]; then + export lt_cv_deplibs_check_method="${lt_cv_deplibs_check_method-pass_all}"; + local i; + find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do + echo "fixing libtool script $i"; + fixLibtool "$i"; + done; + CONFIGURE_MTIME_REFERENCE=$(mktemp configure.mtime.reference.XXXXXX); + find . -executable -type f -name configure -exec grep -l 'GNU Libtool is free software; you can redistribute it and/or modify' {} \; -exec touch -r {} "$CONFIGURE_MTIME_REFERENCE" \; -exec sed -i s_/usr/bin/file_file_g {} \; -exec touch -r "$CONFIGURE_MTIME_REFERENCE" {} \;; + rm -f "$CONFIGURE_MTIME_REFERENCE"; + fi; + if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then + prependToVar configureFlags "${prefixKey:---prefix=}$prefix"; + fi; + if [[ -f "$configureScript" ]]; then + if [ -z "${dontAddDisableDepTrack:-}" ]; then + if grep -q dependency-tracking "$configureScript"; then + prependToVar configureFlags --disable-dependency-tracking; + fi; + fi; + if [ -z "${dontDisableStatic:-}" ]; then + if grep -q enable-static "$configureScript"; then + prependToVar configureFlags --disable-static; + fi; + fi; + if [ -z "${dontPatchShebangsInConfigure:-}" ]; then + patchShebangs --build "$configureScript"; + fi; + fi; + if [ -n "$configureScript" ]; then + local -a flagsArray; + concatTo flagsArray configureFlags configureFlagsArray; + echoCmd 'configure flags' "${flagsArray[@]}"; + $configureScript "${flagsArray[@]}"; + unset flagsArray; + else + echo "no configure script, doing nothing"; + fi; + runHook postConfigure +} +consumeEntire () +{ + + if IFS='' read -r -d '' "$1"; then + echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; + return 1; + fi +} +distPhase () +{ + + runHook preDist; + local flagsArray=(); + concatTo flagsArray distFlags distFlagsArray distTarget=dist; + echo 'dist flags: %q' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + if [ "${dontCopyDist:-0}" != 1 ]; then + mkdir -p "$out/tarballs"; + cp -pvd ${tarballs[*]:-*.tar.gz} "$out/tarballs"; + fi; + runHook postDist +} +dumpVars () +{ + + if [[ "${noDumpEnvVars:-0}" != 1 && -d "$NIX_BUILD_TOP" ]]; then + local old_umask; + old_umask=$(umask); + umask 0077; + export 2> /dev/null > "$NIX_BUILD_TOP/env-vars"; + umask "$old_umask"; + fi +} +echoCmd () +{ + + printf "%s:" "$1"; + shift; + printf ' %q' "$@"; + echo +} +exitHandler () +{ + + exitCode="$?"; + set +e; + if [ -n "${showBuildStats:-}" ]; then + read -r -d '' -a buildTimes < <(times); + echo "build times:"; + echo "user time for the shell ${buildTimes[0]}"; + echo "system time for the shell ${buildTimes[1]}"; + echo "user time for all child processes ${buildTimes[2]}"; + echo "system time for all child processes ${buildTimes[3]}"; + fi; + if (( "$exitCode" != 0 )); then + runHook failureHook; + if [ -n "${succeedOnFailure:-}" ]; then + echo "build failed with exit code $exitCode (ignored)"; + mkdir -p "$out/nix-support"; + printf "%s" "$exitCode" > "$out/nix-support/failed"; + exit 0; + fi; + else + runHook exitHook; + fi; + return "$exitCode" +} +findInputs () +{ + + local -r pkg="$1"; + local -r hostOffset="$2"; + local -r targetOffset="$3"; + (( hostOffset <= targetOffset )) || exit 1; + local varVar="${pkgAccumVarVars[hostOffset + 1]}"; + local varRef="$varVar[$((targetOffset - hostOffset))]"; + local var="${!varRef}"; + unset -v varVar varRef; + local varSlice="$var[*]"; + case " ${!varSlice-} " in + *" $pkg "*) + return 0 + ;; + esac; + unset -v varSlice; + eval "$var"'+=("$pkg")'; + if ! [ -e "$pkg" ]; then + echo "build input $pkg does not exist" 1>&2; + exit 1; + fi; + function mapOffset () + { + local -r inputOffset="$1"; + local -n outputOffset="$2"; + if (( inputOffset <= 0 )); then + outputOffset=$((inputOffset + hostOffset)); + else + outputOffset=$((inputOffset - 1 + targetOffset)); + fi + }; + local relHostOffset; + for relHostOffset in "${allPlatOffsets[@]}"; + do + local files="${propagatedDepFilesVars[relHostOffset + 1]}"; + local hostOffsetNext; + mapOffset "$relHostOffset" hostOffsetNext; + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; + local relTargetOffset; + for relTargetOffset in "${allPlatOffsets[@]}"; + do + (( "$relHostOffset" <= "$relTargetOffset" )) || continue; + local fileRef="${files}[$relTargetOffset - $relHostOffset]"; + local file="${!fileRef}"; + unset -v fileRef; + local targetOffsetNext; + mapOffset "$relTargetOffset" targetOffsetNext; + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; + [[ -f "$pkg/nix-support/$file" ]] || continue; + local pkgNext; + read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; + for pkgNext in $pkgNext; + do + findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; + done; + done; + done +} +fixLibtool () +{ + + local search_path; + for flag in $NIX_LDFLAGS; + do + case $flag in + -L*) + search_path+=" ${flag#-L}" + ;; + esac; + done; + sed -i "$1" -e "s^eval \(sys_lib_search_path=\).*^\1'${search_path:-}'^" -e 's^eval sys_lib_.+search_path=.*^^' +} +fixupPhase () +{ + + local output; + for output in $(getAllOutputNames); + do + if [ -e "${!output}" ]; then + chmod -R u+w,u-s,g-s "${!output}"; + fi; + done; + runHook preFixup; + local output; + for output in $(getAllOutputNames); + do + prefix="${!output}" runHook fixupOutput; + done; + recordPropagatedDependencies; + if [ -n "${setupHook:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; + fi; + if [ -n "${setupHooks:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + local hook; + for hook in ${setupHooks[@]}; + do + local content; + consumeEntire content < "$hook"; + substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; + unset -v content; + done; + unset -v hook; + fi; + if [ -n "${propagatedUserEnvPkgs[*]:-}" ]; then + mkdir -p "${!outputBin}/nix-support"; + printWords "${propagatedUserEnvPkgs[@]}" > "${!outputBin}/nix-support/propagated-user-env-packages"; + fi; + runHook postFixup +} +genericBuild () +{ + + export GZIP_NO_TIMESTAMPS=1; + if [ -f "${buildCommandPath:-}" ]; then + source "$buildCommandPath"; + return; + fi; + if [ -n "${buildCommand:-}" ]; then + eval "$buildCommand"; + return; + fi; + if [ -z "${phases[*]:-}" ]; then + phases="${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} configurePhase ${preBuildPhases[*]:-} buildPhase checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}"; + fi; + for curPhase in ${phases[*]}; + do + runPhase "$curPhase"; + done +} +getAllOutputNames () +{ + + if [ -n "$__structuredAttrs" ]; then + echo "${!outputs[*]}"; + else + echo "$outputs"; + fi +} +getHostRole () +{ + + getRole "$hostOffset" +} +getHostRoleEnvHook () +{ + + getRole "$depHostOffset" +} +getRole () +{ + + case $1 in + -1) + role_post='_FOR_BUILD' + ;; + 0) + role_post='' + ;; + 1) + role_post='_FOR_TARGET' + ;; + *) + echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2; + return 1 + ;; + esac +} +getTargetRole () +{ + + getRole "$targetOffset" +} +getTargetRoleEnvHook () +{ + + getRole "$depTargetOffset" +} +getTargetRoleWrapper () +{ + + case $targetOffset in + -1) + export NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_unknown_linux_gnu=1 + ;; + 0) + export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 + ;; + 1) + export NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu=1 + ;; + *) + echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2; + return 1 + ;; + esac +} +installCheckPhase () +{ + + runHook preInstallCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom installCheckPhase, doing nothing"; + else + if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} "${installCheckTarget:-installcheck}" > /dev/null 2>&1; then + echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray installCheckFlags installCheckFlagsArray installCheckTarget=installcheck; + echoCmd 'installcheck flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + fi; + runHook postInstallCheck +} +installPhase () +{ + + runHook preInstall; + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile or custom installPhase, doing nothing"; + runHook postInstall; + return; + else + foundMakefile=1; + fi; + if [ -n "$prefix" ]; then + mkdir -p "$prefix"; + fi; + local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install; + echoCmd 'install flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + runHook postInstall +} +isELF () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + LANG=C read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [ "$magic" = 'ELF' ]; then + return 0; + else + return 1; + fi +} +isMachO () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + LANG=C read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xcf") || "$magic" = $(echo -ne "\xcf\xfa\xed\xfe") ]]; then + return 0; + else + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xce") || "$magic" = $(echo -ne "\xce\xfa\xed\xfe") ]]; then + return 0; + else + if [[ "$magic" = $(echo -ne "\xca\xfe\xba\xbe") || "$magic" = $(echo -ne "\xbe\xba\xfe\xca") ]]; then + return 0; + else + return 1; + fi; + fi; + fi +} +isScript () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + LANG=C read -r -n 2 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" =~ \#! ]]; then + return 0; + else + return 1; + fi +} +mapOffset () +{ + + local -r inputOffset="$1"; + local -n outputOffset="$2"; + if (( inputOffset <= 0 )); then + outputOffset=$((inputOffset + hostOffset)); + else + outputOffset=$((inputOffset - 1 + targetOffset)); + fi +} +moveToOutput () +{ + + local patt="$1"; + local dstOut="$2"; + local output; + for output in $(getAllOutputNames); + do + if [ "${!output}" = "$dstOut" ]; then + continue; + fi; + local srcPath; + for srcPath in "${!output}"/$patt; + do + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then + continue; + fi; + if [ "$dstOut" = REMOVE ]; then + echo "Removing $srcPath"; + rm -r "$srcPath"; + else + local dstPath="$dstOut${srcPath#${!output}}"; + echo "Moving $srcPath to $dstPath"; + if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then + rmdir "$srcPath" --ignore-fail-on-non-empty; + if [ -d "$srcPath" ]; then + mv -t "$dstPath" "$srcPath"/*; + rmdir "$srcPath"; + fi; + else + mkdir -p "$(readlink -m "$dstPath/..")"; + mv "$srcPath" "$dstPath"; + fi; + fi; + local srcParent="$(readlink -m "$srcPath/..")"; + if [ -n "$(find "$srcParent" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then + echo "Removing empty $srcParent/ and (possibly) its parents"; + rmdir -p --ignore-fail-on-non-empty "$srcParent" 2> /dev/null || true; + fi; + done; + done +} +nixChattyLog () +{ + + _nixLogWithLevel 5 "$*" +} +nixDebugLog () +{ + + _nixLogWithLevel 6 "$*" +} +nixErrorLog () +{ + + _nixLogWithLevel 0 "$*" +} +nixInfoLog () +{ + + _nixLogWithLevel 3 "$*" +} +nixLog () +{ + + [[ -z ${NIX_LOG_FD-} ]] && return 0; + local callerName="${FUNCNAME[1]}"; + if [[ $callerName == "_callImplicitHook" ]]; then + callerName="${hookName:?}"; + fi; + printf "%s: %s\n" "$callerName" "$*" >&"$NIX_LOG_FD" +} +nixNoticeLog () +{ + + _nixLogWithLevel 2 "$*" +} +nixTalkativeLog () +{ + + _nixLogWithLevel 4 "$*" +} +nixVomitLog () +{ + + _nixLogWithLevel 7 "$*" +} +nixWarnLog () +{ + + _nixLogWithLevel 1 "$*" +} +noBrokenSymlinks () +{ + + local -r output="${1:?}"; + local path; + local pathParent; + local symlinkTarget; + local -i numDanglingSymlinks=0; + local -i numReflexiveSymlinks=0; + local -i numUnreadableSymlinks=0; + if [[ ! -e $output ]]; then + nixWarnLog "skipping non-existent output $output"; + return 0; + fi; + nixInfoLog "running on $output"; + while IFS= read -r -d '' path; do + pathParent="$(dirname "$path")"; + if ! symlinkTarget="$(readlink "$path")"; then + nixErrorLog "the symlink $path is unreadable"; + numUnreadableSymlinks+=1; + continue; + fi; + if [[ $symlinkTarget == /* ]]; then + nixInfoLog "symlink $path points to absolute target $symlinkTarget"; + else + nixInfoLog "symlink $path points to relative target $symlinkTarget"; + symlinkTarget="$(realpath --no-symlinks --canonicalize-missing "$pathParent/$symlinkTarget")"; + fi; + if [[ $symlinkTarget = "$TMPDIR"/* ]]; then + nixErrorLog "the symlink $path points to $TMPDIR directory: $symlinkTarget"; + numDanglingSymlinks+=1; + continue; + fi; + if [[ $symlinkTarget != "$NIX_STORE"/* ]]; then + nixInfoLog "symlink $path points outside the Nix store; ignoring"; + continue; + fi; + if [[ $path == "$symlinkTarget" ]]; then + nixErrorLog "the symlink $path is reflexive"; + numReflexiveSymlinks+=1; + else + if [[ ! -e $symlinkTarget ]]; then + nixErrorLog "the symlink $path points to a missing target: $symlinkTarget"; + numDanglingSymlinks+=1; + else + nixDebugLog "the symlink $path is irreflexive and points to a target which exists"; + fi; + fi; + done < <(find "$output" -type l -print0); + if ((numDanglingSymlinks > 0 || numReflexiveSymlinks > 0 || numUnreadableSymlinks > 0)); then + nixErrorLog "found $numDanglingSymlinks dangling symlinks, $numReflexiveSymlinks reflexive symlinks and $numUnreadableSymlinks unreadable symlinks"; + exit 1; + fi; + return 0 +} +noBrokenSymlinksInAllOutputs () +{ + + if [[ -z ${dontCheckForBrokenSymlinks-} ]]; then + for output in $(getAllOutputNames); + do + noBrokenSymlinks "${!output}"; + done; + fi +} +patchELF () +{ + + local dir="$1"; + [ -e "$dir" ] || return 0; + echo "shrinking RPATHs of ELF executables and libraries in $dir"; + local i; + while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if ! isELF "$i"; then + continue; + fi; + echo "shrinking $i"; + patchelf --shrink-rpath "$i" || true; + done < <(find "$dir" -type f -print0) +} +patchPhase () +{ + + runHook prePatch; + local -a patchesArray; + concatTo patchesArray patches; + local -a flagsArray; + concatTo flagsArray patchFlags=-p1; + for i in "${patchesArray[@]}"; + do + echo "applying patch $i"; + local uncompress=cat; + case "$i" in + *.gz) + uncompress="gzip -d" + ;; + *.bz2) + uncompress="bzip2 -d" + ;; + *.xz) + uncompress="xz -d" + ;; + *.lzma) + uncompress="lzma -d" + ;; + esac; + $uncompress < "$i" 2>&1 | patch "${flagsArray[@]}"; + done; + runHook postPatch +} +patchShebangs () +{ + + local pathName; + local update=false; + while [[ $# -gt 0 ]]; do + case "$1" in + --host) + pathName=HOST_PATH; + shift + ;; + --build) + pathName=PATH; + shift + ;; + --update) + update=true; + shift + ;; + --) + shift; + break + ;; + -* | --*) + echo "Unknown option $1 supplied to patchShebangs" 1>&2; + return 1 + ;; + *) + break + ;; + esac; + done; + echo "patching script interpreter paths in $@"; + local f; + local oldPath; + local newPath; + local arg0; + local args; + local oldInterpreterLine; + local newInterpreterLine; + if [[ $# -eq 0 ]]; then + echo "No arguments supplied to patchShebangs" 1>&2; + return 0; + fi; + local f; + while IFS= read -r -d '' f; do + isScript "$f" || continue; + read -r oldInterpreterLine < "$f" || [ "$oldInterpreterLine" ]; + read -r oldPath arg0 args <<< "${oldInterpreterLine:2}"; + if [[ -z "${pathName:-}" ]]; then + if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then + pathName=HOST_PATH; + else + pathName=PATH; + fi; + fi; + if [[ "$oldPath" == *"/bin/env" ]]; then + if [[ $arg0 == "-S" ]]; then + arg0=${args%% *}; + [[ "$args" == *" "* ]] && args=${args#* } || args=; + newPath="$(PATH="${!pathName}" type -P "env" || true)"; + args="-S $(PATH="${!pathName}" type -P "$arg0" || true) $args"; + else + if [[ $arg0 == "-"* || $arg0 == *"="* ]]; then + echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" 1>&2; + exit 1; + else + newPath="$(PATH="${!pathName}" type -P "$arg0" || true)"; + fi; + fi; + else + if [[ -z $oldPath ]]; then + oldPath="/bin/sh"; + fi; + newPath="$(PATH="${!pathName}" type -P "$(basename "$oldPath")" || true)"; + args="$arg0 $args"; + fi; + newInterpreterLine="$newPath $args"; + newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}; + if [[ -n "$oldPath" && ( "$update" == true || "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ) ]]; then + if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then + echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; + escapedInterpreterLine=${newInterpreterLine//\\/\\\\}; + timestamp=$(stat --printf "%y" "$f"); + tmpFile=$(mktemp -t patchShebangs.XXXXXXXXXX); + sed -e "1 s|.*|#\!$escapedInterpreterLine|" "$f" > "$tmpFile"; + local restoreReadOnly; + if [[ ! -w "$f" ]]; then + chmod +w "$f"; + restoreReadOnly=true; + fi; + cat "$tmpFile" > "$f"; + rm "$tmpFile"; + if [[ -n "${restoreReadOnly:-}" ]]; then + chmod -w "$f"; + fi; + touch --date "$timestamp" "$f"; + fi; + fi; + done < <(find "$@" -type f -perm -0100 -print0) +} +patchShebangsAuto () +{ + + if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then + if [[ "$output" != out && "$output" = "$outputDev" ]]; then + patchShebangs --build "$prefix"; + else + patchShebangs --host "$prefix"; + fi; + fi +} +prependToVar () +{ + + local -n nameref="$1"; + local useArray type; + if [ -n "$__structuredAttrs" ]; then + useArray=true; + else + useArray=false; + fi; + if type=$(declare -p "$1" 2> /dev/null); then + case "${type#* }" in + -A*) + echo "prependToVar(): ERROR: trying to use prependToVar on an associative array." 1>&2; + return 1 + ;; + -a*) + useArray=true + ;; + *) + useArray=false + ;; + esac; + fi; + shift; + if $useArray; then + nameref=("$@" ${nameref+"${nameref[@]}"}); + else + nameref="$* ${nameref-}"; + fi +} +printLines () +{ + + (( "$#" > 0 )) || return 0; + printf '%s\n' "$@" +} +printWords () +{ + + (( "$#" > 0 )) || return 0; + printf '%s ' "$@" +} +recordPropagatedDependencies () +{ + + declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); + declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); + local propagatedInputsIndex; + for propagatedInputsIndex in "${!flatVars[@]}"; + do + local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; + local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; + [[ -n "${!propagatedInputsSlice}" ]] || continue; + mkdir -p "${!outputDev}/nix-support"; + printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; + done +} +runHook () +{ + + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook; + for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + _logHook "$hookName" "$hook" "$@"; + _eval "$hook" "$@"; + done; + return 0 +} +runOneHook () +{ + + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook ret=1; + for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + _logHook "$hookName" "$hook" "$@"; + if _eval "$hook" "$@"; then + ret=0; + break; + fi; + done; + return "$ret" +} +runPhase () +{ + + local curPhase="$*"; + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then + return; + fi; + if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then + return; + fi; + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then + return; + fi; + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then + return; + fi; + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then + return; + fi; + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then + return; + fi; + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then + return; + fi; + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then + return; + fi; + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then + return; + fi; + showPhaseHeader "$curPhase"; + dumpVars; + local startTime endTime; + startTime=$(date +"%s"); + eval "${!curPhase:-$curPhase}"; + endTime=$(date +"%s"); + showPhaseFooter "$curPhase" "$startTime" "$endTime"; + if [ "$curPhase" = unpackPhase ]; then + [ -n "${sourceRoot:-}" ] && chmod +x -- "${sourceRoot}"; + cd -- "${sourceRoot:-.}"; + fi +} +showPhaseFooter () +{ + + local phase="$1"; + local startTime="$2"; + local endTime="$3"; + local delta=$(( endTime - startTime )); + (( delta < 30 )) && return; + local H=$((delta/3600)); + local M=$((delta%3600/60)); + local S=$((delta%60)); + echo -n "$phase completed in "; + (( H > 0 )) && echo -n "$H hours "; + (( M > 0 )) && echo -n "$M minutes "; + echo "$S seconds" +} +showPhaseHeader () +{ + + local phase="$1"; + echo "Running phase: $phase"; + if [[ -z ${NIX_LOG_FD-} ]]; then + return; + fi; + printf "@nix { \"action\": \"setPhase\", \"phase\": \"%s\" }\n" "$phase" >&"$NIX_LOG_FD" +} +stripDirs () +{ + + local cmd="$1"; + local ranlibCmd="$2"; + local paths="$3"; + local stripFlags="$4"; + local excludeFlags=(); + local pathsNew=; + [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1; + [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1; + local pattern; + if [ -n "${stripExclude:-}" ]; then + for pattern in "${stripExclude[@]}"; + do + excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')'); + done; + fi; + local p; + for p in ${paths}; + do + if [ -e "$prefix/$p" ]; then + pathsNew="${pathsNew} $prefix/$p"; + fi; + done; + paths=${pathsNew}; + if [ -n "${paths}" ]; then + echo "stripping (with command $cmd and flags $stripFlags) in $paths"; + local striperr; + striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')"; + find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -printf '%D-%i,%p\0' | sort -t, -k1,1 -u -z | cut -d, -f2- -z | xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2> "$striperr" || exit_code=$?; + [[ "$exit_code" = 123 || -z "$exit_code" ]] || ( cat "$striperr" 1>&2 && exit 1 ); + rm "$striperr"; + find $paths -name '*.a' -type f -exec $ranlibCmd '{}' \; 2> /dev/null; + fi +} +stripHash () +{ + + local strippedName casematchOpt=0; + strippedName="$(basename -- "$1")"; + shopt -q nocasematch && casematchOpt=1; + shopt -u nocasematch; + if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then + echo "${strippedName:33}"; + else + echo "$strippedName"; + fi; + if (( casematchOpt )); then + shopt -s nocasematch; + fi +} +substitute () +{ + + local input="$1"; + local output="$2"; + shift 2; + if [ ! -f "$input" ]; then + echo "substitute(): ERROR: file '$input' does not exist" 1>&2; + return 1; + fi; + local content; + consumeEntire content < "$input"; + if [ -e "$output" ]; then + chmod +w "$output"; + fi; + substituteStream content "file '$input'" "$@" > "$output" +} +substituteAll () +{ + + local input="$1"; + local output="$2"; + local -a args=(); + _allFlags; + substitute "$input" "$output" "${args[@]}" +} +substituteAllInPlace () +{ + + local fileName="$1"; + shift; + substituteAll "$fileName" "$fileName" "$@" +} +substituteAllStream () +{ + + local -a args=(); + _allFlags; + substituteStream "$1" "$2" "${args[@]}" +} +substituteInPlace () +{ + + local -a fileNames=(); + for arg in "$@"; + do + if [[ "$arg" = "--"* ]]; then + break; + fi; + fileNames+=("$arg"); + shift; + done; + if ! [[ "${#fileNames[@]}" -gt 0 ]]; then + echo "substituteInPlace called without any files to operate on (files must come before options!)" 1>&2; + return 1; + fi; + for file in "${fileNames[@]}"; + do + substitute "$file" "$file" "$@"; + done +} +substituteStream () +{ + + local var=$1; + local description=$2; + shift 2; + while (( "$#" )); do + local replace_mode="$1"; + case "$1" in + --replace) + if ! "$_substituteStream_has_warned_replace_deprecation"; then + echo "substituteStream() in derivation $name: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" 1>&2; + _substituteStream_has_warned_replace_deprecation=true; + fi; + replace_mode='--replace-warn' + ;& + --replace-quiet | --replace-warn | --replace-fail) + pattern="$2"; + replacement="$3"; + shift 3; + if ! [[ "${!var}" == *"$pattern"* ]]; then + if [ "$replace_mode" == --replace-warn ]; then + printf "substituteStream() in derivation $name: WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; + else + if [ "$replace_mode" == --replace-fail ]; then + printf "substituteStream() in derivation $name: ERROR: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; + return 1; + fi; + fi; + fi; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' + ;; + --subst-var) + local varName="$2"; + shift 2; + if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then + echo "substituteStream() in derivation $name: ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; + return 1; + fi; + if [ -z ${!varName+x} ]; then + echo "substituteStream() in derivation $name: ERROR: variable \$$varName is unset" 1>&2; + return 1; + fi; + pattern="@$varName@"; + replacement="${!varName}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' + ;; + --subst-var-by) + pattern="@$2@"; + replacement="$3"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + shift 3 + ;; + *) + echo "substituteStream() in derivation $name: ERROR: Invalid command line argument: $1" 1>&2; + return 1 + ;; + esac; + done; + printf "%s" "${!var}" +} +unpackFile () +{ + + curSrc="$1"; + echo "unpacking source archive $curSrc"; + if ! runOneHook unpackCmd "$curSrc"; then + echo "do not know how to unpack source archive $curSrc"; + exit 1; + fi +} +unpackPhase () +{ + + runHook preUnpack; + if [ -z "${srcs:-}" ]; then + if [ -z "${src:-}" ]; then + echo 'variable $src or $srcs should point to the source'; + exit 1; + fi; + srcs="$src"; + fi; + local -a srcsArray; + concatTo srcsArray srcs; + local dirsBefore=""; + for i in *; + do + if [ -d "$i" ]; then + dirsBefore="$dirsBefore $i "; + fi; + done; + for i in "${srcsArray[@]}"; + do + unpackFile "$i"; + done; + : "${sourceRoot=}"; + if [ -n "${setSourceRoot:-}" ]; then + runOneHook setSourceRoot; + else + if [ -z "$sourceRoot" ]; then + for i in *; + do + if [ -d "$i" ]; then + case $dirsBefore in + *\ $i\ *) + + ;; + *) + if [ -n "$sourceRoot" ]; then + echo "unpacker produced multiple directories"; + exit 1; + fi; + sourceRoot="$i" + ;; + esac; + fi; + done; + fi; + fi; + if [ -z "$sourceRoot" ]; then + echo "unpacker appears to have produced no directories"; + exit 1; + fi; + echo "source root is $sourceRoot"; + if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then + chmod -R u+w -- "$sourceRoot"; + fi; + runHook postUnpack +} +updateAutotoolsGnuConfigScriptsPhase () +{ + + if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then + return; + fi; + for script in config.sub config.guess; + do + for f in $(find . -type f -name "$script"); + do + echo "Updating Autotools / GNU config script to a newer upstream version: $f"; + cp -f "/nix/store/1kzclixw4c13wxin0b6cij1zykvwp0wb-gnu-config-2024-01-01/$script" "$f"; + done; + done +} +updateSourceDateEpoch () +{ + + local path="$1"; + [[ $path == -* ]] && path="./$path"; + local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ "%p"\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1)); + local time="${res[0]//\.[0-9]*/}"; + local newestFile="${res[1]}"; + if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then + echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; + export SOURCE_DATE_EPOCH="$time"; + local now="$(date +%s)"; + if [ "$time" -gt $((now - 60)) ]; then + echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; + fi; + fi +} +PATH="$PATH${nix_saved_PATH:+:$nix_saved_PATH}" +XDG_DATA_DIRS="$XDG_DATA_DIRS${nix_saved_XDG_DATA_DIRS:+:$nix_saved_XDG_DATA_DIRS}" +export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)" +export TMP="$NIX_BUILD_TOP" +export TMPDIR="$NIX_BUILD_TOP" +export TEMP="$NIX_BUILD_TOP" +export TEMPDIR="$NIX_BUILD_TOP" +eval "${shellHook:-}" diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/1-input.txt b/1-input.txt new file mode 100644 index 0000000..1dbed30 --- /dev/null +++ b/1-input.txt @@ -0,0 +1,4432 @@ +L29 +R49 +L41 +R37 +L13 +L2 +R2 +L42 +L50 +R35 +L43 +L39 +L35 +R5 +L18 +R11 +R42 +R25 +R24 +L17 +R1 +R26 +L48 +R6 +R23 +R1 +R5 +R24 +R35 +R44 +R17 +L6 +R31 +L48 +R22 +L34 +R33 +R35 +L13 +L28 +L45 +L24 +R41 +R12 +R18 +R40 +L18 +L41 +L3 +R43 +R98 +R31 +L72 +L47 +L62 +L89 +L43 +L75 +L41 +L96 +R95 +L32 +R46 +L75 +L85 +L40 +R75 +L94 +L94 +R69 +R32 +L34 +R89 +R67 +R11 +L73 +R23 +L70 +L53 +R39 +L73 +R73 +R35 +L22 +R87 +L15 +R66 +L43 +R56 +L17 +R55 +L69 +L33 +L83 +R88 +R95 +L44 +L11 +R46 +L20 +L71 +L646 +L54 +R55 +R1 +L56 +R91 +L75 +L824 +R90 +L82 +L64 +L65 +R57 +R72 +L789 +R89 +R109 +L509 +L83 +R43 +R99 +R34 +R20 +L13 +R95 +R5 +R62 +R92 +R46 +R349 +R15 +L64 +L326 +R3 +R553 +L65 +R435 +R84 +L3 +R42 +L23 +R59 +R41 +R619 +R81 +R12 +L98 +R86 +R87 +R99 +R41 +L72 +R89 +L544 +R19 +L18 +L1 +R58 +R888 +L42 +L504 +R71 +L71 +L39 +R39 +R45 +L47 +R2 +L537 +L63 +L36 +L63 +R99 +R383 +R38 +R42 +L63 +R445 +R55 +L73 +L27 +L27 +L46 +L18 +R91 +L50 +L39 +R89 +R61 +L135 +L64 +R56 +L18 +L137 +L77 +R98 +R467 +R9 +R87 +L947 +L56 +L77 +R13 +R38 +L18 +L82 +R31 +L49 +R54 +L54 +R787 +R163 +L51 +L85 +R692 +R58 +R11 +R254 +L2 +R536 +R62 +L1 +L24 +R92 +R93 +R398 +R17 +R21 +L21 +L5 +L95 +R43 +L769 +R203 +L884 +L957 +L36 +L36 +R36 +R25 +L25 +L325 +R95 +R92 +R44 +R63 +L69 +R26 +L74 +L52 +L49 +L52 +L39 +L91 +R11 +R752 +L921 +R89 +L89 +L84 +R773 +R55 +L28 +R54 +L41 +R60 +L90 +R90 +R354 +L54 +R56 +L598 +L358 +L28 +L14 +L64 +L59 +R83 +L23 +L62 +L430 +R208 +L812 +L99 +L68 +R54 +R14 +L58 +R70 +R16 +L30 +R56 +L54 +L31 +L69 +R873 +L59 +L94 +L20 +L1 +L82 +R6 +L478 +R41 +L5 +L68 +R80 +L49 +L44 +L92 +R92 +R36 +R720 +R65 +R46 +L7 +R30 +L59 +L99 +R522 +R818 +L72 +R74 +L2 +R28 +L42 +L57 +R79 +R26 +L18 +R12 +R8 +R34 +R64 +L6 +R48 +R130 +R80 +L52 +R94 +R56 +L72 +R33 +L61 +L64 +R911 +R97 +R6 +R81 +L66 +L21 +L75 +L25 +R26 +L3 +R77 +R97 +L3 +L55 +R802 +R59 +R53 +L99 +L71 +R17 +R89 +L42 +L47 +L35 +L744 +R79 +R390 +L90 +R856 +L37 +L3 +R84 +L90 +L21 +R53 +R75 +L50 +R33 +R70 +L205 +L23 +R5 +L27 +R751 +R64 +L19 +R91 +R93 +R89 +L31 +R13 +R6 +R99 +L12 +L79 +L26 +R78 +R63 +L5 +R854 +R43 +R108 +L12 +L75 +L80 +L52 +L32 +R151 +L891 +R56 +L65 +L41 +R41 +L44 +R65 +L21 +L36 +R180 +R56 +R30 +L12 +L43 +L375 +L671 +R14 +L56 +L5 +L382 +R57 +L99 +R5 +L63 +L32 +R87 +R66 +R79 +R486 +R14 +L120 +L80 +L53 +R966 +L774 +R26 +R57 +R278 +L60 +R55 +R58 +L53 +R90 +R10 +L18 +L95 +R20 +L93 +R224 +L367 +R55 +L26 +L36 +R24 +L688 +R33 +L33 +R57 +R22 +L164 +R85 +L119 +L58 +L23 +R19 +L28 +R6 +R3 +L89 +R73 +L84 +L62 +R24 +R21 +L83 +L21 +L479 +R30 +R535 +R86 +L25 +R932 +R52 +L451 +L1 +L96 +L11 +R14 +R33 +R93 +R9 +R62 +L11 +L51 +R402 +L2 +L8 +L362 +R34 +L77 +L763 +R84 +L848 +L565 +R48 +L19 +L24 +L9 +L67 +L24 +L92 +L8 +L88 +L312 +L47 +L56 +R13 +R31 +R72 +R34 +L47 +R35 +L35 +R850 +R50 +L29 +L565 +L22 +R98 +L60 +L18 +L38 +L559 +R63 +R77 +R53 +L95 +L60 +R476 +R339 +R62 +R95 +L66 +R59 +R10 +L79 +L105 +L24 +R288 +L33 +R825 +L4 +L18 +R91 +R60 +R92 +L13 +R47 +L69 +L32 +R54 +R8 +L59 +R347 +R954 +R84 +R66 +R98 +L43 +R45 +L58 +L85 +R117 +L574 +R64 +R36 +R52 +L99 +L53 +L74 +L26 +L237 +L63 +R64 +R36 +L166 +R66 +L48 +L20 +R34 +L789 +L46 +R12 +R17 +R40 +R65 +L65 +L40 +R40 +R21 +R79 +R23 +L95 +R14 +R130 +L43 +L29 +L80 +L95 +L325 +L66 +L24 +R47 +L36 +L43 +L30 +R299 +L39 +R723 +R69 +R827 +R9 +R864 +L528 +L72 +L51 +L3 +R38 +R82 +R12 +R237 +L40 +R725 +L79 +R2 +R98 +L721 +L16 +R99 +R11 +L394 +R47 +R781 +L60 +L68 +L85 +L815 +R21 +R12 +R5 +L55 +R17 +R204 +R87 +L82 +R91 +L69 +L38 +R7 +L857 +R57 +L88 +L412 +L29 +R29 +L24 +R22 +R2 +L92 +R92 +R45 +R635 +R749 +L77 +R406 +L11 +R53 +R48 +L14 +R66 +R25 +L94 +L31 +R51 +L51 +L42 +L27 +L93 +L23 +R13 +L44 +L23 +L80 +R62 +R57 +L8 +R88 +L95 +L63 +R26 +L48 +R779 +R95 +L19 +L87 +R93 +L61 +R691 +L78 +L866 +R46 +R2 +L95 +R12 +R94 +L86 +L20 +L352 +L33 +L77 +R593 +R26 +R20 +L8 +R9 +R22 +L66 +L669 +L11 +L54 +R78 +L2 +L56 +L20 +L951 +L49 +L96 +R51 +L55 +L34 +L865 +R99 +R51 +R49 +R84 +R19 +L3 +R72 +L495 +R23 +L23 +L88 +R938 +L74 +L53 +R94 +L25 +R54 +R20 +R457 +L77 +L99 +R643 +R13 +L79 +L47 +L54 +L92 +L8 +R608 +L8 +R86 +R114 +L47 +R99 +R18 +R206 +L88 +L61 +R24 +L35 +L15 +L34 +L609 +L69 +R11 +L40 +R22 +L3 +R6 +L32 +L56 +R3 +L51 +L49 +R33 +R64 +L78 +R86 +R59 +R503 +R726 +L24 +R31 +R45 +L949 +L96 +L140 +L91 +R83 +L52 +L55 +R61 +L81 +L25 +L42 +R82 +R89 +L90 +R61 +R22 +L22 +L77 +R18 +R93 +R66 +L63 +R363 +L1 +L48 +R49 +L718 +R56 +R62 +R928 +R34 +R38 +R62 +R38 +L904 +L7 +R66 +L55 +L93 +L671 +R46 +L23 +R146 +L93 +L144 +R18 +L850 +R64 +L369 +R69 +L88 +L40 +R28 +L56 +R96 +R60 +L84 +R94 +L10 +L790 +L37 +R455 +R72 +R61 +R34 +L995 +L90 +R83 +R15 +R57 +L23 +R70 +R44 +L5 +R49 +R7 +L92 +L80 +L87 +L648 +R86 +R14 +R53 +R28 +L53 +L62 +R32 +L55 +R977 +R680 +L676 +L198 +L26 +R37 +L37 +R8 +R92 +L28 +R84 +R44 +R27 +L71 +R44 +R58 +L64 +L4 +R53 +L77 +R99 +L65 +L68 +L432 +R783 +L83 +L52 +R50 +R37 +R65 +R67 +L104 +R37 +R81 +R31 +R64 +R834 +R390 +R42 +L79 +R97 +R40 +L94 +R27 +R267 +L24 +L580 +L37 +L632 +R16 +R48 +R165 +R35 +L85 +R94 +L32 +L68 +L15 +L85 +R42 +L19 +L65 +L58 +R87 +L87 +R649 +L16 +R67 +R66 +L66 +L82 +L18 +L17 +L462 +R279 +L881 +L64 +L55 +L68 +L289 +R67 +L92 +L19 +L86 +R687 +R77 +L77 +R63 +R62 +R75 +L716 +L64 +R880 +L30 +R43 +R45 +R85 +R98 +L19 +L70 +R348 +R12 +R58 +L70 +R83 +R12 +R5 +L44 +L77 +L92 +L998 +R11 +R343 +L732 +R89 +R33 +L4 +L44 +L188 +R703 +R30 +R70 +R276 +L78 +R20 +L11 +R493 +R583 +L15 +L68 +R68 +R351 +L86 +R77 +R62 +L35 +R27 +L960 +R96 +R18 +L60 +R25 +L83 +R488 +R87 +R77 +R39 +L62 +L29 +L41 +L31 +R16 +R56 +R320 +L193 +R68 +R5 +R4 +L43 +R74 +R10 +R73 +R107 +R936 +R44 +R395 +L86 +L14 +L7 +R7 +R44 +R1 +L44 +L81 +L18 +R14 +R84 +R48 +L509 +R61 +R534 +L34 +L17 +R17 +L96 +R346 +R86 +L24 +L318 +R82 +R24 +L23 +R88 +R35 +L48 +L78 +L74 +L53 +L88 +R77 +L89 +L91 +L8 +R52 +R6 +L77 +L53 +L76 +L96 +L97 +L80 +L42 +R276 +R539 +R70 +R30 +R20 +R80 +L96 +R21 +L70 +L55 +R756 +L40 +R184 +L392 +L845 +R37 +L57 +L62 +R38 +R39 +L58 +L58 +L42 +R935 +L45 +L70 +L20 +R92 +R66 +R42 +R36 +R40 +R66 +L76 +R34 +R93 +R3 +L96 +L61 +R5 +R56 +R33 +R67 +L96 +R96 +L59 +R82 +L64 +R43 +L34 +R93 +R111 +L7 +L65 +R54 +R91 +R17 +R53 +R21 +L19 +R87 +L4 +R33 +L33 +R74 +R26 +L96 +L38 +L151 +R120 +L96 +L509 +L460 +L78 +R8 +R25 +L625 +L66 +R44 +L68 +L48 +L62 +R90 +L671 +R657 +L76 +R96 +R56 +R182 +L34 +R24 +L24 +L90 +L58 +L15 +L37 +R4 +L4 +R65 +L65 +R75 +L34 +L11 +L30 +L884 +L16 +R24 +L77 +R29 +R16 +L19 +R27 +L4 +L396 +L99 +L1 +L55 +R55 +L67 +L33 +L70 +R75 +R78 +L83 +L12 +L361 +L35 +L92 +R441 +R26 +L30 +L837 +R96 +L67 +R418 +L5 +L42 +R44 +L44 +L94 +L34 +R28 +R51 +R49 +R99 +R96 +L19 +R6 +L82 +R99 +L58 +L541 +R251 +R53 +L80 +R76 +R65 +R46 +R89 +L42 +L86 +L8 +L64 +L84 +R364 +R13 +R18 +L4 +R93 +L107 +L50 +L52 +R9 +L36 +L64 +L90 +L76 +R466 +L10 +L38 +L95 +R43 +R88 +L88 +R6 +L20 +L60 +R99 +L38 +R469 +R691 +L83 +L64 +R38 +L38 +R43 +R52 +L1 +L23 +L71 +R212 +L12 +R79 +L79 +L10 +L39 +L152 +R393 +L49 +R80 +R988 +L11 +R77 +R91 +L3 +L161 +R12 +L85 +L61 +R830 +R81 +L6 +L975 +L890 +L62 +L61 +R12 +L4 +R5 +R82 +R134 +L25 +R9 +L16 +L5 +L379 +L65 +L35 +R23 +R16 +L39 +L44 +R67 +L280 +R39 +L280 +L2 +L57 +R57 +L29 +R29 +L58 +L64 +R46 +R19 +L39 +R53 +R143 +R17 +R15 +R94 +L12 +R80 +L94 +L83 +R81 +L935 +R58 +R10 +L27 +R998 +L402 +L67 +R82 +R17 +L943 +L692 +L45 +R735 +R55 +R16 +R4 +L82 +R45 +R75 +L25 +L75 +L94 +L810 +L71 +R65 +L81 +R509 +L11 +L95 +L33 +L179 +R63 +R37 +R86 +L86 +L923 +L77 +L24 +L94 +R18 +R64 +L78 +R62 +L48 +L62 +L38 +L546 +R21 +R4 +L2 +R96 +L73 +R10 +L210 +L81 +R304 +L1 +L986 +L87 +R71 +L673 +R69 +L90 +R57 +L6 +R19 +R4 +R6 +R114 +L20 +L229 +L31 +L51 +R503 +R5 +R3 +L644 +L4 +L40 +R106 +R56 +L59 +R495 +L10 +R823 +R20 +R75 +R49 +L33 +L834 +L35 +L62 +L3 +L34 +R99 +L65 +R76 +L66 +R37 +L17 +R83 +R92 +L5 +L36 +R65 +R37 +R6 +R315 +L87 +L33 +L1 +L66 +L19 +L86 +R5 +R55 +L55 +R5 +L19 +L86 +R46 +R928 +L74 +L38 +R38 +L14 +L676 +L47 +R26 +L89 +R88 +L88 +L45 +R35 +L10 +L80 +R24 +L175 +L49 +R65 +L677 +L13 +L75 +R97 +R68 +L23 +R25 +R50 +R23 +L11 +L429 +R17 +L50 +R63 +L830 +L48 +R97 +R91 +R22 +R83 +R55 +L96 +R12 +L15 +R83 +L39 +R95 +R7 +L39 +L71 +R32 +L82 +L87 +R56 +R44 +R772 +R38 +R24 +L34 +R1 +R24 +L25 +R3 +L703 +L48 +L52 +R469 +R25 +R83 +R23 +R17 +L95 +R66 +R12 +L60 +L81 +L96 +R937 +L99 +R780 +L581 +L32 +R43 +L6 +R595 +R72 +R73 +R55 +R28 +R44 +L72 +L614 +R14 +R96 +L28 +L63 +L805 +R91 +L86 +R71 +L76 +L75 +R1 +R54 +R343 +L25 +L98 +R86 +L86 +R76 +R53 +L29 +R756 +L92 +R170 +R48 +R14 +R2 +R2 +L22 +R22 +R25 +R90 +R85 +R222 +R682 +R7 +R89 +R619 +L16 +R50 +R90 +R857 +L59 +R94 +L16 +R81 +R698 +R202 +L42 +L17 +L842 +R1 +L34 +R34 +L42 +L58 +R257 +R43 +R45 +R70 +L76 +R61 +L2 +L57 +L634 +L7 +L50 +R450 +R67 +R26 +R7 +R28 +R46 +L50 +R776 +L59 +R88 +L36 +L93 +R370 +L2 +L62 +R89 +L99 +L508 +L40 +L91 +R123 +L80 +L28 +R87 +L61 +R77 +L70 +L255 +L50 +R22 +L32 +L42 +R14 +L62 +R95 +R605 +R3 +L33 +L27 +R22 +L17 +R62 +L60 +L37 +R26 +L20 +R81 +R397 +R72 +L64 +R95 +L89 +L442 +R18 +R567 +L78 +L263 +L29 +R616 +L48 +R41 +L75 +R65 +L11 +L72 +R21 +L21 +L39 +L27 +R223 +L57 +R42 +R58 +R73 +L82 +L79 +L521 +L33 +R942 +L47 +L87 +R749 +L752 +R97 +R51 +R32 +L49 +R106 +R38 +L64 +R74 +R52 +L48 +R48 +L6 +L91 +R42 +L945 +L53 +L147 +L657 +R19 +R38 +R14 +R86 +L139 +L261 +R89 +L9 +R32 +L85 +R892 +R181 +R52 +R48 +L93 +R93 +L713 +R47 +L67 +R5 +R17 +R22 +R47 +L78 +L9 +R939 +R33 +L205 +L72 +R734 +L764 +L41 +R36 +R469 +R19 +L158 +L696 +L62 +R53 +L53 +L40 +L863 +L66 +L664 +R930 +L51 +L49 +L22 +L78 +L18 +R19 +R999 +L40 +L355 +R93 +L98 +R44 +L91 +L615 +L38 +L858 +L342 +L792 +L57 +L325 +L326 +R24 +R94 +L97 +L21 +L55 +L236 +R71 +R55 +L23 +L12 +R11 +L79 +R68 +R96 +L324 +R156 +R41 +R2 +L71 +L64 +L452 +R20 +L933 +L71 +R60 +R74 +L34 +L85 +R72 +R68 +R943 +L613 +R89 +R26 +L89 +L626 +L4 +R19 +R24 +R415 +L34 +R195 +L47 +R99 +R48 +R81 +L10 +R55 +R74 +R95 +R90 +L85 +R49 +R990 +R2 +R59 +R57 +R43 +L94 +R2 +L8 +L774 +R27 +R47 +L78 +L79 +L43 +R241 +R59 +R601 +R34 +L935 +L86 +L24 +R510 +R550 +R70 +L69 +L68 +R17 +R56 +L63 +L93 +L888 +L12 +R16 +R25 +L304 +R43 +R90 +R96 +L66 +L56 +L44 +L76 +L24 +R28 +R656 +L21 +L63 +R546 +R87 +L56 +R50 +L830 +L61 +R60 +L60 +R41 +L82 +R54 +L20 +L429 +L50 +R24 +R64 +L38 +R38 +R17 +L34 +R79 +R83 +R1 +L94 +R77 +R33 +L34 +R8 +R26 +L88 +R28 +R60 +L269 +L31 +L48 +R79 +L459 +R88 +R73 +R74 +L924 +R17 +L37 +R40 +R29 +R8 +L947 +L49 +L144 +L2 +L4 +R44 +R62 +R76 +L87 +R11 +L44 +R77 +R17 +L33 +R63 +L80 +L2 +L98 +L55 +R92 +L92 +L67 +R16 +L94 +L25 +L75 +L21 +L79 +L29 +R429 +R24 +L431 +L6 +L22 +R35 +R9 +R91 +R39 +L9 +L55 +R88 +R632 +R105 +R7 +L23 +L36 +R81 +R871 +L849 +R51 +R75 +L977 +L28 +R619 +R9 +R313 +R64 +L75 +R8 +R31 +R65 +R973 +R21 +L83 +L99 +L18 +R72 +L26 +R54 +L41 +R74 +R39 +L26 +L45 +L1 +R37 +L37 +R89 +R13 +R37 +L39 +L7 +R57 +R550 +L93 +L75 +L58 +R26 +R204 +L88 +R41 +L1 +R338 +R45 +R87 +R38 +R36 +L54 +R79 +R33 +L97 +R39 +R68 +R32 +L359 +R74 +R739 +L15 +R94 +L11 +R78 +R54 +R39 +R17 +L910 +L565 +L35 +R748 +L48 +L35 +R35 +R4 +L4 +R39 +L732 +L22 +L6 +L33 +L1 +R65 +L10 +R36 +L46 +R54 +R56 +R93 +L93 +R67 +L67 +L15 +R326 +L61 +R90 +R60 +R772 +R28 +R72 +R28 +R77 +L77 +L14 +L59 +L791 +R30 +R89 +R504 +R27 +L13 +R27 +L812 +R12 +R50 +L150 +L43 +L57 +L65 +L6 +R952 +R19 +R5 +L90 +L15 +R79 +R95 +L74 +R7 +L70 +R63 +L89 +L89 +R10 +L8 +L3 +R92 +R68 +L46 +R27 +L53 +R43 +R839 +R69 +R363 +L70 +R81 +R69 +L10 +R782 +L43 +R91 +L23 +L745 +R19 +R47 +R79 +R85 +L33 +L627 +L25 +L261 +R329 +R16 +L84 +R304 +R23 +L34 +R68 +R45 +L6 +R38 +L36 +L15 +R13 +L719 +R74 +R22 +L2 +R25 +R54 +R46 +L15 +L85 +L62 +R87 +R11 +L63 +R27 +L44 +L444 +L48 +L18 +R54 +R91 +L23 +R346 +L39 +R25 +R9 +R9 +R5 +L605 +L18 +L39 +R39 +L2 +L37 +L261 +R871 +L71 +R31 +L31 +L77 +R78 +R89 +L21 +R73 +R48 +R66 +R5 +R72 +L85 +R52 +L10 +R8 +R32 +R70 +L25 +R91 +R34 +L23 +L8 +L236 +L2 +R69 +L41 +L59 +L85 +L15 +L79 +L21 +L54 +L65 +L81 +R96 +L92 +R43 +L130 +R83 +R26 +R5 +R24 +L12 +L15 +L83 +L45 +R66 +L76 +L87 +L3 +R856 +R97 +L38 +L310 +L774 +L31 +R73 +R617 +R10 +L61 +R27 +R34 +L8 +R87 +R58 +L837 +R686 +R58 +R56 +R54 +L58 +L216 +L81 +R88 +R13 +R88 +R36 +L24 +R23 +L223 +L59 +R959 +L557 +L15 +R72 +L17 +L97 +R14 +L28 +R28 +L35 +L65 +L46 +L2 +R48 +L79 +R79 +L62 +R13 +R549 +R69 +L93 +R29 +L905 +L93 +L8 +R963 +L312 +L21 +R107 +L536 +R70 +R69 +L439 +L337 +L92 +R29 +L73 +R32 +L59 +R30 +L625 +R39 +L65 +L42 +R63 +R20 +R80 +L82 +R682 +R15 +R47 +R20 +L232 +R50 +L3 +R11 +R69 +R4 +L881 +L86 +L14 +L39 +L9 +L52 +R10 +L91 +L8 +R5 +L489 +R16 +R57 +R34 +L34 +L25 +L21 +R46 +R34 +L1 +R67 +L131 +R30 +L43 +R13 +R628 +R43 +L19 +L85 +R864 +L43 +L57 +R44 +R56 +R94 +R26 +R56 +L22 +R63 +L576 +R19 +L77 +R17 +R54 +L506 +L89 +L59 +R2 +L25 +L77 +L11 +R45 +R66 +L95 +R80 +R55 +R14 +R72 +L39 +L57 +L25 +L38 +L467 +L11 +R94 +L583 +R11 +R89 +L868 +L932 +R39 +R972 +R89 +R19 +L63 +R844 +R231 +R67 +L98 +L29 +R40 +L39 +R314 +L92 +L730 +R70 +R66 +R85 +L59 +R62 +R997 +R15 +L54 +R50 +R59 +R667 +R19 +L51 +L12 +L78 +R85 +R690 +L92 +R17 +L19 +R519 +R2 +R98 +L902 +R18 +R84 +R770 +L84 +L28 +L58 +L97 +L16 +R30 +R283 +R24 +L24 +L66 +L18 +R88 +L67 +L98 +R2 +R46 +L87 +R52 +L63 +R49 +L38 +R2 +L17 +L885 +L48 +R48 +R10 +R90 +R98 +R136 +R66 +L91 +L38 +L71 +L74 +R334 +R142 +R98 +L17 +L78 +L88 +L26 +R57 +L92 +L309 +L20 +R773 +R89 +L17 +L72 +R19 +R824 +R84 +R83 +L69 +L35 +L6 +R72 +L50 +R2 +L56 +R566 +L234 +L70 +R14 +L23 +R69 +L51 +L39 +L78 +R11 +L36 +R11 +L77 +R69 +R37 +R63 +R7 +L97 +L11 +L983 +L33 +R779 +L140 +R42 +L14 +R58 +L8 +R25 +L116 +R53 +R538 +L21 +L32 +L8 +R61 +L874 +L42 +L18 +R34 +L45 +R45 +R50 +L50 +L770 +R70 +R68 +R12 +L58 +L51 +R42 +R87 +L22 +L54 +L91 +L79 +L1 +L378 +R25 +L15 +R475 +L44 +L33 +L47 +R637 +R975 +L48 +L398 +R96 +R77 +L75 +R411 +L22 +R19 +R724 +R51 +R29 +L20 +L98 +R306 +L89 +L59 +L52 +L13 +L287 +L48 +R95 +R53 +R16 +L97 +L17 +L5 +L97 +L67 +L33 +R90 +R616 +R94 +R11 +L35 +L82 +L37 +L187 +L74 +L28 +R46 +R586 +R76 +R24 +R78 +R16 +L94 +L682 +R70 +R12 +L647 +L753 +L12 +L79 +L31 +R53 +R99 +L30 +R207 +L69 +L30 +R66 +L74 +L42 +R11 +R67 +R64 +R96 +R5 +R499 +R94 +L94 +L81 +R70 +L403 +R58 +R567 +R427 +L42 +L5 +R47 +L30 +R960 +L868 +L76 +L50 +R26 +R6 +L6 +R7 +L52 +L55 +R75 +L20 +L55 +L743 +L61 +L96 +L25 +L45 +L30 +R19 +R81 +L19 +R19 +R907 +L73 +R66 +L65 +L53 +L97 +R14 +L34 +R77 +R58 +L53 +R653 +R97 +R14 +R88 +R4 +R28 +L41 +R31 +R79 +R9 +R99 +L770 +L38 +R55 +R13 +R32 +L38 +R38 +R68 +R74 +R39 +L94 +R64 +L51 +L6 +L594 +L19 +R741 +R49 +L97 +R26 +L20 +L7 +L75 +R2 +R154 +R64 +L65 +L53 +R34 +R2 +L12 +L24 +L12 +R56 +R12 +L8 +R530 +L932 +R54 +R81 +R19 +L19 +L52 +L29 +L60 +R60 +R23 +R76 +L299 +R49 +L49 +R60 +R40 +R816 +R84 +R470 +L212 +R76 +R960 +R6 +L20 +L759 +R479 +L9 +R9 +L583 +R83 +R162 +R533 +L65 +L130 +L7 +R31 +L25 +L82 +L85 +R53 +R85 +L815 +R45 +R12 +R39 +L51 +R62 +L968 +L73 +R76 +L196 +L13 +R58 +R997 +L43 +L68 +L45 +L935 +L78 +L167 +L20 +L86 +L21 +L80 +L15 +L18 +R33 +R974 +R826 +R199 +L66 +L219 +R45 +R41 +R34 +R66 +L58 +L35 +R542 +R65 +R303 +L69 +L536 +R74 +L586 +L85 +R685 +L74 +R74 +L56 +R199 +L15 +R72 +L81 +L72 +L47 +L72 +R7 +R95 +L20 +R290 +R76 +L565 +L164 +R53 +R99 +L15 +R816 +R79 +L42 +R20 +L95 +L68 +R866 +R85 +L821 +L62 +R948 +R2 +R88 +L907 +L88 +R41 +L48 +L845 +R47 +L54 +R54 +L12 +R12 +R7 +L60 +R8 +R45 +R64 +R183 +R53 +R622 +L22 +R20 +R19 +L39 +R65 +L92 +L14 +R41 +L92 +L8 +R54 +R52 +R12 +L918 +L141 +L59 +L62 +R3 +R53 +R171 +L65 +L31 +R689 +R88 +R54 +L58 +R53 +R5 +R77 +L94 +L83 +R86 +L46 +R860 +L936 +R80 +R92 +L36 +L87 +L52 +L50 +R89 +R34 +L34 +R83 +L44 +R988 +R40 +L67 +L991 +L54 +L768 +L87 +L82 +R815 +L12 +R24 +R55 +L66 +L734 +L19 +L46 +R9 +R20 +R36 +R68 +R732 +L54 +L25 +L96 +R29 +L989 +L62 +L3 +L67 +L60 +R72 +L31 +R86 +R8 +R47 +R435 +L4 +L86 +R21 +R671 +R21 +R865 +L78 +L525 +R36 +R861 +L72 +R38 +L538 +L50 +L11 +R63 +R98 +L68 +R71 +L3 +R41 +L41 +R20 +R44 +R36 +R35 +R465 +L91 +R158 +R405 +R57 +L28 +R91 +R8 +R28 +L28 +R2 +L91 +R90 +L19 +R83 +R35 +L252 +L48 +R49 +R87 +R64 +L64 +R64 +R46 +L42 +L76 +R51 +L50 +L468 +L989 +L72 +R19 +R48 +R97 +R36 +R43 +R807 +L31 +R29 +L13 +R23 +R658 +L98 +R95 +R87 +R11 +L87 +R776 +L9 +L91 +R75 +R343 +R99 +L84 +L33 +R11 +L11 +L72 +L53 +L309 +L99 +L67 +L44 +L16 +L55 +R415 +L44 +R85 +R48 +L27 +R138 +R67 +L67 +R846 +L50 +L136 +L825 +L35 +R55 +L155 +L35 +L69 +L96 +R449 +R29 +L78 +L70 +L32 +L98 +L98 +L2 +R64 +L44 +R80 +R445 +R89 +R44 +R92 +L54 +R92 +R97 +L905 +R107 +L7 +R65 +R884 +R65 +R71 +L2 +R513 +R955 +R49 +R82 +L1 +L81 +R86 +L566 +R459 +L32 +R53 +L96 +R96 +L4 +L73 +L23 +L1 +R26 +L85 +L64 +R24 +L86 +L92 +L22 +L29 +L71 +R81 +R19 +L757 +L45 +R38 +R67 +R171 +R5 +L140 +R53 +L23 +R31 +L13 +R13 +R83 +L818 +R32 +L74 +R77 +L98 +R9 +L11 +R43 +L704 +R461 +R22 +R28 +L3 +L66 +L19 +L38 +R71 +L905 +R10 +L95 +R46 +L62 +R69 +R52 +L36 +R26 +L45 +L655 +R12 +L84 +R96 +R658 +R73 +R6 +L84 +L77 +L19 +R88 +R35 +R67 +R9 +R38 +R82 +L21 +R258 +L20 +R31 +L57 +L68 +L47 +R84 +L79 +L81 +L92 +R91 +R55 +R86 +L816 +R838 +L30 +L83 +R23 +L72 +L84 +R85 +R7 +L43 +L14 +L85 +L866 +R93 +R7 +R41 +R82 +L9 +L56 +R42 +R67 +L14 +L53 +L31 +L40 +L229 +L1 +L443 +R48 +R261 +R735 +L72 +L828 +R49 +L49 +L629 +R29 +L47 +R76 +R46 +R56 +L98 +L53 +L394 +L573 +L80 +R67 +R947 +L87 +L237 +L23 +L81 +L49 +R30 +R50 +L16 +R36 +R79 +R16 +L67 +R28 +R40 +L66 +R59 +R26 +L85 +L87 +L35 +L918 +R80 +R3 +L843 +L212 +R12 +R74 +R20 +L73 +R79 +L26 +L430 +L64 +L80 +L378 +R78 +R671 +L35 +R344 +L63 +L612 +R95 +R88 +L88 +L42 +L42 +R84 +R7 +L71 +L622 +L277 +L37 +L42 +R40 +L659 +R22 +R39 +R38 +R857 +R32 +L222 +L44 +R74 +R722 +R43 +L24 +R24 +R71 +R81 +L152 +L30 +L23 +R53 +R54 +L50 +L4 +R92 +L67 +R32 +L57 +R770 +R30 +L35 +L65 +R91 +R9 +R83 +R98 +L781 +R51 +L14 +R31 +R703 +L289 +R18 +L66 +L134 +L3 +L18 +L369 +L10 +L21 +R689 +L32 +L36 +R29 +R71 +L195 +L5 +R9 +R37 +L946 +R20 +L220 +L192 +R34 +L26 +R496 +R21 +R98 +L231 +L95 +R79 +L977 +R9 +R51 +R33 +L24 +R60 +L36 +R62 +R338 +R4 +R96 +R97 +R3 +L226 +R20 +R89 +L83 +R6 +L24 +L782 +R74 +R821 +R81 +L28 +L911 +L37 +R50 +L85 +R19 +R23 +R12 +R2 +R62 +L45 +R30 +R16 +L84 +R484 +L84 +R51 +R449 +L56 +L47 +R13 +R90 +R72 +R69 +R59 +R67 +L67 +L69 +R69 +L99 +R209 +L10 +R98 +R26 +L87 +R63 +L15 +L685 +R809 +L2 +L7 +R85 +R37 +L822 +R96 +R4 +R14 +R86 +R68 +L68 +L105 +L295 +L611 +L98 +L230 +L86 +L75 +R492 +R32 +R62 +L86 +R96 +L29 +R233 +R914 +L14 +R49 +R33 +R55 +L98 +L39 +L5 +L30 +R35 +L77 +R760 +R39 +R85 +L407 +L823 +R873 +R66 +L506 +R182 +L97 +R5 +R901 +R78 +L266 +R587 +L985 +L15 +R82 +L62 +L72 +L132 +R60 +L76 +R44 +L44 +L42 +R808 +R34 +R21 +R85 +R94 +R20 +L18 +L96 +L23 +L83 +R40 +R71 +L28 +L73 +L486 +R64 +R66 +R136 +R10 +L844 +R44 +L588 +R19 +L62 +L93 +R14 +R56 +L850 +L96 +R25 +R175 +R85 +R169 +L54 +R50 +L83 +L106 +L49 +L12 +L43 +L69 +R612 +L10 +R50 +R695 +L95 +L46 +R606 +R40 +L940 +R60 +R3 +L163 +L131 +R223 +L1 +L11 +L53 +R44 +R586 +L2 +R55 +L96 +L14 +L791 +L23 +R514 +R310 +R55 +R86 +L951 +R76 +R83 +L85 +R10 +L84 +R45 +R255 +L72 +L28 +L49 +L319 +L228 +R924 +R80 +L38 +L159 +R86 +L15 +L75 +R93 +L61 +R32 +L7 +L29 +R75 +L197 +R87 +L78 +L22 +L78 +L22 +R37 +R63 +L78 +R90 +L25 +R89 +L55 +R36 +L73 +R93 +R27 +L805 +L77 +R25 +L73 +L12 +L594 +L75 +L10 +R85 +L73 +R5 +L110 +L78 +R46 +R5 +L350 +L76 +L65 +L294 +L24 +R95 +L80 +L31 +L38 +L35 +L2 +R346 +R91 +R28 +R905 +L59 +L74 +L7 +L93 +L5 +L95 +R82 +R61 +L83 +L21 +R442 +R41 +L22 +R698 +R2 +R5 +R3 +L22 +R15 +L5 +R59 +R20 +L388 +L91 +R6 +L46 +R44 +L323 +L51 +R47 +R78 +R49 +L75 +R48 +L12 +L86 +R76 +L59 +L43 +L37 +L212 +R59 +L59 +R82 +L682 +L27 +L73 +L736 +L19 +L45 +R727 +L46 +L81 +R1 +L84 +R484 +L28 +L67 +L6 +L8 +L47 +L99 +R789 +R69 +R4 +L74 +R31 +R3 +R918 +L86 +R10 +L10 +R28 +R84 +L43 +R86 +R8 +L377 +L20 +R621 +R42 +R71 +L699 +R99 +R248 +R36 +R496 +R920 +R92 +R8 +L261 +L84 +L755 +L15 +R50 +L48 +L87 +L23 +L296 +L81 +R60 +L33 +R84 +R90 +L1 +R92 +L3 +R11 +R903 +L503 +R20 +L325 +R5 +R73 +L73 +R66 +L65 +R99 +R86 +R14 +R637 +L337 +R38 +L565 +R20 +L893 +R96 +L13 +L83 +L61 +L83 +R144 +R89 +R11 +L74 +R74 +R85 +R22 +R27 +R66 +R5 +R95 +R91 +R66 +R46 +R5 +L83 +R51 +L87 +L93 +R4 +L463 +R77 +L19 +R591 +L11 +R74 +L49 +L80 +L20 +L81 +L690 +R15 +L948 +L96 +R67 +R33 +R6 +L57 +L49 +L36 +L32 +R74 +R94 +R69 +R31 +L73 +L30 +R80 +L77 +R47 +R37 +R16 +R56 +L524 +L628 +R42 +L546 +L44 +L54 +R55 +R43 +L22 +L14 +R36 +L82 +R461 +L79 +R29 +R31 +L91 +R431 +L14 +R214 +L16 +R16 +L53 +L47 +L491 +R11 +L49 +L27 +L78 +R38 +R98 +L2 +R624 +R6 +L10 +L21 +R66 +R535 +L93 +L60 +L312 +L86 +R63 +L20 +L83 +R91 +R77 +L25 +L55 +L48 +L49 +R75 +R48 +R429 +L813 +R65 +R96 +R89 +R11 +R90 +R63 +L12 +L94 +L74 +R60 +L162 +L71 +R226 +R5 +R21 +L53 +R1 +L19 +L46 +R32 +R35 +R98 +R64 +L33 +R69 +L933 +L367 +L74 +L626 +L20 +L580 +R1 +R99 +L972 +R61 +R11 +R28 +R72 +L78 +R78 +R7 +R93 +L99 +R99 +L53 +R66 +R287 +L72 +L228 +L649 +R33 +R65 +R51 +L415 +L53 +L69 +L20 +L43 +R31 +R60 +R68 +L59 +R28 +L28 +L11 +R14 +L67 +R45 +R6 +L15 +R89 +R39 +L36 +L54 +L610 +L1 +L68 +R66 +R3 +R72 +R54 +R74 +L2 +R802 +L1 +L455 +L972 +L856 +L358 +L65 +L81 +L26 +R65 +R49 +R41 +R48 +R771 +R40 +R41 +L41 +L50 +R133 +R62 +L45 +L89 +L11 +L86 +L79 +L74 +R66 +R826 +R47 +R56 +L18 +L69 +L40 +R495 +L124 +R6 +R11 +R48 +L30 +R565 +R4 +R96 +R28 +R816 +L44 +L98 +R34 +R64 +L70 +L95 +L31 +R691 +R36 +R85 +L53 +L40 +L25 +L98 +L760 +L40 +R14 +L59 +L32 +R595 +R82 +L23 +R323 +R25 +L25 +R416 +R435 +L651 +L88 +R88 +R96 +R80 +R24 +R4 +L98 +R46 +L80 +R42 +L48 +L66 +L901 +R1 +R4 +R25 +R68 +R90 +R13 +L82 +L473 +L43 +L2 +R13 +R87 +R29 +L717 +L87 +L27 +R78 +R38 +L14 +R144 +R69 +R328 +L41 +L20 +R20 +R97 +L97 +R70 +R30 +R61 +R651 +L20 +L55 +L74 +R4 +R20 +R13 +L27 +R58 +L12 +L419 +R94 +L44 +R40 +R531 +R89 +R98 +L51 +L57 +R35 +R165 +R141 +L94 +R22 +R88 +L39 +R1 +L16 +L65 +L938 +L94 +R94 +L88 +R2 +R32 +L46 +R89 +R77 +L21 +L645 +L83 +R31 +L5 +R440 +L72 +L49 +L1 +L693 +R532 +L78 +R33 +L55 +R48 +R52 +L61 +R6 +R54 +L99 +L43 +R43 +R83 +R17 +L79 +L298 +L97 +L50 +R24 +R24 +L624 +L92 +L2 +R83 +L742 +R53 +R65 +L23 +R19 +L430 +L31 +R75 +R425 +R88 +L88 +R96 +L66 +L99 +L18 +R836 +R51 +L93 +L7 +L70 +R88 +L18 +R77 +L15 +R38 +R52 +R89 +L56 +L385 +R91 +R643 +L64 +R11 +R7 +R45 +L333 +R44 +L44 +L72 +L56 +L72 +L843 +R43 +L574 +L26 +L19 +L881 +L487 +R16 +L43 +L37 +L37 +L26 +R76 +R38 +L24 +R324 +L38 +L74 +R12 +R92 +R59 +L51 +L65 +R94 +L46 +L983 +L64 +L59 +L77 +R96 +L56 +L581 +L74 +R15 +R31 +L47 +L123 +R98 +L55 +L4 +R393 +L16 +R523 +L85 +R85 +R9 +L912 +L97 +L87 +L81 +R9 +L732 +L334 +R182 +L57 +R243 +L25 +L18 +R11 +R85 +L735 +L17 +R45 +R11 +L44 +R15 +L26 +L61 +R16 +L56 +L47 +L23 +R423 +L63 +L61 +R57 +R14 +L96 +R55 +L126 +R25 +R71 +R27 +R639 +L74 +L65 +L206 +R87 +R64 +R55 +L31 +R31 +R98 +L50 +L4 +L95 +L49 +R62 +R7 +R31 +R72 +R442 +L59 +L692 +L63 +L81 +R56 +L975 +L21 +L79 +R67 +R69 +R64 +L951 +L32 +R83 +L70 +R65 +R11 +R94 +R59 +L44 +L71 +L82 +R78 +R60 +R4 +R45 +L39 +L88 +R28 +R51 +L82 +R81 +R87 +L87 +L3 +L97 +R42 +L67 +R86 +L12 +L49 +L9 +R42 +R67 +R84 +L89 +L95 +R59 +L59 +L3 +L59 +R62 +L56 +L44 +L59 +L75 +L66 +L94 +L71 +L25 +L92 +R73 +R66 +L1 +R65 +R41 +R44 +R27 +L44 +L29 +L6 +R15 +R7 +L36 +L18 +R2 +L6 +R30 +L21 +R39 +R30 +R7 +R27 +L13 +L44 +R21 +R36 +L41 +L9 +R5 +R21 +R47 +R1 +R31 +R34 +L27 +R18 +L28 +R27 +R48 +R25 +L28 +R50 +R45 +L29 +R16 +R50 +R42 +L33 +L1 +L31 +R24 +L36 +L41 +R3 \ No newline at end of file diff --git a/2-input.txt b/2-input.txt new file mode 100644 index 0000000..22b63af --- /dev/null +++ b/2-input.txt @@ -0,0 +1 @@ +11-22,96952600-96977512,6599102-6745632,32748217-32835067,561562-594935,3434310838-3434398545,150-257,864469-909426,677627997-677711085,85-120,2-19,3081-5416,34-77,35837999-36004545,598895-706186,491462157-491543875,5568703-5723454,6262530705-6262670240,8849400-8930122,385535-477512,730193-852501,577-1317,69628781-69809331,2271285646-2271342060,282-487,1716-2824,967913879-967997665,22-33,5722-11418,162057-325173,6666660033-6666677850,67640049-67720478,355185-381658,101543-146174,24562-55394,59942-93946,967864-1031782 diff --git a/3-input.txt b/3-input.txt new file mode 100644 index 0000000..a95a42b --- /dev/null +++ b/3-input.txt @@ -0,0 +1,200 @@ +4426546555433545424424345444644242452452532444564422646557424354153538454225332755435544545533324152 +4325282447422434333445212333343451413231333423353426332541123254243232342322553322244341312543932333 +4332333442334543644333542384256325234452445449454359452442434444344242333247233254353342732444654333 +3242342268563381365322464432323462722532321262324224633345426519263464226222933213111434342164622216 +9447673765733475853338583623277776759662892975737572674219274588774764767584838732636637987466747925 +5465666747656245473486677773645858655623848436585748584726454883586526877665853454785577677638954758 +2444454545573358335454444444533657461424744633575454555414644566436546558449448833539855835444255524 +6157461556353423546422234143542323532463543463631966444536448423543534355464334335525162636648321353 +2835376666759365533343684448534555132335383873465765564643686464153633459349536367566364363345632544 +7344353747645474324795566237335767744553352745445443443425543365567665332834442736643744656373346534 +3432324344242432243242442431213424312243322133232222316433433435212164332223444243334342533334253482 +2622221422722224222132452327221224222224622222233223222324242132332222422263234452222242224221222352 +2333333333332434452126434233262133133233322433432323143323224312238323253333223423537495436441425233 +4223121252222122212232222432222222321212224221232222222232212222212222132111222212222222222251232212 +5656364443456476766564447464434634344344454564655366674845343634444454533645485474555461444675445464 +2222222121422212221222211522213322122342313222422223311222223122112232223422311251182122213322222322 +2333223312323513354132532323242345322322263522221232522335232221232532332552333214121322322432333326 +7375355567864373516855538565346166466365834565633643466338563523647238744789722453348483369683756368 +3433535626365433336245424263342632336633352551353243934354326534345544334562636336633544635333676646 +4552543245436445453245462344463365545345654265453546534544522571554353554535445555264545655555435564 +3462831622494255764853548733574574745524782433922944636735655223248563544574263724458232637544263524 +3222443423222532333422343715535222233233323223229323147323212322223213235433123142326522263133222232 +2333212333432333323325252331233333222732313232324333223824122338323314233632223363333234252333334334 +2331142222264423421223242247254264221412241455233167423223334223352322243322332242134435224322124222 +3221232222123222222425122224223222211121332122111521114212121232122222222222222122314421232222252312 +4434524632643643753662622454563441256616464333645346343655435445363437355666544625446446124156665532 +5763246121842223223525634383114633483812622132447222352264521354343613323122493132222226422223222227 +4323333144422413453633413411233333333524243423323613442334134334272326443343531222133522232333343333 +3234234214223423333422221324424143222312253223324541242142332343441224324344332443233314464323322144 +6423483553431355233336233333334345336244367322543433123333331822542553361323313533255325347255353232 +3132322222322223233332424222432332122221122223412222221632222233122242222122222212233244323221112222 +3223234252425333332431323241242843445242944231814342524224422222443223243222362422833222432522631613 +5452134346551715474544663545634746754756625755345636644657534453655793446525544636345465565236542746 +2542562623212274282227172127123225532255466656628222232244712231262232124222523356442314912654421246 +3211225233123342323233432331212112221333223152322132324122322221233222222322521122723211222213111242 +3353334454347529351635537433344434323313154333345532453533454333633334344534233232145423334343453133 +2421322222222122222412222224221426142223221233322432132223212222221222232223242222321211134225212332 +2232211322312221132342223122223332153233222312242233123533242332222253322332323321225223222123351323 +2212222224122111321322222224322232242322432433322422234351322233321213212322244451123232212221462122 +4753242222111143324312132423244222742522462564632213322315132132323232112123373333383241221125242823 +3343332433226522442332523325331434632334332234433541332334332333321533324463433414323223423452445324 +4524344323452457441245426433352336433434326553565344545554463553455544438435453243345453543233364638 +2222422222322342226232333126234322221442134145212323311233323344224332322333321262212224323432221122 +3383323533448644425453227556452478544424474425324446235764223364445645333444575644414514755244224244 +2343242223221423221232222232322235123135222322222232122251223342243132222424232324122223332321323212 +5354554743424254448274373224228344347744467457167542342976472253445454527198343453444286454338544176 +2223211322212241122221232422322724112224232322212224323223222222212223424124222122257222212222232222 +2434554333445323364344355343542565534353653433345424223233434552444423334434254443374352343633354723 +1122223211242218322232222242222112412222222221222222222212321214432122222222122244222323222222433232 +3435223328333433433423336213335333445244223322372743356333333243335234343654352533322143336232326235 +8378544742468475446585326743783446225742243547346625347879353444342544356656636165235963767334746667 +4244322165354443483434332332423145332345674233324467345451342454527444434234355653425334335554423131 +3244347437313313632433324346415274333463523334233534224637213384333473875425377585334343383721435623 +2685554554535645656456735785556654556665554733943566616656484545455547455754473547517575534755375566 +2222322216222333226262621222213222222227514342221543131325335242221222513222622112127222215253128122 +2222222262225252142233624112522171323122223221242262223222122712226213222711321417112221235466122121 +4333334333225345444622224221332232322243222233423332232235132211236444525373232243322332243234262321 +2642248522122252125221232142221232256424223236215252122642362222222132321222242222522122221426222223 +1226322213251222422211232523211123242331232172224333323215133213233424333516323452242312232222623422 +3122222231213232113242212232822222232222122321222222222212222222122321123322222212322212121221222422 +5423564478854726637332596675245464556354355735582626475634453543575355574784577434459673155684554357 +7222321335635332262332412434655413219633232924622212225164226142242353542343246225753542125222223323 +4267551322534512666454222747274155257242331311455351563556413453655624563424531822633534636274521322 +2322252211221211212122132112222243131223523232132222423222341263332222222212222222222222222221122223 +1768674274274986682341368484535667696977568449486752359465927464497766917178351845264522476299462558 +9973345886329838748767628288667977447953869989379958839745584248767715872788288778581455834264386794 +3147438151432333338344236338737232494224134234544451682652215132332644832842454283383842482244335321 +4643566433347766744675635495457354222475461644663645226234346245536452754345745454465444932565942745 +2225215324326423122223233242434242213262412222221233223222352542224342323121544223222222122424243522 +5322245452664656566453255356611235646656355152264354425465513351415225316613615411625412314435245789 +3532512623242331522454811463433144216352121322573268272964662224275267222324238362545294252247226249 +4212831421213232133322223142223222232221223244343332213353123322323123224122232252313232232212321237 +2559516646662636458444562545554866446626574222272432644244645625329345646257123324497646538129494375 +9487697645944865567668753567656668967724574897467656455865855168454565445566546659685676656548457565 +2271259332592124428922232222322232962517342622322222232214172224332228267227221228162482262221225237 +6443233123316232234343521343174244263223442223223423321152221313245363424122444225443331425623722332 +2631223233332234232222222232233223624324362331422523223632222321252622533132312233252333334122352232 +4374594442425431244344493962542232434523455225227447382442522423334443974437423421342463423254543531 +2355432333335223334533427244747262427442234442324341339233344374345153362152323144742423388326423162 +4443445423434244443443444444444444444453454434424544344351234534453344444435446233443343433434443455 +2253732224712335116222521332125212432325522332331223222422222222232262233125222132623218312312722532 +2745126446333335224424526135332462445373274523354244145463333432422845424534532453225244484442333526 +7243231322222522523243218221822229211222272222132121225212212218162223322262253352242226222836222214 +8455234156755525686463552552391658345445893588246565526285564774355441646662555577978368642945158266 +3343333323213243433334231333434335323412312313221233333132122333233383333233332333432113332333333423 +3383456734935633752439463334363637796364566576539414396635336233843642426783335654663528832337243282 +5344511435325253223124322422315232342443444521133233112342244413322214342143342332245442224284224114 +5672432544132225246254263346129622122631332113422332144322322464231221212259362226232222422423235425 +4524322944436266647664456155534453463635345234664725273342535542575445335444366346254436463682322565 +3451334242232142352433232562333233532438333363343323646422333622532339344445433533245221232362638635 +3233443334336222212333333313221143322323332233423311342213212323422233331233212221332323232313422232 +3538335453453474345453632453342555554432484344312443323743442437447424536444524434375434843224232542 +1134323333132313131333332323533133333233333623323322333244441332334233337333342274333223433233323332 +4454243314521342324532544347434334434335235444344344323342233636214464723343447422324342472464431443 +7212243259122532255215244522214125222124232452252245212117552255264655222522223426322454253422326222 +2312222222222232222222222222222322717232232212282223722231223211112223222213222121232234222222322523 +2423334254424242124413222223224442344344242422322434223443444442221241423332334442224443342321462224 +2128125222642211322122234225124121551426222122221152223262222223412226123232213242622126562225123425 +6363447276635566243523623745255552583521353635323266575519555685676553658347552943633545254924961552 +3676667755587373466346533576626132364223763383165653452675353348646644426366668265737356353476244576 +3422633322422226226233112222224522622422332233123762752272222426216644523363422226125279441225422222 +2421513543234255328413453513213432322425243313515222254346232334321335531342525442552353235434465512 +6415375652731773743516117625153734627224124775172663723121614653367227355752147244664377477315124189 +2422422221222321721222213222222133221322412121222341242222222524122224222242242227224232222222122221 +2222263221312126226422222222222232232232522122222312521212274512142222222239332233161324142222522322 +5214224342122322832221621223821233232353524332825644542254213312221562222316123326232465523312421432 +3666692346463343673765135653333572386454548636472533677643225343655156493533632665435433533363333333 +3236336332133335334334333531334446329333352333444233443333333223336235333533336533533333723322331753 +2332334253445774533552442335534343543373535353354533442353484244432315244243232631235533431325434332 +4552521221112255538222453252525742232852622245255471828252221432256124422144256362213422525332324121 +2372252333723353563333333333333473383323733335833336432411333324316543339422239234393336716637333323 +3332446134233313232612333632163334334322633133212431333462333333224835333344223255333363212354123333 +7552341253243523459433362762313446662433224122932234263432225853655524828528628382822322238267265157 +2322134512221642323542323223511513233543226122331621224322223253615122232123422252522132621252231222 +3429232333431322243333344632343394443442424314352323431333625322314431334423554324321344442415335134 +3133332324343452323333322323333333333334333264133233333332532333133321223323533333342253313333423342 +1343335423352323663332543443263364446232322235234335543232624626585721313544983224252225332324323924 +2343384322234463353555425322583755232622465243247424222413556356413728443742314344222113244251532353 +3232332334422662733311142222213624242324423442212272161353921332323323365114222662326433222211432822 +4744234125222815354354425333344321443843244443221424452394343442222524324344242221332233234242225342 +3462334428262249425482933131743232559746433332564353333244493126335533625323339453832154482421223425 +2222222233134212222222432222224221127322233223212223221332321127222222212311222222122222243322422222 +2432244232223322212223324331424131121232632326332432333422623232243223132243212732213222236112343243 +2353263413345543333423353333424313435236563342233313443334554332372614164221334333214242433343743323 +7262356332233565589343731635726333342324341343234343563337573343334533753353534223443345323333245553 +3431242323312112222476523222532327232153214423528222422132232322222221233323223323234454532312329644 +2333735367546552954626277275124585694263757293962825277347554513674261336273395694226566284745773263 +4173649643475436334333444938463434845834634643336464565244456555431735334846564366333644454658838434 +4224822332242633868373338733362313852898442333324233232246336466283378321233368462332243239624724493 +3534333234432441324334224322153333431244222322152323333332413324252424224444334223352334223435244433 +6797668434457363662697495794664668479675438735856666846457733757642696558784863738494973567987667785 +2532234351434333422252314325113333335424552231452251415554155221313444214412351243321242521144116789 +3342963235551769332228529676272853356744577245483232553575727464245624975847586372312522857261324765 +2524433365455335343313442426354273335335232214443343435433184332364226333334324442532433433436434544 +4222122212332332222223231213222222312211212212121323212233252322321222222213413222323221123352221114 +5424545545342434324453533434332434353334333329332435543336333525325324324362551332333536454133333544 +2222314222413221272111232133221322313112115242245223141212412222244222235114332221123332223221212312 +3212651335442221253634222242124222222642441435234212423212262422522122224324245252222146563216221221 +4534343343554434373455224333444314444534552343337347433344543433344554444335355543345534555526436343 +2912822222483322222232264222224151451255223222333452422122242122248232332227722421522312222232532253 +4363374545543434544442423374342545266566843654647345434434454434474633695544412328432786264722435234 +3343564345744435343522324454522434441435423445134313333444444543324535244244543454334444434424484334 +2322363112224333222332112622331313163122212323222223232231512332235223225122413223321223322222232531 +8546436128277177943554413533685443435367862667384842533295736533834223234414837551795743345232755356 +2213223311223816122359924212256213822322211521422222324321352333322322323236222322223293232222322212 +2554435553538564422555424565552315565514525555355255522743428555232444455355554251246333452345246463 +1333422325315555874222532212731223224223254342221837511242452534326213523243452252233223213322135222 +5645369885892365427476667837637577773387463956656474667757655456846365465836456434746556672555434687 +1421112121223232721222412222222242124512328121322221222122322232222222221131222232242224221212222222 +4775668564556556665766856661654556565656666644646647565572556665554564646675658255256457555646455672 +2342452332222224551123243223222322223222532243215346511152222243322321233351223234222223444213272213 +3134413132411423221323242221321124214114211142114424214131341214344331244312323444323444224243356789 +6474433335362433434337434438443364393293343534343624232383334873273856337846437336343634353362444433 +1233243332444222224424623312622422472142523322262753551222225262222542223454332322545228267264346425 +5236344253423354343636325463336333356423827726333436538779343734634346263644934337562547952563333333 +4224632223222123112222412224243141262412423241322342423442281422522214232242353421222312244224243143 +7469877946847665655586749745973337476666558883376764458965456455676568725755555867744856659595665642 +5356755557561456634566445832832547543365283554567566675752345723326653666295553666765253254564575736 +2321311332333231423323221223223244435231441322214322333343224233412234223313431433353223233353143421 +1124322462241222221323531412334544222322323221214234222324232244223432212422222224223232224112243112 +3332442446346324333247187342434234143434236438533225434637244346324434633333433333446545833348946344 +6262322616264315213225632354273927727338283215826672178422371664423342442785822317832925655256257219 +5445524443444335333443353344243433444334443434344463323445434545248233545423324544444294345453333455 +4223232323333222323333332333322222233332323333313333323242343333332533345333222234233313223533211212 +2223426222252122224112251232142242221222124233312222241221222222212222211222222212224522125231221311 +4627241234423313342333322364213144422247433314234222223143223654226435149632233443252543432234336311 +3333323422333333355233333234444322224324422233131223315323344321434242338123343332321421433143242699 +5722624812261213242322822324282536352232415433623728387976822137157726222323252211524835225474266852 +6336122553423455134143235434142621433345423333324344332423352336233623352364143643333142317333344763 +2323435345339933333233234413323332823632433922347933212225322223237234444332332812753453212221655776 +2114332232122222227222233321132222191224112232322223323413216233224325414223233154142153523213232123 +4363233516332573234322264326642333411233222345332333464327253633423433332221226225313723253223432622 +3422222121231221222421222222121272211223124211222222214432222512422226462422122222221351154222226222 +6573185767843422374335785736331723571626823274547783151717468323887386811276575242725477122713746669 +2433323232322344222233231233134132334523323222232325242333412233214322233314333222533333224362222422 +3222122212322122231223222223232222222313222223113212232222222133211321213121322523223222211221322321 +1242342322434314342233214544224322432222222225724432314723213225244242244514424424223342332323333244 +3322223323232222222221522223212133322322222621322222322222322223213622312322343212233241322414122422 +2625245231422282221441423513255742414624272364847631422343335664343424253113724224727363324547221242 +3326371332622228837252563473123241224363133633313838447333321443724272332475132742349125916442355543 +7233222122232253233222242323323223314121222243233553222212213232332233632222221633531222213332222322 +4421224312252242222221224112221222222224212412222452223422331222221221224222221232323262264232222222 +2253123212223333222222213222243313323332331322233232333213243323321232223233337222421123221325322512 +3225422162433131224312223212312251243322224132425122234262233531224344222313224662223321322393231236 +4642342261562254443344423445428214722743264973162525543742232816222224553343421222242126532254365481 +2312212121222212523433224231211322312282222222522222132135222331121123255225272322122223213222222223 +4312231325246222214421322221112212232222221236232224117221364342225122132212423231222513213355222221 +2651242333442243323334334146333233144333442323333456343363233634333343243343244336244433225344135332 +2763248524234572433753223233622223332331723214122435341443231732223246222334223132623282652622283543 +3243222223323231422312437333423314711552416423122312422543424332522221326222321244222322221422322327 +2233554224243333415331323334332253253232644223453213913343546821552553232233353435533223533435332663 +9646747667546966454644685753753665685635164767563757666773248774626764856573263365676475553556725744 +3865568344165174355665436356555345223355325727554952341715231585477375575282248527523565666551546585 +3234454554445754244327453332241719736853566345534435633379658436763224463639555336653466444123247355 +4438345364534443344333623345533334653253544343661423635845633336348738944346332432336336246326235385 +2114324212222322222222212222254122222222224124132122221332222222424224232332221334212112412425623122 +6221313223122322312222223332222212322222322243233162222222221321233262222522241312222311223223222251 +3134343613223133354232233332661513531335333432332323336333332333333323334433432234333333333632313335 +3413243315334423214232123334223123332333344421223321223234232342332444434512222243333333421331422733 +3643433552173224434364263213563492453254231457525737335444546343413142646222466454322422842347463343 \ No newline at end of file diff --git a/4-input.txt b/4-input.txt new file mode 100644 index 0000000..2e6d3ef --- /dev/null +++ b/4-input.txt @@ -0,0 +1,140 @@ +@.@...@@@....@@@@@@@.@@@.@..@@@@@@@@.@@@@@@@@.@.@@@@@@.@@@@@@@@.@@.@.@@@@.@@.@.@...@@@@@@@.@.@.@.@@@@@.@@.@@.@.@@@@@@@@@@@@@@...@@@@.@.@@... +@.@.@@@@.@.@.@@.@@@@@..@.@@.@@@...@@@...@.@@.@.@@...@...@@.@@@@..@.@..@.@....@@.@@@.@.@@@@...@.@.@.@..@@@.@...@....@...@@.@@@...@.@@@@@@@@@@ +@.@@@@@@.@.@@.@@.@@..@@.@@.@@..@@@.@.@@..@@.@.@.@@@@.@@@@@.@@@@.@..@.@.@.@@.@@.@..@.@@@.@..@@@@@@.@..@@@@@.@@...@.@@@@@@@@.@@@@@@@@@.@@@.@@@ +@@@@@@@@@@@....@@@..@.@@@@@@..@@..@@.@..@.@@@@@@@@@..@@@@@@..@.@.@.@@@@@@.@@@..@@@@.@.@@@@@@@@@.@.@@..@@.@@@@....@@...@@.@..@.@@@.@.@@@@@... +@@@..@.@@@@@@@...@@.@.@...@.@.@@.@@@@.@...@@@.@.@@.@@...@....@.@@@@@..@@.@@..@@..@@..@@...@@..@@@@@@@@.....@..@@@..@@@.@@@.@@@.@.@...@@.@@@@ +.@@.@.@@@.@.@@@@@..@@@.@.@@.@......@@..@..@@@@@@@@..@@.@.@.@@.@.@@...@.@@@@...@@.@..@@.@@@@.@@..@.@.@@.@@.@@.@@@..@@.@@@@@@@..@@@@@@@.@@@@.. +@..@@.@@..@.@.@@@..@@@@.@@@@@@.@.@@....@@@@.@@@@.@.@.@@.@@@@..@@..@.@.@@@...@.....@@@@@.@@@.@.@@@..@..@@@..@@@@@@..@@@@@@..@.....@..@.@...@. +..@@@@..@.@@..@.@@.@@@.......@.@@@@..@.@.@@@@@@@..@..@@@@.@.@@@@..@.@..@@@@@@.@@@.@.@.@@@.@@.@@.@@@@..@@@@..@@@.@@......@@@@@.@@...@@.@..@@@ +.@@@..@.@@@@@@@@@@..@.@@@@@.@@.@@@@@@..@.@.@.@@@.@@.@..@@@@@@@@@.@.@@@@.@@@@.@....@.@..@@.@.@..@.@..@..@@@.@@.@..@@.@@..@@@@@.@..@@@@@.@@@@@ +@.@@..@@.@.@@@@@.@@.@@@..@@@@.@.@@@@@@.@@.@@@..@@@.@@.@@@@@@@.@@@@.@@@.@@.@.@..@.@.@@..@@.@..@@@@@@@@@@.@@..@.@..@@@@@@@@.@@@@@.@.@@@@@@@.@@ +.@@@@..@@..@@@.@.@@..@..@.@@..@@.@.@.@..@@@@@.@@@@@.@@..@.@@.@@@..@@@@@@....@@.@@@@@.@@@.@@@.@@@@@@.@@@..@@@@@.@.@@@@@@@@..@@..@@..@.@.@@@@. +@@@@.@@@@@.@@@@.@@...@@.@.@..@@@.@.@....@.@@@@....@...@@@@@@@.@.@@@@.@@@@...@.@.@.@@@@@@@..@@@@@.@@.@@..@.@@.@.@...@..@.....@...@@@@.@@@.@@@ +....@@.@...@@@..@@@@@@@@..@@@@@....@..@@@@@@@@@@@@@@.@.@.@.@.@@@@@@@@.@@@@@@@@@@@@.@@.@@.@..@@..@.@@@.@@@@.@@@@@@@@@@@@@@@@@.@..@@@@@@@@@@@@ +@@@@@@@.@@...@@@@@@..@@@.@@.@@.@@@..@@@@@@@@@..@@..@@..@@.@@@@@@.@.@@...@.@...@.@@.@..@@..@.@.@@@@.@@@@@.@@@@@.@@.@@.@@....@...@.@.@.@@@..@@ +@@@.@.@...@@..@@.@..@..@@.@@.@@@@.@@@@@@@@@@@@@.@@...@@...@@.@@@@@..@@..@.@@@@@.@@@@@...@@.@.@@@..@@@@@@@.@.@@@@@.@@@.@@@@@.@.@@@@@@.@.@..@@ +.@@..@@@@@...@@.@.@@@@..@@@.@.@...@@@..@@@@.@@@@.@@@@@.@@@@@@@.@@@.@.@@.@.@...@@@.@@@@@@..@@@@@@@@@...@@.@@@..@@..@@.@.....@@@@@.@@@.@@..@@. +@@.@..@@@...@@@@@@.@..@@@@.@..@.@@.@@@.@@@@.@..@.@@@@@@@@@@...@@....@@@@.@@..@@.@@@..@@@.@@@...@@.@.@@@.@@.@@@@@..@@.@..@...@@..@@@@@@.@.@.. +@@.@.@@@..@..@....@@@@@@@@.@@@..@@.@...@@..@@@@@@@.@@@@@@.@.@@@..@@@..@@@...@.@.@@@@...@@@@.@@@@.@@.....@.@.@@..@@@..@@.@@@@@.@@@@@.@@@@.@@. +@@@.@@@@@@@@@@@@@@@@@.@@.@@@@..@@.@.@@.@.@...@.@@@@@@.@@@@@@@@@@@@@@@.@@.@@@@@@@.....@@..@@.@.@..@@@@......@..@..@.@.@@@@@...@@@@..@@.@.@.@@ +.@@@@@@@.@..@@@.@.@@@..@@@.@@@@@@.@.@@@@@@.@@@@..@@@@.@@.@@.@.@.@@@...@@..@.@@....@@@@...@@.@..@@.@@@..@@.@.@@@@.@@@@@..@.@.@.@@@@.@@.@@@@.@ +@@.@@...@.@@@..@@@@@.@@@@.@@@.@@@@@..@@.@@.@@@@@@.@@@@.@....@@@.@..@@.@.@@@..@@@@@@...@@@@@@.@@@..@@.@@@@@@@..@@...@@@@@@@@.@.@@..@@.@.@@.@. +@@@@...@@.@@@.@..@@@@.@@..@@..@..@@@@@.@@@@.@@@@@.@@@@@@@.@..@@@.@.@.@@@.@@@@@..@@@.@..@@..@@.@@.@.@.@@...@@@@@..@.@@@@.@@@@.@.@@..@.@..@@@. +.@@@@@..@@.@.@@.@@@@..@@@@.@@@@..@@.@..@@....@.@.@@@@@@@@@@@@@@@@....@@@.@.@.@@@@@@@@@@@..@@@.@.@@@@@@@@@@@.@..@.@@@@@@.@@@@..@@@@..@.@@.@@. +..@@.@@@..@@@@....@@..@@.@.@@.@.@@.@.@@@.@@@.@@@@@@...@.@@.@@@.@..@.@..@@......@@@@..@@....@..@.@.@@@..@@@@.@@@@@@@@@..@@@@@.@@@@.@.@.@@...@ +@@@@@@@.@@..@.@.@@@.@@@..@.@@@...@@@@.@.@@@@@@@.@@@@@.@..@@@@..@@@.@@@@@@.@@@@.@@.@..@.@.@@@@@.@@.@.@@@..@@.@.@@@.@@@@.@.@@@@.@..@.@@@@@..@@ +@@@@.@@@@@@@@.@.@..@@@@@.@@@@.@...@@@@@@@.@@@.@@@@@@@.@@...@@@@.@@@@@@@..@@@@.@@@...@@.@....@@.@.@.@.@@@@.@@@@.@@@@@....@.@.@@@.@@@@@@.@@@@@ +@@@@@@...@.@@.@..@@@@..@@@@.@@@@@..@@@@@.@..@@...@@@..@.@@@@@.@..@@@@......@..@.@@@@.@@@@@.@@@.@@@.@@@.@@@@..@.@.@....@@.@.@@.@@@.@@@@@@@@@@ +.@@@@.@.@@@@@@@@@.@..@@@@@@@@.@@@.@@@.@.@@@@@@@..@@@@@@.@@@.@@.@.@@@.@@.@.@.@@.@@@@.@@.@@@.@.@@@@@@@@.@@@@@@@@@@@@..@@@@.@@..@@...@@.@@@.@@. +@@@@.@@..@@.@@@@@.@.@.@...@..@@@.@.@@.@@@@...@.@..@@@...@@@.@.@.@@@@.@.@@@..@@@@@@@@.@@@..@.@.@@@.@@...@.@.@@.@@@@@.@.@@@@@.@@.@@@@@.@.@..@@ +@@@@@@@@@@@.@...@@@@.@.....@@.@@.@@.@@.@.@@@@@@@@@@.@.@.@@@.@@@.@.@.@.@.@.@.@..@@@@@@.@@.@.@.@@....@..@@@@@@@.@@..@@@.@..@@@.@@@@.@@@@@@.@.. +@@...@....@.@@.@..@@..@@@...@@@@...@@@.@@@@@@@.@..@....@@.@@.@.@.@@@@@@@@@.@@...@@@@@@@.@.@..@...@@@@@@..@.@@..@@@.@.@@.@@@@.@.@@.@@..@.@@@@ +.@..@...@@@..@@..@@...@@@@@.@@@.@@.@@.@.@.@@.@@@@@...@..@@@..@@@@.@@.@@@....@@@.@@.@@@..@@.@@@@..@@.@..@@@.@@..@@.@@.@.@@@..@@.@@..@@.@@@@.@ +..@@@@@@@@@@.@..@.....@@@@@.@.@@@@@@@@@@@.@...@.@@.@.@@@@.@..@@.@@@..@@@@..@@@@@@@@.@@@.@@.@.@@@@...@.@.@..@@@@.@.@@@@..@@@@.@.@@@@..@@.@@@. +..@@@@.@@@@@@@@...@@@@@.......@.@@@@@@..@...@..@..@.@@@.@@.@.@@.@@..@.@.@.@@.@@.@..@@@..@.@.@.@@@.@@..@@@@@@..@@@.@@@.@@@@..@@.@.@@@@@...@@@ +@...@@@@.@@@@@.@..@@@.@@@@...@@@@..@..@@@.@@@..@@@@@.@@@.@@@@@@..@.@@.@..@@.@@@@.@@@@@@@@..@@@@@@@.@...@.@@@@.@.@@.@@.@@@@.@.@..@@..@.@@.@@@ +@@.@@..@@@.@@..@.@@@@@@.@.@@.@@..@.@..@@@@@.@@@@@@.@@@@@@..@@@..@.@@@@@@@@@@.@..@@@@@.@.@@.@@@@@@.@..@.@@.@@.@..@@@.@@..@@@.@@@@@.@@.@.@@@.@ +.@@@@..@@@@@@@@...@@.@.@@@@..@@@@.@@...@@@@@@..@@..@.@.@.@@@...@@@@@.@@.@@.@@@@.@.@.@.@@.@.@.......@@@@@@@@.@@@@.@@.@@@.@@.@.@.@@@.@@.@@@@@@ +@..@@.@@@..@...@@@..@@.@..@@@@.@..@@.@...@.@@@@.@@@..@@@.@@@..@.@@@..@@@@@@.@.@.@@.@.....@@@@....@@@@.@@@@.@@@@@@@@@@..@...@@@@@@@@.@@.@.@.. +.@@@.@@@@..@.@@@..@@@..@@@.@.@..@@@..@.@@@@@@@@@..@.@.@@@@@.@..@@@@.@@.@..@@@..@..@.@.@@.@.@@@@.@@@.@..@@.@@@@...@.@.@@@@@@.@@@@@@.@@@@@@@@@ +.@..@.@@@@@.@..@@@...@@.@@.@...@@@@@.@@@@@@.@@@....@.@.@@@@@.@..@@@@@@@@@@@@.@..@.@@@@.@@@@@@@.@@.@@.@....@@@@.@.@.@@@@@..@@@@@@..@..@..@.@@ +@@..@.@..@@.@@@@@@@.@@@@@.@.@@.@@@@@.@.@...@@@.@@@@.@.@.@@.@.@@@@...@@@..@@.@@@@@@@@.@@@@.@@@.@@@.@@@@..@@.@@.@..@.@@@@.@.@..@@@@@@@@.@@@.@@ +.@.@.@.@@@@@..@@@@@@@@.@@@@@.@@.@@@@@@.@@@@@@@@.@.@@@.@@@.@..@@@@..@@@@@..@@..@@.@@@@@.@@@@@@@.@@@@..@@@@@.@@..@@@.@@@@.@.@@@.@.@@@@.@@@@..@ +.@@.@..@@@@..@@.@@@@@.@@..@@@@.@.@.@@.@@@@@.@@@.@@@..@@@@@..@@..@.@@.@@@@@@@.@@@...@@@@@.@.@..@@@.@@...@@.@@@@@@@@.@@....@.@.@.@..@@@@.@@@.@ +@@@@@@..@@@@@..@@.@@@..@@.@....@..@@@@@.@.@@@..@.@.@.@@@..@@..@.@@@@.@..@@.@.@.@@@.@.@@@.@.@@@.@...@@@@@@@@@@@..@@@@@@@@.@@@@@@@@@@@@@@.@@.@ +.@@@@.@@@@@.@@@@...@.@@@@@@...@@.@@..@@@@.@@@.@@@@@@@..@.@@@@@..@.@@@.@..@.@@..@..@.@@.@@@.@@@@@@@@@@@@..@@@@@@@@@@..@@@.@@.@..@.@@..@..@@@@ +..@.@.@@@..@@.@@@@@@@.@@@@.@@@@@.@@@@@.@@@..@.@..@@...@@.@...@@..@@....@@@@.@@@@@.@@.@@.@@@@@..@@@..@@@@@@@@.@.@..@@.@@.@..@.@.@@..@.@.@.@@. +@@@@.@@...@.@.@.@.@@@@@..@@@@.@@.@@@..@@@.@.@@@@.@.@@...@.@@@@@@.@@.@@.@.@.@@@.@..@....@@.@@@@.@.@..@@@@@@@@.@.@..@@.@.@.@..@.@.@@@@@..@@@@@ +.@@..@@..@@@@..@@.@@.@@@@.......@..@@...@@@.@@.@@@@@.@@@@@@..@...@@@..@@@@...@@...@@.@@.@..@@@@@.@@.....@@@@@..@@@@@@.@.@@..@@@@@@.@@.@@@..@ +@@@.@@@.@@@@.@@@@@.@.@@..@@..@@.@.@.@..@@.@@.@@.@.@@@...@@@.@.@.@...@@@..@@.@@@..@@@@@.@.@@@@@@.@@@@@@@....@@.@.@@@@.@@.@.@@@@@@@@@@.@@@@..@ +.@..@@@..@..@@..@@..@@@...@.@@.@@.@@@.@@.@@@.@@@@@@@@..@@.@@.@@.@@...@@...@@@.@@@.@@..@@@.@..@@@..@..@@@@@@@@..@@@@@@@@@.@@@.@.@@@..@@@...@@ +@@@@...@@.@@.....@@@.@@@.@..@@.@@@@@.@..@.....@@@@@.@@@@.@@.@@@@.@@.@@@..@.....@@@@@.@@@.@.@..@.@@@@@@.@.@.@@@@.@@.@@.@@..@@@.@.@@@@@@@@@@@@ +..@.@@.@@..@@@@@..@@@.@@..@.@.@...@.....@@@@@@@@@@@.@@@..@@@@@@@@@@...@@@@.@@..@@@@.@.@.@@.@@.@@.@@@@@.@@@.@@@.@@@.@.....@@@@.@@@.@....@@@@@ +.....@@.@@@@@.@@@@.@.@@@.@@..@.@.@@@.@..@.@.@@@..@.@.@.@.@@@@@@@..@@.@@@@@@..@@.@..@.@..@@@@..@.@@@.@.@@@@@...@..@@..@.@@.@..@@.@.....@..@@. +.@@.@@@@...@...@...@.@@.@@..@@.@.@..@@.@@.@.@..@@..@..@@@@@@..@@@@.@.@.@@@@@@@@@@.@@@..@@@@@@.@.@..@@@@@@@@@@@@@..@@@@.@@..@.@@.@@..@..@@@@. +@..@@@@.@@.@...@@.@@.@.@@@...@@@@.@@.@.@@..@.@@@@@.@@@@@@..@@@.@@..@@...@@@@@@@@..@.@@@@@@@...@@@@.@@.@..@.@.@..@@..@@@@@@@....@.....@@@@.@. +@.@@@@@@@..@@.@.@@@@@.@@.@@...@@.@@.@.@..@@.@..@@@.@@..@..@@..@@.@..@..@@@.@@@@@@@@.@@....@.@@@....@@@@@@@@..@@@@@@@@.@@...@....@...@.@.@.@. +.@@@@.@@.@@@@@@@@.@@@.@@@@....@@@@.@@.@@@....@@@@.@@@@@@.....@@@.@@.@.@@@.@@..@@@@@@@@@.@...@@@@@@@@..@@.@@..@@@@@@@@@@....@@@.@..@@@.@@.@.@ +@..@@.@.@@.@..@.@.@..@@@..@..@@...@.@@@@@@@@@@@...@@@.@@@.@@.@@@@@@.@@@.@.@@@..@....@@@.@.@@@@@@@.@@...@@..@......@.@@..@..@.@@@.@@.@.@.@@@. +@.@.@.@@..@@.@@@.@@@...@@@...@.@.@@@.@@@..@.@@..@.@@@@..@@@@..@@.@..@@@..@@.@@.@@@@.@@@@@@.@@@.@@@...@.@.@@@...@.@@..@@..@@@@@@..@@.@.@.@@@. +..@@@.@.@@@@.@@.@@@@@@...@.@..@..@.@.@@.@@..@.@.@@..@@@@.@.@@@@@@@..@@.@.@@@..@@@.@...@@@@@@@@@@@@@.@.@@@@@@.@@.@@@@...@.@..@.@@@.@@.@..@@.. +@.@.@..@@.@@@@@@@.@@@.@@@.@@@@@.@@@@@@@@.@.@@.@@..@..@@@@...@@@.@@@.@.@@@@@.@.@@@@@@.@@@@.@.@@.@...@@@@@@@@@.@@@.@.....@@@@..@.@@@@@..@@@@@@ +@.@@.@@@..@@@.@@@@.@@@.@@..@@@@@@@...@@@.@@.@@@@@.@@..@@@@@@.@@@.@.@.@..@@@@.@.@@@.@@@@.@@.@@@@@@.@@.@@.@@@.@.@....@.@..@@.@@.@@@@@@@@@.@@@@ +...@@.@..@@..@.@@@@@..@..@.@.@...@.@@@@@@.@@@@..@@@.@@.@.@.@.@@.@.@@@@@.@.@@@@@@@@@@@@@@.@@@.@@@.@@@@@.@@@.@@@@@.@@.@.@.@@.@@..@@@@.@@.@.@@@ +@@.@@@@@@@@@.@@@@@.@@@.@@@......@@.@@@@@..@@.@...@@...@@@@@@.@@@@.@@.@@.....@.@@@@@@..@@@.@@..@.@@@@@@.@..@..@@@...@@.@@@@@@.@@@@@@@.@@.@@.. +@@@.@.@..@@@.@..@@@@@...@@...@@@.@@@@..@@@@.@@.@@@..@.@@@@@@.@@@@@@@@.@@@@@@..@@.@@@@.@@@@@....@@@@.@@..@@.@...@@.@.@@@@@@@@@.@@..@@..@@@@.. +@@.@@.@.@@@..@..@@.@@@.@..@@..@@.@@@.@@@@.@..@@@..@@@@.@.@@......@@@@...@.@@@@@@@.@.@@.@.@......@..@@@@@@@.@.@.@.@..@@@...@@@.@@..@@.@@..@@@ +@.@.@@@@@.@.@@@@@@@.@..@..@@...@@@@@@@@.@@@@@@@@.@@@.@..@.@@.@@.@@@.@.@@@@@.@@.@@.@....@@.@@@@..@@@.@.@.@@...@@..@..@@..@@@..@@@@@@@.@.@.@@. +...@.@@@@..@@@@...@.@@@.@@.@@@.@@@@.@@.@@@..@@.@@.@@@.@@..@@@@@@@@.@@@.@@@@.@.@.@.@@.@@.@.@@.@@..@@@@@@.@@@@@@@@@@@..@.@@@@.@...@.@@..@...@@ +.@.@@@.@.@@.@..@@@@@..@@.@@@.@.@@@.@..@.@@@.@@@@@@@.@@@@@@..@@.@.@@@..@@@@@@@@@@@@@..@@...@@@@@@.@@@@..@@.@@@..@@.@@.@.@@@@.@@.@.@.@@.@@@@@@ +@.@.@@...@@@@@@.@@@.@@@.@@@@@@@....@..@@@..@..@@..@@.@.....@@..@.@.@..@@@.@@@@@.@@.@@...@@@@@@.@.@.@...@.@@@@@....@@@.@.@@@....@@@.@@@.@@@.@ +@@.@@@@.@@@@..@@@@@@@@@..@@.@..@.@@@@......@@@@@@@..@@.@@@.@@.@.@.@.@@@.@@.@@..@@@@.@.@@.@@.@@@@@.@.@@.@@@...@..@@@.@.@@@.@@@@@.@@@.@@@@...@ +@..@...@.@.@.@@.@.@...@@.@.@.@@@@@@@.@@.@@..@@..@..@@.@@@.@@@.@@@.@.@@@@@@@@@@@.@@@@@@.@@@.@@@.@@@.@@..@@.@@@@@@@@.@@..@@@.@@.@.@@@@.@.@.@@. +@@@@@.@@..@@@.....@.@@.@@@@.@.@@@@@@@@.@@@...@@@@@@@@@.@@@.....@.@@@.@@@@.@@.@@@...@..@@@@@..@@@@@@@.@...@@@@@@@@@@@@@.@@@..@@@@.@.@..@.@.@@ +@.@@@@@..@@@@@@@.@@.@....@@@@.@@@...@@@@@@..@@@@.@@.@..@@@@@.@@......@.@@@@@@....@@@@@@@@@.@@@@@.@...@.@@@.@..@@@....@@@@.@.@.@.@@@.@@@@@@.. +@@@..@@@@@@@@.@@@..@@@@@@@@@@@@.@@.@@@@@@@..@.@@@.@.@.@.@.@@@.@@..@@.@...@@@.@@@.@@@@.@..@@.@@..@@@..@@.@.@@..@.@@@@@@@..@@@..@@@@...@....@@ +.@@@@@..@@@@@@..@.@.@@@@@@@.@..@@.@.@..@@..@@@@.@.@...@.@.@@.@@@@@.@.@@@@@@@@.@.@...@..@@.@@@..@@@@@@@@..@.@@@@@.@@@.@@@@@@@@..@...@@....... +..@@@@..@.@@.@@..@.@.@@@@@..@@@@@@@..@@.@@.@@.@@.@@@.@@@@@@@@@..@@@@@@.@@@@...@@@@@..@@@@@...@.@@..@@.@.@@@@@@@..@.@@@@@@@@@.@@@.@..@..@.@.. +@@@.@.@@@@.@@@.@@.@@@.@.@@@@@.@@@@@@.@@@....@@@@@@@@@.@@.@@@@@@@@@@@@.@..@@@@.@.@@@...@@@..@@@.@@@.@...@...@@.@@@@@@@...@..@@@.@@@.@@@.@@@.. +@@@@@@@@@.@@@...@@@@..@....@@..@@@@@.@@@.@@@....@@@@@.@@..@@..@...@.@@@@@@.@@@.@@.@.@@.@.@..@@@@.@@..@....@.@..@.@.@.@@..@.@@@.@@@.@@@@@.@@. +...@@@@@.@@.@@@.@.@.@@@...@@.....@@@@@@@.@@@@@@...@@@.@...@@@@@@.@@@@@.@@@@.@@..@.@.@.@@.@@..@@......@.@.@.@@.@@.....@@@..@@@@.@@.@@@@.@.@@@ +@@@@..@@.@.@@.@.@@@@@.@@@@..@@..@@@.@@...@@@@@@.@@@@@.@.@.@.@.@@@@@@@@.@.@..@.@@@.@@@@@@@@...@@.@@.@@.@@@@@@@@@@@@@.@@@@@.@@....@.@@@.@@@@.@ +@.@@.@@..@@@@..@@@@@@@@..@...@@@..@@.@@..@@@@@@@...@.....@@.@@@@.@..@.@@@@.@.@.@@.@@@..@@@.@@@@@@@@@@@@@@...@.@@..@@@@@@@@@.@@@@....@.@@@@.@ +@.@@@@....@@@@@.@@@@@.@@.@@...@@@.@@@.@@.@@@.@@@@...@@@@@@@@..@@@..@@@.@.@.@@.@@..@..@..@@@@.@@@@@.@@@@@.@..@.@@@.@@@@@.@@@.@..@@..@.@.@@.@@ +..@.@@@@...@@...@@.@@@@@@@@.@@@...@@.@.@...@@@@.@@@@.@@@@.@@@..@@@@.@@.@..@@..@...@@@@@@@..@..@.@...@.@@@@@@@@@@.@....@@...@...@@@@.@@@.@@.. +.@@..@.@..@@@@@@@@@@@.@@@@@...@@@.@.@.@@@@@@@@..@..@@..@.@@@@.@@..@..@.@@.@@@@@@..@@.@@.@@.@.@@@@@@@@@@@...@@@.@@@@..@.@...@@@.@...@.@@@@@@@ +.@@@@@@@.@@@.@.@.@.@@.@.@@.@@@..@@@@@@@@@.@@@@@@@.@@@@@.@...@@@.@@..@.@.@.@..@.@@@.@.@.@....@...@.@.@@@.@@@@.@.@@@.@..@@@.@..@.@@@.@@...@.@. +.@@...@@.@@@@.@....@@@@@@.@@..@@.@@@@.@.@@@@@@@@@@@.@@@.@@@@@@@...@@.@@@@.@@.@.@@@@@@.@@.@......@@@..@.@.@@@@.@@@@@....@.@@....@@@..@@@.@@@. +@.@@@.@.@@@@.@.@@@..@@...@@...@@.@@@@@.@.@@@.@.@.@.@@@.@@.@@@@@@@@@.@.@@@.@@@@@@...@@.@@..@@@@@@...@@@@@@@@.@@@@.@@..@.@.@.@@...@..@@.@.@@.. +.@@.@@@.@.@.@.@@@@@.@@@.@.@@@@@@@@@.@@@...@@.@@..@@@@.@.@@@@@@.@@@@@@@@@..@.@.@.@.@@@@@@@.@@..@..@@.@@@...@.@.@..@@@.@....@@@@@@..@..@@@@@@. +@.@....@@@@@@.@@@@@@@@@@..@@@.@.@@@@@@@@@@@.@@@@.@@.@@.@.@@@.@@@.@@.@@....@@.@@.@@..@@.@@.....@.@.@.@.@@..@@.@@@.@@@..@@@@.@.@@@@@@@@@.@@... +.@@.@@@@@@@@@@..@@@@..@.@@@..@@@..@.@.@..@..@@@@.@@.@.@@.@@@@@@..@..@@@@@.@@.@@.@@@@...@@.@.@.@@..@.@..@@@@..@@@@@@.@@@@@@@.@@@@@@@@@.@...@. +...@@..@@.@@@@@.@@@@@@.@@@@@@@@@.@.@@@@@@.@.@@.@@@@@@@..@@@@@..@@.@@...@@@..@@.@@@...@.@@@...@.@@@@@..@@@@.@.@.@@@@@.@.@@@@..@@@.@.@.@@@@@.@ +@@.@@@@.@@...@@.@@....@@.@.@@@@...@@@@.@@@@@@.@@@@..@..@@@@@...@.@@@@.@.@@..@@@.@@.@@@..@@@.@..@@@...@@@@.@..@.@.@.@@@.@@@@@@.@@@.@.@..@..@. +@@@@@@.@.@..@.@@@@@@@.@@@.@@@.@@@@..@@...@@@..@..@@@@@@@.@@.@.@@@@...@@@.@.@@@@@.@@.@..@@@@@@@.@.@...@.@.@...@@..@@@.@@@@@@@@.@@..@@.@.@.@@. +@@.@@.@@@@@@@.@.@@.@@@@@@@@@@@.@.@...@@@@@@@@.@.@.@@@.@@@.@@.@.@.@@...@@.@@..@.@@@@@@..@@@.@@.@@@@@..@.@..@.@@@@.@@@@@.@.@.@..@@.@..@@@@.@@@ +@@@@.@@@.@.@@@.@....@@@@@.@@.@.@.@@@.@@.@@@@@@.@@.@@.@@@@@@@@@@.@@..@.@@@@.@@@@...@....@@.@@@@@@..@@@.@@.@@.@...@@.@.@.@@@.@@@@..@@...@@.@@@ +@..@@.@@@.@...@@@@@.@.@@..@@@@@@.@.@@.@@@@@@@.@@@..@.@@.@..@.@@@@@@.@.@@@@..@.@@.@@@..@@.@@@@......@@.@@.@.@.@.@.@@@.@@@..@.@@@@@@@..@..@@@@ +@.@..@@@.@@@@@...@@.@@..@@@@@.@@..@.@.@@@.@.@@@..@@.@..@@@.@@...@@@@.@@@@.@@@...@..@...@.@@@.@@.@.@@.@@@.@.@@..@@@..@@@@.@.@@..@@@.@@@@@@.@@ +@@@@.@@@@@@@..@@@@.@@@...@.@.@@...@@..@@..@@@@@..@.@@@@.@@@.@@@@.@.@@.@.@..@@..@.@@.@...@.@..@.@.@@@.@@.@@@@.@@@@..@...@....@.@@.@@@@@.@@@@@ +.@@..@@@@@@.@@@@@@@.@@@@...@@@@.@@@@@@@.@.@..@@.@@.@@@@...@...@.@@..@.@@..@@@@@..@@.@@.@..@.@.@...@@@..@..@@@@@..@@@.@@@...@..@.....@.@@@.@. +@@@..@.@@@.@.@@@@@@@@.@@@@.@@@.@.@@@@@@@.@..@@....@..@@@...@..@@@.@@@@..@@@..@..@@..@@..@.@..@@.@.@..@@@..@.@.@@.@.@@@@@@@@@@@@.@@@.@@.@@.@. +@@@.@@...@.@@@@.@.@@@@@@@@@@.@@@@.@@@@@.@@@.@.@.@..@.@@@@.@@.@@..@@...@.@...@@@..@@@..@@@..@.@.@.@.@@..@@@.......@.@.@..@..@.@@@@@...@@@..@. +@@@@@@@.@@@@@.@@@@@@@@..@@.@..@@@@..@..@@@...@...@..@@@@@@@@@@@@@@@..@.@.@.@@@.@.@@....@@.@@@@@@.@.@.@..@@@.@@@@@@@..@.@..@.@@@.@@@.@@.@@.@. +....@@@...@@.@@@@@.@@@@.@@@@...@..@@...@@..@.@@@.@@@@.@@@@...@....@..@@.@.@.@@.@..@@@@.@@@@.@@.@.@....@@@@.@.@@@@@.@@@@.@@@@.@@@@...@.....@@ +@@.@@...@@.@@@@@.@@@@.@@@@@@@@.@...@@@.@@@@@@@@@@@@..@@@@@....@@@@@@.@@..@..@@@@@.@@.@...@@@@.@.@.@.@@..@@@@@.@@@@.@@.@@.@@@@@@@@@.@@..@.@@. +@.@@.@@@@@@@@...@@@.@@.@@.@...@@@@..@@...@@@@@@@.@..@.@@.@@@@@@@...@.@.@@@@.@@.@.@.@.@@.@@..@@@....@.@@@@@@@@@@@..@@@@@@@.@@@@..@...@@.@@@.@ +..@@@@@@..@@@@.@@@.@@@@@.@@@@@@@.@.@@@.@@@@@@@@@@@@@@@@@@..@@.@@@@@@.@@@@@@.@@.@@@@...@@..@.@@.@.@@@@.@..@@@@@@.@@@@..@.@.@..@@@@.@@@@@@..@@ +.@@..@@@@@....@@@@..@@@@.@@@@@@.@.@@..@@@@@@..@...@..@@@.@@..@@..@@.@@@.@@.@.@.@@.@@.@@@.@..@@@@@@.@.@.@@....@@@@@...@@@@..@@@@.@@@@...@@..@ +@@@@@@@@.@@@@@@.@@@@@.@@@@..@@@@.@@@..@@@@@.@@...@@.@@.@@.@.@@@@@@@@@@@@@.@@@@.@@..@@@@@.@.@@....@..@..@.@@..@@@@@@..@@.@@@@@.@.@@@@.@@.@.@@ +@@.@@...@..@@@@.@.@@@@@.@@@..@@@@..@.@@.@.@@.@@@@@.@@@@@.@@..@@@@.@@@.@..@@...@@@@@@.@@@@@..@@@@@@@@.@.@@@@@.@@@@.@@.@....@@.@@@.@..@@..@@@. +@@@@.@@..@@.@@..@..@.@.@@.@....@@..@.@.....@@..@@@@.@..@@..@.@@@@@.@..@..@@@@.@@.@.@.@@@@@@@@@.@@.@@@@@@.@....@@@..@@.@@@.@@@@.@@@@@@@.@@@.@ +.@...@.@@.@..@@.@.@@@.@.@.@...@.@@@@.@@@@@..@@@.@.@....@@@@@@@@@@@@.@@@@@@@@@@@@.@...@@.@..@@@@....@.@.@@@.@@.@@@.@..@@@@@@@.@.@@@@.@@.@@@.. +@@@@@.@.@@@@@@@.@.@.@.@.@.@@@..@@....@.@@.@@@@.@.@@.@.@@.@@@@@.@....@@@@@@@@@@@..@@@@.@.@@..@@.@.@.@@@@@@@@..@@@@.@.@@@@.@@@..@@@@@.@@@@@@@@ +@....@@.@.@@@.@@@.@@@@@..@....@@@@@.@..@.@@..@@.@@@@@.@@.@.@@@@@@.@@@@.@@@.@.@.@@@@@....@@@.@@.@@.@@@..@.@....@.@.@@.@.@@.@.@@...@@@.@.@@.@. +....@@@@@@@.@@@.@@@.@.@@@.@@...@@@@@......@@@.@@.@@@.@.@@@@@@@.@@@.@..@@@@@.@.@...@@@...@.@@@.@..@@.@@..@..@.@@@..@@.@@@.@@.@@.@@.@@@@@..@@@ +@@@@@@@..@@@...@@.@@.@@@.@@@@@.@@.@@@...@.@.@@@...@@@..@@@.@@@@@@..@@.@@@.@..@@.@@@.@@@..@@@.@@@@@@.@@@@@@.@@.@...@@..@.@..@@...@.@..@.@@@@@ +@@.@@@.@.@@.@@@@@@....@@.@@@@@@@@.@@..@@@@@.@@@.@.@..@..@.@@@..@@@@.@@.@@@@@@.@..@@.@@@.@@.@@.@@@@.@@@@@@...@@.@@@@@@.@@.@@@...@@@@@@..@@.@@ +.@@@@.@@.@@@.@@@@@..@.@.@.@@.@@@@..@@@@@@@@@@@@@.@@....@..@@@@..@@@@@..@@.@@@@@.@@@@..@@@.@.@.@@@@..@@@@@@@@.@@.@...@..@@@@@.@..@.......@@@@ +@@@@@@@@.@@@@@@@@.@@@@@.@@.@@@@@.@@@@.@@@@.....@.@....@@..@...@@@@@..@@@@.@@@@.@.@@@@@.@@.@@@@@.@..@@@@.@.@.@@@@.@@.@@@.@..@.@@@@@@@.@@@@@.@ +@@@...@@.@@..@.@@@@@@@@@@@@@@@..@@@@@@.@..@@@..@@@@@@@..@@@.@.@@@.@.@.@@...@@..@..@.@.@@@.@@@@@..@.@@.@@.@@..@.@@@@..@@.@...@.@@.....@...@.@ +.@.@..@@.@.@.@.@@@.@@@@..@@.@@.@.@@.@@@..@@.@.@@@.@@@@@..@@@@@@@.@@@@@..@@..@@@..@....@.@@.@@@@@@@@@..@.@@...@.@@.@.@.@@@@@@@@.@@@@@..@@@@@. +@@@@..@.@.@@@..@@@.@.@..@@@@.@@@..@.@@..@@...@.@..@@..@.@@@@@@@@.@..@@@@@@@@@.@.@@.@@@@@....@..@@@@@@@@@@@@@@@@@...@..@@..@@...@.@@@@@@.@@@. +@@@@@...@@@.@@@.@..@@@@@@@@@@..@@.@.@@@@.@.@@@@@@@.....@@@@@@.@....@..@@..@@.@@@@.@.@@..@@@..@@@@.@@@.@..@@..@.@@.@.@..@..@@@@@@.@@@@@@@@.@@ +.@.@.@@..@@@.@@@.@.@@@@..@..@@@@@@@.@@@@@@@@@..@..@.@@@@.@@.@.@@@@.@@@.@..@@@@@..@.@@@@@@@@@@.@@..@.@@@@@@.@@@@@..@..@..@...@@.@@@@@@.@..@.@ +@@@.@@@@@@@@.@@..@@..@...@@@..@.@@.@@@@@@.@@@@....@..@@@.@..@@.@..@@@.@.@@@@@@@@@.@@@@..@.@..@.@@.....@@@@...@@.@@@...@@@.@.@@@.@@.@...@@..@ +@..@@@@.@.@@@@@.@.@@.@.@@@@.@.@@.@....@.@@.@..@@.@@@@.@@@.@...@@..@@@@@@@@.@.@@@@..@@.@....@.@@.@.@@@@@..@...@@.@@@.@@.@..@.@@...@@@.@@@@.@@ +@@@@..@@.@.@@@...@..@@.@@.@@@@@.@@@.@.@@.@@@@...@..@@..@@.@...@@@@.@.@@@@@@@@.@.@@@@.@@@.@@.@@..@@@.@@@@.@@.@@.@@@@.@@@..@@.@@@@@.@@@@@.@@@. +.@@..@.@@@@..@@.@...@@@....@.@@..@@@..@@@@@.@@..@@@@@@.@@@@.@@@.@@...@...@@.@.@@@@@@@@@@@.@@.@@@@@.@@@.@...@.@@@@@@.@@..@..@..@@@@@.@.@@@@.@ +@@@@@@.@..@..@@..@..@..@@@@..@.@@@.@@..@@..@.@@@@@@@@..@@..@...@@.....@@@@@@@.@@@@..@..@.@@@...@@@@.@@@@@@.@..@.@@@.@@@@@@@..@..@@.@@@@@@.@. +@@@@@@@@@@@@@..@@@.@@@.@@..@..@@@@@@@..@@@@@@...@..@@..@@@@.@@...@.@..@@@@..@@..@....@@..@@...@.@@.@..@@@@.....@.@@@@...@@@.@@@@@@@.@@.@@@@@ +...@.@.@@.@.@@@.@@@@.@..@@.@.@@@......@.@@.@.@@@.@.@..@@@.@@@.@@@...@@.@@.@@@@@@.@....@..@@@.@@@@@..@@@@@..@.@.@@..@...@@.@@@@@@@.@@..@@..@@ +..@@..@@@@@@@@@@.@@@@@@@.@.@@.@@@@@@@.@.....@.@@@@@@@@@..@.@@..@.@@@@@@@@.@@@@..@@@.@@@@@...@@..@@@.@@@@@@@@@...@@@.@.@@@@@@@@..@@@@...@@@.. +.@@@@@@....@@@@@.@@@@.@@.@.@@@.@@.@@@@@@.@...@@@@.@@@@..@@.@@..@@@@.@@...@@..@@@.@.@@.@.@@@@@@@@..@.@@@...@@.@@.@..@@@@..@@@@.@@.@@@@..@@@.. +@@@.@@.@@@@@@.@@@@@.@@.@@.@..@@@.@@@..@@@....@.@.@..@@..@@@@@..@@@@@@@@.@..@@@.@@.@@@@@@@.@@@@@@@.@.@@...@.@.@@@@@.@@@@@@..@@@.@.@.@@@..@@@@ +@@@@@@..@@@@@@@.@@.@@@@@@@@@.@@@.@@@.@@.@.@..@..@@..@@@@@@.@@@.......@@.@@.@.@.@..@.@@@@.@@@.@@....@@.@@.@@@@@@@@@@@@@@@@@@@@@.@@..@@@...@@@ +@@@@.@@@@.@@@@@@@@@.@...@@@@.@@@@@@.@.@@@..@@@@@@@@...@@...@.@.@@.@@@@@@@@.@@@..@@@.@@.@@..@.@@@.@.@@.@@...@@@..@@.@@@.@.@@.@.@@@@.@@@@@..@@ +@.@@@@@@.@@@.@@.@..@..@@@..@@@@.@..@@.@@...@@..@@@@@..@@@@@@@..@@..@@.@..@@.@.@.@@..@...@@@@@@@@@@..@@@@.@.@@@.@...@@.@@.@@@@.@@..@.@.@@@.@@ +@@@.@@.@@@@.@..@@@.@@@@.@@@@@@@@@@@@@@@@.@@.@@@@...@@@.@@@@.@...@@.@@@@@.@@....@@.@.@@@@...@@@.......@@..@@.@.@@.@@@@....@.@@@@@@@..@..@@@.@ +.@@.@@@..@@@.@@@@@@@..@@.@@@.@.@..@@@.@@@.@@@@@.@..@@.@@@@.@@@@@..@@@.@.@@@.@.@@@@@@@@.@@@@..@..@@@.@..@.@.@@.@.@@@.@@@@..@.@..@@.@@@.@..@@@ +@....@@@@@@...@@@@@@..@@@@@@@.@@.@...@@.@@.@.@..@..@@@@@@@.@..@@@..@..@@....@@@@..@.@@..@.@@.@@.@...@@@..@@@.@.@.@.@.@@@..@.@@@@.@@.@.@..@@. diff --git a/5-input.txt b/5-input.txt new file mode 100644 index 0000000..d9b1f96 --- /dev/null +++ b/5-input.txt @@ -0,0 +1,1175 @@ +123733999511819-129097742451553 +72457259933919-73006486209179 +449751833329432-450568741457015 +448947300617550-449751833329432 +316890832692667-318375609475339 +131019804696732-133504194291127 +395398847461944-396102934283973 +468376118242991-471943110871380 +333238489644882-340784194571579 +145963688800831-146145871957057 +537960941273275-540259922750046 +426202095635127-431349654040376 +312828450083787-314305496993884 +543936086278284-548968886939809 +78116148736612-78776205767469 +375440416264834-379737809430310 +523959872606445-523959872606445 +202177936141278-203498793678689 +537077393994144-538544747255375 +144587556727895-144859937290891 +484305130559820-488966224558090 +398364695750914-399128875480997 +318072307317644-319255683053141 +168891995188741-168891995188741 +163090520676375-168891995188741 +365562695731946-368393312968878 +70971915434748-71824285847299 +254114180397478-254114180397478 +148990027966738-149108492715891 +514820395926815-520494825773196 +22756767160351-22756767160351 +225901307405140-228251163257320 +398769071207357-399411191135966 +22756767160352-27807037307628 +50772368198525-58822218726806 +272764005357263-279452204102319 +540434864117418-542603411850875 +213865942274473-213865942274473 +535514631750141-537631240137378 +114540090145831-118145014645056 +97402799394292-97402799394292 +191485186966715-199069720799337 +533237666288192-534793402534845 +179089627875761-179089627875761 +201454906030829-202747562281209 +437971290047841-440939365462702 +152477144442229-158303798019034 +103993765352676-103993765352676 +426202095635127-431349654040376 +400509640504551-400956320724574 +450285967857330-450713973644024 +348493430575081-348493430575081 +209547485503448-210880045174633 +450713973644024-450915605345301 +149597383337345-150487596666673 +205702087897137-207260881959745 +206639283022764-208040019436720 +400509640504551-400956320724574 +42837681618333-45038259219829 +122034590777905-127236687887286 +395258762373838-396026141420454 +42837681618333-49157815364864 +326611040738619-330481152508039 +141592085809887-142341356942707 +444616482618339-445175130948821 +202935099007068-204441264065218 +146699153642080-147158619682012 +434255273547528-440939365462702 +213865942274474-218664945453134 +402654169333020-406434569103853 +231949155646869-237086199261782 +383103533229844-389988436987826 +145206819977168-145963688800831 +142787599347688-143557171206626 +324437266434316-326611040738617 +553825067470460-562009316501320 +15768900832850-15768900832850 +254114180397478-258010591291039 +486346732468311-491257246683015 +78776205767469-79258861946720 +207608866702410-209000903596796 +194773819445986-199069720799337 +64140594340860-68554026650285 +112431945208907-118145014645056 +392930358950372-393469543412806 +77708018530136-78303007481531 +72794065855459-73331859754342 +75812866444581-76582297163100 +141082935241657-141400174620601 +53899982970514-56162558416759 +494962663361751-499924452897506 +152477144442229-158303798019034 +394764025279638-395398847461944 +396513669711427-397030357185118 +344374444362491-348493430575080 +375440416264834-375440416264834 +305497956964067-310819747532438 +247282776586758-249433370001354 +148182555999792-148712833562777 +304586138639328-310819747532438 +231949155646869-240361286655633 +517247388598561-519391364691403 +311872285027385-313439342279269 +1498220551639-6952719563388 +314024115559271-315256926607111 +455090421238550-458362334280272 +185291270397823-190310581333748 +32607483985306-38795978084301 +205096452733529-206458590524066 +134127793532006-136868645700672 +147397374804130-147641905030945 +447751758628882-448426894178436 +447751758628882-447890076574460 +76066049817733-76582297163100 +474763431631341-481635540296155 +356116129221008-359636761675883 +181701409335748-185291270397821 +392266187429988-392930358950372 +73930963939517-74785342454198 +319028042503038-320448279038767 +146145871957057-146361933776836 +352960724896393-358343148565632 +143205059394258-143557171206626 +132956966890879-135585887923730 +103993765352676-109602964033165 +315828331743366-317253286294513 +494962663361751-498291628175739 +523959872606445-531486218692760 +140817009132136-141400174620601 +241729215349632-247282776586757 +314991460694776-316335025854229 +464706095601557-468376118242989 +208679684033567-210052810547714 +143205059394258-143361965215351 +415377694783979-420328423222987 +449460995906643-449751833329432 +171680444344246-179089627875760 +137611104805792-140279553528871 +73006486209179-73331859754342 +363766299808742-370194869964745 +148990027966738-149597383337345 +319986026835966-321422271206633 +203991523121897-205546834849258 +292529454752280-298458727505487 +406434569103854-411448632603079 +146699153642080-147158619682012 +283808279464425-289958181152715 +223025997361587-230324469502334 +333238489644882-337647340379613 +397170692407151-397684418670106 +383103533229843-383103533229843 +508695025798639-511012266908114 +148990027966738-149427147902759 +14038091919253-15768900832849 +283808279464425-289958181152715 +82180997164891-85040800874679 +539193029794061-541036206954435 +534397022700522-536150413315905 +135979964732750-138450706404735 +503901145593421-508695025798638 +395398847461944-396102934283973 +447890076574460-448426894178436 +445960671807395-446434795466429 +481635540296156-481635540296156 +298458727505487-298458727505487 +93779765965657-97402799394292 +85040800874681-87622909142158 +265089854453580-269240241118013 +548968886939809-548968886939809 +1498220551639-6952719563388 +79258861946720-79450046880469 +262400291271055-268503795588810 +553825067470459-553825067470459 +61847066453483-64140594340859 + +522268425811830 +58341928066253 +255014109831764 +315843162847563 +232938072218405 +19238194231473 +266392673472622 +405603051584155 +122087955120424 +163498875135204 +316521298866315 +216386416919494 +244462636143708 +285238009910535 +232770351114751 +395098050723371 +133177507902191 +287256470908438 +32937479800945 +188321939132043 +428374575414591 +222588409351927 +211483387571430 +420352785783313 +364606620872250 +443433046654032 +134440829394773 +409234262909541 +195431555768032 +244941870406086 +351693863657088 +160579331943327 +335278976276672 +187584576177970 +365304047867811 +453939786893495 +145338557625740 +156156443823469 +178167660118496 +31704188932634 +385750661257533 +238590598966474 +479103035176667 +385983385727179 +109102802895817 +416108956305569 +556512417133498 +74445764218069 +401550605187678 +223901416887738 +466323646857857 +396306234993106 +356240729264499 +381863504277317 +294450332161713 +145288624574100 +431757992022260 +501234842002248 +172625840794735 +146922860850506 +353389540408415 +46324443761482 +54607324791467 +336838869669662 +24862029077778 +380246060390313 +429567326467230 +93482011059279 +503522309214910 +214688163106348 +490693281484231 +421210464643474 +117493101193319 +316810636752782 +344065030918857 +526123006217119 +155288157972082 +388647865632927 +376780231285276 +156323268844200 +439437777431944 +518823794594753 +208806734279641 +266752416192087 +177880434410666 +480712749127986 +516921532107868 +225673778279752 +122909268585638 +503624753931605 +5332807310234 +268957787292002 +157865767176152 +542881331469066 +226299602428643 +455029288257451 +562521502590053 +174088697409185 +3869014646122 +313232427509295 +486720516390751 +259873321715480 +88168530621585 +537869748151225 +106164354130800 +371068025927523 +161334365399053 +61095137645381 +108499466473812 +210217902138701 +335424857636711 +354945905754350 +287449528588491 +310235350850966 +374567554573765 +534026067782047 +329427939127247 +3788937071307 +551811336212883 +485602983607056 +249560823332236 +506885482746450 +533792335036195 +278690852579380 +63225072122982 +554896687355375 +241936114653718 +269672347689056 +62558430115002 +328844745814765 +165689097579304 +421101696882810 +104742139988287 +70289948676540 +100914706595381 +506035708154945 +6346536291804 +19525618065147 +475814754454076 +201772379304521 +155091362597495 +165205181408778 +106149532673050 +293444237227651 +10752088753699 +102742333792540 +88529209257082 +156269706699304 +254065526193458 +447702736208059 +142155699071326 +315770576619610 +20077399278893 +201445079264015 +115683569402529 +76447836471839 +325095475798116 +24585508243375 +255707575848517 +246554114912555 +54572741682952 +320932529639558 +550393567902400 +156614834339836 +254214985127865 +356820402288504 +261634022877099 +307377016738681 +307754068645110 +186625528679656 +526492558851810 +201390995577201 +541475681670522 +448142136550328 +238170735580889 +278138903332437 +268159671439729 +163509820281244 +146616846722080 +430090926260930 +209832057065104 +151374002315947 +537516327838442 +547070201835886 +143427834979038 +547817729991804 +100700162698105 +442960456247426 +70880017032405 +450754608786102 +265710598033549 +134971889861648 +319828881455113 +133677853873520 +71423988413197 +289044946954798 +265012479381519 +307082938857726 +449246104891399 +436232084474015 +202656701349398 +21772457467346 +354135642366064 +528828527650724 +378922096990324 +7003386817481 +466613650917734 +411315686256310 +141103121126049 +331027393331265 +315624949775212 +58792020663883 +534706246779483 +390479268927927 +465599625407918 +275666732945071 +538722303129339 +486762527359651 +503833819887241 +323605025017615 +293641802251829 +467539049211907 +439475077901076 +215555015150566 +353204136528043 +448562997127445 +116184430135658 +257579502882425 +176705241754156 +442633813097981 +176899509703934 +144620397795826 +387583371084238 +377950533212149 +412698313911330 +251853841281635 +487824266816512 +496507201659661 +230100209737010 +255434202422560 +503002918221459 +479486088917587 +11876463905084 +486696315919546 +84063663812618 +479974179115957 +354981606995700 +284153624763422 +232445202234137 +138338049453543 +170943888291789 +437901045034036 +354234021765386 +82418433121773 +45406797149516 +470665842164815 +464293471076587 +71113575223668 +289548048040222 +76678209678259 +448962568885499 +219736441363714 +46089374138870 +181429997499787 +215792539063393 +519501951676038 +554185940142208 +350707432219348 +113382408819701 +407719259801762 +217631549461165 +546661725054690 +135538004710123 +355678002063914 +235138052482578 +376508427736755 +88836071188395 +44049450208314 +462368681292444 +380593745459031 +11265659759789 +289500529041586 +317181028103663 +484392335609616 +6471743833805 +160516003082486 +115141678060367 +34394456361293 +428506343214664 +67834825552691 +371704968378355 +71461424354682 +220902080424883 +464265278386287 +447931208293242 +378908807990054 +273500615495985 +158725928736531 +240119229189138 +283684730220286 +277342500339172 +107028834947392 +5133529553047 +105296006886471 +185516143549306 +146303107743922 +124279892113901 +152911267053671 +198932101357516 +313672800572274 +33767737088861 +512390427504898 +294326717669767 +291138260097070 +198020080198704 +469425336414435 +162107030423088 +146860436315904 +359387503053820 +435327832730714 +82932629824843 +265480731831228 +450290255702277 +388722160757197 +139901224037611 +552122750331812 +94815669097041 +14555512984964 +218885867571857 +291379613084005 +430956274353209 +379403395922618 +413510335028658 +386106690791664 +434612154318173 +262511832536836 +155725992682330 +401910159343806 +396394490356238 +57443678242625 +543961501698890 +235459207604743 +530978885804003 +196136757872609 +367849484857813 +159382132610458 +316420429148601 +79136461697580 +98099872195640 +35144594855549 +557257995921798 +274678520935764 +367871094311129 +455508093113179 +415678845138229 +398719791886039 +409663969244563 +170417349432431 +132296081995422 +468458850259073 +405786366476048 +204527335955581 +89519771645577 +186793113488710 +197172404172231 +8123757636577 +33859155781227 +526414053813419 +550108894907272 +427758316754097 +430439193348795 +152985347863083 +407357534838100 +380630010834074 +378499710786526 +391683263784339 +235927635383829 +172392085484758 +378409154262197 +322277473045239 +515832965272084 +69573211257879 +429438737637217 +461591109047897 +538916142777584 +211277182572659 +518029039226072 +307265750365549 +422625831942065 +170122214705943 +73159439284963 +140486950301977 +535271525179306 +1706714418292 +203284656002007 +163008748377037 +514237600082406 +35928140999086 +278642505003002 +194306346751764 +472785559196719 +141216101366622 +459838732066572 +301271761992836 +260435287671722 +294895291899364 +550531387850489 +458869567800346 +338551470401642 +142193778382383 +203445897567592 +440556858669593 +236329512643400 +187483114530502 +65598598657363 +428284415637590 +265725791071353 +551249686244338 +335498314049613 +335517695016382 +156715978643154 +280333011097921 +239932029810785 +546082204952011 +319998027885304 +525003667511858 +82870977921682 +165665780099625 +97049938869069 +280179665568642 +63124932086434 +420115109028748 +178571005850235 +159238772780721 +406500104374341 +37828303242635 +360102094141870 +540715661470620 +164638481969105 +153876795364166 +475405772167422 +127104170807503 +456127484408450 +524779418576973 +519461408279416 +287703204350577 +104158535107420 +326321393590219 +518030496027283 +553821878119290 +438748017597125 +290103152753321 +504924719780971 +69113296811475 +66177208865764 +157818869139341 +85151130484317 +277345377753708 +234584767854645 +444485939931951 +172274489515952 +26696437765364 +71300837075030 +529067116633242 +347345950204210 +524441935927717 +345098509305857 +531161451799306 +442273594579844 +472509756779632 +508827321196329 +243908057655704 +185541381140448 +408826968429599 +407534509311192 +151910125977744 +488789932273075 +437849554259777 +483713463730730 +297955715583440 +63706115520600 +245778383504500 +64330506210084 +173199378689250 +433552772160777 +364190902156416 +454960668246602 +101380098505418 +551818616659312 +148356893868424 +119053869195222 +521833506055334 +490779577188217 +203288001766342 +517561653307775 +113976209371970 +202860556007143 +153740824459975 +163852107010557 +94558632576245 +551555013171094 +256605707168210 +85658202102839 +449726433502070 +365443636888027 +188751352423476 +342850875431614 +266977160178029 +475489731287876 +306499575864069 +384672358156173 +480772613122228 +967936979743 +262616589706552 +174081653835715 +514210408341256 +555296312944773 +557019812239581 +108947869801 +480979773452864 +122106165798653 +342503677839643 +406311789445311 +268425895098237 +226868633308318 +95614524774601 +157647423601681 +101589309041885 +464236913664714 +226234005926657 +219658385980986 +467833965810646 +267475626844713 +396598453912391 +528374073759164 +48399986267436 +401115689121541 +96749374728296 +97663702216747 +539348445567378 +476162396663489 +446755105051181 +240030392724329 +81959632696319 +198034320107976 +368904682200622 +366697162016555 +301537075198997 +510639173248153 +478399551501607 +458001581498818 +371215957989005 +419415397032680 +557042197977017 +81640722102855 +101687529734138 +361161139092044 +315348743421537 +367919366653635 +156923358603588 +174173885018200 +13340794622753 +152443763456078 +118333674185046 +545016087146089 +165867517035497 +329419488047867 +128785676927126 +83340840223053 +164218083371866 +85372463248980 +81840449728525 +161454003862752 +296020743572507 +74520882040063 +292100708348731 +418433665660335 +194550295909312 +205700380717345 +140081816103205 +506811246928702 +84058042018421 +254671031109686 +48322341671590 +443341518290168 +258720147608721 +247778720764879 +490210044045597 +15977000452498 +491235592987621 +388970213731515 +318611086305850 +540978570370659 +381568124743210 +354972815550324 +194253598399274 +217124257445345 +296981040420710 +104213634268578 +554704731366517 +449572575610744 +454458345780882 +207588189730252 +258275595415696 +396445678529436 +280432846459584 +74022361977186 +32678015528549 +265815426531967 +326956940032012 +175803276896058 +339550985311204 +368330539704141 +183118126312787 +28993841207264 +361426960770594 +166308412272869 +393563241351710 +382893421100575 +254386236363854 +495887766607651 +386060415139629 +533023396501415 +351589541104171 +100105062081903 +497029001339824 +277350233058173 +395058538211874 +448629949680092 +136981165485649 +510396040555591 +98919111505347 +265234547253967 +174199186136998 +46864239082385 +131413239128726 +354300504536400 +272865960383179 +552969309748123 +174273235052923 +503566043199917 +59172133860765 +450119619566344 +343622473648391 +430901740896048 +359329830608041 +427341306283631 +91367360423183 +81645922818788 +279798975522659 +321573413529428 +510283703574127 +126752331161988 +238224244150221 +314146170809421 +406370214848390 +494202304589110 +117262010501066 +190008018878234 +460904243404300 +468085851685569 +51789164569805 +345469313980792 +331490702080982 +208084893466741 +215453748884070 +446171759494858 +195308555016048 +59509168033425 +234883528181320 +306345152401339 +233019601717403 +479832400199373 +484702075723597 +261407101950338 +209892979622840 +166284424921136 +264172956731557 +267631421371696 +75135059126929 +183112512741000 +169288618847820 +22702628194649 +51112155243707 +331732079061532 +110421717315904 +399394401209644 +442188789146202 +189455695993232 +54861098847948 +295015293902505 +185098521369464 +457589563053693 +560917315345802 +545040837185642 +383327100035763 +149666980790995 +283105556029967 +268874017206446 +306870979789828 +5950357206942 +500822651116976 +268105922570827 +433224356606500 +356751589226626 +212015504960892 +19382874066773 +24219927731584 +443849867654428 +485299282437603 +528874164034342 +502826823259923 +50908664742642 +187030781272209 +194072946650380 +504290357987181 +180146491098756 +230553647048412 +113917036308954 +375788942110053 +490605812478790 +519330025431418 +137419963624814 +201569761011069 +9480592099536 +472090660911006 +206753069028027 +458259848582221 +248826009280049 +184607829805908 +250494301390092 +275342595561645 +122242252065649 +156196503156114 +92296579808870 +74217856715696 +195244646938556 +341472309590662 +239064736911306 +446392270870172 +191521545598773 +82995387072667 +550235961070923 +355902572749111 +275438130107556 +326627446910088 +248535148289402 +93822887018734 +258481107589613 +551784197179282 +143809378475943 +367094827822666 +66252187165041 +189823598658316 +365510286034575 +240234908018922 +35315136081683 +18081730568484 +439400406439844 +378258419862605 +407510559390305 +345338411124702 +458248624678447 +107130797316410 +465794387213716 +82517039229613 +317732119923775 +202234491082735 +133277265216356 +339428102361697 +504715018551943 +149564589157420 +333897402557700 +166387765267602 +394734429868594 +84235193891914 +12808242938273 +539428472166051 +148491206973675 +108290830454838 +69325948731628 +58075041515849 +194094139256646 +361134280920318 +230058201598134 +155470143683817 +75797983096252 +293904345711224 +65925813953618 +78147659102664 +278613888712541 +277589279868399 +447736918254698 +273749537976682 +41702245130580 +470083016794883 +375307061922216 +455979509709128 +6208109673922 +48127833053387 +199643796855355 +79530147874685 +368375848231329 +26032135379364 +125852681465990 +345272840712858 +12959796000640 +369154965439655 +6226291608820 +356213610933783 +326501044333283 +528042020579136 +364874510888959 +525030914131956 +491751469681677 +103413821989208 +104464123832285 +442273011774060 +228883129318903 +142207288256713 +321644335387344 +263834808764912 +65046354682216 +56798318595030 +191333927611985 +150829625837253 +126232380779498 +72622592596260 +412559410160292 +301449671026116 +559459172918876 +398513600128804 +528427551705542 +312139395783111 +193822855748043 +491629639271943 +463656937290223 +467021910079109 +181195660505841 +257977427417482 +388057462249765 +225725126746217 +86268413977309 +491213280262732 +458614915371195 +22273818951004 +468780424702625 +536933077001014 +496120838621027 +335151107483505 +418848922785654 +546114456979767 +467050722143514 +419016096879970 +208950118068705 +46239176985547 +62154608924248 +107168569888720 +58980362520432 +122047834171265 +478733783356228 +136950947540420 +165023278448909 +544744214940896 +529048550722243 +53230344341406 +200078416853115 +17104887836511 +19912237186819 +344046181070903 +269239927198105 +354704064722889 +353702393034456 +457625329073557 +57829421026343 +161748202644160 +364995130015300 +366152936025197 +259881085355924 +218012857543645 +404511261279477 +147525680200970 +549400248914135 +295520434089937 +535148558876549 +347144353410250 +227655478464968 +201943593222412 +198422412095281 +536555204204103 +110969899184009 +386163644928839 +417734498918300 +62263277079372 +398966953404239 +254059235829297 +486981976533329 +417315203085410 +24527645171959 +544640788595782 +157687153115875 +302599428782975 +37202598794670 +24250339443146 +70112251339720 +491056738812447 +22141714311902 +167023996819965 +354884346055617 +362635101945206 +356609281688422 +499086885108526 +179903109525110 +126801889293083 +113385780783605 +548901779729641 +264667938986079 +262126453251697 +534237204595353 +143802723317071 +388321951909634 +297709851944253 +120702256719193 +535481108529532 +490920924006183 +423859539322624 +289878037043922 +7283092373101 +82644252942341 +365343808709762 +254583212513165 +185776440739207 +906575294370 +368795017014698 +145679755079585 +299574654126826 +48121232683634 +213273036185622 +385359463768521 +154242899511592 +126564275894839 +446471589054538 +357485080609641 +348952407077346 +465023919243636 +139632747453290 +20601639946113 +132495824403437 +538886340307624 +64210869638075 +10295730576351 +507329877456014 +426902002766141 +370922358084867 +207931651824892 +135704653994954 +525219092816682 +435503071299719 +502924120970810 +33327304328811 +187354799573736 +397356124169193 +403904198319633 +150011076702236 +247973610195657 +54677732861479 +374628123962656 +265806552296980 +98580886664027 +392561271404753 +557841296401612 +430645543566707 +550140505203572 +516191528100466 +84527986514542 +513070923820895 +432819046856184 +177839615092019 +266043399855097 +194801159145767 +353510684747755 +540586542239904 +380220223728163 +448900463683128 +317199941073069 +360474465987966 +264480511951897 +119655846555726 +67917305960231 +296007444718361 +395792875364672 +164362101285074 +538343539400921 +167689689862956 +51298031167366 +1612927824087 +92073285006472 +151989719510572 +404906777217450 +527820283544138 diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..e6e29ee --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aoc-2025" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..bcf5194 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "aoc-2025" +version = "0.1.0" +edition = "2024" + +[dependencies] + +[[bin]] +name = "1-secret-entrance" +path = "src/1-secret-entrance.rs" + +[[bin]] +name = "2-gift-shop" +path = "src/2-gift-shop.rs" + +[[bin]] +name = "3-lobby" +path = "src/3-lobby.rs" + +[[bin]] +name = "4-printing-department" +path = "src/4-printing-department.rs" + +[[bin]] +name = "5-cafeteria" +path = "src/5-cafeteria.rs" \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b17d8ab --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1764947035, + "narHash": "sha256-EYHSjVM4Ox4lvCXUMiKKs2vETUSL5mx+J2FfutM7T9w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a672be65651c80d3f592a89b3945466584a22069", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..23c8da9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "Tutorials from the Rust by Example pages"; + + inputs.nixpkgs.url = "nixpkgs"; + + outputs = {nixpkgs, ...}: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + in { + devShells.${system}.default = pkgs.mkShell { + name = "qmk-default"; + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + packages = with pkgs; [ + rustc + cargo + clippy + ]; + }; + }; +} \ No newline at end of file diff --git a/src/1-secret-entrance.rs b/src/1-secret-entrance.rs new file mode 100644 index 0000000..c4c5859 --- /dev/null +++ b/src/1-secret-entrance.rs @@ -0,0 +1,34 @@ +use std::fs::File; +use std::io::{self, BufRead, BufReader}; + +const DIAL_SIZE: i64 = 100; + +fn parse_turn(s: &str) -> i64 { + let (dir, num) = s.split_at(1); + let sign = match dir { + "L" => -1, + "R" => 1, + _ => panic!("Bad input direction"), + }; + sign * num.parse::().unwrap() +} + +fn main() -> Result<(), io::Error>{ + let f = File::open("1-input.txt")?; + let br = BufReader::new(f); + let mut position = 50; + let mut zeroes = 0; + for line in br.lines() { + let line = line?; + let resulting_position = position + parse_turn(&line); + + zeroes += (resulting_position / DIAL_SIZE).abs(); + if position > 0 && resulting_position <= 0 { + zeroes += 1; + } + position = resulting_position.rem_euclid(DIAL_SIZE); + // println!("Move: {}, (P: {}, C: {})", line, position, zeroes); + } + println!("Result: {}", zeroes); + Ok(()) +} \ No newline at end of file diff --git a/src/2-gift-shop.rs b/src/2-gift-shop.rs new file mode 100644 index 0000000..4c63706 --- /dev/null +++ b/src/2-gift-shop.rs @@ -0,0 +1,52 @@ +use std::{fs::File, io::{self, BufRead, BufReader}}; + +fn parse_range(s: &str) -> (i64, i64) { + let (low_s, high_s) = s.split_once('-').unwrap(); + (low_s.parse().unwrap(), high_s.parse().unwrap()) +} + +fn invalid_in_range(low: i64, high: i64) -> i64 { + let mut total: i64 = 0; + for i in low..=high { + let len = i.ilog10() + 1; + for j in (2..=len).filter(|x| len % x == 0) { + let split = 10i64.pow(len / j); + let target = i % split; + let mut mut_i = i; + while mut_i > 0 && (mut_i % split) == target { + mut_i /= split; + } + if mut_i == 0 { + // println!("{} in {}-{}", i, low, high); + total += i; + break + } + } + } + total +} + +fn main() -> Result<(), io::Error> { + let f = File::open("2-input.txt")?; + let reader = BufReader::new(f); + let mut ranges = reader.lines() + .next() + .unwrap() + .unwrap() + .split(",") + .map(parse_range) + .collect::>(); + ranges.sort_unstable(); + + let mut total: i64 = 0; + let mut last: i64 = 0; + for (low, high) in ranges { + let low = low.max(last); + if low <= high { + total += invalid_in_range(low, high); + } + last = high + 1; + } + println!("Result {}", total); + Ok(()) +} \ No newline at end of file diff --git a/src/3-lobby.rs b/src/3-lobby.rs new file mode 100644 index 0000000..e1f4d5f --- /dev/null +++ b/src/3-lobby.rs @@ -0,0 +1,37 @@ +use std::{fs::File, io::{self, BufRead, BufReader}}; + +fn max_joltage(s: &str) -> u64 { + let values = s.chars() + .map(|x| x.to_digit(10).unwrap()) + .collect::>(); + + let max_idx = |xs: &[u32]| { + xs.iter() + .enumerate() + .fold(0, |max, (i, &x)| { + if x > xs[max] { i } else { max } + }) + }; + + let (_, total) = + (0..12).rev().fold( + (0, 0u64), + |(start_idx, total), i| { + let next_idx = start_idx + max_idx(&values[start_idx..values.len() - i]); + (next_idx + 1, 10 * total + values[next_idx] as u64) + } + ); + total +} + +fn main() -> Result<(), io::Error> { + let f = File::open("3-input.txt")?; + let reader = BufReader::new(f); + + let mut total: u64 = 0; + for line in reader.lines() { + total += max_joltage(line?.as_str()) as u64; + } + println!("Result: {}", total); + Ok(()) +} \ No newline at end of file diff --git a/src/4-printing-department.rs b/src/4-printing-department.rs new file mode 100644 index 0000000..4af22d7 --- /dev/null +++ b/src/4-printing-department.rs @@ -0,0 +1,64 @@ +use std::{fs::File, io::{self, BufRead, BufReader}}; + +const NEIGHBOURS: [(i32, i32); 8] = [ + (-1, -1), (0, -1), (1, -1), + (-1, 0), (1, 0), + (-1, 1), (0, 1), (1, 1), +]; + +fn get_grid_cell(grid: &[Vec], x: i32, y: i32) -> bool { + let (Ok(ux), Ok(uy)) = (usize::try_from(x), usize::try_from(y)) else { + return false + }; + grid.get(uy) + .and_then(|row| row.get(ux)) + .copied() + .unwrap_or(false) +} + +fn count_surrounding(grid: &[Vec], x: i32, y: i32) -> i32 { + NEIGHBOURS + .iter() + .map(|(dx, dy)| get_grid_cell(grid, x + dx, y + dy)) + .filter(|&p| p) + .count() as i32 +} + +fn update_grid(grid: &[Vec]) -> Vec> { + let height = grid.len(); + let width = grid[0].len(); + (0..height).map(|y| { + (0..width).map(|x| { + let x = x as i32; + let y = y as i32; + get_grid_cell(grid, x, y) && (count_surrounding(grid, x, y) >= 4) + }).collect::>() + }).collect::>() +} + +fn count_all_true(grid: &[Vec]) -> usize { + grid.iter().flatten().filter(|&&b| b).count() +} + +fn main() -> Result<(), io::Error> { + let f = File::open("4-input.txt")?; + let reader = BufReader::new(f); + let original_grid = reader + .lines() + .collect::, _>>()? + .iter() + .map(|s| s.chars().map(|c| c == '@').collect::>()) + .collect::>(); + + let mut last_grid = original_grid.clone(); + loop { + let next_grid = update_grid(&last_grid); + if next_grid == last_grid { + break; + } + last_grid = next_grid; + } + + println!("Result: {}", count_all_true(&original_grid) - count_all_true(&last_grid)); + Ok(()) +} \ No newline at end of file diff --git a/src/5-cafeteria.rs b/src/5-cafeteria.rs new file mode 100644 index 0000000..ed2c302 --- /dev/null +++ b/src/5-cafeteria.rs @@ -0,0 +1,49 @@ +use std::{cmp::max, fs::File, io::{self, BufRead, BufReader}}; + +fn parse_range(s: &str) -> (u64, u64) { + let (s1, s2) = s.split_once('-').unwrap(); + (s1.parse().unwrap(), s2.parse().unwrap()) +} + +fn main() -> Result<(), io::Error> { + let f = File::open("5-input.txt")?; + let reader = BufReader::new(f); + let mut lines = reader.lines().map_while(Result::ok); + + let mut ranges: Vec<_> = lines + .by_ref() + .take_while(|l| !l.is_empty()) + .map(|l| parse_range(&l)) + .collect(); + ranges.sort_unstable(); + + let mut ids: Vec = lines + .map(|l| l.parse::().unwrap()) + .collect(); + ids.sort_unstable(); + + let mut total = 0; + + // let mut range_idx = 0; + // let mut id_idx = 0; + // while id_idx < ids.len() && range_idx < ranges.len() { + // let (low, high) = ranges[range_idx]; + // if ids[id_idx] < low { + // id_idx += 1; + // } else if ids[id_idx] <= high { + // id_idx += 1; + // total += 1; + // } else { + // range_idx += 1; + // } + // } + + let mut max_seen = 0; + for (low, high) in ranges { + let new_low = max(low, max_seen + 1); + max_seen = max(high, max_seen); + total += 1 + max_seen - new_low; + } + println!("Result {}", total); + Ok(()) +} \ No newline at end of file