Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef local
- #define _GLIBCXX_DEBUG 1
- #endif
- #pragma GCC optimize("Ofast", "unroll-loops")
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define double long double
- using pii = pair<int, int>;
- template <typename T>
- using Prior = std::priority_queue<T>;
- template <typename T>
- using prior = std::priority_queue<T, vector<T>, greater<T>>;
- #define X first
- #define Y second
- #define eb emplace_back
- #define ef push_front
- #define ee emplace
- #define pf pop_front
- #define pb pop_back
- #define ALL(x) begin(x), end(x)
- #define RALL(x) rbegin(x), rend(x)
- #define SZ(x) (int)(x).size()
- #ifdef local
- #define debug(...) \
- _color.eb("\u001b[31m"),\
- cerr << _color.back() << "In function '" << __FUNCTION__ << "', line " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ",\
- _do(__VA_ARGS__),\
- _color.pb(),\
- cerr << _color.back()
- #define fastIO()
- deque<string> _color{"\u001b[0m"};
- template <typename T> concept is_string = is_same_v<T, string&> or is_same_v<T, const string&>;
- template <typename T> concept is_iterable = requires (T _t) {begin(_t);};
- template <typename T> inline void _print_err(T &&_t) {cerr << _t;}
- template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>) {
- string _tmp_color = _color.back();
- ++_tmp_color[3], _color.eb(_tmp_color);
- cerr << _color.back() << "[";
- for (bool _first = true; auto &_x : _t) {
- if (!_first) cerr << ", ";
- _print_err(_x), _first = false;
- }
- cerr << "]" << (_color.pb(), _color.back());
- }
- template <typename T, typename U> ostream& operator << (ostream &os, pair<T, U> &_tu) {
- string _tmp_color = _color.back();
- ++_tmp_color[3], _color.eb(_tmp_color);
- cerr << _color.back() << "(";
- _print_err(_tu.first), cerr << ", ", _print_err(_tu.second);
- cerr << ")" << (_color.pb(), _color.back());
- return os;
- }
- template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &) {
- cerr << ")" << (_color.pb(), _color.back());
- }
- template <size_t I = 0, typename ...U> inline typename enable_if<I < sizeof...(U), void>::type _print_err(tuple<U...> &_t) {
- if (!I) {
- string _tmp_color = _color.back();
- ++_tmp_color[3], _color.eb(_tmp_color);
- cerr << _color.back();
- }
- cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
- }
- template <typename T> inline void _do(T &&_t) {_print_err(_t), cerr << "\n";}
- template <typename T, typename ...U> inline void _do(T &&_t, U &&..._u) {_print_err(_t), cerr << ", ", _do(_u...);}
- #else
- #define debug(...) void()
- #define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
- #endif
- mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
- inline int getRand(int L, int R) {
- if (L > R) swap(L, R);
- return (int)(rng() % ((uint64_t)R - L + 1) + L);
- }
- template <typename T> bool chmin(T &lhs, T rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
- template <typename T> bool chmax(T &lhs, T rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}
- void solve() {
- cout << "meow\n";
- vector<int> v = {1, 2};
- string S = "string";
- debug(3, v, string("test"), S, v);
- basic_string<int> s = {3, 4};
- debug(s, s+s, s+1LL);
- vector<vector<int>> vv = {{1, 2}, {3, 4, 5}, {}, {6}, {7, 8, 9}};
- debug(vv);
- vector<vector<vector<vector<double>>>> vvvv = {{{{1}}, {}, {{1.1}, {1.11}, {1.111}}}, {}, {{{1.1111}}}, {{{1.11111}}, {{1.111111}}}};
- debug(vvvv);
- list<list<list<list<list<list<int>>>>>> llllll = {{{{{{0}}}}}};
- debug(llllll);
- set<int> st = {1, 2, 2, 6, -1};
- map<string, int> mp = {{"rk", 42745417}, {"tmwilliamlin", 168}, {"yp", 155136}, {"coldEr", 66}, {"erd", 1}};
- unordered_multiset<int> umst = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9};
- debug(st, mp, umst);
- pair<int, int> p1 = {-1, -2};
- pair<double, char> p2 = {2.718, 'e'};
- pair<pair<int, float>, pair<pair<int, char>, double>> p3 = {{6, 0.01}, {{99, 'X'}, 71.22}};
- debug(p1, p2, p3);
- tuple<int, double, int, string> t1 = {-3, 3.14, -4, "tuple"};
- tuple<pair<int, char>, vector<bitset<3>>, array<pair<int, int>, 3>> t2 = {
- {1, 'A'},
- {bitset<3>("110"), bitset<3>("000"), bitset<3>("111")},
- {pii{2, 3}, pii{4, 5}, pii{6, 7}}
- };
- debug(t1, t2);
- list<int> l = {-1, -2, -3};
- debug(l);
- debug("test normal", "test string"s, "debug(\"test recursive\")"s);
- debug("bin"s, 0b110, "hex"s, 0xdeadbeef, "oct"s, 01000, "dec"s, 1024);
- // not compiling
- // debug();
- // not working properly (for sure)
- // list<string> l_color = {"\u001b[31m", "\u001b[32m", "\u001b[33m", "\u001b[34m", "\u001b[35m", "\u001b[36m", "\u001b[37m"};
- // debug(l);
- }
- int32_t main() {
- fastIO();
- int t = 1; // cin >> t;
- for (int _ = 1; _ <= t; ++_) {
- // cout << "Case #" << _ << ": ";
- solve();
- }
- return 0;
- }
- /*
- /// Fast I/O by FHVirus ///
- /// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
- #include <unistd.h>
- const int S = 65536;
- int OP = 0;
- char OB[S];
- inline char RC() {
- static char buf[S], *p = buf, *q = buf;
- return p == q and (q = (p = buf) + read(0, buf, S)) == buf ? -1 : *p++;
- }
- inline int RI() {
- static char c;
- int a;
- while (((c = RC()) < '0' or c > '9') and c != '-' and c != -1);
- if (c == '-') {
- a = 0;
- while ((c = RC()) >= '0' and c <= '9') a *= 10, a -= c ^ '0';
- }
- else {
- a = c ^ '0';
- while ((c = RC()) >= '0' and c <= '9') a *= 10, a += c ^ '0';
- }
- return a;
- }
- inline void WI(int n, char c = '\n') {
- static char buf[20], p;
- if (n == 0) OB[OP++] = '0';
- p = 0;
- if (n < 0) {
- OB[OP++] = '-';
- while (n) buf[p++] = '0' - (n % 10), n /= 10;
- }
- else {
- while (n) buf[p++] = '0' + (n % 10), n /= 10;
- }
- for (--p; p >= 0; --p) OB[OP++] = buf[p];
- OB[OP++] = c;
- if (OP > S-20) write(1, OB, OP), OP = 0;
- }
- /// Fast I/O by FHVirus ///
- /// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
- */
Add Comment
Please, Sign In to add comment