跳到正文

个人记录

c++缺省源+模版(不全)

Eiralys约 22 分钟
原文
文章信息与版本

文章信息

发布
2026年7月25日
收录
2026年9月20日
更新
2026年11月12日
篇幅
约 22 分钟

版本

  1. v1当前

关于缺省源捏

vscode:

C++
{
	"Print to console": {
		"prefix": "norm",
		"body": [
            "// I often find myself reminiscing about the past.",
            "// Moments of life freeze in my mind.",
            "// I cut, fold, and curl the time behind me, kneading it into the white clouds drifting across the sky.",
            "// Even clouds have their distinctions: cumulus clouds are heavy, while cirrus clouds are ethereal.",
            "// The moments in life that strike me with awe pass through my thoughts and remain unforgettable forever, while the more ordinary, everyday memories leave behind only fragments under the erosion of time.",
            "// Reminiscence is like entering a dream—too clear, and it cannot delight my imagination; too vague, and it sinks into nothingness.",
            "// Only the mist-shrouded mountains and rivers, the veiled woman—that perfect haziness—can satisfy my longing for beauty.",
            "// Reminiscence always wraps me, unbidden, in the yellowed pages of the past.",
            "// Friends parted and reunited, streets demolished and rebuilt—each clue helps me set out from a specific moment and sail upstream against the river of time.",
            "// The days gone by cannot be relived; I am merely a passerby.",
            "// Yet I still long to leave myself moments of leisure on every journey into memory—to pause before a scene, to gaze across the haze of years at my former self, and to savor as much sweetness as I can.",
            "// If beautiful times once flowed through my body, I am already content.",
            "// The past has solidified.",
            "// I carry my memories forward, but I often neglect to tend to them, and so the memories themselves keep changing their forms.",
            "// This brings a certain challenge to my journeys of recollection.",
            "// Where should I linger? I ask myself.",
            "",
			"#include <bits/stdc++.h>",
            "#define LOCAL",
            "#define FILE",
            "#define IOS() std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0)",
            "#define re register",
            "// #define int long long",
            "using pii = std::pair <int, int>;",
            "using ll = long long;",
            "",
            "namespace ly {",
            "    namespace IO {",
            "        #ifndef LOCAL",
            "            constexpr auto maxn = 1 << 21;",
            "            char in[maxn], out[maxn], *p1 = in, *p2 = in, *p3 = out;",
            "            #define getchar() (p1 == p2 && (p2 = (p1 = in) + fread(in, 1, maxn, stdin), p1 == p2) ? EOF : *p1++)",
            "            #define flush() (fwrite(out, 1, p3 - out, stdout))",
            "            #define putchar(x) (p3 == out + maxn && (flush(), p3 = out), *p3++ = (x))",
            "            class Flush{ public: ~Flush(){ flush(); } } _;",
            "        #endif",
            "        namespace usr {",
            "            template <typename type>",
            "            inline type read(type &x){",
            "                x = 0; bool flag(0); char ch = getchar();",
            "                while(!isdigit(ch)) flag ^= ch == '-', ch = getchar();",
            "                while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();",
            "                return flag ? x = -x : x;",
            "            }",
            "            template <typename type>",
            "            inline void write(type x){",
            "                x < 0 ? x = -x, putchar('-') : 0;",
            "                static short Stack[50], top(0);",
            "                do Stack[++top] = x % 10, x /= 10; while(x);",
            "                while(top) putchar(Stack[top--] | 48);",
            "            }",
            "            inline char read(char &x){",
            "                do x = getchar(); while(isspace(x));",
            "                return x;",
            "            }",
            "            inline char write(const char &x){",
            "                return putchar(x);",
            "            }",
            "            inline void read(char *x){",
            "                static char ch;",
            "                read(ch);",
            "                do *(x++) = ch; while(!isspace(ch = getchar()) && ~ch);",
            "            }",
            "            template <typename type> inline void write(type *x){",
            "                while(*x) putchar(*(x++));",
            "            }",
            "            inline void read(std::string &x){",
            "                static char ch; read(ch), x.clear();",
            "                do x += ch; while(!isspace(ch = getchar()) && ~ch);",
            "            }",
            "            inline void write(const std::string &x){",
            "                for(int i = 0, len = x.length(); i < len; ++i) putchar(x[i]);",
            "            }",
            "            template <typename type, typename...T> inline void read(type &x, T&...y){",
            "                read(x), read(y...);",
            "            }",
            "            template <typename type, typename...T>",
            "            inline void write(const type &x, const T&...y){",
            "                write(x), putchar(' '), write(y...), sizeof...(y) ^ 1 ? 0 : putchar('\\n');",
            "            }",
            "            template <typename type>",
            "            inline void put(const type &x, bool flag = 0){",
            "                write(x), flag ? putchar('\\n') : putchar(' ');",
            "            }",
            "        }",
            "        #ifndef LOCAL",
            "            #undef getchar",
            "            #undef flush",
            "            #undef putchar",
            "        #endif",
            "    } using namespace IO::usr;",
            "} using namespace ly::IO::usr;",
            "",
            "int main(){",
            "    #ifndef FILE",
            "        freopen(\".in\", \"r\", stdin);",
            "        freopen(\".out\", \"w\", stdout);",
            "    #endif",
            "    $0",
            "    return 0;",
            "}",
            "",
            "// 阿乌拉,投降吧",
            "// ......",
            "// 阿乌拉,站在你面前的是活了上千年的魔法使",
		],
		"description": "a template",
	}
}
C++
// I often find myself reminiscing about the past.
// Moments of life freeze in my mind.
// I cut, fold, and curl the time behind me, kneading it into the white clouds drifting across the sky.
// Even clouds have their distinctions: cumulus clouds are heavy, while cirrus clouds are ethereal.
// The moments in life that strike me with awe pass through my thoughts and remain unforgettable forever, while the more ordinary, everyday memories leave behind only fragments under the erosion of time.
// Reminiscence is like entering a dream—too clear, and it cannot delight my imagination; too vague, and it sinks into nothingness.
// Only the mist-shrouded mountains and rivers, the veiled woman—that perfect haziness—can satisfy my longing for beauty.
// Reminiscence always wraps me, unbidden, in the yellowed pages of the past.
// Friends parted and reunited, streets demolished and rebuilt—each clue helps me set out from a specific moment and sail upstream against the river of time.
// The days gone by cannot be relived; I am merely a passerby.
// Yet I still long to leave myself moments of leisure on every journey into memory—to pause before a scene, to gaze across the haze of years at my former self, and to savor as much sweetness as I can.
// If beautiful times once flowed through my body, I am already content.
// The past has solidified.
// I carry my memories forward, but I often neglect to tend to them, and so the memories themselves keep changing their forms.
// This brings a certain challenge to my journeys of recollection.
// Where should I linger? I ask myself.

