For this Question: Given a string S consisting of opening and closing parenthesis '(' and ')'. Find length of the longest valid parenthesis substring.Each test case have one line string S of character '(' and ')' of length  N.

Constraints:
1 <= N <= 10^5Print the length of the longest valid parenthesis substring.Input
((()

Output
2

Input
)()())

Output
4, I have written this Solution Code: #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N];

signed main() {
	IOS;
	string s;
	cin >> s;
	int n = s.length();
	s = "#" + s;
	stack<int> st;
	st.push(0);
	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(s[i] == '(')
			st.push(i);
		else{
			if(s[st.top()] == '('){
				int x = st.top();
				a[i] = i-x+1 + a[x-1];
				ans = max(ans, a[i]);
				st.pop();
			}
			else
				st.push(i);
		}
	}
	cout << ans;
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?