func_code_string: #include <bits/stdc++.h>   using namespace std;   long long pw(long long b, long long p) {     if (!p) return 1;     long long sq = pw(b, p / 2);     sq *= sq;     if (p % 2) sq *= b;     return sq;   }   long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }   long long sd(long long x) { return x < 10 ? x : x % 10 + sd(x / 10); }   long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }   int n, xs, ys, xd, yd, dp[1010][1010];   int dx[] = {0, 0, 1, -1};   int dy[] = {1, -1, 0, 0};   bool isvalid(int x, int y) {     return (((y == 0 || y == n) && x <= n && x >= 0) ||             ((x == 0 || x == n) && y <= n && y >= 0));   }   int dfs(int x, int y) {     if (x == xd && y == yd) return 0;     if (!isvalid(x, y)) return 1 << 30;     int &ret = dp[x][y];     if (ret != -1) return ret;     ret = 1 << 30;     for (int i = 0; i < 4; ++i) ret = min(ret, dfs(x + dx[i], y + dy[i]) + 1);     return ret;   }   int main() {     cin >> n >> xs >> ys >> xd >> yd;     memset(dp, -1, sizeof dp);     cout << dfs(xs, ys);   }   