func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 300005;   using ll = long long;   map<ll, int> dd;   map<pair<int, int>, int> f;   int n, pre[3][N];   ll a[3][N];   int dfs(int n, int m) {     if (pre[1][n] == -1 && pre[2][m] == -1 && pre[0][min(n, m)] == -1) return 0;     pair<int, int> p{n, m};     if (f.count(p)) return f[p];     int ans = 0;     if (pre[1][n] > pre[2][m])       ans = max(ans, dfs(pre[1][n], m) + 1);     else if (pre[2][m] != -1)       ans = max(ans, dfs(n, pre[2][m]) + 1);     if (pre[0][min(n, m)] != -1)       ans = max(ans, dfs(pre[0][min(n, m)], pre[0][min(n, m)]) + 1);     return f[p] = ans;   }   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int j = 1; j <= 2; j++)       for (int i = 1; i <= n; i++) cin >> a[j][i], a[0][i] += a[j][i];     for (int i = 0; i <= 2; i++)       for (int j = 1; j <= n; j++) a[i][j] += a[i][j - 1];     for (int i = 0; i <= 2; i++) {       dd.clear();       dd[0] = 0;       pre[i][0] = -1;       for (int j = 1; j <= n; j++) {         pre[i][j] = max(pre[i][j - 1], dd.count(a[i][j]) ? dd[a[i][j]] : -1);         dd[a[i][j]] = j;       }     }     cout << dfs(n, n) << endl;     return 0;   }   