func_code_string: #include <bits/stdc++.h>   using namespace std;   string S;   const int MAX_N = 5000;   bool wyn[MAX_N + 3][MAX_N + 3];   int main() {     ios::sync_with_stdio(0);     cin >> S;     int wynik = 0;     int val = 0;     int zap = 0;     for (int l = 0; l < S.size(); l++) {       val = 0;       zap = 0;       for (int r = l; r < S.size(); r++) {         if (S[r] ==  ( )           val++;         else if (S[r] ==  ) )           val--;         else if (S[r] ==  ? )           zap++;         if (val + zap >= 0)           wyn[l][r] = true;         else           break;       }     }     for (int r = 0; r < S.size(); r++) {       val = 0;       zap = 0;       for (int l = r; l >= 0; l--) {         if (S[l] ==  ( )           val--;         else if (S[l] ==  ) )           val++;         else if (S[l] ==  ? )           zap++;         int len = r - l + 1;         if (val + zap >= 0) {           if (wyn[l][r] && len % 2 == 0) wynik++;         } else           break;       }     }     cout << wynik;   }   