Skip to content
Common Lisp implementation of algorithms
Common Lisp Other
Branch: master
Clone or download
Latest commit fab83c0 Feb 22, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.travis.yml
2d-bit.lisp
2d-rolling-hash.lisp
2d-sparse-table.lisp
2dcumul.lisp
README.md
abstract-bit.lisp
abstract-heap.lisp
adjacent-duplicates.lisp
array-element-type.lisp
binary-indexed-tree.lisp
binomial-coefficient-mod.lisp
binomial-coefficient-slow.lisp
binomial-coefficient.lisp
binsort.lisp
bipartite-matching.lisp
bipartite-p.lisp
bisect.lisp
bit-basher.lisp
block-cut-tree.lisp
bounded-partition-number.lisp
bron-kerbosch.lisp
buffered-read-line.lisp
chinese-remainder.lisp
clamp.lisp
compile-test.lisp
complex-geometry.lisp
condensation.lisp
convex-hull-trick.lisp
convex-hull.lisp
copy-array.lisp
cyclic-permutation.lisp
date.lisp
deque.lisp
detect-cycle.lisp
dfs-order.lisp
diameter.lisp
dice.lisp
dictionary-order.lisp
dinic.lisp
disjoint-set.lisp
disjoint-sparse-table.lisp
displace.lisp
divisor.lisp
dopairs.lisp
dorange.lisp
dotimes-unroll.lisp
double-stack-deque.lisp
dynamic-mod-operations.lisp
ensure-gethash.lisp
enum-quotients.lisp
eratosthenes.lisp
explicit-treap.lisp
ext-eratosthenes.lisp
f2.lisp
farey.lisp
fft-real.lisp
fft-recursive.lisp
fft.lisp
find-argopt.lisp
fkm.lisp
ford-fulkerson.lisp
freiwald.lisp
gemm.lisp
geometry.lisp
gray-code.lisp
heap.lisp
hopcroft-karp.lisp
implicit-treap.lisp
increase-stack-size.lisp
integer-length.lisp
integer-pack.lisp
inverse-table.lisp
inversion-number.lisp
jonker-volgenant.lisp
lca.lisp
lis.lisp
log-ceil.lisp
log-factorial.lisp
logreverse.lisp
make-array-header.lisp
map-flipping-subseq.lisp
map-indices.lisp
map-monotone-subseq.lisp
map-mountain.lisp
map-permutations.lisp
map-run-length.lisp
matrix-rotate.lisp
merge.lisp
mex.lisp
min-cost-flow-slow.lisp
min-cost-flow.lisp
mo.lisp
mod-factorial.lisp
mod-operations.lisp
mod-power.lisp
modify-macro.lisp
modular-arithmetic.lisp
multidiagonal-matrix-float.lisp
next-table.lisp
order-statistic.lisp
pairing-heap.lisp
parse-bignum.lisp
parse-fixnum.lisp
parse-float.lisp
partition-number.lisp
persistent-disjoint-set.lisp
placeholder-syntax.lisp
polynomial.lisp
power.lisp
prim.lisp
println-sequence.lisp
queue.lisp
quicksort.lisp
random-graph.lisp
random-tree.lisp
random.lisp
range-tree-fc.lisp
range-tree.lisp
read-bignum.lisp
read-digit.lisp
read-fixnum.lisp
read-float.lisp
read-line-into.lisp
read-schar.lisp
ref-able-treap.lisp
relative-error.lisp
rolling-hash.lisp
rolling-hash62.lisp
rooted-tree.lisp
seek-line.lisp
self-compile.lisp
shuffle.lisp
sliding-window.lisp
spanning-tree.lisp
split-objs-bind.lisp
split-string.lisp
stair-sum.lisp
stirling.lisp
string-prefix-p.lisp
succinct-bit-vector.lisp
template.lisp
topological-sort.lisp
treap.lisp
tree-centroid.lisp
trie.lisp
triemap.lisp
trisect.lisp
tzcount.lisp
walsh-hadamard.lisp
warshall-floyd.lisp
wavelet-matrix.lisp
while-collecting.lisp
with-buffered-stdout.lisp
with-cache.lisp
write-double-float.lisp
xor.lisp
z-algorithm.lisp
zeta-integer.lisp
zeta-transform.lisp

README.md

Common Lisp code collection for competitive programming

Build Status

This code collection is maintained mainly for competitive programming, and partly for just understanding algorithms.

License

The greater part of this library is distributed as public domain, or licensed under either CC0 or the MIT license, whichever gives you the most rights in your legislation. Some code, however, has its specific license (usually because it is a dead copy of other library). For the details, please see the header of each file.

Style

Currently I don't introduce any name spaces (packages) in each file. This is due to the circumstance unique to the competitive programming: one-file-per-submission. It is somewhat troublesome to manage many packages on a single file (especially when modifying inserted code). This style may change in the future, however.

On portability: I try not to abuse non-portable code though I sometimes resort to SBCL's extension and behaviour: e.g. declaration as assertion, bivalent stream, extensible sequence, sb-kernel:%vector-raw-bits and sb-c:define-source-transform. To my knowledge, every competition site adopts SBCL.

Every data structure and algorithm handles a 0-based index and a half-open interval unless otherwise noted.

Test environment

  • SBCL 1.5.5 (x64, linux) — yukicoder's version
  • SBCL 1.3.13 (x64, linux) — CodeChef's version
  • SBCL 1.3.3 (x64, linux) — CS Academy's version
  • SBCL 1.2.4 (x64, linux) — the oldest intallable SBCL

Note that the version of SBCL is 1.1.14 on AtCoder.

Contents

General data structures

General algorithms

Arithmetic and algebra

Real and complex

Bit operations

Graph

Geometry

Pattern matching

I/O

Other utilities

Weird things

  • integer-pack.lisp defstruct-like macro to deal with an integer as a bundle of some slots
  • increase-stack-size.lisp This header runs another SBCL as external process and leaves the entire processing to it. (This ugly hack was invented to increase the stack size of SBCL on contest sites.)
  • self-compile.lisp self-rewriting compilation
You can’t perform that action at this time.