This file contains hidden or 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
| // Eko <http://nztrain.com/problems/56> | |
| #include <cstdio> | |
| #include <climits> | |
| using namespace std; | |
| long long total_wood(int *trees, size_t n_trees, int sawblade) { | |
| long long total = 0; | |
| for (size_t i = 0; i != n_trees; ++i) { | |
| if (trees[i] > sawblade) { |
This file contains hidden or 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
| """ | |
| ============================= | |
| The Epic Fail Guessing Game | |
| ============================= | |
| The Epic Fail Guessing Game (*efguess*) is a simple number guessing game. | |
| Except you can't win it, of course. That would be silly. | |
| """ |
This file contains hidden or 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
| """ | |
| Simple input loop thing, with ducks. | |
| By Lambda Fairy (github.com/lfairy) | |
| Examples:: | |
| n = read(int, 'Enter a number: ') | |
| MIN = 1 |
This file contains hidden or 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 python3 | |
| class Fenwick: | |
| """A specialized data structure for representing range sums.""" | |
| def __init__(self, size, identity=0): | |
| self.tree = [identity] * (size + 1) | |
| self.identity = identity |
This file contains hidden or 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
| import qualified Data.Sequence as S | |
| import Data.Foldable (toList) | |
| movingMean :: Int -> [Double] | |
| slices :: Int -> [a] -> [[a]] | |
| slices k ys = case takeMaybe k xs of | |
| Nothing -> [] | |
| Just start -> start : loop (S.fromList start) ys | |
| where |
This file contains hidden or 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
| """ | |
| ======================================================================== | |
| SUPER AWESOME ENCODER THINGY | |
| ------------------------------------------------------------------------ | |
| BY LAMBDA FAIRY COPYRIGHT BLAH BLAH BLAH DON'T COPY OR YOU WILL | |
| >>>>>>>> DIIIIIIIIIIIIIIIIIIIIEEEEEEEEEEEEEEEEEEEE <<<<<<<< | |
| ======================================================================== | |
| """ |
This file contains hidden or 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
| """Great Scott!""" | |
| import sys | |
| sys.setrecursionlimit(4000) | |
| fix = lambda f: lambda x: f(fix(f))(x) | |
| zero = lambda z: lambda s: z | |
| succ = lambda x: lambda z: lambda s: s(x) | |
| # plus, times are faster when the second argument is small |
This file contains hidden or 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
| __ | |
| _a | |
| _b | |
| _c | |
| _d | |
| _e | |
| _f | |
| _g | |
| _h | |
| _i |
This file contains hidden or 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
| -- http://en.wikipedia.org/wiki/Peano_axioms | |
| module PeanoAxioms where | |
| data ⊥ : Set where -- empty | |
| data ℕ : Set where | |
| -- [1] 0 is a natural number. | |
| zero : ℕ | |
| -- [6] For every natural number n, S(n) is a natural number. |
This file contains hidden or 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 "log.h" | |
| void | |
| PLog_printf(const char *type, const char *filename, unsigned int line, const char *fmt, ...) { | |
| va_list vl; | |
| va_start(vl, fmt); | |
| fprintf(stderr, "%s:%u: %s: ", filename, line, type); | |
| vfprintf(stderr, fmt, vl); | |
| putc('\n', stderr); |