Skip to content

Instantly share code, notes, and snippets.

import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
alias T = Tuple!(long, "value", long, "time");
class SegmentTree
{
private:
T[] xs;
long size;
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
long[] parent;
long[][] children;
long[] depth;
long[][] ancestor_table;
void calc_depth(long i, long d)
{
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
void main(string[] args)
{
long n;
readf("%d\n", &n);
long ans = 0;
long before = 0;
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
struct LinkCutNode
{
public:
LinkCutNode* parent, left, right;
void rotate()
{
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
struct LinkCutNode
{
public:
LinkCutNode* parent, left, right;
/// thisがparentの親になるように部分木をを回す
void rotate()
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
alias T = Tuple!(long, "value", long, "time");
class Segtree
{
private:
long size;
T[] xs;
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
struct SplayNode
{
public:
long size;
SplayNode* parent, left, right;
long value, minimum;
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
std.typecons, std.math, std.container, std.format, std.numeric;
struct SplayNode
{
public:
long value;
SplayNode* parent;
SplayNode* left, right;
@theoremoon
theoremoon / CPU.hs
Last active January 21, 2020 12:16
my cpu project based on https://yager.io/CPU/CPU1.html
module CPU where
import Clash.Sized.Unsigned (Unsigned)
import Clash.Sized.Vector (Vec((:>), Nil), (!!), replace, repeat, (++))
import Clash.Class.Resize (zeroExtend, resize)
import Clash.Sized.BitVector (BitVector, (++#), Bit)
import Clash.Class.BitPack (pack, unpack)
import Clash.Promoted.Nat.Literals as Nat
import Clash.Prelude (slice,System)
import Clash.Signal (Signal,register,sample)
import subprocess
import sys
import os
from itertools import product
OUTPUT_DIR = 'decrypted_files'
# list up all cipher methods and digest algorithms
lines = subprocess.run(['openssl', 'help'], check=True, stderr=subprocess.PIPE).stderr.decode().splitlines()