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;
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()
@theoremoon
theoremoon / out.csv
Last active July 28, 2018 00:13
同期加算で誤差を減らしていくようなやつです
A C00001 C10000 Nn
0.0000 0.1689 0.0136 107.8424
6.7156 7.6140 6.7031 70.9367
9.9518 10.2794 9.9450 59.2852
8.0321 10.4816 8.0463 48.3563
1.9509 1.3047 1.9560 48.2972
-5.1410 -4.8743 -5.1362 44.6529
-9.5694 -9.6891 -9.5795 40.4456
-9.0399 -9.5145 -9.0418 37.7089
-3.8268 -3.1973 -3.8463 35.8761