Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    int n;
    ll p,cnt,cntMin,total=0;
    string s;
    vector<pair<ll,ll>> V1,V2;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> s;
        cnt=0;
        cntMin=0;
        int m=s.size();
        for (int j=0;j<m;j++) {
            if (s[j]=='(') {
                    cnt++;
                }
            else {
                cnt--;
                cntMin=min(cntMin,cnt);
            }
        }
        if (cnt>=0) {
            V1.push_back({cntMin,cntn);
        }
        else {
            V2.push_back({cntMin,cntn);
            }

    }
    sort(V1.begin(),V1.end());
    reverse(V1.begin(),V1.end());
    sort(V2.begin(),V2.end());

    for (auto e : V1) {
        if (total+e.second.first<0) {
            cout << "No" << endl;
            return 0;
        }
        total+=e.second.second;
    }

    for (auto e : V2) {
        if (total+e.second.first<0) {
            cout << "No" << endl;
            return 0;
        }
        total+=e.second.second;
    }

    if (total==0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:34: error: 'cntn' was not declared in this scope; did you mean 'cnt'?
   26 |             V1.push_back({cntMin,cntn);
      |                                  ^~~~
      |                                  cnt
a.cc:26:38: error: expected '}' before ')' token
   26 |             V1.push_back({cntMin,cntn);
      |                          ~           ^
a.cc:26:25: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   26 |             V1.push_back({cntMin,cntn);
      |             ~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:29:34: error: 'cntn' was not declared in this scope; did you mean 'cnt'?
   29 |             V2.push_back({cntMin,cntn);
      |                                  ^~~~
      |                                  cnt
a.cc:29:38: error: expected '}' before ')' token
   29 |             V2.push_back({cntMin,cntn);
      |                          ~           ^
a.cc:29:25: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   29 |             V2.push_back({cntMin,cntn);
      |             ~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:38:28: error: request for member 'first' in 'e.std::pair<long long int, long long int>::second', which is of non-class type 'long long int'
   38 |         if (total+e.second.first<0) {
      |                            ^~~~~
a.cc:42:25: error: request for member 'second' in 'e.std::pair<long long int, long long int>::second', which is of non-class type 'long long int'
   42 |         total+=e.second.second;
      |                         ^~~~~~
a.cc:46:28: error: request for member 'first' in 'e.std::pair<long long int, long long int>::second', which is of non-class type 'long long int'
   46 |         if (total+e.second.first<0) {
      |                            ^~~~~
a.cc:50:25: error: request for member 'second' in 'e.std::pair<long long int, long long int>::second', which is of non-class type 'long long int'
   50 |         total+=e.second.second;
      |                         ^~~~~~