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 <iostream>
#include <algorithm>

using namespace std;

void tasu(string s1, string s2){
	int num[2][max(s1.length(), s2.length())+1];
	for(int i = 0; i < sizeof(num[0])/sizeof(int); i++){
		if(s1.length() > i){
			num[0][i] = (int)s1.at(s1.length()-1-i) - (int)'0';
		}else{
			num[0][i] = 0;
		}
		if(s2.length() > i){
			num[1][i] = (int)s2.at(s2.length()-1-i) - (int)'0';
		}else{
			num[1][i] = 0;
		}
	}
	for(int i = 0; i < sizeof(num[0])/sizeof(int)-1; i++){
		num[1][i] += num[0][i];
		if(num[1][i] > 9){
			num[1][i+1] += (int)(num[1][i]/10);
			num[1][i] %= 10;
		}
	}
	int keta = sizeof(num[0])/sizeof(int);
	while(keta && !num[1][keta-1]){
		keta--;
	} 
	if(keta > 80){
		cout << "overflow" << flush;
	}else if(keta){
		while(keta--){
			cout << num[1][keta] << flush;
		}
	}else{
		cout << 0 << flush;
	}
}
int main(){
	int n;
	cin >> n;
	while(n--){
		string s1, s2;
		cin >> s1 >> s2;
		tasu(s1, s2);
		if(n){
			cout << endl;
		}
	}
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n,m;
	string aindex, bindex, ans;
	cin >> m;
	n = 0;
	string a,b;
	for(int j = 0; j < m; j++){
		cin >> a >> b;
		if(a.size()>80||b.size()>80){
			cout << "overflow" << endl;
		}else{
			for(int i = 0; i< max(a.size(),b.size()); i++){
				if(a.size()-i > 0){
					aindex = a[a.size()-i-1];
				}else{
					aindex = "0";
				}
				if(b.size()-i > 0){
					bindex = b[b.size()-i-1];
				}else{
					bindex = "0";
				}
				n = stoi(aindex) + stoi(bindex) + (n-n%10==10);
				aindex = to_string(n%10);
				ans = aindex + ans;
			}
			if(ans.size()>80){
				cout << "overflow" << endl;
			}else{
				cout << ans << endl;
			}	
		}
	}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

const int MAX_SIZE = 90;

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = 0;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == 0&& r.d[i] == 0){
	if(!updigit)
	  goto end;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i])
	  a = toI(this->d[i]);
	if(r.d[i])
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
  end:
    this->size = tmp;
    return;
  }

  void print()
  {
    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
    puts("");
  }

  int sz()
  {
    return this->size;
  }
};

int main()
{
  int x;
  scanf("%d", &x);
  char s1[MAX_SIZE], s2[MAX_SIZE];  
  for(int i=0;i<x;i++){
 /*   scanf("%s%s",s1, s2);
   Z z1(s1);
    Z z2(s2);
    if(z1.sz() > 80 || z2.sz() > 80){
      puts("overflow");
      continue;
    }
    z1.add(z2);
    z1.print(); */
  }
  return 0;
}

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

int main()
{
	int n;
	cin >> n;
	
	for(int j = 0; j < n; ++j)
	{
		string numA;
		string numB;
		cin >> numA >> numB;
		
		while(numA.size() != numB.size())
		{
			if(numA.size() < numB.size())
			{
				numA = "0" + numA;
			}
			else
			{
				numB = "0" + numB;
			}
		}
		
		numA = "0" + numA;
		numB = "0" + numB;
		
		for(int i = numA.size() - 1; i >= 0; --i)
		{
			int sum = 0;
			sum = (numA[i] - '0') + (numB[i] - '0');
			
			if(sum >= 10)
			{
				sum -= 10;
				numA[i - 1] += 1;
			}
			
			numA[i] = sum + '0';
		}
		
		if(numA.size() > 81)
		{
			cout << "overflow" << endl;
			continue;
		}
		if(numA.size() == 81 && numA[0] != '0')
		{
			cout << "overflow" << endl;
			continue;
		}
		
		for(int i = 0; i < numA.size(); ++i)
		{
			if(i == 0 && numA[i] == '0') continue;
			cout << numA[i];
		}
		
		cout << endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

string addString(string a,string b ){
	if(a.size()<b.size())swap(a,b);         //len(a)>len(b)???
	b = string(a.size()-b.size(),'0')+b;    //b????????????a??¨??????????????????????????????0??§?????????
	
	string ans = string(a.size()+1,'0');    //a?????????+1 ?????????0??§???????????????
	for(int i=(int)a.size()-1;i>=0;i--){    //?¶??????? & ??°????????????
		ans[i+1] += (a[i]-'0') + (b[i]-'0');
		if(ans[i+1]>='0'+10){
			ans[i] += 1;
			ans[i+1] -= 10;
		}
	}
	string ret = "";                        //??????????????°???0????¶????
	rep(i,ans.size()){
		if(ans[i]!='0'||i==ans.size()-1){
			ret = ans.substr(i,ans.size()-i);
			break;
		}
	}
	return ret;
}


int main(){
	int n;
	cin>>n;
	rep(i,n){
		string a,b;
		cin>>a>>b;
		string res = addString(a,b);
		if(res.size()>80)cout<<"overflow"<<endl;
		else cout<<res<<endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    int ans[100] = {0};
    string a,b;
    cin >>a>>b;
    int as = a.size(),bs = b.size(),t = 0,s = 0,x = 0;
    int ms = (as>bs)? as:bs;
    for(int i=0; i<ms; i++,x++){
      if(i<as && i<bs){t = a[as-i-1]+b[bs-i-1]-2*'0'+s;}
      else if(i>=as){t = b[bs-i-1]-'0'+s;}
      else if(i>=bs){t = a[as-i-1]-'0'+s;}
      s = t/10;
      ans[x] = t%10;
    }
    if(s){ans[x] = s;x++;}
    if(x>=80){cout <<"over flow"<<endl;}
    else{
      for(int i=0; i<x; i++){cout <<ans[x-i-1];}
      cout <<endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    string A,B;
    int n,Ak,Bk,ans[81];
    
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        
        for(int j=0;j<80;j++){
            ans[j]=0;
        }
        
        cin >> A >> B;
        
        Ak=(int)A.size();
        Bk=(int)B.size();
        
        for(int i=0;i<max(Ak,Bk);i++){
            if(i<min(Ak,Bk))
                ans[79-i]+=(A[Ak-1-i]-'0')+(B[Bk-1-i]-'0');
            else if(i<Ak)
                ans[79-i]+=A[Ak-1-i]-'0';
            else if(i<Bk)
                ans[79-i]+=B[Bk-1-i]-'0';
            
            if(ans[79-i]>=10){
                if(i==79){
                    break;
                }
                ans[79-i-1]++;
                ans[79-i]-=10;
            }
        }
        
        if(ans[79-i]>=10){
            puts("overflow");
        }else{
            bool f = false;
            for(int i=0;i<80;i++){
                if(ans[i] || f){
                    printf("%1d",ans[i]);
                    f = true;
                }
            }
            printf("\n");
        }
    }
    
    return 0;
}