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 Main | |
qsort : Ord a => List a -> List a | |
qsort [] = [] | |
qsort (x :: xs) = smaller ++ [x] ++ larger | |
where smaller = qsort [y | y <- xs, y <= x] | |
larger = qsort [y | y <- xs, y > x] | |
main : IO () | |
main = printLn $ qsort [5, 1, 5, 89, 1, 8, 5, 78] |
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
//Pairing heap implementation in TMP | |
#include <iostream> | |
#include <type_traits> | |
#include <tuple> | |
using std::tuple; | |
struct Empty; |
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
sealed trait SegTree { | |
def size: Int | |
def v: Int | |
def query(a: Int, b: Int): Int | |
def update(a: Int, k: Int): SegTree | |
} | |
case class Leaf(v: Int) extends SegTree { | |
override val size = 1 | |
override def query(a: Int, b: Int): Int = v |
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
CXX = g++ | |
CXXFLAGS = -std=c++11 -O2 | |
SRC = $(wildcard *.cpp) | |
OBJ = $(subst .cpp,,$(SRC)) | |
$(OBJ): $(SRC) | |
$(CXX) $(CXXFLAGS) $(SRC) -o $(OBJ) | |
run: $(OBJ) | |
./$(OBJ) |
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
set nocp | |
set number | |
syntax enable | |
colorscheme desert | |
nnoremap ; : | |
nnoremap : ; | |
vnoremap ; : | |
vnoremap : ; | |
nnoremap j gj | |
nnoremap k gk |
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 <algorithm> | |
#include <limits> | |
using namespace std; | |
class segtree { | |
vector<int> data; | |
int n = 1; |
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
#!/bin/bash | |
#script for JOI qualifier | |
#usege : ./runner.sh exec_name problemnumber | |
BINNNAME=$1 | |
PROBLEMID=$2 | |
for i in `seq 1 5`; do | |
INPUTNAME="2015-yo-t$PROBLEMID-in$i.txt" |
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
declare i32 @putchar(i32) | |
define i32 @add(i32 %a, i32 %b) { | |
%1 = add i32 %a, %b | |
ret i32 %1 | |
} | |
define void @loop() { | |
%1 = call i32 @add(i32 0, i32 97) | |
call i32 @putchar(i32 %1) |
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 <utility> | |
using namespace std; | |
template<class T, T M> | |
class mods { | |
T v; | |
public: | |
mods() {} | |
mods(T v) : v(v%M) {} |
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
//Typical DP contest A | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main() { | |
int n; | |
cin>>n; | |
vector<int> p(n); | |
for (auto& i : p) cin>>i; |