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 <stdio.h>
#include <string.h>

int chomp(char *str){
    int len = strlen(str);
    if(str[len-1]=='\n'){
        str[len-1] = '\0';
        len--;
    }
    return len;
}

int main(){
    int n;
    int i,j;
    int s1,s2,la,sm;
    char a1[103],a2[103],*pla,*psm,dummy[2];
    int carry,r;
    scanf("%d",&n);
    fgets(dummy,2,stdin);
    for(i=0;i<n;i++){
        fgets(a1,103,stdin);
        fgets(a2,103,stdin);
        s1 = chomp(a1);
        s2 = chomp(a2);
        if(s1>80||s2>80){
            printf("overflow\n");
            next;
        }
        if(s1<s2){
            pla = a2;
            la = s2;
            psm = a1;
            sm = s1;
        }else{
            pla = a1;
            la = s1;
            psm = a2;
            sm = s2;
        }
        carry = 0;
        for(j=0;j<la;j++){
            r = (j<sm) ? (psm[sm-j-1]-'0') : 0;
            r += (pla[la-j-1]-'0')+carry;
            carry = r/10;
            pla[la-j] = '0' + r%10;
        }
        if(carry){
            pla[0] = '1';
        }else{
            pla = (s1<s2) ? &a2[1] : &a1[1];
        }
        if(j+carry>80){
                printf("overflow\n");
                next;
        }
        printf("%s\n",pla);
    }
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	for(cin>>n;n--;){
		string a,b;
		cin>>a>>b;
		int f=0;
		if(a.size()<b.size())swap(a,b);
		while(a.size()>b.size())b="0"+b;
		for(int i=a.size()-1;i>=0;i--){
			a[i]+=(b[i]-'0'+f);
			if(a[i]>'9'){
				f=1;
				a[i]-=10;
			}
			else f=0;
		}
		if(f)a="1"+a;
		cout<<(a.size()>80?"overflow":a)<<endl;
	}
	return 0;
}

C++: 
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int N;

int f(string s1,string s2,int x){
	if(N>80){cout<<"overflow"<<endl;return 0;}
	if(s1.size()<=N&&s2.size()<=N&&x==0)return 0;
	if(s1.size()>N)x+=s1[s1.size()-N-1]-'0';
	if(s2.size()>N)x+=s2[s2.size()-N-1]-'0';
	++N;
	f(s1,s2,x/10);
	if(N<=80)cout<<x%10;
	return 0;
}

int main(){
	int n,a=0;
	cin>>n;
	rep(i,n){
		if(a)cout<<endl;
		a++;
		N=0;
		string s1,s2;
		cin>>s1>>s2;
		f(s1,s2,0);
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>

using namespace std;

void arrangeDigits(string &str1, string &str2){
  // st1 > str2
  if(str1.length() <= str2.length()){
    string tmp = str1;
    str1 = str2;
    str2 = tmp;
  }

  string tmp2;
  for(int i=0;i<str1.length()-str2.length();i++){
    tmp2 += '0';
  }
  tmp2 += str2;
  str2 = tmp2;
  // cout << "str1: " << str1 << endl;
  // cout << "str2: " << str2 << endl;
}

int main(){
  int numDatasets;
  cin >> numDatasets;
  
  for(int i=0;i<numDatasets;i++){
    bool flag = false;
    string str1, str2;

    cin >> str1;
    //80????¶?????????´???
    if(str1.length() > 80){
      flag = true;
    }

    cin >> str2;
    //80????¶?????????´???
    if(str2.length() > 80){
      flag = true;
    }

    // ??????????????????
    arrangeDigits(str1, str2);
      
    //?¨????

    int c = 0;
    string res;

    // cout << str1.length() << endl;
    
    for(int i=0;i<str1.size();i++){
      int now;
      if((int)((char)str2[str2.size()-i-1]-'0') == -48){
	now = (int)(str1[str1.size()-i-1]-'0') + c;
      }
      else{
	now = (int)(str1[str1.size()-i-1]-'0') + (int)((char)str2[str2.size()-i-1]-'0') + c;
      }
      
      res = (char)(now%10 + '0') + res;
      c = now/10;
      // str1.pop_back();
      // str2.pop_back();
      // cout << "----" << endl;
      // cout << "i:" << i << endl;
      // cout << (int)(str1[str1.size()-i-1]-'0') << " + " << (int)(str2[str2.size()-i-1]-'0') << endl;
      // cout << "now:" << now << endl;
      // cout << "res:" << res << endl;
    }

    if(c>0){
      res = (char)(c-'0') + res;
    }

    if(res.size()>0){
      flag == false;
    }
    
    if(flag == false){
      cout << res << endl;
    }else{
      cout << "overflow" << endl;
    }
    
  }
}

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

int main(void)
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int kuriage = 0;
		int sum[200] = {};
		string a, b;
		bool f = true;
		cin >> a >> b;
		int sizea = a.size(), sizeb = b.size();
		if (sizea > 80 || sizeb > 80) f = false;
		else
			for (int j = 0; j < max(sizea, sizeb); j++)
			{
				if (sizea > j && sizeb > j) sum[j] = (a[sizea - j - 1] - '0') + (b[sizeb - j - 1] - '0') + kuriage;
				else if (sizea > j) sum[j] = (a[sizea - j - 1] - '0') + kuriage;
				else if (sizeb > j) sum[j] = (b[sizeb - j - 1] - '0') + kuriage;
				kuriage = 0;
				if (sum[j] > 9)
				{
					kuriage++;
					sum[j] -= 10;
				}
			}
			sum[max(sizea, sizeb)] = kuriage;
			int count = max(sizea, sizeb);
			while (sum[count] == 0 && count > 0) count--;
			if (count >= 80 || f == false) cout << "overflow" << endl;
			else
			{
				for (int j = count; j >= 0; j--)
					cout << sum[j];
				cout << endl;
			}
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;

int main()
{
	
	
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++){
		string a;
		string b;

		cin >> a;
		cin >> b;	
		string res;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int carry = 0;
		int idx;
		for(int j=0;j<min(a.size(),b.size());j++){
			int lhs = a[j] - '0';
			int rhs = b[j] - '0';
			res.push_back((carry + lhs + rhs) % 10 + '0');
			carry = (carry + lhs + rhs) / 10 ? 1 : 0;
			idx =j;
		}

		for(int j=idx+1;j<max(a.size(),b.size());j++){
			if(a.size() > b.size()){
				int lhs = a[j] - '0';
				res.push_back((carry + lhs) % 10 + '0');
				carry = (carry + lhs) / 10 ? 1 : 0;
			}
			else{
				int rhs = b[j] - '0';
				res.push_back((carry + rhs) % 10 + '0');
				carry = (carry + rhs) / 10 ? 1 : 0;
			}
		}
		if(carry) res.push_back(carry+'0');
		reverse(res.begin(),res.end());
		res = (res.size() > 80) ? "over flow" : res;
		cout << res << endl;
	}	
}

C++: import java.util.Scanner;
import java.math.BigInteger;

public class Main{
    public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int N = scanner.nextInt();
	for (int i = 0; i < N; i++) {
	    String a = scanner.next(), b = scanner.next();
	    BigInteger sum = new BigInteger(a), A = new BigInteger(b);
	    sum.add(A);
	    String n_80 = "1";
	    for (int j = 0; j < 79; j++) {
		n_80 += "0";
	    }
	    BigInteger N_80 = new BigInteger(n_80);
	    if (sum.compareTo(N_80) >= 0) {
		System.out.println("overflow");
	    }
	    else {
		System.out.println(sum.toString());
	    }
	}
    }
}