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

int main(void){
    char buf[N*2];
    int datas;
    int degits;
    int lint1[N+1], lint2[N+1], sum[N+1];
    int cry;
    
    scanf("%d", &datas);
    for (int n=0; n<datas; n++){
        // reset
        for (int i=0; i<N; i++) lint1[i]=lint2[i]=0;
        // input
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint1[degits-i-1]= buf[i]-'0';
        }
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint2[degits-i-1]= buf[i]-'0';
        }
        // calc
        cry=0;
        for (int i=0; i<N; i++){
            sum[i] = lint1[i]+lint2[i] + cry;
            cry = sum[i]>9 ? 1:0;
            if (cry) sum[i] -= 10;
        }
        // output
        if (cry){
            puts("overflow");
        } else {
            bool zero=true;
            if (cry) puts("1");
            for (int i=N-1; i>=0; i--){
                if (zero && sum[i] != 0) zero=false;
                if (!zero) printf("%d", sum[i], i);
            }
            printf("\n");
        }
        
    }
    
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    string one,two,ans;
    cin >>one>>two;
    int os = one.size()-1, ts = two.size()-1;
    int ls = (os>ts)?os:ts;
    int t = 0;
    for(int i=0; i<=ls; i++){
      if(i<=os && i<=ts){t = one[os-i]+two[ts-i]-'0'*2+t/10;}
      else if(i<=os){t = one[os-i]-'0'+t/10;}
      else if(i<=ts){t = two[ts-i]-'0'+t/10;}
      ans+=(t%10)+'0';
    }
    if(t/10){ans+='1';}
    if(ans.size()>80){cout <<"overflow"<<endl;}
    else{
      for(int i=ans.size()-1; i>=0; i--){
	cout <<ans[i];
      }
      cout <<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef vector <int> vi;
typedef vector <string> vs;

string right(string &text, int n){
	int length = text.size();
	string tmp;
	tmp = text.substr(length-n, n);
	text = text.substr(0, length-n);
	return tmp;
}

long str2lng(string text){
	stringstream ss;
	ss<<text;
	long tmp;
	ss>>tmp;
	return tmp;
}

string lng2str(long n){
	stringstream ss;
	ss<<n;
	string text;
	ss>>text;
	return text;
}

string lng2str8(long n){
	stringstream ss;
	ss<<setw(10)<<setfill ('0')<<n;
	string text;
	ss>>text;
	return text;
}

vi longstr2num(string text){
	vi buf;
	while (!text.empty()){
		if (text.size()>=8)
			buf.push_back(str2lng(right(text, 8)));
		else{
			buf.push_back(str2lng(text));
			text="";
		}
	}
	return buf;
}

int main(void){
	int n;
	cin>>n;
	for (int i=0; i<n; i++){
		string s1, s2;
		cin>>s1>>s2;
		vi tmp, tmp1 = longstr2num(s1), tmp2 = longstr2num(s2);
		int size1 = tmp1.size(), size2 = tmp2.size(), size=max(size1, size2);
		long s, c = 0;
		for (int j=0; j<size; j++){
			s = c;
			if (j<size1) s += tmp1[j];
			if (j<size2) s += tmp2[j];
			
			tmp.push_back(s%100000000);
			c = s / 100000000;
		}
		if (c != 0)	tmp.push_back(c);

		stringstream buf;
		for (int j=tmp.size()-1; j>=0; j--)
			if (j != tmp.size()-1)
				buf<<setfill('0')<<setw(8)<<tmp[j];
			else
				buf<<tmp[j];
		string str;
		buf>>str;
		if (str.size()>80) cout<<"overflow"<<endl;
		else cout<<str<<endl;
	}
	return 0;
}

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

int main(){
int n,ans[100],kuri,i,j,ap,bp;
char a[1000],b[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%s",a,b);
if(strlen(a)>80||strlen(b)>80){
printf("overflow\n");
continue;
}
ap=strlen(a)-1;
bp=strlen(b)-1;
j=0;
kuri=0;
while(ap>=0||bp>=0){
ans[j]=kuri;
if(ap>=0)ans[j]+=a[ap];
if(bp>=0)ans[j]+=b[bp];
kuri=ans[j]/10;
ans[j]%10;
j++;
ap--;
bp--;
}
if(kuri==1)ans[j]==1;
else j--;
if(j>=80){
printf("overflow\n");
continue;
}
for(;j>=0;j--){
printf("%d",ans[j]);
}
printf("\n");
}
return 0;
}