windows
set go= cin nu ts=4 sw=4 sts=4
set backspace=eol,start,indent
syntax on
map <F4> :!g++ -o2 -std=c++11 % -o %<<cr>
map <F5> :!%<<cr>
linux
set go= cin nu ts=4 sw=4 sts=4
set backspace=eol,start,indent
syntax on
map <F4> :!g++ -o2 -std=c++11 % -o %<<cr>
map <F5> :!./%<<cr>
非比赛用
set go= cin nu sts=4 sw=4 ts=4 et
set backspace=indent,eol,start
syntax on
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ -std=c++11 -w -O2 % -o %<"
exec "! %<"
elseif &filetype == 'cpp'
exec "!g++ -std=c++11 -w -O2 % -o %<"
exec "! %<"
elseif &filetype == 'java'
exec "!javac %"
exec "!java %<"
elseif &filetype == 'python'
exec "!python %"
endif
endfunc
map <F8> :call Rungdb()<CR>
func! Rungdb()
exec "w"
exec "!g++ % -g -o %<"
exec "!gdb %<"
endfunc
map <C-A> ggVG"+y
map <C-D> ggdG<cr>
set guifont=Consolas:h14
set fileencodings=gb2312,gb18030,utf-8
set termencoding=utf-8
set encoding=prc
set mouse=a
set hlsearch
colorscheme solarized
map <F3> : call Stitle()<cr>
func Stitle()
let l = 0
let l = l + 1 | call setline(l, '#include <bits/stdc++.h>')
let l = l + 1 | call setline(l, 'using namespace std;')
let l = l + 1 | call setline(l, '#define pi (acos(-1.0))')
let l = l + 1 | call setline(l, 'const double eps = 1e-9;')
let l = l + 1 | call setline(l, 'const int inf = 0x3f3f3f3f;')
let l = l + 1 | call setline(l, 'const int M = 1e5+10;')
let l = l + 1 | call setline(l, 'const int mod = 1e9+7;')
let l = l + 1 | call setline(l, 'int sign(double x){return x<-eps?-1:x>eps;}')
let l = l + 1 | call setline(l, '')
endfunc
map <F2> :call SetTitle()<cr>
func SetTitle()
let l = 0
let l = l + 1 | call setline(l, '#include <stdio.h>')
let l = l + 1 | call setline(l, '#include <numeric>')
let l = l + 1 | call setline(l, '#include <time.h>')
let l = l + 1 | call setline(l, '#include <bitset>')
let l = l + 1 | call setline(l, '#include <string.h>')
let l = l + 1 | call setline(l, '#include <stack>')
let l = l + 1 | call setline(l, '#include <algorithm>')
let l = l + 1 | call setline(l, '#include <iostream>')
let l = l + 1 | call setline(l, '#include <set>')
let l = l + 1 | call setline(l, '#include <map>')
let l = l + 1 | call setline(l, '#include <math.h>')
let l = l + 1 | call setline(l, '#include <queue>')
let l = l + 1 | call setline(l, '#include <complex>')
let l = l + 1 | call setline(l, '#include <functional>')
let l = l + 1 | call setline(l, '#include <limits.h>')
let l = l + 1 | call setline(l, 'using namespace std ;')
let l = l + 1 | call setline(l, 'typedef long long ll ;')
let l = l + 1 | call setline(l, 'typedef long double ld ;')
let l = l + 1 | call setline(l, 'typedef unsigned long long ull ;')
let l = l + 1 | call setline(l, '#ifdef _WIN32')
let l = l + 1 | call setline(l, '#define LLD "%I64d"')
let l = l + 1 | call setline(l, '#else')
let l = l + 1 | call setline(l, '#define LLD "%lld"')
let l = l + 1 | call setline(l, '#endif')
let l = l + 1 | call setline(l, '#define pi (acos(-1.0))')
let l = l + 1 | call setline(l, '#define fi first')
let l = l + 1 | call setline(l, '#define se second')
let l = l + 1 | call setline(l, '#define SZ(x) ((int)x.size())')
let l = l + 1 | call setline(l, '#define lson (o<<1),l,mid')
let l = l + 1 | call setline(l, '#define rson (o<<1|1),mid+1,r')
let l = l + 1 | call setline(l, '#define MP make_pair')
let l = l + 1 | call setline(l, '#define sqr(x) ((x)*(x))')
let l = l + 1 | call setline(l, '#define ALL(v) (v).begin(),(v).end()')
let l = l + 1 | call setline(l, '#define showtime fprintf(stderr,"time = %.15f\n",clock() / (double)CLOCKS_PER_SEC)')
let l = l + 1 | call setline(l, 'const double eps = 1e-9 ;')
let l = l + 1 | call setline(l, 'const int MOD=(int)1e9+7,BAS=233;')
let l = l + 1 | call setline(l, 'inline int sign(double x){return x<-eps?-1:x>eps;}')
let l = l + 1 | call setline(l, 'inline int clz(int x){return __builtin_clz(x);}')
let l = l + 1 | call setline(l, 'inline int clz(ll x){return __builtin_clzll(x);}')
let l = l + 1 | call setline(l, 'inline int lg2(int x){return !x ? -1 : 31-clz(x);}')
let l = l + 1 | call setline(l, 'inline int lg2(ll x){return !x ? -1 : 63-clz(x);}')
let l = l + 1 | call setline(l, 'int AP (char *s) {')
let l = l + 1 | call setline(l, ' unsigned hash=0;')
let l = l + 1 | call setline(l, ' for(int i=0; s[i]; i++){')
let l = l + 1 | call setline(l, ' if (i & 1) hash ^= (~((hash<<11)^s[i]^(hash>>5)));')
let l = l + 1 | call setline(l, ' else hash ^= ((hash<<7)^s[i]^(hash>>3));')
let l = l + 1 | call setline(l, ' } return hash & 0x7FFFFFFF;')
let l = l + 1 | call setline(l, '}')
let l = l + 1 | call setline(l, '')
endfunc