Skip to content

Instantly share code, notes, and snippets.

@lvv
lvv / spiral.cc
Last active November 30, 2016 21:54
spiral matrix
#include <iostream>
#include <vector>
using namespace std;
int main() {
size_t n,m;
std::cin >> n >> m;
vector<vector<int> > M(m, vector<int>(n,-1));
int T=0,B=m,L=0,R=n; // top, bottom, left, right
@lvv
lvv / folding.vim
Last active December 11, 2015 05:48
Table-of-contents Fold
" table of contents fold
" fold togle
nmap <F8> :hi clear Folded<CR>:call Fold()<CR>
" next/pref fold
nmap { kzkjz<CR>
nmap } zjz<CR>
#include <sto/sto.h>
using namespace sto;
#include <vector>
#include <iostream>
using namespace std;
int main() {
// no need for clumsy iota (is covertable to any STL container)
#include <sto/sto.h>
using namespace sto;
#include <vector>
#include <iostream>
using namespace std;
int main() {
// no need for clumsy iota (is covertable to any STL container)
#include <utility>
#include <iostream>
using namespace std;
template <typename T>
struct counter {
static int created, alive;
counter() {++created; ++alive; }
~counter() { --alive; }
};
@lvv
lvv / test
Created August 15, 2009 18:12
some test