This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env perl | |
use strict; | |
use warnings; | |
my @part; | |
for (<>) { | |
@_ = split; | |
$part[1]++ unless m/\b(\w+)\b.*\b\1\b/; | |
$part[2]++ unless m/\b(\w)(\w?+)(\w?+)(\w?+)(\w?+)(\w?+)(\w?+)\b.*\b(?:\1\2\3\4\5\6\7|\1\2\3\4\5\7\6|\1\2\3\4\6\5\7|\1\2\3\4\6\7\5|\1\2\3\4\7\5\6|\1\2\3\4\7\6\5|\1\2\3\5\4\6\7|\1\2\3\5\4\7\6|\1\2\3\5\6\4\7|\1\2\3\5\6\7\4|\1\2\3\5\7\4\6|\1\2\3\5\7\6\4|\1\2\3\6\4\5\7|\1\2\3\6\4\7\5|\1\2\3\6\5\4\7|\1\2\3\6\5\7\4|\1\2\3\6\7\4\5|\1\2\3\6\7\5\4|\1\2\3\7\4\5\6|\1\2\3\7\4\6\5|\1\2\3\7\5\4\6|\1\2\3\7\5\6\4|\1\2\3\7\6\4\5|\1\2\3\7\6\5\4|\1\2\4\3\5\6\7|\1\2\4\3\5\7\6|\1\2\4\3\6\5\7|\1\2\4\3\6\7\5|\1\2\4\3\7\5\6|\1\2\4\3\7\6\5|\1\2\4\5\3\6\7|\1\2\4\5\3\7\6|\1\2\4\5\6\3\7|\1\2\4\5\6\7\3|\1\2\4\5\7\3\6|\1\2\4\5\7\6\3|\1\2\4\6\3\5\7|\1\2\4\6\3\7\5|\1\2\4\6\5\3\7|\1\2\4\6\5\7\3|\1\2\4\6\7\3\5|\1\2\4\6\7\5\3|\1\2\4\7\3\5\6|\1\2\4\7\3\6\5|\1\2\4\7\5\3\6|\1\2\4\7\5\6\3|\1\2\4\7\6\3\5|\1\2\4\7\6\5\3|\1\2\5\3\4\6\7|\1\2\5\3\4\7\6|\1\2\5\3\6\4\7|\1\2\5\3\6\7\4|\1\2\5\3\7\4\6|\1\2\5\3\7\6\4|\1\2\5\4\3\6\7|\1\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name SpeedSolving Hotkey Fixer | |
// @namespace https://voltara.org/ | |
// @version 0.1 | |
// @description Work around glitchy SpeedSolving forum hotkeys | |
// @author Voltara | |
// @match https://www.speedsolving.com/forum/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// nvcc -O3 day03.cu | |
#include <cstdio> | |
#include <vector> | |
struct input_t { int id, x0, y0, x1, y1; }; | |
static __device__ void reduce(int *out, int *in) { | |
volatile int *vin = in; | |
int tid = threadIdx.x; | |
__syncthreads(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ -O3 -march=native -std=c++17 hashsimd.cpp | |
#include <cstdio> | |
#include <vector> | |
#include <array> | |
#include <algorithm> | |
#include <x86intrin.h> | |
#include <inttypes.h> | |
static uint64_t hash(const __m256i &m); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
chomp(my $in = <>); | |
@_ = sort { $a <=> $b } react($in), map { react($in =~ s/$_//rig) } "a".."z"; | |
print "Part 1: $_[$#_]\n"; | |
print "Part 2: $_[0]\n"; | |
sub react { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ -O3 -march=native day14.cpp -o day14 | |
#include <string> | |
#include <array> | |
#include <cstdint> | |
#include <algorithm> | |
#include <x86intrin.h> | |
// Recipes 0..22 precomputed | |
static constexpr std::array<uint8_t, 23> BASE = { | |
3,7,1,0,1,0,1,2,4,5,1,5,8,9,1,6,7,7,9,2,5,1,0 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ -march=native -O3 day23part2.cpp -o day23part2 | |
#include <iostream> | |
#include <cstdio> | |
#include <string> | |
#include <vector> | |
#include <array> | |
#include <functional> | |
#include <algorithm> | |
// https://en.wikipedia.org/wiki/Q*bert#/media/File:Qbert.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstdlib> | |
#include <vector> | |
using vec = std::vector<int>; | |
/* Bare bones implementation of the intcode vm for Day 7 Part 2 | |
* When run with a phase setting of 5, 6, 7, 8, or 9, returns | |
* an array of numbers that represents the effect of each | |
* amplification stage (i.e., iteration of the feedback loop): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstdint> | |
#include <vector> | |
#include <array> | |
#include <random> | |
using int_t = long long; | |
using vec = std::vector<int_t>; | |
using arr8 = std::array<int8_t, 8>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,330,331,332,109,3470,1101,1182,0,15,1101,1481,0,24,1002,0,1,570,1006,570,36,1001,571,0,0,1001,570,-1,570,1001,24,1,24,1105,1,18,1008,571,0,571,1001,15,1,15,1008,15,1481,570,1006,570,14,21102,1,58,0,1106,0,786,1006,332,62,99,21101,0,333,1,21102,73,1,0,1105,1,579,1102,0,1,572,1101,0,0,573,3,574,101,1,573,573,1007,574,65,570,1005,570,151,107,67,574,570,1005,570,151,1001,574,-64,574,1002,574,-1,574,1001,572,1,572,1007,572,11,570,1006,570,165,101,1182,572,127,102,1,574,0,3,574,101,1,573,573,1008,574,10,570,1005,570,189,1008,574,44,570,1006,570,158,1105,1,81,21101,0,340,1,1105,1,177,21102,477,1,1,1106,0,177,21101,514,0,1,21101,176,0,0,1106,0,579,99,21102,1,184,0,1106,0,579,4,574,104,10,99,1007,573,22,570,1006,570,165,1002,572,1,1182,21101,375,0,1,21101,0,211,0,1106,0,579,21101,1182,11,1,21102,222,1,0,1105,1,979,21102,388,1,1,21101,233,0,0,1105,1,579,21101,1182,22,1,21102,1,244,0,1105,1,979,21102,401,1,1,21101,255,0,0,1105,1,579,21101,1182,33,1,21101,266,0,0,1106,0,979,21101,414,0,1,21102,1,277,0,1105,1,579,3,575, |
OlderNewer