func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5001;   bool dp1[N][N], dp2[N][N];   int main() {     {       ios_base::sync_with_stdio(false);       cin.tie(NULL);     }     string s;     memset(dp1, false, sizeof dp1);     memset(dp2, false, sizeof dp2);     cin >> s;     long long n = s.length();     for (long long i = 0; i < n; i++) {       long long curr = 0;       for (long long j = i; j < n; j++) {         if (s[j] ==  ) )           curr--;         else           curr++;         if (curr >= 0)           dp1[i][j] = true;         else           break;       }     }     for (long long i = n - 1; i >= 0; i--) {       long long curr = 0;       for (long long j = i; j >= 0; j--) {         if (s[j] ==  ( )           curr--;         else           curr++;         if (curr >= 0)           dp2[j][i] = true;         else           break;       }     }     long long ans = 0;     for (long long i = 0; i < n; i++) {       for (long long j = i; j < n; j++) {         if (dp1[i][j] && dp2[i][j] && (j - i + 1) % 2 == 0) ans++;       }     }     cout << ans <<   n ;   }   