代码模板

2022.10.6正在使用

#include<bits/stdc++.h>
using namespace std;
namespace Fast{
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define int128 __int128
#define uint128 unsigned __int128
#define Ld long double
#define space putchar(' ')
#define enter putchar('\n')
#define PI acos(-1)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<"="<<(x)<<"\n"
#define inf 1000000000
#define INF 1000000000000000000
#define N 1010
#define M 1000010
    template<class T>inline bool read(T &x){
        x=0;char c=getchar();bool f=0;
        while(!isdigit(c)){if(c==EOF)return false;f^=c=='-',c=getchar();}
        while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
        if(f)x=-x;
        return true;
    }
    template<typename T>inline void print(T x){
        int s[65],top=0;
        if(x<0)putchar('-'),x=~x+1;
        while(x)s[++top]=x%10,x/=10;
        if(!top)s[++top]=0;
        while(top)putchar(s[top--]+'0');
    }
	template<class T>inline bool readd(T &x){
        ll X=0;double y=1.0;char c=getchar();bool f=0;
        while(!isdigit(c)){if(c==EOF)return false;f^=c=='-',c=getchar();}
        while(isdigit(c))X=(X<<3)+(X<<1)+(c^48),c=getchar();
        x=X;
        if(c!='.'&&c!='E'&&c!='e'){if(f)x=-x;return true;}
        if(c=='.'){c=getchar();while(isdigit(c))x+=(y/=10)*(c^48),c=getchar();}
        if(f)x=-x;
        X=0;f=0;
        if(c=='E'||c=='e'){
            c=getchar();
            while(!isdigit(c)){if(c==EOF)return true;f^=c=='-',c=getchar();}
            while(isdigit(c))X=(X<<3)+(X<<1)+(c^48),c=getchar();
        }
        if(f)for(ll i=1;i<=X;i++)x/=10;
        else for(ll i=1;i<=X;i++)x*=10;
        return true;
    }
    template<class T>inline void printd(T x,int y){
        static ll mul[]={1};
        for(ll i=1;i<=18;i++)
            mul[i]=(mul[i-1]<<3)+(mul[i-1]<<1);
        if(x<-1e-12)putchar('-'),x=-x;
        x*=mul[y];
        ll x1=(ll)round(x),x2=x1/mul[y],x3=x1-x2*mul[y];
        print(x2);
        if(y>0){
            putchar('.');
            for(ll i=1;i<y&&x3*mul[i]<mul[y];putchar('0'),i++);
            print(x3);
        }
    }
    template<class T>inline bool readc(T &x){
        char c=getchar();
        while(c==' '||c=='\n'||c=='\r'||c=='\t')c=getchar();
        if(c==EOF)return false;
        x=c;
        return true;
    }
    template<class T>inline void printc(T x){putchar(x);}
    template<class T>inline bool readcc(T *x){
        char c=getchar();
        while(c==' '||c=='\n'||c=='\r'||c=='\t')c=getchar();
        if(c==EOF)return false;
        while(c!=' '&&c!='\n'&&c!='\r'&&c!='\t'&&c!=EOF)*x++=c,c=getchar();
        *x=0;
        return true;
    }
    template<class T>inline void printcc(T *x){while(*x)putchar(*x++);}
    template<class T>inline bool reads(T &x){
        x="";char c=getchar();
        while(c==' '||c=='\n'||c=='\r'||c=='\t')c=getchar();
        if(c==EOF)return false;
        while(c!=' '&&c!='\n'&&c!='\r'&&c!='\t'&&c!=EOF)x+=c,c=getchar();
        return true;
    }
    template<class T>inline void prints(T x){for(ll i=0;x[i]!='\0';i++)putchar(x[i]);}
    template<class T,class ...S>inline bool read(T &x,S &...y){return read(x)&&read(y...);}
    template<class T,class ...S>inline bool readd(T &x,S &...y){return readd(x)&&readd(y...);}
    template<class T,class ...S>inline bool readc(T &x,S &...y){return readc(x)&&readc(y...);}
    template<class T,class ...S>inline bool readcc(T *x,S *...y){return readcc(x)&&readcc(y...);}
    template<class T,class ...S>inline bool reads(T &x,S &...y){return reads(x)&&reads(y...);}
    template<class T,class ...S>inline void print(T x,S ...y){print(x),putchar(' '),print(y...);}
    template<class T,class ...S>inline void printd(T x,S ...y){printd(x),putchar(' '),printd(y...);}
    template<class T,class ...S>inline void printc(T x,S ...y){printc(x),putchar(' '),printc(y...);}
    template<class T,class ...S>inline void printcc(T *x,S *...y){printcc(x),putchar('\n'),printcc(y...);}
    template<class T,class ...S>inline void prints(T x,S ...y){prints(x),putchar('\n'),prints(y...);}
    const double eps=1e-7;
    template<typename T>inline T Abs(T x){return x>0?x:-x;}
    template<typename T>inline T Max(T x,T y){return x>y?x:y;}
    template<typename T>inline T Min(T x,T y){return x<y?x:y;}
    template<typename T>inline T Fabs(T x){return x>eps?x:-x;}
    template<typename T>inline T Fmax(T x,T y){return x-y>eps?x:y;}
    template<typename T>inline T Fmin(T x,T y){return x-y<eps?x:y;}
}
using namespace Fast;
int main(){
//	freopen("a.out","r",stdin);
//	freopen("a.out","w",stdout);
	
    return 0;
}

