Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int main(void) {
	int sets;
	char input1[100], input2[100], out[100];
	int i1, i2, o, carry;
	int ic1, ic2;
	int i;

	cin >> sets;
	for(i=0;i<sets;i++) {
		scanf("%s", input1);
		for(i1=0;input1[i1] != '\0';i1++);
		if(i1 > 80) { printf("overflow\n"); }
		scanf("%s", input2);
		for(i2=0;input2[i2] != '\0';i2++);
		if(i2 > 80) { printf("overflow\n"); }
		i1--;i2--;o=0;carry=0;
		while(i1>=0 || i2>=0 || carry) {
			if(o > 80) { break; }
			if(i1>=0) { ic1 = input1[i1]-'0'; i1--; } else { ic1 = 0; }
			if(i2>=0) { ic2 = input2[i2]-'0'; i2--; } else { ic2 = 0; }
			if( ic1+ic2+carry < 10 ) {
				out[o] = ic1+ic2+carry+'0';
				carry = 0;
			} else {
				out[o] = ic1+ic2+carry-10+'0';
				carry = 1;
			}
			o++;
		}
		if(o > 80) {
			printf("overflow\n");
		}
		else {
			for(o--;o>=0;o--) {
				printf("%c", out[o]);
			}
			printf("\n");
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>;
using namespace std;
string Sum(string str1, string str2){
	int str1_index, str2_index, num, advance;
	string strsum;
	if(str1.size() < str2.size()){
		while(str1.size() != str2.size()) str1 = "0" + str1;
	}else if(str1.size() > str2.size()){
		while(str1.size() != str2.size()) str2 = "0" + str2;
	}
	str1_index = str1.size()-1;
	str2_index = str2.size()-1;
	advance = 0;
	while(true){
		num = (str1[str1_index] - '0') + (str2[str2_index] - '0') + advance;//????????????????£?????¶???????+??°????????°
		strsum = char( (num % 10) + '0') + strsum;//??????????????\
		//cout<<"strsum="<<strsum<<endl;
		(num >= 10)? advance=1: advance=0;
		str1_index--;
		str2_index--;
		if(str1_index<0 || str2_index<0){
			if(advance>0) strsum = "1" + strsum;
			break;
		}
	}
	return strsum;
}

int main(){
	int i, n;
	string str1,str2;
	string strsum;
	while(cin>>n){
		for(i=0;i<n;i++){
			cin>>str1;
			if(str1.size()>80) cout<<"overflow"<<endl;
			cin>>str2;
			if(str2.size()>80) cout<<"overflow"<<endl;
			strsum = Sum(str1, str2);
			if(strsum.size()>80)
				cout<<"overflow"<<endl;
			else
				cout<<strsum<<endl;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
double EPS=1e-10;
int INF=1e9;
string sum(string a,string b){
      string res="";
      reverse(ALL(a));
      reverse(ALL(b));
      if(a.size()>b.size())swap(a,b);
      int k=0;
      REP(i,a.size()){
            int t=a[i]-'0'+b[i]-'0'+k;
            res+=(char)(t%10+'0');
            k=t/10;
      }
      for(int i=a.size();i<b.size();i++){
            int t=b[i]-'0'+k;
            res+=(char)(t%10+'0');
            k=t/10;
      }
      while(k>0){
            res+=(char)(k%10+'0');
            k/=10;
      }
      reverse(ALL(res));
      return res;
}
int main(){
      int n;
      cin>>n;
      while(n--){
            string a,b;
            cin>>a>>b;
            string ans=sum(a,b);
            if(ans.size()>80){
                  cout<<"overflow"<<endl;
            }else{
                  cout<<ans<<endl;
            }
      }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
int main() {
	int n; cin >> n;
	while (n--) {
		string big, small;
		cin >> big >> small;
		if (small.size() > big.size())swap(big, small);
		reverse(big.begin(), big.end());
		reverse(small.begin(), small.end());
		//cout << "reverse" << endl << s1 << endl << s2 << endl;
		vector<int>vb(big.size()), vs(small.size());
		for (int i = 0; i < big.size(); i++)vb[i] = big[i] - '0';
		for (int i = 0; i < small.size(); i++)vs[i] = small[i] - '0';
		for (int i = 0; i < small.size(); i++) vb[i] += vs[i];
		for (int i = 0; i < big.size(); i++) {
			if (vb[i] >= 10) {
				vb[i] -= 10;
				if (i == big.size() - 1)vb.push_back(1);
				else vb[i + 1]++;
			}
		}
		if (vb.size() > 80)cout << "overflow" ;
		else for (int i = 0; i < vb.size(); i++) {
			cout << vb[vb.size() - 1 - i];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

inline std::string Add_MultiplePrecision(const std::string A, const std::string B) {

	int a[200] = {};
	int b[200] = {};
	int c[300] = {};

	for (unsigned int i = 0; i < A.length(); i++) {
		a[i] = A[A.length() - 1 - i] - '0';
	}
	for (unsigned int i = 0; i < B.length(); i++) {
		b[i] = B[B.length() - 1 - i] - '0';
	}

	int carry = 0;
	for (unsigned int i = 0; i < std::max(A.length(), B.length()); i++) {
		c[i] = (a[i] + b[i] + carry) % 10;
		c[i + 1] = carry = (a[i] + b[i] + carry) / 10;
	}

	int st = 299;
	while (c[st] == 0) {
		st--;
	}

	std::string ans;
	for (int i = st; i >= 0; i--) {
		ans += std::to_string(c[i]);
	}

	if (ans == "") {
		ans = "0";
	}

	return ans;
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	int n = 0;
	std::cin >> n;
	std::vector<std::string> ans(n);

	std::string temp1, temp2, temp3;
	for (int i = 0; i < n; i++) {
		std::cin >> temp1 >> temp2;
		temp3 = Add_MultiplePrecision(temp1, temp2);
		if (temp3.length() >= 80) {
			ans[i] = "overflow";
		}
		else {
			ans[i] = temp3;
		}
	}

	for (int i = 0; i < n; i++) {
		std::cout << ans[i] << std::endl;
	}
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main () {
    int n;
    string a, b;
    
    cin >> n;
    for(int i=0;i<n;i++){
        int x[81]={0}, y[81]={0}, z[81]={0};
        
        cin >> a;
        cin >> b;
        
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        
        for(int j=0;j<a.size();j++){
            x[j]=a[j]-'0';
        }
        for(int j=0;j<b.size();j++){
            y[j]=b[j]-'0';
        }
        int c=0;
        int r;
        for(int j=0;j<80;j++){
            r=x[j]+y[j]+c;
            if (r >= 10){
                z[j]=r%10;
                c=1;
            }else{
                z[j]=r;
                c=0;
            }
        }
        
        if(z[80]>0){
            cout << "overflow" <<endl;
        }else{
            bool flag = 0;
            for(int j=79;j>=0;j--){
                if(z[j]==0 && flag==0){
                    continue;
                }else{
                    flag=1;
                }
                cout<<z[j];
            }
            if(flag==0){
                cout<<0;
            }
            cout<<endl;
            
        }
    }
    return 0;
}