Language: C++

    //For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    vector<pii> v,v2;

    bool comp(pii a,pii b)
    {
        if(a.s!=b.s)
            return a.s>b.s;
        return a.f<b.f;
    }

    bool comp2(pii a,pii b)
    {
        if(a.f!=b.f)
            return a.f<b.f;
        return a.s>b.s;
    }

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,i,j;
            cin>>n;
            string ar[n+1];
            int ar2[n+1],ct,ct2,mini;
            for(i=1;i<=n;++i)
            {
                cin>>ar[i];
                ct=0,ct2=0,mini=0;
                for(j=0;j<ar[i].size();++j)
                {
                    if(ar[i][j]=='(')
                        ++ct;
                    else
                        --ct;
                    mini=min(mini,ct);
                }
                mini=mini*-1;
                // cout<<mini<<" "<<ct<<endl;
                if(ct>=0)
                {
                    v.pb({mini,ct});
                }
                else
                {
                    v2.pb({mini,ct});
                }
            }
            sort(v.begin(),v.end());
            ct=0;
            for(auto it:v)
            {
                if(ct<it.f)
                {
                    cout<<"No"<<endl;
                    return 0;
                }
                ct=ct+it.s;
            }
            // cout<<ct<<endl;
            int flag=1;
            ll ct2=ct;
            sort(v2.begin(),v2.end(),comp);
            for(auto it:v2)
            {
                if(ct<it.f)
                {
                    flag=0;
                    break;
                }
                ct=ct+it.s;
            }
            if(ct!=0)
            {
                flag=0;
                break;
            }
            if(flag)
            {
            	cout<<"Yes"<<endl;
            	return 0;
            }
            ct=ct2;
            flag=1;
            sort(v2.begin(),v2.end(),comp2);
            for(auto it:v2)
            {
                if(ct<it.f)
                {
                    flag=0;
                    break;
                }
                ct=ct+it.s;
            }
            if(ct!=0)
            {
                flag=0;
                break;
            }
            if(flag)
            {
            	cout<<"Yes"<<endl;
            	return 0;
            }
            cout<<"No"<<endl;
        }
        return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:92:16: error: conflicting declaration 'long long int ct2'
   92 |             ll ct2=ct;
      |                ^~~
a.cc:55:29: note: previous declaration as 'int ct2'
   55 |             int ar2[n+1],ct,ct2,mini;
      |                             ^~~