快读快写模板

· · 闲话

简化版

#include<bits/stdc++.h>
using namespace std;
int getc(){
    static char buf[16384],*bg=buf,*ed=buf;
    if(bg==ed){
        bg=buf,ed=buf+fread(buf,1,16384,stdin);
        if(bg==ed)return EOF;}
    return *bg++;}
int read(){
    int sgn=0,ret=0,ch=getc();
    while(ch!=EOF&&!isdigit(ch))sgn|=ch=='-',ch=getc();
    while(isdigit(ch))ret=ret*10+ch-'0',ch=getc();
    return sgn?-ret:ret;}
string readstr(){
    string s;char ch=getc();
    while(ch!=EOF&&isspace(ch))ch=getc();
    while(ch!=EOF&&!isspace(ch))s.push_back(ch),ch=getc();
    return s;}
struct fw{
    char buf[1<<20],*p=buf;
    ~fw(){flush();}
    void flush(){fwrite(buf,1,p-buf,stdout);p=buf;}
    void put(char c){if(p==buf+(1<<20))flush();*p++=c;}
    void wrt(const string&s){for(char c:s)put(c);}
    void wrt(int x){
        if(x<0)put('-'),x=-x;
        char tmp[20],*t=tmp;
        do *t++='0'+x%10;while(x/=10);
        while(t!=tmp)put(*--t);}
    fw&operator<<(char c){put(c);return*this;}
    fw&operator<<(const string&s){wrt(s);return*this;}
    fw&operator<<(int x){wrt(x);return*this;}}out;
int main(){

    return 0;}

原版


#include<bits/stdc++.h>
using namespace std;
char getc(){
    static char buf[16384],*bg=buf,*ed=buf;
    if(bg==ed){
        bg=buf;
        ed=buf+fread(buf,1,16384,stdin);
        if(bg==ed)return EOF;}
    return *bg++;}
int read(){
    int ret=0,sgn=0,ch=getc();
    while(ch!=EOF&&!isdigit(ch))sgn|=ch=='-',ch=getc();
    while(isdigit(ch))ret=ret*10+ch-'0',ch=getc();
    return sgn?-ret:ret;}
string readstr(){
    string s;
    char ch=getc();
    while(ch!=EOF&&isspace(ch))ch=getc();
    while(ch!=EOF&&!isspace(ch))s.push_back(ch),ch=getc();
    return s;}
struct FastWriter{
    static constexpr int BUF_SIZE=1<<20;
    char buf[BUF_SIZE];
    char* p=buf;
    ~FastWriter(){flush();}
    void flush(){fwrite(buf,1,p-buf,stdout);p=buf;}
    void put(char c){if(p==buf+BUF_SIZE)flush();*p++=c;}
    void write(const char* s){while(*s)put(*s++);}
    void write(const std::string& s){write(s.c_str());}
    void write(int x){
        if(x<0){put('-');x=-x;}
        if(x==0){put('0');return;}
        char tmp[20],*t=tmp;
        while(x){*t++='0'+char(x%10);x/=10;}
        while(t!=tmp)put(*--t);}
    FastWriter&operator<<(char c){put(c);return*this;}
    FastWriter&operator<<(const char* s){write(s);return*this;}
    FastWriter&operator<<(const std::string& s){write(s);return*this;}
    FastWriter&operator<<(int x){write(x);return*this;}};
FastWriter out;
int main(){
    char c=getc();
    int x=read();
    string s=readstr();
    out<<c<<' '<<x<<' '<<s;
    return 0;}