Language: C++

#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct data
{
    string s;
    ll x;
};
bool fun(data a,data b)
{
    return a.x>b.x;
}
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n;
    cin>>n;
    ve <data> arr(n);
    rep (i,0,n)
    {
        cin>>arr[i].s;
        ll val=0;
        for (auto x: arr[i].s)
        {
            if (x=='(')
            {
                val++;
            }
            else
            {
                val--;
            }
        }
        arr[i].x=val;
    }
    sort(all(arr),fun);
    string ans;
    rep (i,0,n)
    {
        for (auto x: arr[i].s)
        {
            ans.pb(x);
        }
    }
    stack <ll> s1;
    for (auto y: ans)
    {
        if (y=='(')
        {
            s1.push(1);
        }
        else
        {
            if (s1.size()>0)
            {
                s1.pop();
            }
            else
            {
                cout<<"No\n";
                return 0;
            }
        }
    }
    if (s1.size()==0)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    
}


Compiler output:
a.cc:46:10: error: reference to 'data' is ambiguous
   46 | bool fun(data a,data b)
      |          ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:41:8: note:                 'struct data'
   41 | struct data
      |        ^~~~
a.cc:46:17: error: reference to 'data' is ambiguous
   46 | bool fun(data a,data b)
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:41:8: note:                 'struct data'
   41 | struct data
      |        ^~~~
a.cc:46:23: error: expression list treated as compound expression in initializer [-fpermissive]
   46 | bool fun(data a,data b)
      |                       ^
a.cc: In function 'int main()':
a.cc:61:13: error: template argument 1 is invalid
   61 |     ve <data> arr(n);
      |             ^
a.cc:61:13: error: template argument 2 is invalid
a.cc:64:17: error: invalid types 'int[ll {aka long long int}]' for array subscript
   64 |         cin>>arr[i].s;
      |                 ^
a.cc:66:25: error: invalid types 'int[ll {aka long long int}]' for array subscript
   66 |         for (auto x: arr[i].s)
      |                         ^
a.cc:77:12: error: invalid types 'int[ll {aka long long int}]' for array subscript
   77 |         arr[i].x=val;
      |            ^
a.cc:13:18: error: request for member 'begin' in 'arr', which is of non-class type 'int'
   13 | #define all(v) v.begin(), v.end()
      |                  ^~~~~
a.cc:79:10: note: in expansion of macro 'all'
   79 |     sort(all(arr),fun);
      |          ^~~
a.cc:13:29: error: request for member 'end' in 'arr', which is of non-class type 'int'
   13 | #define all(v) v.begin(), v.end()
      |                             ^~~
a.cc:79:10: note: in expansion of macro 'all'
   79 |     sort(all(arr),fun);
      |          ^~~
a.cc:83:25: error: invalid types 'int[ll {aka long long int}]' for array subscript
   83 |         for (auto x: arr[i].s)
      |                         ^