Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n;
  string s;
  cin>>n;
  cin>>s;
  ll r=0;
  ll l=0;
  rep(i,n){
    if(s[i]=='('){
      r++;
    }
    else if(r>0&&s[i]==')'){
      r--;
    }
  }
  for(int i=n-1;i>=0;i--){
    if(s[i]==')'){
      l++;
    }
    else if(l>0&&s[i]=='('){
      l--;
    }
  }
  vector<char> ll(0),rr(0)
  while(l){
    ll.pb('(');
    l--;
  }
  while(r){
    rr.pb(')');
    r--;
  }
  rep(i,sz(ll)){
    cout<<ll[i];
  }
  cout<<s;
  rep(i,sz(rr)){
    cout<<rr[i];
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: expected primary-expression before 'long'
    6 | #define ll long long
      |            ^~~~
a.cc:59:16: note: in expansion of macro 'll'
   59 |   vector<char> ll(0),rr(0)
      |                ^~
a.cc:65:5: error: 'rr' was not declared in this scope; did you mean 'r'?
   65 |     rr.pb(')');
      |     ^~
      |     r
a.cc:6:12: error: expected primary-expression before 'long'
    6 | #define ll long long
      |            ^~~~
a.cc:7:39: note: in definition of macro 'rep'
    7 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                       ^
a.cc:68:9: note: in expansion of macro 'sz'
   68 |   rep(i,sz(ll)){
      |         ^~
a.cc:68:12: note: in expansion of macro 'll'
   68 |   rep(i,sz(ll)){
      |            ^~
a.cc:6:12: error: expected ')' before 'long'
    6 | #define ll long long
      |            ^~~~
a.cc:7:39: note: in definition of macro 'rep'
    7 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                       ^
a.cc:68:9: note: in expansion of macro 'sz'
   68 |   rep(i,sz(ll)){
      |         ^~
a.cc:68:12: note: in expansion of macro 'll'
   68 |   rep(i,sz(ll)){
      |            ^~
a.cc:25:20: note: to match this '('
   25 | #define sz(x) (int)(x).size()
      |                    ^
a.cc:7:39: note: in definition of macro 'rep'
    7 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                       ^
a.cc:68:9: note: in expansion of macro 'sz'
   68 |   rep(i,sz(ll)){
      |         ^~
a.cc:7:41: error: expected ')' before ';' token
    7 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                      ~  ^
a.cc:68:3: note: in expansion of macro 'rep'
   68 |   rep(i,sz(ll)){
      |   ^~~
a.cc:6:12: error: expected primary-expression before 'long'
    6 | #define ll long long
      |            ^~~~
a.cc:69:11: note: in expansion of macro 'll'
   69 |     cout<<ll[i];
      |           ^~
a.cc:72:12: error: 'rr' was not declared in this scope; did you mean 'r'?
   72 |   rep(i,sz(rr)){
      |            ^~
a.cc:7:39: note: in definition of macro 'rep'
    7 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                       ^
a.cc:72:9: note: in expansion of macro 'sz'
   72 |   rep(i,sz(rr)){
      |         ^~