2022.9.17

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define int128 __int128
#define uint128 unsigned __int128
#define Ld long double
#define reg register
#define space putchar(' ')
#define enter putchar('\n')
#define PI 3.14159265358979323846
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<"="<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<"={";for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<",";cerr<<"}"<<endl;}
#define inf 1000000000
#define INF 1000000000000000000
#define N 1010
#define M 1000010
namespace Fast{
    template<typename T>inline void read(T &x){
        x=0;bool f=false;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=true;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        if(f)x=~x+1;
    }
    template<typename T>inline void print(T x){
        int s[65],top=0;
        if(x<0)putchar('-'),x=~x+1;
        while(x)s[++top]=x%10,x/=10;
        if(!top)s[++top]=0;
        while(top)putchar(s[top--]+'0');
    }
    template<typename T,typename...Args>inline void read(T &x,Args&...others){
        read(x),read(others...);
    }
    template<typename T,typename...Args>inline void print(T x,Args...others){
        print(x),space,print(others...);
    }
    const double eps=1e-7;
    template<typename T>inline T Abs(T x){return x>0?x:-x;}
    template<typename T>inline T Max(T x,T y){return x>y?x:y;}
    template<typename T>inline T Min(T x,T y){return x<y?x:y;}
    template<typename T>inline T Fabs(T x){return x>eps?x:-x;}
    template<typename T>inline T Fmax(T x,T y){return x-y>eps?x:y;}
    template<typename T>inline T Fmin(T x,T y){return x-y<eps?x:y;}
    template<typename T>inline void addmod(T &x,T p){if(x>=p)x-=p;}
    template<typename T>inline void submod(T &x,T p){if(x<0)x+=p;}
}
using namespace Fast;
int main(){
    // freopen("a.in","r",stdin);
    // freopen("a.out","w",stdout);

    return 0;
}

2022.4.15

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define int128 __int128
#define uint128 unsigned __int128
#define Ld long double
#define reg register
#define space putchar(' ')
#define enter putchar('\n')
#define PI 3.14159265358979323846
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<"="<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<"={";for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<",";cerr<<"}"<<endl;}
#define inf 1000000000
#define INF 1000000000000000000
#define N 1010
#define M 1000010
namespace Fast{
    template<typename T>inline void read(T &x){
        x=0;bool f=false;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=true;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        if(f)x=~x+1;
    }
    template<typename T>inline void print(T x){
        int s[65],top=0;
        if(x<0)putchar('-'),x=~x+1;
        while(x)s[++top]=x%10,x/=10;
        if(!top)s[++top]=0;
        while(top)putchar(s[top--]+'0');
    }
    template<typename T,typename...Args>inline void read(T &x,Args&...others){
        read(x),read(others...);
    }
    template<typename T,typename...Args>inline void print(T x,Args...others){
        print(x),space,print(others...);
    }
    const double eps=1e-7;
    template<typename T>inline T Abs(T x){return x>0?x:-x;}
    template<typename T>inline T Max(T x,T y){return x>y?x:y;}
    template<typename T>inline T Min(T x,T y){return x<y?x:y;}
    template<typename T>inline T Fabs(T x){return x>eps?x:-x;}
    template<typename T>inline T Fmax(T x,T y){return x-y>eps?x:y;}
    template<typename T>inline T Fmin(T x,T y){return x-y<eps?x:y;}
    template<typename T>inline void addmod(T &x,T p){if(x>=p)x-=p;}
    template<typename T>inline void submod(T &x,T p){if(x<0)x+=p;}
}
using namespace Fast;
int main(){
    // freopen("a.in","r",stdin);
    // freopen("a.out","w",stdout);

    return 0;
}

2021.10.31

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define LL long long
#define uLL unsigned long long
#define reg register
#define PI acos(-1.0)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<=<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<={;for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<,;cerr<<}<<endl;}
#define inf 100000000
#define N 1000
#define M 1000001
template<class T>inline void read(T &x)
{
    x=0;register char c=getchar();register bool f=0;
    while(!isdigit(c))f^=c=='-',c=getchar();
    while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
    if(f)x=-x;
}
template<class T>inline void print(T x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar('0'+x%10);
}
int main()
{

    return 0;
}

2021.10.13

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define reg register
#define PI acos(-1.0)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<=<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<={;for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<,;cerr<<}<<endl;}
#define inf 100000000
#define N 1000
#define M 1000001
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int main()
{

    return 0;
}

2021.10.5

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<=<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<={;for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<,;cerr<<}<<endl;}
#define inf 100000000
#define N 1000
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int main()
{

    return 0;
}