Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Author: chhokmah
- * Date: 2020-08-17 21:42:52
- */
- #include <bits/stdc++.h>
- struct IO {
- const static int size_in = 25 << 20, size_out = 5 << 20;
- char in[size_in], *p_in = in;
- char out[size_out], *p_out = out;
- IO() {
- freopen("test.in", "r", stdin);
- freopen("test.out", "w", stdout);
- fread(in, 1, size_in, stdin);
- }
- ~IO() { fwrite(out, 1, p_out - out, stdout); }
- template <typename T>
- T read() {
- T x = 0;
- bool f = 0;
- while (!isdigit(*p_in)) f |= *p_in++ == '-';
- while (isdigit(*p_in)) x = x * 10 + (*p_in++ & 15);
- return f ? -x : x;
- }
- IO& operator>>(int& x) { return x = read<int>(), *this; }
- IO& operator>>(long long& x) { return x = read<long long>(), *this; }
- IO& operator>>(unsigned long long& x) { return x = read<unsigned long long>(), *this; }
- IO& operator>>(char& ch) { return ch = *p_in++, *this; }
- IO& operator>>(char* s) {
- int n = 0;
- while (*p_in == ' ' || *p_in == '\n' || *p_in == '\0') p_in++;
- while (*p_in != ' ' && *p_in != '\n' && *p_in != '\0') s[n++] = *p_in++;
- return s[n] = '\0', *this;
- }
- template <typename T>
- void write(T x) {
- static char buf[20], *p = buf;
- if (x < 0)
- *p_out++ = '-', x = -x;
- do
- *p++ = '0' + x % 10;
- while (x /= 10);
- while (p != buf) *p_out++ = *--p;
- }
- IO& operator<<(int x) { return write(x), *this; }
- IO& operator<<(long long x) { return write(x), *this; }
- IO& operator<<(unsigned long long x) { return write(x), *this; }
- IO& operator<<(char ch) { return *p_out++ = ch, *this; }
- IO& operator<<(char* s) {
- for (int i = 0; s[i]; ++i) *p_out++ = s[i];
- return *this;
- }
- } io;
- template <typename T, typename Y>
- IO& operator>>(IO& in, std::pair<T, Y>& a) {
- in >> a.first >> a.second;
- return in;
- }
- template <typename T>
- IO& operator>>(IO& in, std::vector<T>& a) {
- for (unsigned i = 0; i < a.size(); ++i) in >> a[i];
- return in;
- }
- template <typename T>
- IO& operator<<(IO& out, std::vector<T> a) {
- for (unsigned i = 0; i < a.size(); ++i) out << a[i] << ' ';
- return out;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement