{
"OI代码头": {
"prefix": "P#include",
"body": [
"#include<cstdio>",
"#include<iostream>",
"#include<algorithm>",
"#include<cstring>",
"#include<cmath>",
"//#include<vector>",
"//#include<set>",
"//#include<queue>",
"//#include<stack>",
"#define PII pair<int,int>",
"#define MP make_pair",
"using namespace std;",
"typedef long long LL;",
"typedef unsigned long long ULL;",
"inline LL read()",
"{",
"\tLL s=0; bool w=0; char ch=getchar();",
"\twhile(ch<'0'||ch>'9'){if(ch=='-') w=1; ch=getchar();}",
"\twhile(ch>='0'&&ch<='9'){s=(s<<3)+(s<<1)+(ch^48); ch=getchar();}",
"\treturn w ? ~s+1 : s;",
"}",
"",
"int main()",
"{",
"\tfreopen(\"input.txt\",\"r\",stdin);",
"\t",
"\tfclose(stdin);",
"\treturn 0;",
"}"
],
"description": "代码头"
},
"字符串读入优化": {
"prefix": "Pread_str",
"body": [
"bool validchar(char ch){return (ch>='a'&&ch<='z') || (ch>='A'&&ch<='Z') || (ch>='0'&&ch<='9');}",
"inline int read_str(char* str)",
"{",
"\tchar ch=getchar(); int i=0;",
"\twhile(!validchar(ch)){ch=getchar();}",
"\twhile(validchar(ch)){i++; *(str+i)=ch; ch=getchar();}",
"\t*(str+i+1)='\\0'; return i;",
"}"
],
"description": "字符串快读"
},
"无权图": {
"prefix": "GRNW",
"body": [
"int h[maxn],ecnt,n,m;",
"struct Edge",
"{",
"\tint u,v;",
"\tint nxt;",
"}e[maxm<<1];",
"void adde(int u,int v)",
"{",
"\tecnt++; e[ecnt].u=u; e[ecnt].v=v;",
"\te[ecnt].nxt=h[u]; h[u]=ecnt; return;",
"}"
],
"description": "无权图"
},
"有权图": {
"prefix": "GRWW",
"body": [
"int h[maxn],ecnt,n,m;",
"struct Edge",
"{",
"\tint u,v;",
"\tLL w;",
"\tint nxt;",
"}e[maxm<<1];",
"void adde(int u,int v,LL w)",
"{",
"\tecnt++; e[ecnt].u=u; e[ecnt].v=v; e[ecnt].w=w;",
"\te[ecnt].nxt=h[u]; h[u]=ecnt; return;",
"}"
],
"description": "有权图"
},
"线段树&主席树框架": {
"prefix": "DSGT",
"body": [
"#define fa tree[x]",
"#define ls tree[x<<1]",
"#define rs tree[x<<1|1]",
"//#define nw tree[p]",
"//#define ls tree[tree[x].sl]",
"//#define rs tree[tree[x].sr]",
"struct SGT",
"{",
"\tint l,r,len;",
"\t// int sl,sr;",
"\tint sum,tag;",
"}tree[maxn<<2];"
],
"description": "线段树&主席树"
},
"Splay框架": {
"prefix": "DBIT",
"body": [
"#define me tree[x]",
"#define fa tree[tree[x].faz]",
"#define ls tree[tree[x].sl]",
"#define rs tree[tree[x].sr]",
"struct BIT",
"{",
"\tint sl,sr,faz;",
"\tint val,rep,siz;",
"}tree[maxn];"
],
"description": "Splay"
},
"并查集(alpha)": {
"prefix": "DDSU",
"body": [
"int fa[maxn],sz[maxn],n;",
"void init(int n){for(int i=1;i<=n;i++){fa[i]=i; sz[i]=1;}}",
"int get(int x){return fa[x]==x ? x : fa[x]=get(fa[x]);}",
"void merge(int x,int y)",
"{",
"\tx=get(x); y=get(y); if(x==y) return;",
"\tif(sz[x]>sz[y]) swap(x,y);",
"\tfa[x]=y; sz[y]+=sz[x]; return;",
"}"
],
"description": "并查集"
},
"树状数组": {
"prefix": "DTAR",
"body": [
"LL tar[maxn];",
"int n;",
"inline int lb(int x){return x&(-x);}",
"void add(int pos,int k){for(;pos<=n;pos+=lb(pos)) tar[pos]+=k; return;}",
"LL query(int pos){LL ans=0; for(;pos>0;pos-=lb(pos)) ans+=tar[pos]; return ans;}"
],
"description": "树状数组"
}
}