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<string>
using namespace std;
int main(){
	int n;
	cin >>n;
	while(n--){
		string a, b, c;
		cin >>a>>b;
		int x = a.size(), y = b.size(), t = 0, max = (x>y)?x:y;
		for(int i=0; i<max; i++){
			if(i<x && i<y){t = (int)a[x-i-1]+(int)b[y-i-1]-2*'0'+t/10;}
			else if(i<x){t = (int)a[x-i-1]-'0'+t/10;}
			else if(i<y){t = (int)b[y-i-1]-'0'+t/10;}
			c+=(char)(t%10)+'0';
		}
		if(t/10){c+='1';}
		if(c.size() > 80){cout<<"overflow";}
		else{for(int i=c.size()-1; i>=0; i--){cout<<c[i];}}
		cout<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> sum(string A, string B);
int main() {
  string a="99999999999999999999999999999999999999999999999999999999999999999999999999999999";
  string b="0";
    if((int)a.size()>80 || (int)b.size()>80)
      cout<<"overflow\n";
    else{
      vector<int> tmp=sum(a,b);
      if(tmp.size()>80)
	cout<<"overflow\n";
      else {
	string *s=new string[tmp.size()];
	for(int i=0;i<(int)tmp.size();i++) {
	  s[i]=to_string(tmp[i]);
	  cout<<s[i];
	}
	cout<<endl;
      }
    }
  return 0;
}
vector<int> sum(string A, string B) {
  int  a_size=A.size()-1;
  int  b_size=B.size()-1;
  int end=-1;
  vector<int> tmp;
  int Dr=0;
  while(true) {
    if(a_size<0 ){
      end=0;
      break;
    }
    if(b_size<0){
      end=1;
      break;
    }
    int a=(int)A[a_size]-(int)'0';
    int b=(int)B[b_size]-(int)'0';
    int n=a+b+Dr;
    if(n>=10){
      tmp.push_back(n-10);
      Dr=1;
    }
    else{
      Dr=0;
      tmp.push_back(n);
    }
    a_size--;
    b_size--;
  }

  if(end==0) {
    for(int i= b_size;i>=0;i--){
      int n=(int)B[b_size]-int('0')+Dr;
      if(n>=10) {
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  else if(end==1){
    for(int i=a_size;i>=0;i--){
      int n=(int)A[a_size]-int('0')+Dr;
      if(n>=10){
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  if(Dr==1)
    tmp.push_back(1);
  reverse(tmp.begin(),tmp.end());
  return tmp;
}

C++: #include <stdio.h>

#define DEGITS 80

int load(int a[]);
void print(int a[]);

int main(void){
    int a[DEGITS]; // a[0] = LSD
    int b[DEGITS];
    int n;
    int cry;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        // reset
        for (int i=0; i<DEGITS; i++){
            a[i]=b[i]=0;
        }
        // load
        if (load(a)){
            printf("overflow\n");
            load(b);
            continue;
        }
        if (load(b)){
            printf("overflow\n");
            continue;
        }        // add ( a <- a + b )
        cry=0;
        for (int d=0; d<DEGITS; d++){
            a[d] += (b[d] + cry);
            cry = a[d]/10;
            if (a[d]>9){
                a[d]-=10;
            }
        }
        // print
        if (cry){
            printf("overflow\n");
        } else{
            print(a);
        }
    }

    return 0;
}

int load(int a[]){
    char *pt;
    char st[DEGITS+1];
    int i;
    
    scanf("%s", st);
    for (pt=st, i=0; *pt!='\0'; pt++, i++) ;
    if (i>DEGITS) return 1;
    for (int i=0; pt!=st; i++){
        a[i] = *(--pt)-'0';
    }
    return 0;
}

void print(int a[]){
    int d;
    
    for (d=DEGITS-1; d>0; d--){ 
        if (a[d] != 0) break;
    }
    for (; d>0; d--) printf("%d", a[d]);
    printf("%d\n", a[0]);
}

C++: #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int N;
	cin>>N;
	for(int i=0;i<N;i++) {
		string A,B,C;
		cin>>A>>B;
		reverse(A.begin(),A.end());
		reverse(B.begin(),B.end());
		if(A.size()>80||B.size()>80) {
			cout<<"overflow"<<endl;
			continue;
		}
		for(int i=0;i<A.size()||i<B.size();i++) {
			int n=0;
			if(i<A.size())n+=(A[i]-'0');
			if(i<B.size())n+=(B[i]-'0');
			C.push_back(n);
		}
		for(int i=0;i<C.size();i++) {
			if(i!=C.size()-1)C[i+1]+=C[i]/10,C[i]%=10;
		}
		reverse(C.begin(),C.end());
		if(C.size()>80) {
			cout<<"overflow"<<endl;
		}else {
			for(int i=0;i<C.size();i++) {
				if(C[i]>=10) {
					cout<<(char)(C[i]/10+'0');
					cout<<(char)(C[i]%10+'0');
				}else cout<<(char)(C[i]+'0');
			}
			cout<<endl;
		}
	}
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	int n = 0;
	char i1[100], i2[100], o[100];
	int li1=0, li2 = 0;
	int d1[81], d2[81], d[81];
	int c = 0;

	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		c = 0;
		scanf("%s", i1);
		scanf("%s", i2);
		li1 = strlen(i1);
		li2 = strlen(i2);
		if(li1 > 80 || li2 > 80){
			puts("overflow");
			continue;
		}
		for(int j=0;j<81;++j){
			d1[j] = d2[j] = d[j] = 0;
		}
		for(int j=0;j<li1;++j){
			d1[j] = *(i1 + li1 - j - 1) - '0';
		}
		for(int j=0;j<li2;++j){
			d2[j] = *(i2 + li2 - j - 1) - '0';
		}
		for(int j=0;j<81; ++j){
			d[j] = d1[j] + d2[j] + c;
			c = d[j] >= 10 ? 1 : 0;
			d[j] -= 10 * c;
		}
		for(c=80; c>=0; --c){
			if(d[c] != 0){
				break;
			}
		}
		if(c == 80){
			puts("overflow");
			continue;
		}
		for(int j = 0; j<=c; ++j){
			o[j] = d[c - j] + '0';
		}
		o[c + 1] = '\0';
		printf("%s\n", o);
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#define MAX 80

using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int counter = 0; counter < n; counter++){
		string a, b;
		cin >> a >> b;
		if (a.length() > MAX || b.length() > MAX){
			cout << "overflow" << endl;
			continue;
		}
		if (a.length() == 1 && b.length() == 1 && a[0] == '0' && b[0] == '0'){
			cout << 0 << endl;
			continue;
		}
		int inta[MAX + 2], intb[MAX + 2], sum[MAX + 2];
		fill(inta, inta + MAX + 2, 0);
		fill(intb, intb + MAX + 2, 0);
		fill(sum, sum + MAX + 2, 0);
		for (int i = 0; i < (signed)a.length(); i++){
			inta[i] = a[a.length() - i - 1] - '0';
		}
		for (int i = 0; i < (signed)b.length(); i++){
			intb[i] = b[b.length() - i - 1] - '0';
		}

		int over = 0;
		for (int i = 0; i < MAX + 2; i++){
			sum[i] = inta[i] + intb[i] + over;
			if (sum[i] >= 10){
				sum[i] %= 10;
				over = 1;
			}
			else{
				over = 0;
			}
		}

		for (int i = MAX + 1;; i--){
			if (sum[i] != 0){
				if (i >= MAX){
					cout << "overflow" << endl;
					break;
				}
				for (int j = i; j >= 0; j--){
					cout << sum[j];
				}
				cout << endl;
				break;
			}
		}
	}
	return 0;
}