Skip to content

Instantly share code, notes, and snippets.

@qrno
Last active June 12, 2022 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qrno/3db1d8d35057ae13c6e1ca946ce43faa to your computer and use it in GitHub Desktop.
Save qrno/3db1d8d35057ae13c6e1ca946ce43faa to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
#define int long long
//( Experimental Template (x1.1.1) (cf/cebolinha)
// G++ Sorcery
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
// Container Aliases
template<typename T> using V = vector<T>;
template<typename T> using PQ = priority_queue<T>;
template<typename A, typename B> using UM = unordered_map<A, B>;
template<typename A> using US = unordered_set<A>;
using ii = pair<int, int>;
using ll = long long;
using dd = double;
// Ordered Set - order_of_key, find_by_order
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T> using OS = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
// Cool Macros B)
#define all(c) c.begin(), c.end()
#define rall(c) c.begin(), c.end()
#define apply(v, f) for_each(all(v), f)
#define sz(v) (int)v.size()
#define rsz resize
#define loop(ii, n) for (int ii = 0; ii < (n); ++ii)
#define xloop(ii, l, r) for (int ii = (l); ii <= (r); ++ii)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define cond(c, t, f) ((c) ? (t) : (f))
#define read(type, ...) type __VA_ARGS__; in(__VA_ARGS__)
// xread is very likely useless
#define xread(type, t, ...) type t(__VA_ARGS__); in(t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define inbounds(x, l, r) ((l) <= (x) && (x) <= (r))
#define ff first
#define ss second
#define nemo ><>
// a = min(a, b) and a = max(a, b)
template<typename T, typename U> inline void miq(T& a, U b){if (a > b) a = b;}
template<typename T, typename U> inline void maq(T& a, U b){if (a < b) a = b;}
// fast IO (put with ; at beginning of main)
#define fastio ios::sync_with_stdio(false); cin.tie(nullptr)
// Container IO
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &a : v) is >> a; return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
loop(i, sz(v)) os << cond(i," ","") << v[i]; return os; }
template <typename T> ostream &operator<<(ostream &os, set<T> v) {
for (auto it = v.begin(); it != v.end(); it++) os << cond(it != v.begin()," ","") << *it; return os; }
template <typename F, typename S> ostream &operator<<(ostream &os, pair<F, S> v) {
os << v.first << " " << v.second; return os; }
// General IO
template <typename... A> void in(A &...a) { ((cin >> a), ...); }
template <typename... A> void out(A... a) { ((cout << a << " "), ...); cout << endl; }
template <typename... A> void print(A... a) { ((cout << a), ...); }
const bool colored_output = false;
#define vvv(x) "[", #x, " ", x, "] "
#define var(x) "\033[33m[", #x, " \033[31m", x, "\033[33m]\033[32m "
template <typename... A>
void db(A... a) {
if (colored_output) cout << "\033[32m";
((cout << (a)), ...);
if (colored_output) cout << "\033[0m";
cout << endl;
}
//)
signed main() {
fastio;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment