Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

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

C++: #include <iostream>
#include <algorithm>
#include <string>
 
using namespace std;
 
char calc(char x,char y,char z,bool &C){
  int a = x - '0',b = y - '0',c = z - '0';
  int d = a + b + c;
 
  if(d >= 10){
    C = true;
    d -= 10;
  }
 
  return d + '0';
}
 
string sum(string a,string b){
  string res = "";
 
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
 
  int length;
  if((int)a.size() > (int)b.size()){
    length = (int)a.size();
     
    for(int i = (int)b.size() ; i < length ; i++){
      b += '0';
    }
 
  }
  else{
    length = (int)b.size();
 
    for(int i = (int)a.size() ; i < length ; i++){
      a += '0';
    }
 
  }
 
  for(int i = 0 ; i <= length ; i++)
    res += '0';
 
  for(int i = 0 ; i < length ; i++){
    bool C = false;
    res[i] = calc(a[i],b[i],res[i],C);
    if(C) res[i+1] = ((res[i+1]-'0') + 1) + '0';
  }
 
  for(int i = length ;; i--){
     
    if(res[i] == '0'){
      res.erase(res.begin()+i);
    }
    else{
      break;
    }
     
  }
 
  reverse(res.begin(),res.end()); 
 
  return res;
}

int main(){
  int n;

  cin >> n;
  while(n--){
    string a,b;

    cin >> a >> b;
    string c = sum(a,b);
    
    if((int)c.size() > 80) cout << "overflow" << endl;
    else cout << c << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  int n, maxlen;
  char a[10001], b[10001];

  cin >> n;
  for(int ii = 0 ; ii < n ; ii++){
    string ans = "";
    scanf("%s %s", a, b);
    
    maxlen = max(strlen(a), strlen(b));

    reverse(a, a+strlen(a));
    reverse(b, b+strlen(b));
    
    for(int i = strlen(a) ; i < 10001 ; i++){
      a[i] = '0';
    }
    for(int i = strlen(b) ; i < 10001 ; i++){
      b[i] = '0';
    }

    int tmp, tmp2 = 0;

    for(int i = 0 ; i < maxlen ; i++){
      tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
      
      if(i == maxlen - 1){
	if(tmp >= 10){
	  tmp2 = 1;
	  tmp -= 10;
	  ans += tmp + '0';
	  ans += '1';
	}
	else ans += tmp + '0';
      }

      else if(tmp >= 10){
	tmp2 = 1;
	tmp -= 10;
	ans += tmp + '0';
      }
      else if(tmp <= 9){
	ans += tmp + '0';
	tmp2 = 0;
      }
    }

    reverse(ans.begin(), ans.end());

    int size = ans.size();

    if(size > 80 || maxlen > 80) cout << "overflow" << endl;
    else cout << ans << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	string a,b;
	int c[100]={0};
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(a.size()>80||b.size()>80)
			cout<<"overflow"<<endl;
		else{
			int t;
			if(a.size()>=b.size())
				t=a.size();
			if(a.size()<b.size())
				t=b.size();
			for(int j=0;j<t;j++){
				if(j<a.size())
					c[j]+=a[a.size()-j-1]-'0';
				if(j<b.size())
					c[j]+=b[b.size()-j-1]-'0';
				if(c[j]>=10){
					c[j]-=10;
					c[j+1]=1;
				}
			}
			bool h=true;
			if(c[t]==1){
				if(t==80){
					cout<<"overflow"<<endl;
					h=false;
				}
				else
				    cout<<"1";
			}
			if(h==true){
			for(int j=t-1;j>=0;j--)
				cout<<c[j];
			cout<<endl;
			}
		}
	}
	return 0;
}