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
#!/bin/bash | |
SCORE=0 | |
while read LINE; do | |
case $LINE in | |
("A X") SCORE=$(($SCORE+1+3));; | |
("A Y") SCORE=$(($SCORE+2+6));; | |
("A Z") SCORE=$(($SCORE+3+6));; | |
("B X") SCORE=$(($SCORE+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
#!/usr/bin/python3 | |
# wordslist from https://github.com/dwyl/english-words | |
# extract 5 letter words (no repeats) from list of all words | |
def read_words(): | |
with open("words_alpha.txt") as fd: | |
return [word for word in fd.read().split("\n") if len(word) == 5 and len(set(word)) == 5] | |
# eliminate anagrams of words |
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 <iostream> | |
#include <cstdint> | |
#include <array> | |
#include <ranges> | |
#include <cassert> | |
#include <bitset> | |
uint32_t pow_n(uint32_t a, uint32_t d, uint32_t n) { | |
if (d == 0) return 1; | |
if (d == 1) return a; |
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 <cstdint> | |
#include <array> | |
#include <utility> | |
#include <x86intrin.h> | |
using Big = std::array<uint64_t, 4>; | |
/* | |
unsigned char sum(Big & __restrict__ a, const Big & __restrict__ b) { | |
unsigned char c = 0; | |
for (std::size_t i = a.size(); i > 0; --i) { |
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 <array> | |
#include <bitset> | |
#include <climits> | |
template <typename T, std::size_t len> | |
constexpr std::bitset<sizeof(T) * CHAR_BIT * len> from_array(const std::array<T, len> &arr) { | |
std::bitset<sizeof(T) * CHAR_BIT * len> res; | |
std::size_t pos = 0; | |
for (auto x : arr) { | |
for(std::size_t i = 0; i < sizeof(T) * CHAR_BIT; ++i) { |
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
static_cast<T*>(operator new[](sizeof(T) * rows * cols, static_cast<std::align_val_t>(alignof(T)))) |
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
// scope.h - Declarative Control Flow | |
/* Copyright (C) 2020 Goswin von Brederlow <goswin-v-b@web.de> | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
let magic = "\x7FELF" | |
let class_32_bit = '\x01' | |
let class_64_bit = '\x02' | |
let data_little_endian = '\x01' | |
let data_big_endian = '\x02' | |
let ident_version = '\x01' |
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
// print 2**82589933-1 | |
#include <stdio.h> | |
#include <math.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
#include <string.h> | |
const uint32_t exponent = 82589933; | |
//const uint32_t exponent = 100; |
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 <stdio.h> | |
#include <stdlib.h> | |
char get() { | |
int a = getchar(); | |
if ((a >= '0') && (a <= '9')) { | |
return a - '0'; |
NewerOlder