[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
create integer adj of size 1000 with array of size 1000
declare swap taking in floats &a and &b
    if b is less than a
        create float temp = b
        set b to a
        set a to temp
    end of the block
    return
end of the block
declare inside taking in float arrays p of size 2 and s of size 4 with array of size 2 and returning bool
    if s[0][0] is equal to s[1][0]
        create float l = s[0][0] and u = s[2][0]
        swap values of l and u
        if p[0] is less than or equal to u and p[0] is greater than or equal to 1
            set l to s[0][1]
            set u to s[1][1]
            swap values of l and u
            if p[1] is greater than or equal to 1 and p[1] is less than or equal to u
                return true
            otherwise do
                return false
        else do
            return false
        end of the block
    else
        make floats l = s[0][1] and u = s[2][1]
        swap values of l and u
        if p[1] is less than or equal to u and p[1] is greater than or equal to 1
            set l to s[0][0]
            set u to s[1][0]
            swap values of l and u
            if p[0] is greater than or equal to 1 and p[0] is less than or equal to u
                return true
            else
                return false
        otherwise
            return false
        end of the block
    end of the block
end of the block
define the main function
    make float arrays p1 of size 4 with array of size 2 and p2 of size 4 with array of size 2
    for i = 0 to (4) exclusive
        for j = 0 to (2) exclusive, read p1[i][j]
    end of the block
    for i = 0 to (4) exclusive
        for j = 0 to (2) exclusive, read p2[i][j]
    end of the block
    create bool ans = false
    for i = 0 to (4) exclusive
        if inside(p2[i], p1) is truthy, set ans to true
    end of the block
    make float array p of size 2 containing {0, 0}
    for i = 0 to (4) exclusive
        set p[0] to p[0] + p2[i][0]
        set p[1] to p[1] + p2[i][1]
    end of the block
    set p[0] to p[0] * 1.0 / 4
    set p[1] to p[1] * 1.0 / 4
    if inside(p, p1) is truthy, set ans to true
    for i = 0 to (4) exclusive
        make floats x = p1[i][0] - p1[i][1] and y = p1[i][0] + p1[i][1]
        set p1[i][0] to x
        set p1[i][1] to y
    end of the block
    for i = 0 to (4) exclusive
        make floats x = p2[i][0] - p2[i][1] and y = p2[i][0] + p2[i][1]
        set p2[i][0] to x
        set p2[i][1] to y
    end of the block
    for i = 0 to (4) exclusive
        if inside(p1[i], p2) is truthy, set ans to true
    end of the block
    if ans is truthy
        print "YES\n"
    else do
        show "NO\n"
    end of the block
end of the block

[CODE]:

int adj[1000][1000];
void swap(float &a, float &b) {
    if (b < a) {
        float temp = b;
        b = a;
        a = temp;
    }
    return;
}
bool inside(float p[2], float s[4][2]) {
    if (s[0][0] == s[1][0]) {
        float l = s[0][0], u = s[2][0];
        swap(l, u);
        if (p[0] <= u && p[0] >= l) {
            l = s[0][1];
            u = s[1][1];
            swap(l, u);
            if (p[1] >= l && p[1] <= u) {
                return true;
            } else
                return false;
        } else {
            return false;
        }
    } else {
        float l = s[0][1], u = s[2][1];
        swap(l, u);
        if (p[1] <= u && p[1] >= l) {
            l = s[0][0];
            u = s[1][0];
            swap(l, u);
            if (p[0] >= l && p[0] <= u) {
                return true;
            } else
                return false;
        } else {
            return false;
        }
    }
}
int main() {
    float p1[4][2], p2[4][2];
    for (int i = 0; i < (4); i++) {
        for (int j = 0; j < (2); j++) cin >> p1[i][j];
    }
    for (int i = 0; i < (4); i++) {
        for (int j = 0; j < (2); j++) cin >> p2[i][j];
    }
    bool ans = false;
    for (int i = 0; i < (4); i++) {
        if (inside(p2[i], p1)) ans = true;
    }
    float p[2] = {0, 0};
    for (int i = 0; i < (4); i++) {
        p[0] += p2[i][0];
        p[1] += p2[i][1];
    }
    p[0] = p[0] * 1.0 / 4;
    p[1] = p[1] * 1.0 / 4;
    if (inside(p, p1)) ans = true;
    for (int i = 0; i < (4); i++) {
        float x = p1[i][0] - p1[i][1], y = p1[i][0] + p1[i][1];
        p1[i][0] = x;
        p1[i][1] = y;
    }
    for (int i = 0; i < (4); i++) {
        float x = p2[i][0] - p2[i][1], y = p2[i][0] + p2[i][1];
        p2[i][0] = x;
        p2[i][1] = y;
    }
    for (int i = 0; i < (4); i++) {
        if (inside(p1[i], p2)) ans = true;
    }
    if (ans) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}