代码模版
EmptyFile
C++#include<bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
using ll=long long;
using ld=long double;
//#define int ll
using pii=pair<int,int>;
//bool Mst;
//bool Med;
signed main()
{
// cerr<<"Memory Size: "<<abs((&Med)-(&Mst))/1024.0/1024<<" MB\n";
// ios::sync_with_stdio(0);
// cin.tie(0),cout.tie(0);
}
FastIO
C++namespace wyzfastio
{
#ifndef __not_use_fread
namespace __getchar
{
const int bufsize=1<<20;
char buf[bufsize<<1],*p1=buf,*p2=buf;
inline char getchar()
{return (p1==p2&&(p2=(p1=buf)+fread(buf,1,bufsize,stdin),p1==p2))?EOF:(*p1++);}
}
using __getchar::getchar;
#endif // #ifdef __not_use_fread
/*---input---*/
inline void read(unsigned long long &x)
{char ch=getchar();unsigned long long res=0;while(ch<'0'||ch>'9')ch=getchar();while(ch>='0'&&ch<='9')res=(res<<3)+(res<<1)+ch-'0',ch=getchar();x=res;}
inline void read(unsigned int &x)
{char ch=getchar();unsigned int res=0;while(ch<'0'||ch>'9')ch=getchar();while(ch>='0'&&ch<='9')res=(res<<3)+(res<<1)+ch-'0',ch=getchar();x=res;}
inline void read(long long &x)
{char ch=getchar();long long f=1;unsigned long long res=0;while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}while(ch>='0'&&ch<='9')res=(res<<3)+(res<<1)+ch-'0',ch=getchar();x=res*f;}
inline void read(int &x)
{char ch=getchar();int f=1;unsigned res=0;while(ch<'0'||ch>'9'){if(ch=='-')f=-f;;ch=getchar();}while(ch>='0'&&ch<='9')res=(res<<3)+(res<<1)+ch-'0',ch=getchar();x=res*f;}
inline void read(char &s)
{s=getchar();while(s==' '||s=='\n'||s=='\r') s=getchar();}
inline int read(char *s)
{int i=0;char ch=getchar();while(ch==' '||ch=='\n'||ch=='\r') ch=getchar();while(!(ch==' '||ch=='\n'||ch=='\r'||ch==EOF)) s[++i]=ch,ch=getchar();s[i+1]='\0';return i;}
inline void read(std::string &s)
{char ch=getchar();s.clear();while(ch==' '||ch=='\n'||ch=='\r') ch=getchar();while(!(ch==' '||ch=='\n'||ch=='\r'||ch==EOF)) s.push_back(ch),ch=getchar();}
template<typename _Tp,typename ...Args>
inline void read(_Tp &x,Args &...args){read(x),read(args...);}
/*---output---*/
inline void write(unsigned long long x){if(x<10) putchar(x+'0');else write(x/10),putchar(x%10+'0');}
inline void write(long long x){unsigned long long t=x;if(x<0)putchar('-'),t=-x;write(t);}
inline void write(unsigned int x){if(x<10) putchar(x+'0');else write(x/10),putchar(x%10+'0');}
inline void write(int x){unsigned int t=x;if(x<0)putchar('-'),t=-x;write(t);}
inline void write(char x){putchar(x);}
inline void write(const char *s){while(*s!='\0'&&*s!=EOF)putchar(*s),s++;}
template<typename _Tp,typename ...Args>
inline void write(_Tp x,Args ...args){write(x),write(args...);}
}
CMath
C++namespace wyzmath
{
int inv[N],jc[N],invjc[N];
void init()
{
inv[0]=jc[0]=invjc[0]=inv[1]=jc[1]=invjc[1]=1;
for(int i=2;i<N;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod,jc[i]=1ll*jc[i-1]*i%mod,invjc[i]=1ll*invjc[i-1]*inv[i]%mod;
}
inline int C(int n,int m){return (n<0||m<0||m<n)?0:1ll*jc[m]*invjc[n]%mod*invjc[m-n]%mod;}
inline int A(int n,int m){return (n<0||m<0||m<n)?0:1ll*jc[m]*invjc[m-n]%mod;}
}