For this Question: A robot is initially placed at the origin of the number line. The robot also has a happiness counter with an initial value of 0.

A command string is also given. Each character of this string denotes an operation on the robot. Each character of the string can be one of the following:

• 'C': Changes the robot's position by moving in either direction by one unit along the number line.

• '+': If the robot's current position is X, then add X to the happiness counter of the robot.

• '-': If the robot's current position is X, then subtract X from the happiness counter of the robot.

The robot will start executing the command string, i.e., it will execute each character one by one in the given order. However, the robot must return back to the origin after execution of the command string is finished. Thus, among all possible paths the robot can take, you must choose an assignment of directions in such a way that the robot finally ends up at the origin.
 
Note that the robot's coordinates and happiness can be negative while executing the string. Find the maximum possible happiness of the robot after executing the string.The first line of the input contains a single integer N (2 ≤ N ≤ 2×10<sup>5</sup>).
The next line contains the command string S of length N. The string only consists of characters '+', '-' and 'C'. The total number of appearances of 'C' in the string is guaranteed to be even.Print a single integer denoting the maximum possible happiness of the robot.Sample Input 1:
4
C-C-

Sample Output 1:
1

Sample Explanation 1:
There are only two possible paths the robot can take as it has to return to origin. The paths are 0 -> 1 -> 0 and 0 -> -1 -> 0. The path 0 -> -1 -> 0 gives the maximum happiness of 1.

Sample Input 2:
5
C+-C+

Sample Output 2:
0

Sample Explanation 2:
There are again only two possible paths the robot can take, both of which give happiness 0.

Sample Input 3:
6
C+CC-C

Sample Output 3:
2, I have written this Solution Code: //Author: Xzirium
//Time and Date: 00:13:26  24 May 2022

//Optional FAST
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

template <typename T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template <typename T> using ordered_set1 = tree<T,null_type,greater<T>,rb_tree_tag,tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll b, ll e)
{
    ll r = 1ll;
    for(; e > 0; e /= 2, (b *= b) %= MOD)
        if(e % 2) (r *= b) %= MOD;
    return r;
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(N);
    string S; 
    cin >> S;
    vector<ll> C; 
    ll curr = 0;
	FORI(i, 1, N+1) 
    {
		if (S[N - i] == 'C') 
        {
			C.push_back(curr);
		} 
        else if (S[N - i] == '+') 
        {
			curr++;
		} 
        else 
        {
            curr--;
        }
	}
    ll ans=0;
    sort(C.begin(), C.end());
    FORI(i, 0, C.size())
    {
        if(i < C.size()/2)
        {
            ans-=C[i];
        }
        else
        {
            ans+=C[i];
        }
    }
    cout<<ans<<endl;

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?