func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int a[200009], b[200009];   bool k[200009];   int mx;   int main() {     scanf( %d , &n);     for (int j = 1; j <= n; j++) scanf( %d , &a[j]);     for (int j = 1; j <= n; j++) scanf( %d , &b[j]);     for (int j = 1; j <= n; j++) k[a[j]] = 1;     if (!k[1]) {       int o = 1;       bool kk = 0;       while (b[o] != 1) o++;       for (int j = o; j <= n; j++)         if (b[j] != j - o + 1) {           kk = 1;           break;         }       if (kk == 0) {         if (o == 1) {           printf( 0 );           return 0;         }         if (k[n - o + 2] == 1) {           for (int j = 1; j < o; j++)             if (b[j] != 0 && j - b[j] + n - o + 2 > 0) {               kk = 1;               break;             }           if (kk == 0) {             printf( %d , o - 1);             return 0;           }         }       }     }     for (int j = 1; j <= n; j++)       if (b[j] != 0 && j - b[j] + 1 > mx) mx = j - b[j] + 1;     printf( %d , mx + n);     return 0;   }   