text: a : 1); } inline int getbit(int x, int b) { return (x >> b) & 1; } inline int setbit(int x, int b) { return x | (1 << b); } inline void _setbit(int &x, int b) { x = setbit(x, b); } inline long long setbit(long long x, int b) { return x | (1ll << b); } inline void _setbit(long long &x, int b) { x = setbit(x, b); } inline int unsetbit(int x, int b) { return x & (INT_MAX - (1 << b)); } inline void _unsetbit(int &x, int b) { x = unsetbit(x, b); } inline int countbit(int x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); return ((x + (x >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; } inline long long countbit(long long x) { return countbit(int(x & INT_MAX)) + countbit(int(x >> 32) & INT_MAX); } inline void printbit(int x, int len) { for (int i = len - 1; i >= 0; i--) printf("%d", getbit(x, i)); } int gcd(int a, int b) { return b == 0 ?a : gcd(b, a % b); } long long gcd(long long a, long long b) { return b == 0 ?a : gcd(b, a % b); } template <typename A, typename B> ostream &operator<<(ostream &stream, const pair<A, B> &p) { stream << "{" << p.first << "," << p.second << "}"; return stream; } template <typename A> ostream &operator<<(ostream &stream, const vector<A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " "; stream << "]"; return stream; } template <typename A, typename B> ostream &operator<<(ostream &stream, const map<A, B> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " "; stream << "]"; return stream; } template <typename A> ostream &operator<<(ostream &stream, const set<A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " "; stream << "]"; return stream; } template <typename A> ostream &operator<<(ostream &stream, const stack<A> &v) { stack<A> st = v; stream << "["; while (!st.empty()) { stream << st.top() << " "; st.