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)
	}
}

Python: R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
 L=[];t=''
 for e in input()[:-1]:
  if e.isdigit():t+=e
  else:
   if t:L+=[t];t=''
   L+=e
 if t:L+=[t]
 P,S=[],[]
 for i in L:
  if"("==i:S+=i
  elif")"==i:
   while"("!=S[-1]:P+=S.pop()
   S.pop()
  elif i in R:
   while S and R[S[-1]]>=R[i]:P+=S.pop()
   S+=i
  else:P+=[i]
 while S:P+=S.pop()
 for x in P:S+=[str(int(eval(S.pop(-2)+x+S.pop())))if x in"+-*/"else x]
 print(*S)

Python: def ReversePolishNotation(string):

    priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2}

    stack = []
    signStack = ["Sentinel"]

    for item in string[:-1]:
        if item == "(":
            signStack.append(item)
        elif item == ")":
            while signStack[-1] != "(":
                stack.append(signStack.pop())
            signStack.pop()
        else:
            if item in priority.keys():
                if priority[signStack[-1]] < priority[item]:
                    signStack.append(item)
                else:
                    top = signStack.pop()
                    stack.append(top)
                    signStack.append(item)
            else:
                stack.append(item)

    while signStack[-1] != "Sentinel":
        stack.append(signStack.pop())

    return stack


def Calculate(formulaList):

    signs = ["+", "-", "*", "/"]

    stack = []

    for item in formulaList:

        if item not in signs:
            stack.append(item)
        else:
            num1 = int(stack.pop())
            num2 = int(stack.pop())

            result = 0

            if item == "+":
                result = num2 + num1
            elif item == "-":
                result = num2 - num1
            elif item == "*":
                result = num2 * num1
            else:
                result = num2 / num1

            stack.append(result)
        print(stack)
        print(item)

    return int(stack[0])


inputCount = int(input())

for lp in range(inputCount):
    formula = input()

    rpn = ReversePolishNotation(formula)
    answer = Calculate(rpn)

Python: #!/usr/bin/python3

import re
n = int(input())
for _ in range(n):
    print(int(eval(re.sub(r'(\d+/\d+)', r'int(\1)', input()[0:-1]))))

Python: # -*- coding: utf-8 -*-
'''
所要時間は、分位であった。
'''


# ライブラリのインポート
#import re
import sys
input = sys.stdin.readline
#import heapq
#import bisect
from collections import deque
#import math

def main():
    n = int(input())
    for _ in range(n): 
        IN = input().strip()
        exp1 = calcmold(IN)
        exp2 = calc1(exp1)
        exp3 = calcmult(exp2)
        print(calcplus(exp3))

def calcmold(exp):
    # seikei
    tmp = ""
    EXP = deque()
    oplist = ["+","-","*","/","(",")","="]
    for i in range(len(exp)):
        if exp[i] not in oplist:
            tmp += exp[i]
        else:
            if tmp == "":
                EXP.append(exp[i])
                continue
            EXP.append(int(tmp))
            EXP.append(exp[i])
            tmp = ""
    return EXP


def calc1(IN):
    #calculate()
    EXP = deque()
    while(IN):
        check = IN.popleft()
        if check == ")":
            TMP = deque()
            while(1):
                look = EXP.pop()
                if look == "(": break
                TMP.appendleft(look)
            TMP.append("=")
            EXP.append(calcplus(calcmult(TMP)))
        else: EXP.append(check)
    return EXP
        


def calcmult(exp):
    # no()
    EXP = deque()
    while(exp):
        check = exp.popleft()
        if check == "*":
            arg1 = EXP.pop()
            arg2 = exp.popleft()
            EXP.append(arg1*arg2)
        elif check == "/":
            arg1 = EXP.pop()
            arg2 = exp.popleft()
            EXP.append(int(arg1/arg2))
        else: EXP.append(check)
    return EXP


def calcplus(exp):
    # no()
    EXP = deque()
    while(exp):
        check = exp.popleft()
        if check == "+":
            arg1 = EXP.pop()
            arg2 = exp.popleft()
            EXP.append(arg1+arg2)
        elif check == "-":
            arg1 = EXP.pop()
            arg2 = exp.popleft()
            EXP.append(arg1-arg2)
        elif check == "=":
            return EXP.pop()
        else: EXP.append(check)
    return EXP
if __name__ == '__main__':
    main()

Python: #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
from operator import add, sub, mul, floordiv


OPERATOR = {'+': add, '-': sub, '*': mul, '/': floordiv}


class Parser(list):
    """
    <statement> ::= <expression> "="
    <expression> ::= <term> [ ("+"|"-") <term> ]
    <term> ::= <factor> [ ("*"|"/") <factor> ]
    <factor> ::= <number> | "(" <expression> ")"
    """

    def __init__(self, tokens):
        self._iter_tokens = iter(tokens)

        self._next_symbol()
        while self.symbol != '=':
            self._expression()

    def _expression(self):
        if self.symbol in ('+', '-'):
            op_sign = self.symbol
            self._next_symbol()
            self._term()
            self.append(OPERATOR[op_sign])
        else:
            self._term()

        while self.symbol in ('+', '-'):
            op_sign = self.symbol
            self._next_symbol()
            self._term()
            self.append(OPERATOR[op_sign])

    def _term(self):
        self._factor()
        while self.symbol in ('*', '/'):
            op_sign = self.symbol
            self._next_symbol()
            self._factor()
            self.append(OPERATOR[op_sign])

    def _factor(self):
        if self.symbol.isdigit():
            self.append(int(self.symbol))
            self._next_symbol()
        elif self.symbol == '(':
            self._next_symbol()
            self._expression()
            if self.symbol != ')':
                raise SyntaxError(self.symbol)
            self._next_symbol()
        else:
            raise SyntaxError(self.symbol)

    def _next_symbol(self):
        self.symbol = next(self._iter_tokens)


def tokenize(line):
    buf = []
    tokens = []

    for c in line:
        if c.isdigit():
            buf.append(c)
        else:
            if buf:
                tokens.append(''.join(buf))
                del buf[:]
            tokens.append(c)
            if c == '=':
                return tokens


def run(commands):
    stack = []

    for cmd in commands:
        if isinstance(cmd, int):
            stack.append(cmd)
        else:
            buf = stack.pop()
            stack[-1] = cmd(stack[-1], buf)
    return stack[-1]


def main(readline=stdin.readline):
    for _ in range(int(readline())):
        print(run(Parser(tokenize(readline()))))
    exit()


if __name__ == '__main__':
    main()

Python: import sys

n = int(input())
while n != 0:
	s = input()
	print(eval(s[0:len(s)-1]));
	n -= 1
	sys.stdout.flush()