#include <bits/stdc++.h>
#define LOCAL
#define FILE
#define IOS() std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0)
#define re register
// #define int long long
using pii = std::pair <int, int>;
using ll = long long;

namespace ly {
    namespace IO {
        #ifndef LOCAL
            constexpr auto maxn = 1 << 21;
            char in[maxn], out[maxn], *p1 = in, *p2 = in, *p3 = out;
            #define getchar() (p1 == p2 && (p2 = (p1 = in) + fread(in, 1, maxn, stdin), p1 == p2) ? EOF : *p1++)
            #define flush() (fwrite(out, 1, p3 - out, stdout))
            #define putchar(x) (p3 == out + maxn && (flush(), p3 = out), *p3++ = (x))
            class Flush{ public: ~Flush(){ flush(); } } _;
        #endif
        namespace usr {
            template <typename type>
            inline type read(type &x){
                x = 0; bool flag(0); char ch = getchar();
                while(!isdigit(ch)) flag ^= ch == '-', ch = getchar();
                while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
                return flag ? x = -x : x;
            }
            template <typename type>
            inline void write(type x){
                x < 0 ? x = -x, putchar('-') : 0;
                static short Stack[50], top(0);
                do Stack[++top] = x % 10, x /= 10; while(x);
                while(top) putchar(Stack[top--] | 48);
            }
            inline char read(char &x){
                do x = getchar(); while(isspace(x));
                return x;
            }
            inline char write(const char &x){
                return putchar(x);
            }
            inline void read(char *x){
                static char ch;
                read(ch);
                do *(x++) = ch; while(!isspace(ch = getchar()) && ~ch);
            }
            template <typename type> inline void write(type *x){
                while(*x) putchar(*(x++));
            }
            inline void read(std::string &x){
                static char ch; read(ch), x.clear();
                do x += ch; while(!isspace(ch = getchar()) && ~ch);
            }
            inline void write(const std::string &x){
                for(int i = 0, len = x.length(); i < len; ++i) putchar(x[i]);
            }
            template <typename type, typename...T> inline void read(type &x, T&...y){
                read(x), read(y...);
            }
            template <typename type, typename...T>
            inline void write(const type &x, const T&...y){
                write(x), putchar(' '), write(y...), sizeof...(y) ^ 1 ? 0 : putchar('\n');
            }
            template <typename type>
            inline void put(const type &x, bool flag = 0){
                write(x), flag ? putchar('\n') : putchar(' ');
            }
        }
        #ifndef LOCAL
            #undef getchar
            #undef flush
            #undef putchar
        #endif
    } using namespace IO::usr;
} using namespace ly::IO::usr;

int main(){
    #ifndef FILE
        freopen(".in", "r", stdin);
        freopen(".out", "w", stdout);
    #endif
    
    return 0;
}

// 阿乌拉,投降吧
// ......
// 阿乌拉,站在你面前的是活了上千年的魔法使
原文