Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
//'+','_','*'
int a[3];
bool mark(char t) {
	if (t == '+' || t == '_' || t == '*')return true;
	else return false;
}
string trans(string x) {
	int l = x.length();
	rep(j, 3) {
		rep(i, l) {
			if (x[i] == '+'&&a[0] == j) {
				int le = i-1; int ri = i+1;
				while (le >= 0 && (!mark(x[le])))le--; le++;
				while (ri < l && (!mark(x[ri])))ri++; ri--;
				int d = ri - le + 1;
				string u1 = x.substr(le, i - le);
				string u2 = x.substr(i + 1, ri - i);
				string u = to_string(stoll(u1) + stoll(u2));
				int d2 = u.length();
				x.erase(x.begin() + le, x.begin() + ri + 1);
				x.insert(le, u);
				i = le - 1; l = l - d + d2;
			}
			else if (x[i] == '_'&&a[1] == j) {
				int le = i-1; int ri = i+1;
				while (le >= 0 && (!mark(x[le])))le--; le++;
				while (ri < l && (!mark(x[ri])))ri++; ri--;
				int d = ri - le + 1;
				string u1 = x.substr(le, i - le);
				string u2 = x.substr(i + 1, ri - i);
				string u = to_string(stoll(u1) - stoll(u2));
				int d2 = u.length();
				x.erase(x.begin() + le, x.begin() + ri + 1);
				x.insert(le, u);
				i = le - 1; l = l - d + d2;

			}
			else if (x[i] == '*'&&a[2] == j) {
				int le = i-1; int ri = i+1;
				while (le >= 0 && (!mark(x[le])))le--; le++;
				while (ri < l && (!mark(x[ri])))ri++; ri--;
				int d = ri - le + 1;
				string u1 = x.substr(le, i - le);
				string u2 = x.substr(i + 1, ri - i);
				string u = to_string(stoll(u1) * stoll(u2));
				int d2 = u.length();
				x.erase(x.begin() + le, x.begin() + ri + 1);
				x.insert(le, u);
				i = le - 1; l = l - d + d2;
			}
		}
	}
	return x;
}
ll ord(string x) {
	int l = x.length();
	rep(i, l) {
		if (x[i] == ')') {
			int le = i-1;
			while (x[le] != '(')le--;
			string u = x.substr(le + 1, i - le - 1);
			int d = i - le + 1;
			string nu = trans(u);
			int d2 = nu.length();
			x.erase(x.begin() + le, x.begin() + i + 1);
			x.insert(le, nu);
			i = le - 1;
			l = l - d + d2;
		}
	}
	ll res = stoll(trans(x));
	return res;
}
int main() {
	string s; cin >> s;
	int len = s.length();
	rep(i, len) {
		if (s[i] == '-')s[i] = '_';
	}
	ll ma = -LLONG_MAX;
	rep(x, 3) {
		rep(y, 3) {
			rep(z, 3) {
				a[0] = x; a[1] = y; a[2] = z;
				ma = max(ma, ord(s));
			}
		}
	}
	cout << ma << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:113:18: error: 'LLONG_MAX' was not declared in this scope
  113 |         ll ma = -LLONG_MAX;
      |                  ^~~~~~~~~
a.cc:15:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include<complex>
  +++ |+#include <climits>
   15 | using namespace std;