malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   long n, k;   long ans[1000010];   int main() {     cin >> n >> k;     if ((k > n) || ((k <= n) && (k == 1) && (n != 1))) {       cout <<  -1  << endl;       return 0;     }     if ((n == 1) && (k == 1)) {       cout <<  a  << endl;       return 0;     }     if (!(n & 1)) {       ans[1] = 97;       ans[2] = 98;       long c(96 + k);       for (long i = n; i >= n - (k - 2) + 1; --i) ans[i] = c--;       cout <<  ab ;       for (long i = 1; i <= ((n - k) / 2); ++i) cout <<  ab ;       if (k & 1) cout <<  a ;       for (long i = (n - (k - 2) + 1); i <= n; ++i) cout << char(ans[i]);       cout << endl;     } else {       ans[1] = 97;       ans[2] = 98;       long c(96 + k);       for (long i = n; i >= n - (k - 2) + 1; --i) ans[i] = c--;       cout <<  ab ;       for (long i = 1; i <= ((n - k) / 2); ++i) cout <<  ab ;       if (!(k & 1)) cout <<  a ;       for (long i = (n - (k - 2) + 1); i <= n; ++i) cout << char(ans[i]);       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int x[110], y[110], n, epsilon, k;   double dist[110], p[110], mem[110][110];   double solve(int idx, int k) {     if (k == 0) return 1;     if (idx == n) return 0;     double& res = mem[idx][k];     if (res != -1) return res;     res = p[idx] * solve(idx + 1, k - 1);     res += (1 - p[idx]) * solve(idx + 1, k);     return res;   }   bool binary(double r) {     for (int i = 0; i < n; i++) {       if (dist[i] <= r)         p[i] = 1;       else         p[i] = exp(1 - dist[i] * dist[i] / (r * r));     }     for (int i = 0; i < n + 1; i++)       for (int j = 0; j < k + 1; j++) mem[i][j] = -1;     double res = solve(0, k);     return ((1 - res) * 1000 <= epsilon);   }   int main() {     ios::sync_with_stdio(false);     int x0, y0;     cin >> n >> k >> epsilon;     cin >> x0 >> y0;     for (int i = 0; i < n; i++) cin >> x[i] >> y[i];     for (int i = 0; i < n; i++) dist[i] = hypot(x[i] - x0, y[i] - y0);     double mid, low = 0, high = 1000000;     while (abs(low - high) > 1e-9) {       mid = (low + high) / 2;       if (binary(mid))         high = mid;       else         low = mid;     }     printf( %.15lf n , (low + high) / 2);     return 0;   }
#include <bits/stdc++.h>   const long long int MAX = 1e12;   using namespace std;   const int alpha = 26;   void solve() {     int n;     cin >> n;     vector<int> arr(n);     for (auto &it : arr) cin >> it;     for (int i = 0; i < n; i++) {       while (arr[i] % 2 == 0) arr[i] /= 2;       while (arr[i] % 3 == 0) arr[i] /= 3;     }     if (count(arr.begin(), arr.end(), arr[0]) == n)       cout <<  YES ;     else       cout <<  NO ;   }   int main() {     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<string> ans;   string f =  1 ;   bool sort2(string &a, string &b) {     if (a.size() == b.size()) {       return a < b;     }     return a.size() < b.size();   }   void calc(string s) {     if (s.size() >= 11) {       return;     }     ans.push_back(s);     s +=  1 ;     calc(s);     s.pop_back();     s +=  0 ;     calc(s);     s.pop_back();   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     string l = to_string(n);     calc(f);     int ans2 = 0;     sort(ans.begin(), ans.end(), sort2);     for (int i = 0; i < ans.size(); i++) {       if (ans[i].size() > l.size()) {         break;       } else if (ans[i].size() == l.size()) {         if (l >= ans[i]) {           ans2++;         } else {           break;         }       } else {         ans2++;       }     }     cout << ans2 <<   n ;   }
#include <bits/stdc++.h>   int n, cnt;   char ch[100005], tmp;   int main() {     scanf( %d , &n);     scanf( %s , ch + 1);     for (int i = 1; i <= n; i++)       if (ch[i] != tmp) {         if (tmp != 0) {           if ((tmp ==  o  || tmp ==  e ) && cnt == 2)             printf( %c%c , tmp, tmp);           else {             if (tmp ==  a  || tmp ==  e  || tmp ==  i  || tmp ==  o  ||                 tmp ==  u  || tmp ==  y )               printf( %c , tmp);             else               for (int j = 1; j <= cnt; j++) putchar(tmp);           }         }         tmp = ch[i];         cnt = 1;       } else         cnt++;     if ((tmp ==  o  || tmp ==  e ) && cnt == 2)       printf( %c%c , tmp, tmp);     else {       if (tmp ==  a  || tmp ==  e  || tmp ==  i  || tmp ==  o  || tmp ==  u  ||           tmp ==  y )         printf( %c , tmp);       else         for (int j = 1; j <= cnt; j++) putchar(tmp);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a[100005], i, j, m, n, ans = 0, pos = 1;     cin >> n;     for (i = 1; i <= n; i++) cin >> a[i];     for (i = 3; i <= n;) {       if (a[i] == a[i - 1] + a[i - 2]) {         while (a[i] == a[i - 1] + a[i - 2] && i <= n) {           i++;         }         ans = max(i - pos, ans);         pos = i - 2;       } else         i++, pos = i - 2;     }     cout << max(ans, min(n, 2));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int ms = 2005, me = 4005;   int adj[ms], to[me], ant[me], z = 0, idx[ms], path[ms], bridge[me], ind,                                 vis[ms];   int s[ms], l[ms], ans;   bool dfs(int v, int end) {     if (vis[v])       return false;     else if (v == end)       return path[v] = true;     vis[v] = 1;     for (int e = adj[v]; e > -1; e = ant[e]) {       path[v] = path[v] || dfs(to[e], end);     }     return path[v];   }   int dfs2(int v, int par = -1) {     int low = idx[v] = ind++;     for (int i = adj[v]; i > -1; i = ant[i]) {       if (idx[to[i]] == -1) {         int temp = dfs2(to[i], v);         if (temp > idx[v] && path[to[i]] && path[v]) ans++;         low = min(low, temp);       } else if (to[i] != par)         low = min(low, idx[to[i]]);     }     return low;   }   void add(int a, int b) {     to[z] = b;     ant[z] = adj[a];     adj[a] = z++;     swap(a, b);     to[z] = b;     ant[z] = adj[a];     adj[a] = z++;   }   int main() {     cin.tie(0);     cin.sync_with_stdio(false);     int n, m;     cin >> n >> m;     z = 0;     memset(adj, -1, sizeof adj);     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       add(a, b);     }     int k;     cin >> k;     for (int i = 0; i < k; i++) {       cin >> s[i] >> l[i];     }     for (int i = 0; i < k; i++) {       ans = 0;       memset(idx, -1, sizeof idx);       ind = 0;       memset(bridge, 0, sizeof bridge);       memset(vis, 0, sizeof vis);       memset(path, 0, sizeof path);       dfs(s[i], l[i]);       dfs2(s[i]);       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int l, r, mx, pre, suf;   };   vector<node> T;   vector<pair<int, int> > ht;   int n, m, a[100055], root[100055], first, second, z;   int init(int l, int r) {     int ind = T.size();     if (l == r) {       T.push_back({-1, -1, 1, 1, 1});       return ind;     }     int mid = (l + r) >> 1;     T.push_back({-1, -1, r - l + 1, r - l + 1, r - l + 1});     T[ind].l = init(l, mid);     T[ind].r = init(mid + 1, r);     return ind;   }   int update(int k, int l, int r, int tar) {     int ind = T.size();     if (l == r) {       T.push_back({-1, -1, 0, 0, 0});       return ind;     }     int mid = (l + r) >> 1, left, right;     T.push_back({-1, -1, 0, 0, 0});     if (tar <= mid) {       left = update(T[k].l, l, mid, tar);       right = T[k].r;     } else if (tar > mid) {       left = T[k].l;       right = update(T[k].r, mid + 1, r, tar);     }     T[ind] = {left, right,               max(max(T[left].mx, T[right].mx), T[left].suf + T[right].pre),               T[left].pre, T[right].suf};     if (T[left].pre == mid - l + 1) T[ind].pre = T[left].pre + T[right].pre;     if (T[right].suf == r - mid) T[ind].suf = T[right].suf + T[left].suf;     return ind;   }   node longest(int k, int l, int r, int tl, int tr) {     if (tl <= l && r <= tr) {       return T[k];     }     int mid = (l + r) >> 1;     if (mid < tl) return longest(T[k].r, mid + 1, r, tl, tr);     if (tr <= mid) return longest(T[k].l, l, mid, tl, tr);     node rans = longest(T[k].r, mid + 1, r, mid + 1, tr);     node lans = longest(T[k].l, l, mid, tl, mid);     node ret = (node){0, 0, 0, 0, 0};     ret.mx = max(max(rans.mx, lans.mx), lans.suf + rans.pre);     ret.pre = lans.pre;     if (lans.pre == mid - tl + 1) ret.pre = lans.pre + rans.pre;     ret.suf = rans.suf;     if (rans.suf == tr - mid) ret.suf = rans.suf + lans.suf;     return ret;   }   void DEBUG(int k, int l, int r) {     if (l == r) return;     int mid = (l + r) >> 1;     DEBUG(T[k].l, l, mid);     DEBUG(T[k].r, mid + 1, r);   }   int main() {     T.reserve(1000000);     scanf( %d , &n);     ht.push_back({0, 0});     for (int i = 1; i <= n; i++) {       scanf( %d , a + i);       ht.push_back({a[i], i});     }     sort(ht.begin(), ht.end());     root[1] = init(1, n);     for (int i = 2; i <= n; i++)       root[i] = update(root[i - 1], 1, n, ht[i - 1].second);     for (int i = 1; i <= n; i++) {     }     scanf( %d , &m);     while (m--) {       scanf( %d%d%d , &first, &second, &z);       int l = 1, r = n + 1;       while (l < r - 1) {         int mid = (l + r) >> 1;         node res = longest(root[mid], 1, n, first, second);         if (res.mx >= z)           l = mid;         else           r = mid;       }       printf( %d n , ht[l]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, q, x, y, xx, yy;   long long read() {     long long x = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) ch = getchar();     while (ch >=  0  && ch <=  9 ) {       x = (x << 3) + (x << 1) + ch -  0 ;       ch = getchar();     }     return x;   }   struct BIT {     long long c[1005][1005];     long long ask(int x, int y) {       long long ans = 0;       for (; x; x -= x & -x)         for (int i = y; i; i -= i & -i) ans ^= c[x][i];       return ans;     }     void modify(int x, int y, long long v) {       for (; x <= (n + 1); x += x & -x)         for (int i = y; i <= (n + 1); i += i & -i) c[x][i] ^= v;     }   } t[2][2];   long long v;   int main() {     n = read();     q = read();     while (q--) {       int op = read();       x = read();       y = read();       xx = read();       yy = read();       if (op == 2) {         v = read();         t[x & 1][y & 1].modify((x + 1) >> 1, (y + 1) >> 1, v);         t[x & 1][(yy + 1) & 1].modify((x + 1) >> 1, (yy + 2) >> 1, v);         t[(xx + 1) & 1][y & 1].modify((xx + 2) >> 1, (y + 1) >> 1, v);         t[(xx + 1) & 1][(yy + 1) & 1].modify((xx + 2) >> 1, (yy + 2) >> 1, v);       } else {         long long v1 = t[(x - 1) & 1][(y - 1) & 1].ask(x >> 1, y >> 1);         long long v2 = t[(x - 1) & 1][yy & 1].ask(x >> 1, (yy + 1) >> 1);         long long v3 = t[xx & 1][(y - 1) & 1].ask((xx + 1) >> 1, y >> 1);         long long v4 = t[xx & 1][yy & 1].ask((xx + 1) >> 1, (yy + 1) >> 1);         printf( %lld n , v1 ^ v2 ^ v3 ^ v4);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     int t;     cin >> t;     for (int i = 0; i < t; i++) {       long long a, b;       long long uns = 0;       cin >> a >> b;       uns = abs(a - b) / 5;       if (abs(a - b) % 5 == 1) uns++;       if (abs(a - b) % 5 == 2) uns += 1;       if (abs(a - b) % 5 == 3) uns += 2;       if (abs(a - b) % 5 == 4) uns += 2;       cout << uns << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int v[1000005];   long long int l[1000005];   long long int r[1000005];   int main(void) {     int n, m;     int sum;     scanf(  %d %d , &n, &m);     for (int i = 0; i < n; i++) {       scanf(  %d , &v[i]);     }     l[0] = 0;     sum = 0;     for (int i = 1; i < n; i++) {       sum++;       int trip = (sum + m - 1) / m;       l[i] = l[i - 1] + 1LL * trip * (v[i] - v[i - 1]);     }     r[n - 1] = 0;     sum = 0;     for (int i = n - 2; i >= 0; i--) {       sum++;       int trip = (sum + m - 1) / m;       r[i] = r[i + 1] + 1LL * trip * (v[i + 1] - v[i]);     }     long long int res = l[0] + r[0];     for (int i = 0; i < n; i++) {       res = min(res, l[i] + r[i]);     }     printf( %lld n , 2 * res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long g[222222][2];   int f[222222], p[222222][2], n, i;   long long dfs(int x, int k, int z) {     if (x < 1 || x > n) return 0;     if (g[x][z] == -1 || p[x][z] == k) return -1;     if (p[x][z]) return g[x][z];     long long ans = 0;     p[x][z] = k;     if (z)       ans = dfs(x + f[x], k, z ^ 1);     else       ans = dfs(x - f[x], k, z ^ 1);     if (ans == -1)       return g[x][z] = -1;     else       return g[x][z] = ans + f[x];   }   int main() {     scanf( %d , &n);     for (i = 2; i <= n; i++) scanf( %d , f + i);     for (i = 1; i < n; i++) {       f[1] = i;       p[1][1] = 0;       g[1][1] = 0;       printf( %I64d n , dfs(1, i, 1));     }     return 0;   }
#include <bits/stdc++.h>   int a[100001], p[100001], N, Q;   int T[2100001], ls[2100001], rs[2100001], n, root[100001];   int end[100001], steps[100001];   int build(int l, int r) {     int p = ++n;     T[p] = r - l + 1;     if (l < r) {       int m = l + r >> 1;       ls[p] = build(l, m);       rs[p] = build(m + 1, r);     }     return p;   }   int get_kth(int p, int x) {     int l = 1, r = N;     while (l < r) {       int m = l + r >> 1;       if (x <= T[ls[p]])         p = ls[p], r = m;       else         x -= T[ls[p]], p = rs[p], l = m + 1;     }     return l;   }   int P(int p, int x, int w) {     int l = 1, r = N, root;     T[root = ++n] = T[p] + w;     while (l < r) {       int m = l + r >> 1;       if (x <= m)         ls[n] = n + 1, rs[n] = rs[p], p = ls[p], r = m;       else         rs[n] = n + 1, ls[n] = ls[p], p = rs[p], l = m + 1;       T[++n] = T[p] + w;     }     return root;   }   int G(int p, int x) {     int l = 1, r = N, ans = 0;     while (l < r) {       int m = l + r >> 1;       if (x <= m)         p = ls[p], r = m;       else         ans += T[ls[p]], p = rs[p], l = m + 1;     }     return ans + T[p];   }   int main() {     scanf( %d%d , &N, &Q);     for (int i = 1; i <= N; i++) scanf( %d , a + i);     end[0] = a[1] - 1;     steps[0] = 0;     for (int i = 1; i < N; i++) {       int add = (a[i + 1] - end[i - 1] - 1) / i;       end[i] = end[i - 1] + i * add;       steps[i] = steps[i - 1] + add;     }     for (int i = 2; i <= N; i++) p[i] = (p[i - 1] + a[i] - a[i - 1]) % (i - 1);     root[N] = build(1, N);     for (int i = N; i; i--) {       p[i] = get_kth(root[i], p[i] + 1);       root[i - 1] = P(root[i], p[i], -1);     }     while (Q--) {       int x, k;       scanf( %d%d , &x, &k);       if (x < a[1]) {         printf( %d n , x);         continue;       }       int belong = std::lower_bound(end + 1, end + N, x) - end;       k += steps[belong - 1] + (x - end[belong - 1] - 1) / belong + 1;       int ord = (x - end[belong - 1] - 1) % belong + 1;       ord = get_kth(root[belong], ord);       belong = std::lower_bound(steps + 1, steps + N, k) - steps;       printf( %lld n , end[belong - 1] +                            (long long)(k - steps[belong - 1] - 1) * belong +                            G(root[belong], ord));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c, d, x, y, x1, y1;     cin >> a >> b >> c >> d;     x = (3 * a) / 10;     x1 = (a - (a / 250) * c);     int m = max(x, x1);     y = (3 * b) / 10;     y1 = (b - (b / 250) * d);     int m1 = max(y, y1);     if (m < m1)       cout <<  Vasya  << endl;     else if (m1 < m)       cout <<  Misha  << endl;     else       cout <<  Tie  << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 50;   const int MOD = 1e9 + 9;   int n, k, a, b, c, d, m, L, R, tot = 1;   pair<int, int> cities[MAXN];   struct TreeNode {     int x, l, r, lson, rson;     pair<int, int> v;   } tree[MAXN];   int newNode(int &x) { return x = ++tot; }   pair<int, int> calc(pair<int, int> l, pair<int, int> r) {     return {l.second + r.second, max(l.first + r.second, l.second + r.first) + 1};   }   void build(int o, int l, int r) {     int max_y = -1, max_id = l;     for (int i = l; i <= r; i++) {       if (cities[i].second > max_y) {         max_y = cities[i].second;         max_id = i;       }     }     tree[o].l = cities[l].first;     tree[o].r = cities[r].first;     tree[o].x = cities[max_id].first;     if (l < max_id) build(newNode(tree[o].lson), l, max_id - 1);     if (max_id < r) build(newNode(tree[o].rson), max_id + 1, r);     tree[o].v = calc(tree[tree[o].lson].v, tree[tree[o].rson].v);   }   pair<int, int> query(int o, int l, int r) {     if (o == 0 || l > tree[o].r || r < tree[o].l) return {-1, 0};     if (l <= tree[o].l && tree[o].r <= r) return tree[o].v;     if (r < tree[o].x) return query(tree[o].lson, l, r);     if (l > tree[o].x) return query(tree[o].rson, l, r);     return calc(query(tree[o].lson, l, r), query(tree[o].rson, l, r));   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 0; i < k; i++) {       scanf( %d%d , &cities[i].first, &cities[i].second);     }     scanf( %d%d%d%d , &a, &b, &c, &d);     for (int i = k; i < n; i++) {       cities[i].first = (1LL * a * cities[i - 1].first + b) % MOD;       cities[i].second = (1LL * c * cities[i - 1].second + d) % MOD;     }     sort(cities, cities + n);     tree[0].v = {-1, 0};     build(1, 0, n - 1);     scanf( %d , &m);     while (m--) {       scanf( %d%d , &L, &R);       printf( %d n , query(1, L, R).second);     }   }
#include <bits/stdc++.h>   int main() {     int i, n;     scanf( %d , &n);     for (i = 0; i < n; i++) {       long long int x;       long long int k, y;       scanf( %I64d %I64d , &k, &x);       y = x + 9 * (k - 1);       printf( %I64d , y);       printf(  n );     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int q;     cin >> q;     for (int i = 0; i < q; ++i) {       int n;       cin >> n;       set<int> st;       for (int j = 0; j < n; ++j) {         int x;         cin >> x;         st.insert(x);       }       int ans = 0;       int mx = *st.rbegin();       if (mx % 2 == 0 && mx % 3 == 0 && mx % 5 == 0) {         if (st.count(mx / 2) && st.count(mx / 3) && st.count(mx / 5)) {           ans = max(ans, mx / 2 + mx / 3 + mx / 5);         }       }       vector<int> res;       while (!st.empty() && int(res.size()) < 3) {         int x = *st.rbegin();         st.erase(prev(st.end()));         bool ok = true;         for (auto it : res) ok &= (it % x != 0);         if (ok) res.push_back(x);       }       ans = max(ans, accumulate(res.begin(), res.end(), 0));       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a, b, w, start = 0, k;   long long int MAX = 1e18;   vector<vector<int> > wait(100005);   vector<vector<pair<int, int> > > adj(100005);   void binarySearch(int v, long long int& d) {     if (v == n - 1 or wait[v].size() == 0) {       return;     }     int low = 0, high = wait[v].size() - 1, mid;     while (low <= high) {       mid = (low + high) >> 1;       if (wait[v][mid] == d) {         ++d;         ++mid;         while (mid <= wait[v].size() - 1 and                wait[v][mid] == wait[v][mid - 1] + 1) {           ++d;           ++mid;         }         return;       } else if (wait[v][mid] > d) {         high = mid - 1;       } else {         low = mid + 1;       }     }     return;   }   int main(void) {     ios ::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int i = 0; i <= m - 1; ++i) {       cin >> a >> b >> w;       --a;       --b;       adj[a].push_back({b, w});       adj[b].push_back({a, w});     }     for (int i = 0; i <= n - 1; ++i) {       cin >> k;       for (int j = 1; j <= k; ++j) {         cin >> w;         wait[i].emplace_back(w);       }     }     set<pair<long long int, int> > s;     vector<long long int> dist(n, MAX);     vector<int> present(n, 1);     dist[start] = 0;     s.insert({dist[start], start});     while (!s.empty()) {       auto c = *(s.begin());       s.erase(c);       int v = c.second;       present[v] = 0;       binarySearch(v, dist[v]);       for (auto e : adj[v]) {         int u = e.first;         w = e.second;         if (present[u] and dist[u] > dist[v] + 1LL * w) {           s.erase({dist[u], u});           dist[u] = dist[v] + 1LL * w;           s.insert({dist[u], u});         }       }     }     if (dist[n - 1] == MAX) {       cout << -1 << endl;     } else {       cout << dist[n - 1] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool *Seive(long long n, bool *p) {     memset(p, 1, sizeof(p));     long long i, j;     for (i = 2; i <= n; i++) {       if (p[i] == 1)         for (j = i * i; j <= n; j += i) {           p[j] = 0;         }     }     p[1] = 0;     return p;   }   long long gcd(long long a, long long b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   long long modexp(long long x, long long y) {     if (y == 0)       return 1;     else if (y % 2 == 0) {       return modexp((x * x) % (long long)(1e9 + 7), y / 2);     } else {       return (x * modexp((x * x) % (long long)(1e9 + 7), (y - 1) / 2)) %              (long long)(1e9 + 7);     }   }   long long fact(long long n) {     long long f = 1;     for (long long i = 2; i <= n; i++) {       f = (i % (long long)(1e9 + 7) * f % (long long)(1e9 + 7)) %           (long long)(1e9 + 7);     }     return f;   }   long long nCr(long long n, long long r) {     return (fact(n) * modexp((fact(n - r) * fact(r)) % (long long)(1e9 + 7),                              (long long)(1e9 + 7) - 2)) %            (long long)(1e9 + 7);   }   void showlist(list<int> g) {     list<int>::iterator it;     for (it = g.begin(); it != g.end(); ++it) cout << *it <<    ;     cout <<   n ;   }   bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {     return (a.first > b.first);   }   struct Point {     int x, y;   };   long long overlappingArea(long long x3, long long x4, long long x5,                             long long x6, long long y3, long long y4,                             long long y5, long long y6) {     long long area1 = abs(x3 - x4) * abs(y3 - y4);     long long area2 = abs(x5 - x6) * abs(y5 - y6);     long long areaI = (min(x4, x6) - max(x3, x5)) * (min(y4, y6) - max(y3, y5));     if (areaI <= 0) areaI = 0;     return (area1 + area2 - areaI);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long a, x1, x2, y1, y2, x3, x4, x5, x6, y3, y4, y5, y6;     cin >> x1 >> y1 >> x2 >> y2;     cin >> x3 >> y3 >> x4 >> y4;     if (x4 > x2) {       x4 = x2;     }     if (x3 < x1) {       x3 = x1;     }     if (y4 > y2) {       y4 = y2;     }     if (y3 < y1) {       y3 = y1;     }     cin >> x5 >> y5 >> x6 >> y6;     if (x6 > x2) {       x6 = x2;     }     if (x5 < x1) {       x5 = x1;     }     if (y6 > y2) {       y6 = y2;     }     if (y5 < y1) {       y5 = y1;     }     a = 0;     if ((x4 - x3 <= 0 || y4 - y3 <= 0) && (x6 - x5 <= 0 || y6 - y5 <= 0))       ;     else if (x4 - x3 <= 0 || y4 - y3 <= 0) {       a = (x6 - x5) * (y6 - y5);     } else if (x6 - x5 <= 0 || y6 - y5 <= 0) {       a = (x4 - x3) * (y4 - y3);     } else {       a = overlappingArea(x3, x4, x5, x6, y3, y4, y5, y6);     }     if (a == (x2 - x1) * (y2 - y1)) {       cout <<  NO  << endl;     } else {       cout <<  YES  << endl;     }     return 0;   }