func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = INT_MAX / 2, NINF = INT_MIN / 2;   const long double PI = acos(-1.0);   void prepareIO() {     if (strlen(  ) != 0) {       freopen(                         .in ,            r , stdin);       freopen(                         .out ,            w , stdout);     }   }   void debout() {}   template <typename Head, typename... Tail>   void debout(Head H, Tail... T) {}   void stressout() {}   template <typename Head, typename... Tail>   void stressout(Head H, Tail... T) {}   void solve1();   int main() {     prepareIO();     solve1();     fprintf(stderr,  %.6lf n , (double)clock() / CLOCKS_PER_SEC);     return 0;   }   struct T {     int to, cnt, pos;   };   const int N = 1010;   int a[N], mark[N];   void solve1() {     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     int ans = 0, cnt = 0;     int to = 1;     int pos = 0;     while (cnt < n) {       if (a[pos] <= cnt && mark[pos] == false) {         mark[pos] = 1;         cnt++;         continue;       }       if (to == 1) {         if (pos == n - 1) {           ans++;           to ^= 1;           continue;         }         pos++;       } else {         if (pos == 0) {           ans++;           to ^= 1;           continue;         }         pos--;       }     }     printf( %d n , ans);   }   