Go: package main

import (
	"bufio"
	"fmt"
	"go/token"
	"go/types"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	for i := 0; i < n; i++ {
		stdin.Scan()
		exp := strings.TrimRight(stdin.Text(), "=")
		res, _ := types.Eval(token.NewFileSet(), nil, token.NoPos, exp)
		fmt.Println(res.Value)
	}
}

C++: #define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

const int tx[] = {0,1,0,-1};
const int ty[] = {-1,0,1,0};

P equation(const string &str, int pos=0);
P factor(const string &str, int pos = 0);
P term(const string &str, int pos = 0);

P equation(const string &str, int pos){
	P res = factor(str,pos);
	while(str[res.second] == '+' || str[res.second] == '-'){
		P res_ = factor(str,res.second+1);
		if(str[res.second] == '+') res.first += res_.first;
		else res.first -= res_.first;
		res.second = res_.second;
	}
	return res;
}

P factor(const string &str, int pos) {
	P res = term(str, pos);
	while (str[res.second] == '*' || str[res.second] == '/') {
		P res_ = term(str, res.second+1);
		if(str[res.second] == '*') res.first *= res_.first;
		else res.first /= res_.first;
		res.second = res_.second;
	}
	return res;
}

P term(const string &str, int pos) {
	if(str[pos] == '('){
		P res = equation(str,pos+1);
		res.second += 1;
		return res;
	} else {
		int val = 0;
		while(isdigit(str[pos])){
			val = val * 10 + (str[pos++]-'0');
		}
		return P(val,pos);
	}
}


int main(){
	string str;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		cin>>str;
		P res = equation(str);
		cout << res.first << endl;
	}
	return 0;
}

C++: //A Reward for a Carpenter
#include <iostream>
#include <cstdio>
#include <cassert>
#define rep(i,n) for(int i = 0;i < n;i++)
#define mp make_pair
using namespace std;
string S;
size_t cur = 0;
bool isdigit(char);
int digit();
int number();
int term();
int expression();
int factor();
int parse(){
    return expression();
}

int main(){
    int n;
    cin >> n;
    rep(i,n){
        cin >> S;
        cout << parse() << endl;
    }
}

bool isdigit(char c){
    return c >= '0' && c <= '9';
}
int digit(){
    assert(isdigit(S[cur]));
    int n = S[cur] - '0';
    cur = cur + 1;
    return n;
}
int number(){
    int n = digit();
    while(cur<S.size()&&isdigit(S[cur])){
        n = n*10+digit();
    }
    return n;
}

int expression(){
    int mult = 1;
    if(S[cur]=='-'){
        mult = -1;
        cur++;
    }
    int sum = term()*mult;
    while(cur < S.size()&&(S[cur]=='+'||S[cur]=='-')){
        char op = S[cur];
        cur++;
        if(op == '+'){
            sum += term();
        }else{
            sum -= term();
        }
    }
    return sum;
}
int term(){
    int ret = factor();
    while(cur < S.size() &&( S[cur]=='*'||S[cur]=='/')){
        char op = S[cur];
        cur++;
        if(op == '*'){
            ret *= factor();
        }else{
            ret /= factor();
        }
    }
    return ret;
}
int factor(){
    if(S[cur]!='(')
        return number();
    cur += 1;
    int n = expression();
    assert(S[cur]==')');
    cur++;
    return n;
}

C++: #include <bits/stdc++.h>
#define P int
using namespace std;
string s;
int p;
P bns1();
P g_A(){
  P r=0;
  if(s[p]=='('){
    p++;
    r=bns1();
    p++;
  }
  else{
    while(isdigit(s[p])){
      r=r*10+(s[p]-'0');
      p++;
    }
  }
  return r;
}
P bns2(){
  P res=g_A();
  while(s[p]=='*'||s[p]=='/'){
    int t=p++;
    if(s[t]=='*')res*=g_A();
    if(s[t]=='/')res/=g_A();
  }
  return res;
}
P bns1(){
  P res=bns2();
  while(s[p]=='+'||s[p]=='-'){
    int t=p++;
    if(s[t]=='+')res+=bns2();
    if(s[t]=='-')res-=bns2();
  }
  return res;
}
int main(){
  int ans,n;
  cin>>n;
  while(n--){
    cin>>s;
    p=0;
    P ans=bns1();
    cout<<ans<<endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
string s;
int INDEX;
int number();
int factor();
int term();
int expr();
int number(){
    int n = s[INDEX] - '0';
    INDEX++;
    while(isdigit(s[INDEX])){
        n = n*10 + s[INDEX] - '0';
        INDEX++;
    }
    return n;
}
int factor(){
    if(isdigit(s[INDEX])) return number();
    INDEX++;
    int ret = expr();
    INDEX++;
    return ret;
}
int term(){
    int val = factor();
    while(s[INDEX] == '*' || s[INDEX] == '/'){
        char op = s[INDEX];
        INDEX++;
        int tmp = factor();
        if(op == '*') val *= tmp;
        else val /= tmp;
    }
    return val;
}
int expr(){
    int val = term();
    while(s[INDEX] == '+' || s[INDEX] == '-'){
        char op = s[INDEX];
        INDEX++;
        int tmp = term();
        if(op == '+')val += tmp;
        else val -= tmp;
    }
    return val;
}
int main(){
    int N;
    cin >> N;
    while(N--){
        INDEX = 0;
        cin >> s;
        cout << expr() << "\n";
    }
    return 0;
}