malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <iostream>   #include<bits/stdc++.h>   #include<vector>   #define fo(i,n) for(long long i=0;i<n;i++)   #define ll long long int   #define inf 999999999999999999   #define pb push_back   #define fi first   #define se second   #define vi vector<ll>   #define vii vector<vector<ll>>   #define pi pair<ll,ll>   #define mp make_pair   #define MOD 1000000007   #define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)   #define fio ios_base::sync_with_stdio(false);cin.tie(0);   using namespace std;   //cerr<<   n  <<  Time elapsed :  << clock() * 1000.0 / CLOCKS_PER_SEC <<   ms n  ;   //freopen( explicit.in ,  r , stdin);   //freopen( explicit.out ,  w , stdout);       void SieveOfEratosthenes()    {        bool prime[10000001];       memset(prime, true, sizeof(prime));             for (ll p=2; p*p<=10000000; p++)        {            if (prime[p] == true)            {                // Update all multiples of p greater than or                 // equal to the square of it                // numbers which are multiple of p and are                // less than p^2 are already been marked.                 for (ll i=p*p; i<=10000000; i += p) {                   prime[i] = false;                }           }        }     }    ll binpow(ll a, ll b) {       ll res = 1;       while (b > 0) {           if (b & 1)               res = (res * a);           a = (a * a);           b >>= 1;       }       return res;   }   ll gcd(ll a,ll b)   {       if(b%a==0)          return a;       return gcd(b%a,a);   }   ll power(ll x,ll y,ll p)    {        ll r = 1;            x = x % p;       while (y > 0) {           if (y & 1)                r = (r * x) % p;           y = y >> 1;            x = (x * x) % p;        }        return r;    }     ll modInverse(ll n, ll p)    {        return power(n, p - 2, p);    }        ll nCrModP(ll n,ll r, ll p)    {        ll fac[100005];       if (r == 0)            return 1;             return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;    }   int32_t main()    {       fio       ll j,i,n,t,l,s,r,c,h,k,m,maxi,d,a,b,x;       cin>>t;       string w;       for(i=0;i<t;i++)       {           cin>>a>>b>>c;           s=0;           for(j=0;j<c;j++)           {               s=s*10+1;           }           l=s;           while(true)           {               x=s;               d=0;               while(x!=0)               {                   x=x/10;                   d++;               }               if(d==a)                   break;               s=s*2;           }           m=s;           s=l;           while(true)           {               x=s;               d=0;               while(x!=0)               {                   x=x/10;                   d++;               }               if(d==b)                   break;               s=s*3;           }           cout<<m<<   <<s<<endl;           // cout<<__gcd(m,s)<<endl;       }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5;   int n, can_win[MAXN + 5], can_lose[MAXN + 5];   struct game {     long long s, e;   } a[MAXN + 5];   bool get_win(long long s, long long e) {     assert(s <= e);     if (e % 2 == 1) {       if (s % 2 == 1)         return 0;       else         return 1;     } else {       if (s * 2 > e) {         if (s % 2 == 1)           return 1;         else           return 0;       } else if (s * 4 > e) {         return 1;       } else {         return get_win(s, e / 4);       }     }   }   bool get_lose(long long s, long long e) {     if (s * 2 > e) {       return 1;     } else {       return get_win(s, e / 2);     }   }   int main() {     cin >> n;     for (int i = 1; i <= n; ++i) cin >> a[i].s >> a[i].e;     can_lose[0] = 1;     for (int i = 1; i <= n; ++i) {       if (can_lose[i - 1] && can_win[i - 1]) {         cout << 1 <<     << 1 << endl;         return 0;       }       if (!can_lose[i - 1] && !can_win[i - 1]) {         cout << 0 <<     << 0 << endl;         return 0;       }       if (can_lose[i - 1]) {         can_win[i] = get_win(a[i].s, a[i].e);         can_lose[i] = get_lose(a[i].s, a[i].e);       } else {         can_win[i] = (!get_win(a[i].s, a[i].e));         can_lose[i] = (!get_lose(a[i].s, a[i].e));       }     }     cout << can_win[n] <<     << can_lose[n] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const int maxN = 100000;   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     int n, m;     cin >> n >> m;     int ok = 1;     for (int i = 0; i < n; i++) {       for (int k = 0; k < m; k++) {         char c;         cin >> c;         if (c !=  B  && c !=  W  && c !=  G ) ok = 0;       }     }     cout << (ok ?  #Black&White  :  #Color ) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct READ {     int d1, d2, d3;     READ(int d1 = -1, int d2 = -1, int d3 = -1) : d1(d1), d2(d2), d3(d3) {}     template <class T>     operator T() {       T tmp;       this->read(tmp);       return tmp;     }     template <class T>     void read(T& t) {       cin >> t;     }     template <class T>     void read(vector<T>& cont) {       assert(d1 != -1);       cont.resize(d1);       READ r(d2, d3);       for (int i = 0; i < d1; ++i) r.read(cont[i]);     }     template <class T1, class T2>     void read(pair<T1, T2>& x) {       read(x.first);       read(x.second);     }   };   vector<pair<int, int>> solve(int n, int k) {     int64_t combs = (int64_t)k * (k - 1);     if (combs < n) return {};     vector<pair<int, int>> result;     for (int diff = 1;; diff += 1) {       for (int x = 1; x <= k; ++x) {         result.emplace_back(x, (x + diff - 1) % k + 1);         if (result.size() >= n) return result;       }     }   }   int main(int argc, char* argv[]) {     int n = READ();     int k = READ();     vector<pair<int, int>> result = solve(n, k);     if (result.empty()) {       cout <<  NO  << endl;     } else {       cout <<  YES  << endl;       for (auto& p : result) {         cout << p.first <<     << p.second << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC optimize( O0 )   #pragma GCC optimize( O1 )   template <typename T>   void vec_SUN(vector<T> &Vec) {     vector<T> X;     X = Vec;     sort(X.begin(), X.end());     X.resize(unique(X.begin(), X.end()) - X.begin());     for (auto &u : Vec) u = lower_bound(X.begin(), X.end(), u) - X.begin() + 1;   }   template <typename T>   void arr_SUN(T *A, int n) {     vector<T> B(n);     for (int i = 0; i < n; i++) B[i] = A[i];     sort(B.begin(), B.end());     B.resize(unique(B.begin(), B.end()) - B.begin());     for (int i = 0; i < n; i++)       A[i] = lower_bound(B.begin(), B.end(), A[i]) - B.begin() + 1;   }   template <typename T>   void vec_012(vector<T> &A, int n) {     A.resize(n);     for (int i = 0; i < n; i++) A[i] = (T)i;   }   template <typename T>   void arr_012(T *A, int n) {     for (int i = 0; i < n; i++) A[i] = (T)i;   }   template <typename T>   void vec_123(vector<T> &A, int n) {     A.resize(n);     for (int i = 0; i < n; i++) A[i] = (T)(i + 1);   }   template <typename T>   void arr_123(T *A, int n) {     for (int i = 0; i < n; i++) A[i] = (T)(i + 1);   }   template <typename T>   void arr_equal(T *A, T *P, int n) {     for (int i = 0; i < n; i++) P[i] = A[i];   }   template <typename T>   void setTOvec(set<T> &S, vector<T> &V) {     V.resize(S.size());     int i = 0;     for (auto it = S.begin(); it != S.end(); it++) V[i++] = *it;   }   const int N = 1e5 + 5;   struct X {     int A[N];     int s = 0;     void add(int x) { A[s++] = x; }     void del() { s--; }     void print() {       cout << 0 <<    ;       for (int i = s - 1; i >= 0; i--) cout << A[i] <<    ;     }   };   bitset<N> M;   int n;   bool f(X &ANS, int s) {     if (s == 0 && ANS.s == n) {       ANS.print();       return true;     }     if (M[s]) return false;     M[s] = true;     ANS.add(s);     if (f(ANS, s / 2)) return true;     if (f(ANS, (s + n) / 2)) return true;     ANS.del();     M[s] = false;     return false;   }   int main() {     ios_base ::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     X ANS;     if (n % 2 == 1)       cout << -1;     else       f(ANS, 0);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   mt19937_64 rang(       chrono::high_resolution_clock::now().time_since_epoch().count());   const int M = 1e9 + 7;   long long power(long long x, long long y) {     long long v = 1;     while (y > 0) {       if (y & 1) v = v * x;       y = y >> 1;       x = x * x;     }     return v;   }   bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }   long long ceil(long long a, long long b) { return (a + b - 1) / b; }   void _print(long long t) { cerr << t; }   void _print(int t) { cerr << t; }   void _print(string t) { cerr << t; }   void _print(char t) { cerr << t; }   void _print(long double t) { cerr << t; }   void _print(double t) { cerr << t; }   void _print(unsigned long long t) { cerr << t; }   template <class T, class V>   void _print(pair<T, V> p);   template <class T>   void _print(vector<T> v);   template <class T>   void _print(set<T> v);   template <class T, class V>   void _print(map<T, V> v);   template <class T>   void _print(multiset<T> v);   template <class T, class V>   void _print(pair<T, V> p) {     cerr <<  { ;     _print(p.first);     cerr <<  , ;     _print(p.second);     cerr <<  } ;   }   template <class T>   void _print(vector<T> v) {     cerr <<  [  ;     for (T i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T>   void _print(set<T> v) {     cerr <<  [  ;     for (T i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T>   void _print(multiset<T> v) {     cerr <<  [  ;     for (T i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T, class V>   void _print(map<T, V> v) {     cerr <<  [  ;     for (auto i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   void init() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   void solve() {     int n;     cin >> n;     vector<int> a(n + 1);     for (int i = 1; i <= n; i++) cin >> a[i];     vector<int> pos(n + 1);     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       pos[x] = i;     };     ;     for (int i = 1; i <= n; i++) a[i] = pos[a[i]];     ;     int c = 1;     for (int i = 2; i <= n; i++) {       if (a[i] > a[i - 1])         c++;       else         break;     }     cout << n - c;   }   int main() {     init();     long long test = 1;     while (test--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char str[102];   char miao[] =  miao. ;   char lala[] =  lala. ;   int check(char* a) {     int res = 0;     int k = strlen(a);     if (k < 5) return 0;     if (strncmp(a, miao, 5) == 0) res += 2;     if (strncmp(a + k - 5, lala, 5) == 0) res += 1;     return res;   }   int main() {     int n, i, res;     cin >> n;     cin.getline(str, 101);     for (i = 0; i < n; i++) {       cin.getline(str, 101);       res = check(str);       if (res == 1)         cout <<  Freda s n ;       else if (res == 2)         cout <<  Rainbow s n ;       else         cout <<  OMG>.< I don t know! n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long double esp = 1e-11;   const long double PI = acos((long double)-1);   const long long int INF = 0x3f3f3f3fll;   const int MOD = 1000000007ll;   const int maxn = 200001;   int inv[maxn], pin_inv[maxn], pin[maxn];   void initCab(int N) {     inv[0] = pin[0] = pin_inv[0] = inv[1] = pin[1] = pin_inv[1] = 1;     for (int x = 2; x <= N; x++) {       inv[x] = (long long int)(MOD - MOD / x) * inv[MOD % x] % MOD;       pin[x] = (long long int)pin[x - 1] * x % MOD;       pin_inv[x] = (long long int)pin_inv[x - 1] * inv[x] % MOD;     }   }   long long int Cab(int n, int m) {     return (long long int)pin[n] * pin_inv[m] % MOD * pin_inv[n - m] % MOD;   }   long long int m[maxn], ans[10];   int main() {     initCab(maxn - 1);     int n;     scanf( %d , &n);     for (int x = 1; x <= n; x++) scanf( %d , &m[x]);     int f = 1;     if (n % 2 == 0) {       for (int x = 1; x < n; x++)         if (x & 1)           m[x] = (m[x] + m[x + 1]) % MOD;         else           m[x] = (m[x] - m[x + 1]) % MOD;       n--;       f = 0;     }     int time = (n - 1) / 4 * 4;     for (int x = 1; x <= n - time; x++) {       ans[x] = 0;       for (int y = 1; y <= time + 1; y++)         if (y & 1) {           ans[x] = (ans[x] + m[x + y - 1] * Cab(time / 2, y / 2)) % MOD;         }     }     n -= time;     while (n > 1) {       for (int x = 1; x < n; x++) {         if (f & 1)           ans[x] = (ans[x] + ans[x + 1]) % MOD;         else           ans[x] = (ans[x] - ans[x + 1]) % MOD;         f ^= 1;       }       n--;     }     ans[1] = (ans[1] % MOD + MOD) % MOD;     printf( %I64d n , ans[1]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int dx[] = {0, 1, -1, 0, 1, -1, -1, 1};   const long long int dy[] = {-1, 0, 0, 1, 1, 1, -1, -1};   long long int gcd(long long int x, long long int y) {     return (y != 0 ? gcd(y, x % y) : x);   }   long long int lcm(long long int x, long long int y) {     return (x / gcd(x, y) * y);   }   long long int limak;   long long int pos;   char matei[300010];   vector<pair<long long int, pair<long long int, long long int> > > v;   long long int n;   bool compare(pair<long long int, pair<long long int, long long int> > a,                pair<long long int, pair<long long int, long long int> > b) {     return a.second.first > b.second.first;   }   long long int solve() {     pos = 1;     memset(matei, 0, sizeof matei);     priority_queue<pair<long long int, long long int>,                    vector<pair<long long int, long long int> >,                    greater<pair<long long int, long long int> > >         pq;     int idx;     long long int melhorPos = 300000000;     for (idx = 0; idx < n; idx++) {       if (v[idx].second.first <= limak || v[idx].first == 0) break;       pq.push(make_pair(v[idx].second.second - v[idx].second.first + 1,                         v[idx].first));       matei[v[idx].first] = 1;       pos++;     }     melhorPos = pos;     long long int precisa, id;     while (!pq.empty()) {       precisa = pq.top().first;       id = pq.top().second;       pq.pop();       if (precisa > limak) break;       limak -= precisa;       pos--;       for (idx = idx; idx < n; idx++) {         if (v[idx].second.first <= limak) break;         if (!matei[v[idx].first] && v[idx].first != 0) {           pq.push(make_pair(v[idx].second.second - v[idx].second.first + 1,                             v[idx].first));           matei[v[idx].first] = 1;           pos++;         }       }       if (pos < melhorPos) melhorPos = pos;     }     return melhorPos;   }   int main() {     cin >> n;     long long int t, w;     for (int i = 0; i < n; i++) {       cin >> t >> w;       if (i == 0) limak = t;       v.push_back(make_pair(i, make_pair(t, w)));     }     sort(v.begin(), v.end(), compare);     cout << solve() << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 512;   const int INF = 0x3f3f3f3f;   long long dis[MAXN][MAXN], a[MAXN], ans[MAXN];   bool in[MAXN];   int n;   void Floyd() {     for (int k = n; k >= 1; k--) {       int t = a[k];       in[t] = 1;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= n; j++) {           dis[i][j] = min(dis[i][j], dis[i][t] + dis[t][j]);           if (in[i] && in[j]) ans[k] += dis[i][j];         }       }     }     for (int i = 1; i <= n; i++) printf( %lld  , ans[i]);     puts(  );   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         scanf( %lld , &dis[i][j]);       }     }     for (int i = 1; i <= n; i++) {       scanf( %lld , &a[i]);     }     Floyd();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long n, m;   vector<int> a[1000000];   bool yt = 0;   map<int, int> rt;   string t;   long ry = 0;   string p[] = { 1869 ,  6198 ,  1896 ,  9186 ,  9168 ,  6189 ,  8691 };   void df(int k) {     for (int i = 1; i <= rt[k]; ++i) {       ry = (ry * 10 + k) % 7;       cout << k;     }   }   int main() {     cin >> t;     for (int k = 0; k < t.size(); ++k) {       rt[t[k] -  0 ]++;     }     --rt[1];     --rt[6];     --rt[8];     --rt[9];     for (int k = 1; k <= 9; ++k) df(k);     cout << p[ry];     df(0);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 200005;   const int Maxl = 20;   int table[Maxl][Maxn];   int tableor[Maxl][Maxn];   int numlog[Maxn];   int n, a[Maxn];   void buildTable() {     numlog[1] = 0;     for (int i = 2; i <= n; i++) {       numlog[i] = numlog[i >> 1] + 1;     }     for (int i = 0; i <= numlog[n]; i++) {       int curlen = 1 << i;       for (int j = 1; (j + curlen - 1) <= n; j++) {         if (i == 0) {           table[i][j] = j;           continue;         } else {           if (a[table[i - 1][j]] >= a[table[i - 1][j + (curlen >> 1)]]) {             table[i][j] = table[i - 1][j];           } else {             table[i][j] = table[i - 1][j + (curlen >> 1)];           }         }       }     }   }   void buildTableOr() {     for (int i = 0; i <= numlog[n]; i++) {       int curlen = 1 << i;       for (int j = 1; (j + curlen - 1) <= n; j++) {         if (i == 0) {           tableor[i][j] = a[j];           continue;         } else {           tableor[i][j] = tableor[i - 1][j] | tableor[i - 1][j + (curlen >> 1)];         }       }     }   }   int getMaxIndex(int l, int r) {     int curlog = numlog[r - l + 1];     if (a[table[curlog][l]] >= a[table[curlog][r - (1 << curlog) + 1]]) {       return table[curlog][l];     } else {       return table[curlog][r - (1 << curlog) + 1];     }   }   int RMQ(int l, int r) { return a[getMaxIndex(l, r)]; }   int getOr(int l, int r) {     int curlog = numlog[r - l + 1];     return (tableor[curlog][l] | tableor[curlog][r - (1 << curlog) + 1]);   }   int binary_search(int gst, int st, int end, int cur_or) {     while (st + 1 < end) {       int mid = (st + end) / 2;       int g = getOr(gst, mid);       if (g > cur_or)         end = mid;       else         st = mid;     }     int g = getOr(gst, end);     if (g == cur_or)       return end;     else {       return st;     }   }   int get() {     int ret = 0;     for (int i = 1; i <= n; i++) {       int cur_or = a[i];       int M = a[i];       for (int j = i; j <= n; j++) {         cur_or |= a[j];         M = max(M, a[j]);         if (cur_or > M) {           ret++;         }       }     }     return ret;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     buildTable();     buildTableOr();     long long ans = 0;     for (int i = n; i >= 1; i--) {       int cur_or = a[i];       int st = i;       int end = binary_search(i, i, n, cur_or);       int idx = getMaxIndex(st, end);       if (a[idx] < cur_or) {         ans += (long long)end - st + 1;       } else {         ans += (long long)idx - st;       }       while (end <= n) {         st = end + 1;         if (st > n) break;         cur_or = cur_or | a[st];         end = binary_search(i, st, n, cur_or);         idx = getMaxIndex(st, end);         if (a[idx] < cur_or)           ans += (long long)end - st + 1;         else           ans += (long long)idx - st;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1 << 30;   int n, in[100010], cnt, dyn[100010];   void check() {     if (cnt < 2) {       printf( %d n , cnt);       exit(0);     }   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &in[i]);     for (int i = n - 1; i >= 0; i--) dyn[i] = dyn[i + 1] + (in[i] == 0 ? 1 : 0);     if (n == 2) {       if (in[0] == 0 && in[1] != 0)         printf( 1 n );       else         printf( 0 n );       return 0;     }     if (dyn[0] > 1) {       int ans = INF;       if (dyn[0] == n) ans = min(ans, 0);       if (dyn[1] >= n - 2) ans = min(ans, n - 1 - dyn[1]);       if (dyn[2] == n - 2) ans = min(ans, n - 2);       if (ans < 2)         printf( %d n , ans);       else         printf( 2 n );       return 0;     }     bool t = true;     for (int i = 2; i < n; i++)       if (in[i] * in[i - 2] != in[i - 1] * in[i - 1]) t = false;     if (t) {       printf( 0 n );       return 0;     }     if (n == 3) {       if (in[1] == 0) goto l;     }     t = true;     for (int i = 2; i < n; i++)       if (in[i] * in[1] != in[2] * in[i - 1]) t = false;     if (t) {       printf( 1 n );       return 0;     }   l:;     cnt = 0;     for (int i = 1; i < n; i++) {       if (in[i] * in[0] != in[1] * in[i - 1]) {         cnt++;         if (i < n - 1 && in[i + 1] * in[0] != in[1] * in[i - 1]) cnt++;         i++;       }     }     check();     cnt = 0;     for (int i = 1; i < n; i++) {       if (in[i] * in[1] != in[2] * in[i - 1]) {         cnt++;         if (i < n - 1 && in[i + 1] * in[1] != in[2] * in[i - 1]) cnt++;         i++;       }     }     check();     cnt = 0;     for (int i = 1; i < n; i++) {       if (in[i] * in[0] != in[2] * in[i - 1]) {         cnt++;         if (i < n - 1 && in[i + 1] * in[0] != in[2] * in[i - 1]) cnt++;         i++;       }     }     check();     printf( 2 n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ma[(300 + 10)][(300 + 10)], dp[(300 + 10)][(300 + 10)][(300 + 10) << 1];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) cin >> ma[i][j];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         for (int k = 0; k <= n + n; k++) dp[i][j][k] = -11111111;     dp[1][1][0] = ma[1][1];     int num = 2 * n - 2;     for (int i = 0; i < num; i++) {       for (int j = 1; j <= min(n, i + 1); j++) {         for (int k = 1; k <= min(n, i + 1); k++) {           if ((j + 1 <= n) && (k + 1 <= n) && (i + 2 - k <= n) &&               (i + 2 - j <= n) && (i + 2 - k >= 1) && (i + 2 - j >= 1)) {             if (j >= n || k >= n) continue;             int add = ma[j + 1][i + 2 - j] + (j == k ? 0 : ma[k + 1][i + 2 - k]);             dp[j + 1][k + 1][i + 1] =                 max(dp[j + 1][k + 1][i + 1], dp[j][k][i] + add);           }           if ((j + 1 <= n) && (i + 3 - k <= n) && (i + 2 - j <= n) &&               (i + 3 - k >= 1) && (i + 2 - j >= 1)) {             int add =                 ma[j + 1][i + 2 - j] + (((j + 1 != k) || (i + 2 - j != i + 3 - k))                                             ? ma[k][i + 3 - k]                                             : 0);             dp[j + 1][k][i + 1] = max(dp[j + 1][k][i + 1], dp[j][k][i] + add);           }           if ((i + 3 - j <= n) && (k + 1 <= n) && (i + 3 - j >= 1) &&               (i + 2 - k >= 1) && (i + 2 - k <= n)) {             int add =                 ma[j][i + 3 - j] + (((j != k + 1) || (i + 3 - j != i + 2 - k))                                         ? ma[k + 1][i + 2 - k]                                         : 0);             dp[j][k + 1][i + 1] = max(dp[j][k + 1][i + 1], dp[j][k][i] + add);           }           if ((i + 3 - j <= n) && (i + 3 - k <= n) && (i + 3 - j >= 1) &&               (i + 3 - k >= 1)) {             int add = ma[j][i + 3 - j] + (j == k ? 0 : ma[k][i + 3 - k]);             dp[j][k][i + 1] = max(dp[j][k][i + 1], dp[j][k][i] + add);           }         }       }     }     cout << dp[n][n][num];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, x, y, c = 0, d = 0;     cin >> n;     long long m = n;     while (n--) {       scanf( %lld %lld , &x, &y);       if (x > 0) c++;       if (x < 0) d++;     }     if (c == m - 1 || d == m - 1 || c == m || d == m)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }