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 python | |
# -*- coding: utf-8 -*- | |
import argparse | |
import codecs | |
import getpass | |
import glob | |
import json | |
import logging | |
import lxml.etree |
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 <vector> | |
#include <type_traits> | |
#include <boost/optional.hpp> | |
#include <boost/range/adaptor/transformed.hpp> | |
#include <boost/range/adaptor/filtered.hpp> | |
template<typename MapperT> | |
class filter_mapped_adaptor; |
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 <cmath> | |
#include <cstdint> | |
#include <random> | |
#include <iostream> | |
template<typename Float, int N> | |
class log_sum { | |
static_assert(N > 0, "N must be positive"); |
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
def unary(symbol, priority): | |
# XXX: BRAIN DAMAGE HAZARD AHEAD | |
# Consider prioritize's argument: what's it for? | |
# Isn't it expected to be a number? | |
# How dare it work and work correctly? | |
# Turns out, Python mixed-type comparison semantics are exploited in an | |
# awkward way. Python specifies that when no other rules apply, e.g. no | |
# overridden comparison magic-methods on any side, it falls back to | |
# comparing both sides' type names. | |
# One could grep CPython sources for `default_3way_compare' function that |
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
#define in(name) freopen(#name ".in", "r", stdin) | |
#ifdef DEBUG | |
# define out(name) | |
# define debug(f, args...) printf("[DEBUG] " f "\n", ##args) | |
#else | |
# define out(name) freopen(#name ".out", "w", stdout) | |
# define debug(...) | |
#endif |
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
-module(ctree). | |
-export([merge/2, split/2, add/2, add/3, remove/2, flatten/1, random/1, ordered/1, fromlist/1, remove_list/2, depth/1]). | |
% null / {Key, Param, Left, Right} | |
% Объединяет 2 дерева (любой элемент левого меньше любого элемента правого( | |
merge(null, B) -> B; | |
merge(A, null) -> A; | |
merge(A, B) -> | |
{A_key, A_param, A_left, A_right} = 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
-module(ctree). | |
-export([merge/2, split/2, add/2, add/3, remove/2, flatten/1, random/1, ordered/1, fromlist/1, remove_list/2, depth/1]). | |
% null / {Key, Param, Left, Right} | |
-record(cnode, {key, param, left, right}). | |
%% Объединяет 2 дерева (любой элемент левого меньше любого элемента правого) |
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 <algorithm> | |
#include <vector> | |
#include <cstdlib> | |
#include <cstdio> | |
#include <time.h> | |
#include <sys/types.h> | |
using namespace std; |
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
-- Coroutine wrappers | |
function expect (token) | |
local this = coroutine.running() | |
return coroutine.yield(token, this) | |
end | |
function start (stream) | |
return coroutine.create(stream) | |
end |
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
import qualified Data.Map as M | |
subst = [('a','y'),('b','n'), | |
('c','f'),('d','i'), | |
('e','c'),('f','w'), | |
('g','l'),('h','b'), | |
('i','k'),('j','u'), | |
('k','o'),('l','m'), | |
('m','x'),('n','s'), | |
('o','e'),('p','v'), |
OlderNewer