func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   int a[maxn], b[maxn], ww[maxn], www[maxn];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       ww[a[i]] = 1;     }     for (int i = 1; i <= n; i++) {       scanf( %d , &b[i]);       www[b[i]] = i;     }     int t1 = 1;     while (t1 <= n && b[t1] == 0) t1++;     if (t1 == n + 1) {       printf( %d n , n);     } else {       int f = 1;       for (int i = t1; i <= n; i++) {         if (b[i] != i - t1 + 1) {           f = 0;           break;         }       }       if (f) {         printf( %d n , t1 - 1);       } else {         int x = b[n];         int fx = 0;         for (int i = n - 1; i >= 1; i--) {           if (b[i + 1] == 1) {             fx = 1;             break;           }           if (b[i] != b[i + 1] - 1) {             break;           }         }         int ans = 0;         int fx2 = 0;         if (fx) {           ans = n - b[n];           if (!ww[b[n] + 1]) {             fx2 = 1;           }           for (int i = b[n] + 2; i <= n; i++) {             if (www[i] > i - b[n] - 1) {               fx2 = 1;               break;             }           }         }         if (fx2 || fx == 0) {           for (int i = 1; i <= n; i++) {             if (ww[i]) continue;             ans = max(ans, max(0, www[i] + 1 - i) + n);           }         }         printf( %d n , ans);       }     }     return 0;   }   