#if !__INCLUDE_LEVEL__ #include __FILE__ void VvyLw::solve() { INT(n,m1); set s; int now=0; rep(m1) { INT(a); now+=a; s.emplace(now); } INT(m2); now=n; rep(m2) { INT(b); now-=b; s.emplace(now); } debug(s); out(n+1-s.size()); } // -------------------------------------------------------------------------------------------------------------- #else #include #include #include using namespace std; using namespace __gnu_pbds; // -------------------------------------------------------------------------------------------------------------- /*#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops")//*/ //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wdeprecated-copy" namespace VvyLw { void wa_haya_exe(){ cin.tie(nullptr) -> sync_with_stdio(false); } void solve(); } // VvyLw mt19937 EhaL(hash()("Huitloxopetl")); mt19937 Random() { random_device seed_gen; mt19937 engine {seed_gen()}; return engine; } using Timer = chrono::system_clock::time_point; [[maybe_unused]] Timer start, stop; #if local void now(Timer &t){ t = chrono::system_clock::now(); } void time(const Timer &t1, const Timer &t2){ auto tm = chrono::duration_cast(t2-t1).count(); cout << tm << "ms\n"; } #else [[maybe_unused]] void now(Timer &t){ void(0); } [[maybe_unused]] void time(const Timer &t1, const Timer &t2){ void(0); } #endif // -------------------------------------------------------------------------------------------------------------- #define overload4(_1,_2,_3,_4,name,...) name #define overload3(_1,_2,_3,name,...) name #define rep1(n) for(ll i=0; i<(n); ++i) #define rep2(i,n) for(ll i=0; i<(n); ++i) #define rep3(i,a,b) for(ll i=(a); i<=(b); ++i) #define rep4(i,a,b,c) for(ll i=(a); i<=(b); i+=(c)) #define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__) #define rvp1(n) for(ll i=(n)-1; i>=0; i--) #define rvp2(i,n) for(ll i=(n)-1; i>=0; i--) #define rvp3(i,a,b) for(ll i=(a); i>=(b); i--) #define rvp4(i,a,b,c) for(ll i=(a); i>=(b); i-=(c)) #define rvp(...) overload4(__VA_ARGS__,rvp4,rvp3,rvp2,rvp1)(__VA_ARGS__) #define all1(v) v.begin(),v.end() #define all2(v,a) v.begin(),v.begin()+a #define all3(v,a,b) v.begin()+a,v.begin()+b #define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__) #define rall1(v) v.rbegin(),v.rend() #define rall2(v,a) v.rbegin(),v.rbegin()+a #define rall3(v,a,b) v.rbegin()+a,v.rbegin()+b #define rall(...) overload3(__VA_ARGS__,rall3,rall2,rall1)(__VA_ARGS__) #define each1(elem,v) for(auto &elem: v) #define each2(x,y,v) for(auto &[x,y]: v) #define each3(x,y,z,v) for(auto &[x,y,z]: v) #define each(...) overload4(__VA_ARGS__,each3,each2,each1)(__VA_ARGS__) #define sqrp1(n) for(ll i=0; i*i<(n); ++i) #define sqrp2(i,n) for(ll i=0; i*i<(n); ++i) #define sqrp3(i,a,b) for(ll i=(a); i*i<=(b); ++i) #define sqrp(...) overload3(__VA_ARGS__,sqrp3,sqrp2,sqrp1)(__VA_ARGS__) #define irp(it,v) for(auto it=v.begin(); it!=v.end(); ++it) #define ir(it,v) for(auto it=v.begin(); it!=v.end();) using ll = long long; using ld = long double; using uint = unsigned; using ul = unsigned long long; using i128 = __int128_t; using u128 = __uint128_t; const int dx[]={0,0,0,-1,1,-1,-1,1,1}; const int dy[]={0,-1,1,0,0,-1,1,-1,1}; const int MOD = 0x3b800001; const int M0D = 1e9+7; const int INF = 0x3fffffff; const ll LINF = 0x1fffffffffffffff; const ld DINF = numeric_limits::infinity(); const ld PI = acos(-1); const ld E = 2.718281828459045; namespace vectors { template using V = vector; using vi = V; using vu = V
    ; using vd = V; using vc = V; using vs = V; using vb = V; using wi = V; using wu = V; using wd = V; using wc = V; using ws = V; using wb = V; template inline V ndiv(T&& n, U&& v) noexcept { return V(forward(n), forward(v)); } template inline decltype(auto) ndiv(T&& n, Ts&&... v) noexcept { return V(v)...))>(forward(n), ndiv(forward(v)...)); } template V& operator++(V& v){ each(el,v) el++; return v; } template V& operator--(V& v){ each(el,v) el--; return v; } template V& operator+=(V& v, const U x){ each(el,v) el+=x; return v; } template V& operator-=(V& v, const U x){ each(el,v) el-=x; return v; } template V& operator*=(V& v, const U x){ each(el,v) el*=x; return v; } template V& operator/=(V& v, const U x){ each(el,v) el/=x; return v; } template V& operator%=(V& v, const U x){ each(el,v) el%=x; return v; } template V operator+(const V& v, const U x){ V res = v; res+=x; return res; } template V operator-(const V& v, const U x){ V res = v; res-=x; return res; } template V operator*(const V& v, const U x){ V res = v; res*=x; return res; } template V operator/(const V& v, const U x){ V res = v; res/=x; return res; } template V operator%(const V& v, const U x){ V res = v; res%=x; return res; } } // vectors using namespace vectors; namespace pairs { template using P = pair; template using PP = P; using pi = PP; using pd = PP; using pc = PP; using ps = PP; template PP operator+(const PP& a, const PP& b){ return {a.first + b.first, a.second + b.second}; } template PP operator-(const PP& a, const PP& b){ return {a.first - b.first, a.second - b.second}; } template PP operator-(const PP& a){ return {-a.first, -a.second}; } template PP operator*(const PP& a, const U& b){ return {a.first * b, a.second * b}; } template PP operator/(const PP& a, const U& b){ return {a.first / b, a.second / b}; } template PP& operator+=(PP& a, const PP& b){ return a = a + b; } template PP& operator-=(PP& a, const PP& b){ return a = a - b; } template PP& operator*=(PP& a, const U& b){ return a = a * b; } template PP& operator/=(PP& a, const U& b){ return a = a / b; } template bool operator==(const PP &p, const PP &q){ return p.first==q.first && p.second==q.second; } template bool operator!=(const PP &p, const PP &q){ return !(p==q); } template bool operator<(const PP &p, const PP &q){ if(p.first==q.first) return p.second bool operator<=(const PP &p, const PP &q){ if(p.first==q.first) return p.second<=q.second; return p.first bool operator>(const PP &p, const PP &q){ if(p.first==q.first) return p.second>q.second; return p.first>q.first; } template bool operator>=(const PP &p, const PP &q){ if(p.first==q.first) return p.second>=q.second; return p.first>q.first; } template bool operator==(const P &p, const P &q){ return p.first==q.first && p.second==q.second; } template bool operator!=(const P &p, const P &q){ return !(p==q); } template bool operator<(const P &p, const P &q){ if(p.first==q.first) return p.second bool operator<=(const P &p, const P &q){ if(p.first==q.first) return p.second<=q.second; return p.first bool operator>(const P &p, const P &q){ if(p.first==q.first) return p.second>q.second; return p.first>q.first; } template bool operator>=(const P &p, const P &q){ if(p.first==q.first) return p.second>=q.second; return p.first>q.first; } template PP rotate(const PP& a){ return {-a.second, a.first}; } // 90 degree ccw template pd rotate(const PP& a, const int ang) { assert(0<=ang && ang<360); const ld rad=PI*ang/180; return {a.first*cos(rad)-a.second*sin(rad), a.first*sin(rad)+a.second*cos(rad)}; } template T dot(const PP& a, const PP& b){ return a.first * b.first + a.second * b.second; } template T cross(const PP& a, const PP& b){ return dot(rotate(a), b); } template T square(const PP& a){ return dot(a, a); } template ld grad(const PP& a){ assert(a.first); return 1.0L * a.second / a.first; } template ld abs(const PP& a){ return hypotl(a.first, a.second); } template T gcd(const PP& a){ return gcd(a.first, a.second); } template PP normalize(PP a) { if(a == PP{}) return a; a /= gcd(a); if(a < PP{}) a = -a; return a; } template P swap(const P &p){ P ret={p.second,p.first}; return ret; } template V> swap(const V> &vp) { V> ret; each(el,vp) ret.emplace_back(swap(el)); return ret; } template V first(const V> &vp) { V res; each(el,vp) res.emplace_back(el.first); return res; } template V second(const V> &vp) { V res; each(el,vp) res.emplace_back(el.second); return res; } } // pairs using namespace pairs; template using ti = array; using tri = ti<3>; template using pq = priority_queue; template using pqr = priority_queue,greater>; template using Tree = tree,rb_tree_tag,tree_order_statistics_node_update>; template using TREE = tree,rb_tree_tag,tree_order_statistics_node_update>; template bool chmax(T& a, const U& b){ if(a bool chmin(T& a, const U& b){ if(a>b){ a=b; return 1; } return 0; } template inline bool overflow_if_add(T a, U b){ return (numeric_limits::max()-a) inline bool overflow_if_mul(T a, U b){ return (numeric_limits::max()/a)sputn(d, len) != len) { dest.setstate(ios_base::badbit); } } return dest; } template istream& operator>>(istream &is, P &p){ is >> p.first >> p.second; return is; } template istream& operator>>(istream &is, array &a){ each(el,a) is >> el; return is; } template istream& operator>>(istream &is, V &v){ each(el,v) is >> el; return is; } template inline bool in(T& x){ cin >> x; return 1; } template inline bool in(Head& head, Tail&... tail){ in(head); in(tail...); return 1; } template ostream& operator<<(ostream &os, const P &p){ os << p.first << ' ' << p.second; return os; } template ostream& operator<<(ostream &os, const array &a){ if(a.size()){ os << a.front(); for(auto i=a.begin(); ++i!=a.end();){ os << ' ' << *i; } } return os; } template ostream& operator<<(ostream &os, const V &v){ if(v.size()){ os << v.front(); for(auto i=v.begin(); ++i!=v.end();){ os << ' ' << *i; } } return os; } template ostream& operator<<(ostream &os, const map &m){ if(m.size()){ os << m.begin()->first << ' ' << m.begin()->second; for(auto i=m.begin(); ++i!=m.end();){ os << '\n' << i->first << ' ' << i->second; } } return os; } template ostream& operator<<(ostream &os, const set &st){ if(st.size()){ os << *st.begin(); for(auto i=st.begin(); ++i!=st.end();){ os << ' ' << *i; } } return os; } template ostream& operator<<(ostream &os, const deque &dq){ if(dq.size()){ os << dq.front(); for(auto i=dq.begin(); ++i!=dq.end();){ os << ' ' << *i; } } return os; } template inline void out(){ cout << '\n'; if(flush) cout.flush(); } template inline void out(const T& x){ cout << x << '\n'; if(flush) cout.flush(); } template inline void out(const Head& head, const Tail&... tail){ cout << head << ' '; out(tail...); } template inline void vout(const T& v){ cout << v << '\n'; if(flush) cout.flush(); } template inline void vout(const V& v){ rep(v.size()) cout << v[i] << '\n'; if(flush) cout.flush(); } template inline void vout(const Head& head, const Tail&... tail){ cout << head << '\n'; vout(tail...); } void fix(short x){ cout << fixed << setprecision(x); } void Alpha(){ cout << boolalpha; } #define INT(...) int __VA_ARGS__; in(__VA_ARGS__) #define LL(...) ll __VA_ARGS__; in(__VA_ARGS__) #define UL(...) ul __VA_ARGS__; in(__VA_ARGS__) #define LD(...) ld __VA_ARGS__; in(__VA_ARGS__) #define CHR(...) char __VA_ARGS__; in(__VA_ARGS__) #define STR(...) string __VA_ARGS__; in(__VA_ARGS__) #define VEC(type,name,size) V name(size); in(name) #define WEC(type,name,h,w) V> name(h,V(w)); in(name) #define fin(...) do{ out(__VA_ARGS__); return; }while(false) } // IO using namespace IO; namespace zia_qu { #ifdef local //https://gist.github.com/naskya/1e5e5cd269cfe16a76988378a60e2ca3 #include "debug_print.hpp" #define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else #define debug(...) static_cast(0) #endif #define elif else if #define eid(el,v) &el-&v[0] #define bif(bit,tar) if(((bit)>>(tar))&1) #define nxp(x) next_permutation(all(x)) #define prp(x) prev_permutation(all(x)) #define strpl(s,a,b) regex_replace(s,regex(a),b) #define rgxmt(s,rgx) regex_match(s,regex(rgx)) inline void YES(bool ok=1){ out(ok?"YES":"NO"); } inline void NO(bool ok=1){ YES(!ok); } inline void Yes(bool ok=1){ out(ok?"Yes":"No"); } inline void No(bool ok=1){ Yes(!ok); } inline void yes(bool ok=1){ out(ok?"yes":"no"); } inline void no(bool ok=1){ yes(!ok); } template inline T sqr(T x){ return x*x; } template inline T cub(T x){ return x*x*x; } template inline T Mod(T x, T m){ return (x+m)%m; } template inline T Pow(T a, T b, T mod=0) { T res=1; if(mod) { res%=mod; a%=mod; } while(b>0) { if(b&1) res*=a; if(mod) res%=mod; a*=a; if(mod) a%=mod; b>>=1; } return res; } inline ll Ceil(ld x, ll m){ return ceil(x/m); } inline ll Round(ld x, ll m, short fx=0){ if(fx==0) return round(x/m); else { ul y=Pow
      (10,fx); return round((x/y)/m)*y; } } inline ld Log(ll x, double base=2){ return log2(x)/log2(base); } inline int bitdigit(ll x){ return 64-__builtin_clzll(x); } inline int popcnt(ll x){ return __builtin_popcountll(x); } inline int fione(ll x){ return __builtin_ffsll(x); } inline int zrcnt(ll x){ return __builtin_ctzll(x); } template inline bool out_of_scope(T min, T cod, T max){ return cod < min || cod >= max; } template inline bool scope(T a, T x, T b){ return a <= x && x <= b; } inline bool isupper(char c){ return std::isupper(c); } inline bool isupper(const string &s){ bool ok=1; each(el,s) ok&=isupper(el); return ok; } inline bool islower(char c){ return std::islower(c); } inline bool islower(const string &s){ bool ok=1; each(el,s) ok&=islower(el); return ok; } inline bool isalpha(char c){ return std::isalpha(c); } inline bool isalpha(const string &s){ bool ok=1; each(el,s) ok&=isalpha(el); return ok; } inline bool isdigit(char c){ return std::isdigit(c); } inline bool isdigit(const string &s){ bool ok=1; each(el,s) ok&=isdigit(el); return ok; } inline bool isalnum(char c){ return std::isalnum(c); } inline bool isalnum(const string &s){ bool ok=1; each(el,s) ok&=isalnum(el); return ok; } inline bool isspace(char c){ return std::isspace(c); } inline bool isspace(const string &s){ bool ok=1; each(el,s) ok&=isspace(el); return ok; } inline bool ispunct(char c){ return std::ispunct(c); } inline bool ispunct(const string &s){ bool ok=1; each(el,s) ok&=ispunct(el); return ok; } inline bool isprint(char c){ return std::isprint(c); } inline bool isprint(const string &s){ bool ok=1; each(el,s) ok&=isprint(el); return ok; } inline ll strins(string &s, ll id, const string &t){ s.insert(id,t); return s.size(); } inline string toupper(string s){ each(c,s) c=std::toupper(c); return s; } inline string tolower(string s){ each(c,s) c=std::tolower(c); return s; } inline vi ten_to_adic(ll n, const short base) { vi res; while(n) { res.emplace_back(n%base); n/=base; } //rev(res); return res; } inline ll adic_to_ten(vi &v, const short base) { ll res=0; //rev(v); each(el,v) { ll idx=eid(el,v); res+=Pow(base,idx)*el; } return res; } inline string to_hex(ll x) { stringstream ss; ss<(x); string s=ss.str(); reverse(all(s)); s.resize(ten_to_adic(x,2).size()); reverse(all(s)); return s; } inline ll to_ten(string s, short base){ return stoll(s,nullptr,base); } inline i128 stoL(string &s) { i128 ret = 0; each(el,s) { if(isdigit(el)) ret = 10 * ret + el - '0'; } if(s.front()=='-') ret=-ret; return ret; } template constexpr auto symin(Ts... a){ return min(initializer_list>{a...}); } template constexpr auto symax(Ts... a){ return max(initializer_list>{a...}); } template inline V kyl(const map m, const U val) { V keys; irp(it,m) { if(it->second==val) keys.emplace_back(it->first); } return keys; } template inline K kymin(const map &m){ return m.begin()->first; } template inline K kymax(const map &m){ return m.rbegin()->first; } template inline V kymin_v(const map &m){ return m.begin()->second; } template inline V kymax_v(const map &m){ return m.rbegin()->second; } template inline V vlmin(const map &m){ auto pr = *min_element(all(m),[](P const &x, P const &y){ return x.second > y.second; }); return pr.second; } template inline V vlmax(const map &m){ auto pr = *max_element(all(m),[](P const &x, P const &y){ return x.second < y.second; }); return pr.second; } template inline K vlmin_k(const map &m){ auto pr = *min_element(all(m),[](P const &x, P const &y){ return x.second > y.second; }); return pr.first; } template inline K vlmax_k(const map &m){ auto pr = *max_element(all(m),[](P const &x, P const &y){ return x.second < y.second; }); return pr.first; } template inline T stmin(const set &s){ return *s.begin(); } template inline T stmax(const set &s){ return *s.rbegin(); } } // zia qu namespace Lady_sANDy { template inline void rev(T& v){ reverse(all(v)); } template inline void rev(T& v, const ll a, const ll b){ reverse(all(v,a,b+1)); } template inline T revd(const T& v){ auto c=v; rev(c); return c; } template inline T revd(const T& v, const ll a, const ll b){ auto c=v; rev(c,a,b); return c; } template inline void Sort(T& v){ sort(all(v)); } template inline void Sort(T& v, const ll a, const ll b){ sort(all(v,a,b+1)); } template inline T sorted(T& v){ auto c=v; Sort(c); return c; } template inline T sorted(const T& v, const ll a, const ll b){ auto c=v; Sort(c,a,b); return c; } template inline void Sortt(T& v){ sort(rall(v)); } template inline void Sortt(T& v, const ll a, const ll b){ sort(rall(v,v.size()-b-1,v.size()-a)); } template inline T Sorted(T& v){ auto c=v; Sortt(c); return c; } template inline T Sorted(const T& v, const ll a, const ll b){ auto c=v; Sortt(c,a,b); return c; } template inline void Sorth(T& v){ make_heap(all(v)); sort_heap(all(v)); } template inline T mrg(const T& a, const T& b){ T res; merge(all(a),all(b),back_inserter(res)); return res; } template inline T Min(const V& v){ return *min_element(all(v)); } template inline T Min(const V& v, const ll a, const ll b){ return *min_element(all(v,a,b+1)); } template inline T Max(const V& v){ return *max_element(all(v)); } template inline T Max(const V& v, const ll a, const ll b){ return *max_element(all(v,a,b+1)); } template inline ll Min_i(const T& v){ return min_element(all(v))-v.begin(); } template inline ll Max_i(const T& v){ return max_element(all(v))-v.begin(); } template inline ll LB(const T& v, const U x){ return lower_bound(all(v),x)-v.begin(); } template inline ll UB(const T& v, const U x){ return upper_bound(all(v),x)-v.begin(); } template inline bool BS(const T& v, const U x){ return binary_search(all(v),x); } template inline bool BS(const T& v, const U x, Boolean fn){ return binary_search(all(v),x,fn); } template inline bool All(const T& v, Boolean fn){ return all_of(all(v),fn); } template inline bool Exist(const T& v, Boolean fn){ return any_of(all(v),fn); } template inline ll pt(T& v, Boolean fn){ auto p=partition(all(v),fn); return p-v.begin(); } template inline ll ptp(const T& v, Boolean fn){ return partition_point(all(v),fn)-v.begin(); } template inline ll Find(T& v, const U x){ auto itr=find(all(v),x); if(itr==v.end()) return -1LL; return itr-v.begin(); } template inline void rpl(T& v, const U fn, const U r){ replace(all(v),fn,r); } template inline void rplif(T& v, Boolean fn, const U r){ replace_if(all(v),fn,r); } template inline ul cntif(const T& v, Boolean fn){ return count_if(all(v),fn); } template inline T Count(V& v, ll x){ /*Sort(v);//*/ return UB(v,x)-LB(v,x); } template inline T IP(const V& v, const V& u, T init){ return inner_product(all(v),u.begin(),init); } template inline V iot(T n, ll init=0){ V a(n); iota(all(a),init); return a;} template inline V trans(const V& v, Boolean fn){ V res; transform(all(v),back_inserter(res),fn); return res; } template inline ll ers(T& v, U x){ v.erase(remove(all(v),x),v.end()); return v.size(); } template ll ersif(T& v, Boolean x){ v.erase(remove_if(all(v),x),v.end()); return v.size(); } template inline ll unq(T& v){ Sort(v); v.erase(unique(all(v)),v.end()); return v.size(); } template inline T cp(const T& v){ T res; copy(all(v),back_inserter(res)); return res; } template inline T cp(const T& v, ll a, ll b){ T res; copy(all(v,a,b),back_inserter(res)); return res; } template inline void rtt(T& s, ll idx){ ll id=zia_qu::Mod(idx,s.size()); rotate(all(s,id),s.end()); } template inline void rtt(T& s, ll a, ll b, ll c){ rotate(all(s,a,b),s.end()-c); } template inline V psum(const V& v){ V s{0}; partial_sum(all(v),back_inserter(s)); return s; } template inline V adf(const V& v){ V a; adjacent_difference(all(v),back_inserter(a)); rtt(a,1); a.pop_back(); return a; } template inline V rext(V& v, ll size){ V res; sample(all(v),back_inserter(res),size,Random()); return res; } template inline T rext(V& v){ V res; sample(all(v),back_inserter(res),1,Random()); return res.front(); } template inline ll vsum(V &v){ return reduce(all(v),0LL); } template inline ll vsum(V &v, ll a, ll b){ return reduce(all(v,a,b),0LL); } template inline ld vdsum(V &v){ return reduce(all(v),0.0L); } template inline ld vdsum(V &v, ll a, ll b){ return reduce(all(v,a,b),0.0L); } template inline ll vmul(V &v){ return reduce(all(v),1LL,[](ll acc,ll i){ return acc*i; }); } template inline ll vmul(V &v, ll a, ll b){ return reduce(all(v,a,b),1LL,[](ll acc,ll i){ return acc*i; }); } template inline ld vdmul(V &v){ return reduce(all(v),1.0L,[](ll acc,ll i){ return acc*i; }); } template inline ld vdmul(V &v, ll a, ll b){ return reduce(all(v,a,b),1.0L,[](ll acc,ll i){ return acc*i; }); } } // Lady s&y namespace Heileden { template inline V div(T n) { V d; sqrp(i,1,n) { if(n%i==0) { d.emplace_back(i); if(i*i!=n) d.emplace_back(n/i); } } Lady_sANDy::Sort(d); return d; } template inline V> prmfct(T n) { V> res; sqrp(i,2,n) { if(n%i!=0) continue; T tmp=0; while(n%i==0) { tmp++; n/=i; } res.emplace_back(i,tmp); } if(n!=1) res.emplace_back(n,1); return res; } struct p_table { vb SoE; p_table(int n): SoE(n+1,1){ SoE[0]=SoE[1]=0; rep(i,2,n) { if(!SoE[i]) continue; rep(j,i*i,n,i) SoE[j] = 0; } } vi get() { vi p; rep(i,2,SoE.size()-1) if(SoE[i]) p.emplace_back(i); return p; } }; struct p_fact { vi spf; p_fact(int n): spf(n + 1){ iota(all(spf),0); sqrp(i,2,n) { if(spf[i]==i) { rep(j,i*i,n,i) { if(spf[j]==j) spf[j]=i; } } } } map get(int n) { map m; while(n!=1) { m[spf[n]]++; n/=spf[n]; } return m; } }; template inline T bins(T ok, T ng, Boolean fn, ld eps = 1) { while(abs(ok-ng)>eps) { T mid=(ok+ng)/2; (fn(mid)?ok:ng) = mid; } return ok; } template inline V cmp(const V& v) { V res,cp=v; Lady_sANDy::unq(cp); each(el,v) res.emplace_back(Lady_sANDy::LB(cp,el)); return res; } template inline V cmp2(V &c1, V &c2) { V res; const int n = c1.size(); rep(n) { for(T d = 0; d < 1; d++) { T tc1 = c1[i]+d; T tc2 = c2[i]+d; res.emplace_back(tc1); res.emplace_back(tc2); } } Lady_sANDy::unq(res); rep(n) { c1[i]=Lady_sANDy::LB(res,c1[i]); c2[i]=Lady_sANDy::LB(res,c2[i]); } return res; } template T factor(T n, T mod=0) { T res=1; while(n>0) { res*=n--; if(mod) res%=mod; } return res; } template T perm(T n, T r, T mod=0) { const T tmp=n; T res=1; while(n>tmp-r) { res*=n--; if(mod) res%=mod; } return res; } template T binom(T n, T r, T mod=0) { if(r < 0 || n < r) return 0; T res = 1; rep(i,1,r) { res*=n--; if(mod) res%=mod; res/=i; if(mod) res%=mod; } return res; } inline bool is_int(ld n){ ll r=floor(n); return r==n; } inline bool is_sqr(ll n){ return is_int(sqrt(n)); } /* grundy sample template inline bool grundy(V v) { ll res=0; each(el,v) res^=el; return res!=0; }//*/ } // Heileden // -------------------------------------------------------------------------------------------------------------- using namespace zia_qu; using namespace Lady_sANDy; using namespace Heileden; int main() { VvyLw::wa_haya_exe(); now(start); /*INT(t); while(t--)//*/ VvyLw::solve(); now(stop); time(start, stop); } #endif