TAKINAS SITE
hi i do silly things
My hobbies
- Breathing
- Maybe math
- Maybe computer thing
- Cats
- Yarn
My social thing that is not really social
- atcoder stuff i mostly
read editorialdo contest and upsolve にほんごもんだいわからない。。。 - guthib
Quick copy
- C++ template (courtesy of aryansh's quickest IO library & nor's blog
(I don't use that much of pr & re, but when i do it is quite useful)#include "bits/stdc++.h" using namespace std; using str=string; using ll = int64_t; using ull = uint64_t; using ld = long double; using vi=vector<int>; using vll=vector<ll>; #define ALL(xs) begin(xs), end(xs) #define BY(...) [&](auto &&lhs, auto &&rhs) { \ auto predicate = [&](auto &&x) { \ return __VA_ARGS__; \ }; \ return predicate(lhs) < predicate(rhs); \ } // sort(ALL(pairs), BY(x.second)); #define m1(x) template<class T, class... U> void x(T&& a, U&&... b) #define m2(x) (int[]){(x forward<U>(b),0)...} m1(pr) { cout << forward<T>(a); m2(cout << " " <<); cout << "\n"; } m1(re) { cin >> forward<T>(a); m2(cin >>); } template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } #define sza(x) ((int)x.size()) #define all(a) (a).begin(), (a).end() #define rall(x) x.rbegin(), x.rend() #define sor(x) sort(all(x)) #define f first #define s second #define rsz resize #define ins insert #define ft front() #define bk back() #define pb push_back #define lb lower_bound #define ub upper_bound #define FOR(i,a,b) for (int (i) = (a); (i) < (b); ++(i)) #define REP(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int (i) = (b)-1; (i) >= (a); --(i)) #define PER(i,a) ROF(i,0,a) #define rep(a) REP(_,a) #define each(a,x) for (auto& a: x) const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; #ifdef DEBUG #define dbg(x) x #else #define dbg(x) 0; #endif // my try at implementing sieve of erastesternostetestterstorone // based on reading https://atcoder.jp/contests/abc383/editorial/11553 go read this vector<bool> isprime; vector<ll> eras(ll max) { isprime.resize(max,0);//what tf is this doing vector<ll> res; isprime[0]=false; isprime[1]=false; for(ll q=2;q<max;q++) isprime[q]=true; for(ll q=2;q<max;q++) { if (isprime[q]) {res.push_back(q); for(ll j=q*2;j<max;j+=q) isprime[j]=false;} } return res; } template <int MOD> class Modular { using ModInt = Modular<1'000'000'007>; public: Modular(long long v=0) { value = v % MOD; if (value < 0) value += MOD; } Modular(long long a, long long b) : value(0) { *this += a; *this /= b; } Modular& operator+=(Modular const& b) { value += b.value; if (value >= MOD) value -= MOD; return *this; } Modular& operator-=(Modular const& b) { value -= b.value; if (value < 0) value += MOD; return *this; } Modular& operator*=(Modular const& b) { value = (long long)value * b.value % MOD; return *this; } friend Modular power(Modular a, long long e) { Modular res = 1; while (e) { if (e & 1) res *= a; a *= a; e >>= 1; } return res; } friend Modular inverse(Modular a) { return power(a, MOD - 2); } Modular& operator/=(Modular const& b) { return *this *= inverse(b); } friend Modular operator+(Modular a, Modular const b) { return a += b; } friend Modular operator-(Modular a, Modular const b) { return a -= b; } friend Modular operator-(Modular const a) { return 0 - a; } friend Modular operator*(Modular a, Modular const b) { return a *= b; } friend Modular operator/(Modular a, Modular const b) { return a /= b; } friend std::ostream& operator<<(std::ostream &os, Modular const& a) { return os << a.value; } friend std::istream& operator>>(std::istream &is, Modular& a) { is >> a.value; a.value %= MOD; if (a.value < 0) a.value += MOD; return is; } friend bool operator==(Modular const& a, Modular const& b) { return a.value == b.value; } friend bool operator!=(Modular const& a, Modular const& b) { return a.value != b.value; } friend Modular& operator++(Modular& a, int) { return a += 1; } friend Modular operator++(Modular const& a, int) { return Modular(a)++; } friend Modular& operator--(Modular& a, int) { return a -= 1; } friend Modular operator--(Modular const& a, int) { return Modular(a)--; } int value; static const int MOD_value = MOD; }; ll concat(ll a, ll b){ ll log10 = b; ll exp = 1; while(log10){ log10 /= 10; exp *= 10; } return a * exp + b; } void solve() { } int main() { cin.tie(nullptr)->sync_with_stdio(false); // cout << setprecision(20) << fixed; #ifdef DEBUG int _tests = 1; cin >> _tests; for (int _test = 1; _test <= _tests; ++_test) { cout << "Case #" << _test << ": "; #endif solve(); #ifdef DEBUG cout<<'\n'; } #endif }