#ifndef INCLUDED_MAIN #define INCLUDED_MAIN #include __FILE__ int main(){ ll n,k; cin>>n>>k; string s; cin>>s; if(!taio(s)){ no(); return 0; } if(calc_min(s) match(n, 1); stack st; rep(i,n){ if(s[i]=='(') st.push(i); else { int j=st.top(); st.pop(); match[i]=j; match[j]=i; } } string ans=""; stack waiting; rep(i,n) { char cc=s[i]; if(cc=='(') { waiting.push(i); ans+=cc; } else { int left=waiting.top(); waiting.pop(); if(left==i-1) { ans+="1+1)"; } else ans+=')'; if(i using namespace std; #define rep(i,n) for(ll i=0;i #define vc vector ll calc_min(const string &s){ stack st; for(char c:s){ if(c=='('){ st.push(0); } else { ll cur=st.top(); st.pop(); ll sc=(cur==0 ? 2 : cur+1); if(st.empty()) st.push(sc); else{ ll t=st.top(); st.pop(); st.push(t+sc); } } } return st.empty()?0:st.top(); } bool taio(const string &s){ ll bal=0; for(char c:s){ if(c=='(') bal++; else{ if(bal==0) return false; bal--; } } return bal==0; } template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} void no() { cout<<"No"<& a) { ll ans=0; for(auto i:a) ans+=i; return ans; } #endif