#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #pragma GCC optimize("O3") #pragma GCC target("avx2") #pragma GCC optimize("unroll-loops") //#pragma GCC optimize ("Ofast") #include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rfor(i, m, n) for (int i = (m); i >= (n); --i) #define unless(c) if (!(c)) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define range_it(a, l, r) (a).begin() + (l), (a).begin() + (r) using namespace std; using ll = long long; using LD = long double; using VB = vector; using VVB = vector; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; using VS = vector; using VD = vector; using PII = pair; using VP = vector; using PLL = pair; using VPL = vector; template using PQ = priority_queue; template using PQS = priority_queue, greater>; constexpr int inf = (int)1e9; constexpr ll inf_ll = (ll)1e18, MOD = 1000000007; constexpr LD PI = M_PI, EPS = 1e-12; // --- input --- // #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #define putchar_unlocked _putchar_nolock #define fwrite_unlocked fwrite #define fflush_unlocked fflush #endif class Input { static int gc() { return getchar_unlocked(); } template static void i(T& v) { cin >> v; } static void i(char& v) { while (isspace(v = gc())) ; } static void i(bool& v) { v = in() != '0'; } static void i(string& v) { v.clear(); char c; for (i(c); !isspace(c); c = gc()) v += c; } static void i(int& v) { bool neg = false; v = 0; char c; i(c); if (c == '-') { neg = true; c = gc(); } for (; isdigit(c); c = gc()) v = v * 10 + (c - '0'); if (neg) v = -v; } static void i(long long& v) { bool neg = false; v = 0; char c; i(c); if (c == '-') { neg = true; c = gc(); } for (; isdigit(c); c = gc()) v = v * 10 + (c - '0'); if (neg) v = -v; } static void i(double& v) { double dp = 1; bool neg = false, adp = false; v = 0; char c; i(c); if (c == '-') { neg = true; c = gc(); } for (; isdigit(c) || c == '.'; c = gc()) { if (c == '.') adp = true; else if (adp) v += (c - '0') * (dp *= 0.1); else v = v * 10 + (c - '0'); } if (neg) v = -v; } static void i(long double& v) { long double dp = 1; bool neg = false, adp = false; v = 0; char c; i(c); if (c == '-') { neg = true; c = gc(); } for (; isdigit(c) || c == '.'; c = gc()) { if (c == '.') adp = true; else if (adp) v += (c - '0') * (dp *= 0.1); else v = v * 10 + (c - '0'); } if (neg) v = -v; } template static void i(pair& v) { i(v.first); i(v.second); } template static void i(vector& v) { for (auto& e : v) i(e); } template static void input_tuple(T& v) { if constexpr (N < tuple_size_v) { i(get(v)); input_tuple(v); } } template static void i(tuple& v) { input_tuple(v); } struct InputV { int n, m; InputV(int _n) : n(_n), m(0) {} InputV(const pair& nm) : n(nm.first), m(nm.second) {} template operator vector() { vector v(n); i(v); return v; } template operator vector>() { vector> v(n, vector(m)); i(v); return v; } }; public: static string get_line() { string v; char c; for (i(c); c != '\n' && c != '\0'; c = gc()) v += c; return v; } template static T in() { T v; i(v); return v; } template operator T() const { return in(); } int operator--(int) const { return in() - 1; } InputV operator[](int n) const { return InputV(n); } InputV operator[](const pair& n) const { return InputV(n); } void operator()() const {} template void operator()(H&& h, T&&... t) const { i(h); operator()(forward(t)...); } private: template