一些奇怪的东西

#if !defined(YCM) && 1
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx")
#include 
#endif
#include
#include
#include
#include
#include
#include 
#define LL long long
using namespace std;
inline int read()
{
    char ch=getchar();int f=0,x=1;
    while(ch<'0'||ch>'9'){if(ch=='-') x=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){f=(f<<1)+(f<<3)+ch-'0';ch=getchar();}
    return f*x;
}
float __attribute__((aligned(32))) a[100005];
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const int __BS = 4096;
static char __bur[__BS + 16], *__er = __bur + __BS, *__ir = __er;
template<class T = int> T readInt() {
    auto c = [&]() { if (__ir == __er) std::fill(__bur, __bur + __BS, 0), cin.read(__bur, __BS), __ir = __bur; };
    c(); while (*__ir && (*__ir < '0' || *__ir > '9') && *__ir != '-') ++__ir; c();
    bool m = false; if (*__ir == '-') ++__ir, c(), m = true;
    T r = 0; while (*__ir >= '0' && *__ir <= '9') r = r * 10 + *__ir - '0', ++__ir, c();
    ++__ir; return m ? -r : r;
}
static char __buw[__BS + 20], *__iw = __buw, *__ew = __buw + __BS;
template<class T>
void writeInt(T x, char endc = '\n') {
    if (x < 0) *__iw++ = '-', x = -x; if (x == 0) *__iw++ = '0';
    char* s = __iw;
    while (x) { T t = x / 10; char c = x - 10 * t + '0'; *__iw++ = c; x = t; }
    char* f = __iw - 1; while (s < f) swap(*s, *f), ++s, --f;
    if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw;
    *__iw++ = endc;
}
template<class T>
void writeStr(const T& str) {
    int i = 0; while (str[i]) { *__iw++ = str[i++]; if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw; }
}
struct __FL__ { ~__FL__() { if (__iw != __buw) cout.write(__buw, __iw - __buw); } };
static __FL__ __flushVar__;
//STL output *****************************************************************************************************
#define TT1 template
#define TT1T2 template
#define TT1T2T3 template
TT1T2 ostream& operator << (ostream& os, const pair& p);
TT1 ostream& operator << (ostream& os, const vector& v);
TT1T2 ostream& operator << (ostream& os, const set&v);
TT1T2 ostream& operator << (ostream& os, const multiset&v);
TT1T2 ostream& operator << (ostream& os, priority_queue v);
TT1T2T3 ostream& operator << (ostream& os, const map& v);
TT1T2T3 ostream& operator << (ostream& os, const multimap& v);
TT1T2T3 ostream& operator << (ostream& os, const triple& t);
template<class T, size_t N> ostream& operator << (ostream& os, const array& v);
TT1T2 ostream& operator << (ostream& os, const pair& p){ return os <<"("<", "<< p.second<<")"; }
TT1 ostream& operator << (ostream& os, const vector& v){       bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<0;}return os << "]"; }
template<class T, size_t N> ostream& operator << (ostream& os, const array& v) {     bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const set&v){    bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multiset&v){bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<0;}return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const map& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multimap& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, priority_queue v) { bool f = 1; os << "["; while (!v.empty()) { auto x = v.top(); v.pop(); if (!f) os << ", "; f = 0; os << x; } return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const triple& t){ return os << "(" << t.a << ", " << t.b << ", " << t.c << ")"; }
TT1T2 void printarray(const T1& a, T2 sz, T2 beg = 0){ for (T2 i = beg; icout << a[i] << " "; cout << endl; }
//STL input *****************************************************************************************************
TT1T2T3 inline istream& operator >> (istream& os, triple& t);
TT1T2 inline istream& operator >> (istream& os, pair& p) { return os >> p.first >> p.second; }
TT1 inline istream& operator >> (istream& os, vector& v) {
    if (v.size()) for (T& t : v) os >> t; else {
        string s; T obj; while (s.empty()) {getline(os, s); if (!os) return os;}
        stringstream ss(s); while (ss >> obj) v.push_back(obj);
    }
    return os;
}
TT1T2T3 inline istream& operator >> (istream& os, triple& t) { return os >> t.a >> t.b >> t.c; }

你可能感兴趣的:(模板总结)