func_code_string: #include <bits/stdc++.h>   using namespace std;   char _buf[100000], *_op(_buf), *_ed(_buf);   inline int getint() {     int _s = 0, _f = 1;     char _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),                                _op == _ed)                     ? EOF                     : *_op++);     while (!( 0  <= _ch && _ch <=  9 ))       (_ch ==  - ) && (_f = -1),           _ch =               (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),                               _op == _ed)                    ? EOF                    : *_op++);     while (( 0  <= _ch && _ch <=  9 ))       _s = _s * 10 + _ch - 48,       _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),                             _op == _ed)                  ? EOF                  : *_op++);     return _s * _f;   }   const int N = 2e5 + 1, mod = 1e9 + 7;   inline void check(int& x) { x -= mod, x += x >> 31 & mod; }   inline void cmax(int& x, int y) {     if (x - y >> 31) x = y;   }   inline void cmin(int& x, int y) {     if (y - x >> 31) x = y;   }   int n, m, ans;   int Sx, Sy, Fx, Fy;   int X[N], Y[N], tag[N];   int idx[N], idy[N], posx[N], posy[N];   inline int dis(int x, int y, int p) {     return min(abs(X[p] - x), abs(Y[p] - y));   }   priority_queue<pair<int, int> > q;   inline void input() {     n = getint(), m = getint();     Sx = getint(), Sy = getint(), Fx = getint(), Fy = getint();     for (int i = 1; i <= m; i++) X[i] = getint(), Y[i] = getint();     ans = abs(Fx - Sx) + abs(Fy - Sy);     for (int i = 1; i <= m; i++) q.push(pair<int, int>(-dis(Sx, Sy, i), i));   }   inline int cmpx(int x, int y) { return X[x] < X[y]; }   inline int cmpy(int x, int y) { return Y[x] < Y[y]; }   inline void init() {     for (int i = 1; i <= m; i++) idx[i] = i;     sort(idx + 1, idx + 1 + m, cmpx);     for (int i = 1; i <= m; i++) posx[idx[i]] = i;     for (int i = 1; i <= m; i++) idy[i] = i;     sort(idy + 1, idy + 1 + m, cmpy);     for (int i = 1; i <= m; i++) posy[idy[i]] = i;   }   inline void work() {     for (int u, w, v; !q.empty();) {       w = -q.top().first, u = q.top().second, q.pop();       if (tag[u]) continue;       tag[u] = 1, ans = min(0ll + ans, 0ll + w + abs(X[u] - Fx) + abs(Y[u] - Fy));       if ((v = idx[posx[u] - 1]) && !tag[v])         q.push(pair<int, int>(-w - X[u] + X[v], v));       if ((v = idx[posx[u] + 1]) && !tag[v])         q.push(pair<int, int>(-w - X[v] + X[u], v));       if ((v = idy[posy[u] - 1]) && !tag[v])         q.push(pair<int, int>(-w - Y[u] + Y[v], v));       if ((v = idy[posy[u] + 1]) && !tag[v])         q.push(pair<int, int>(-w - Y[v] + Y[u], v));     }     cout << ans <<   n ;   }   int main() {     input();     init();     work();     return 0;   }   