#include using namespace std; typedef long long ll; typedef long double ld; #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (int i = m; i < n; ++i) #define FORR(i, m, n) for (int i = m; i >= n; --i) #define ALL(v) (v).begin(),(v).end() #define ALLR(v) (v).rbegin(),(v).rend() #define fi first #define se second #define PB push_back #define EB emplace_back using P = pair; template using PQ = priority_queue; template using QP = priority_queue,greater>; templatevoid debug(const T &v,ll h,ll w){for(ll i=0;ivoid debug(const T &v,ll n){for(ll i=0;ivoid debug(const vector&v){debug(v,v.size());} templatevoid debug(const vector>&v){for(auto &vv:v)debug(vv,vv.size());} templatevoid debug(stack st){while(!st.empty()){cout<void debug(queue st){while(!st.empty()){cout<void debug(deque st){while(!st.empty()){cout<void debug(PQ st){while(!st.empty()){cout<void debug(QP st){while(!st.empty()){cout<void debug(const set&v){for(auto z:v)cout<void debug(const multiset&v){for(auto z:v)cout<void debug(const array &a){for(auto z:a)cout<void debug(const map&v){for(auto z:v)cout<<"["<bool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> p >> q; cout << p+q << endl; // int n;cin >> n; // FOR(p,2,n+1) FOR(q,p+1,n+1){ // if(gcd(p,q)!=1) continue; // double xl=inf,xr=inf; // int pl,pr,ql,qr; // FOR(u,1,q) FOR(v,1,q){ // if(p*v-q*u>0){ // if(chmin(xl,1.*p/q-1.*u/v)){ // pl=u,ql=v; // } // } // else if(p*v-q*u<0){ // if(chmin(xr,-1.*p/q+1.*u/v)){ // pr=u,qr=v; // } // } // } // cerr << p << '/' << q << endl; // cerr << pl << '/' << ql << " " << pr << '/' << qr << endl; // cerr << p+q << " " << pl+ql+pr+qr << endl; // } }