テンプレ(7/27現在)

テンプレがちょくちょく新しくなっているのでテンプレだけ置いておきます。
前の記事も参考までに(スニペットなどは変わってません)

コード

// @SyNtAx_error_1
// CC0
/* #region  templates */
// clang-format off
#include<bits/stdc++.h>
//#include<atcoder/all>
#define rep(i,n) REP(i,0,n)
#define REP(i,a,b) for(ll i=a; i<ll(b);i++)
#define ALL(x) x.begin(),x.end()
using namespace std;
//using namespace atcoder;
using ll=long long;
using ld=long double;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vpll=vector<pll>;
using Graph=vector<vll>;
template<class T>using p_queue=priority_queue<T>;
template<class T>using rp_queue=priority_queue<T,vector<T>,greater<T>>;
constexpr int INF32=2147483647;
constexpr ll INF64=9223372036854775807LL;
constexpr ll INF=3e18;
constexpr ld pi=3.14159265358979323846264338327950288419719l;
struct Init{Init(){ios::sync_with_stdio(0);std::cin.tie(0);cout<<fixed<<setprecision(15);}}init;
void inline yes(bool end=1){cout<<"Yes\n";if(end)exit(0);}
void inline no(bool end=1){cout<<"No\n";if(end)exit(0);}
void inline yesno(bool b,bool end=1){if(b)yes(end);else no(end);}
template<class T>bool inline chmin(T &a,T b){return(a>b?a=b,1:0);}
template<class T>bool inline chmax(T &a,T b){return(a<b?a=b,1:0);}
template<class T>void inline prt(T t,string end="\n"){cout<<t<<end;}
template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U> &p){return(os<<p.first<<" "<<p.second);}
template<class T>ostream&ca(T b,T e,ostream &os,bool c){for(;b!=e;){os<<*b<<((++b==e)?"":(c?" ":"\n"));}return os;}
struct _has_itr{template<class T,class U=class T::iterator> static true_type c(T*);template<class T>static false_type c(...);};
template<class T>struct has_itr:decltype(_has_itr::c<T>(nullptr)){};
struct _has_inr{template<class T,class U=class T::value_type,class V=class U::iterator>static true_type c(T*);
template<class T,class U=class T::value_type>static true_type c(decltype(U::first)*);template<class>static false_type c(...);};
template<class T>struct has_inr:decltype(_has_inr::c<T>(nullptr)){};
template<class T,enable_if_t<has_itr<T>::value&&!is_same_v<T,string>&&!has_inr<T>::value>* =nullptr> ostream& operator<<(ostream&os,const T &t){return ca(ALL(t),os,1);}
template<class T,enable_if_t<has_itr<T>::value&&!is_same_v<T,string>&&has_inr<T>::value>* =nullptr> ostream&operator<<(ostream&os,const T &t){return ca(ALL(t),os,0);}
template<template<class...>class T,class U,enable_if_t<is_same_v<T<U>,set<U>>||is_same_v<T<U>,unordered_set<U>>>* =nullptr>istream&operator>>(istream&is,T<U>&o){U u;is>>u;o.insert(move(u));return is;}
template<class T>istream&operator>>(istream&is,vector<T> &v){for(auto&i:v)is>>i;return is;}
template<class T>T inline powint(T x,T n){T ans=1;while(n>0){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
template<class T>T inline lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>bool inline exist(T &t){return !t.empty();}
// clang-format on
/* #endregion */

int main() {
  ll N;
  cin >> N;
}

defineの濫用はやめよう!!!!!!
自分が読むときはよくても、ほかの人の頭の中が?????になるので

おまけ

特に書くことないのでいつも使っているVSCodeの拡張機能でも貼っておきます。
#region folding for VS Code
これを使うと、くそ長テンプレを隠せます!地味に便利
setting.jsonに

"C_Cpp.dimInactiveRegions": false,
  "maptz.regionfolder": {
    "[cpp]": {
      "disableFolding": false,
      "defaultFoldStartRegex": "^[\\s]*/\\*[\\s]*#region[\\s]*(.*)[\\s]*\\*/[\\s]*$",
      "foldEnd": "/* #endregion */",
      "foldStart": "/* #region [NAME] */",
      "foldEndRegex": "^[\\s]*/\\*[\\s]*#endregion[\\s]*(.*)[\\s]*\\*/[\\s]*$",
      "foldStartRegex": "^[\\s]*/\\*[\\s]*#region[\\s]*(.*)[\\s]*\\*/[\\s]*$"
    }
  },

こんな感じのを書いておくと自動で閉じてくれるので便利です。

この記事が気に入ったらサポートをしてみませんか?