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<iostream>
#include<vector>
#include<algorithm>
using namespace std;

class BigInt{
public:
  vector<int> value;
  int sign;

  void set(int n){
    value.clear();
    if(n==0){
      sign = 0;
      value.push_back(0);
    }else if(n<0){
      sign = -1;
      n *= -1;
    }else{
      sign = 1;
    }
    while(n){
      value.push_back(n%10);
      n/=10;
    }
  }

  void set(string str){
    value.clear();
    if(str[0]=='-')sign = -1;
    else if(str[0]=='0')sign = 0;
    else sign = 1;
    int a = 0;
    if(sign<0)a = 1; 
    for(int i=str.size()-1;i>=a;i--){
      value.push_back(str[i]-'0');
    }
  }

  void print(void){
    if(sign<0)cout << '-';
    for(int i=value.size()-1;i>=0;i--)cout << value[i];
    cout << endl;
  }

  BigInt add(BigInt x){
    int max,min;
    BigInt ans;

    if(sign == 0)return x;
    if(x.sign == 0)return *this;
       
    ans.sign = 1;
    ans.value.clear();
    if(value.size()>x.value.size()){
      max = value.size();
      min = x.value.size();
      for(int i=0;i<min;i++)ans.value.push_back(value[i]+x.value[i]);
      for(int i=min;i<max;i++)ans.value.push_back(value[i]);
    }else{
      max = x.value.size();
      min = value.size();
      for(int i=0;i<min;i++)ans.value.push_back(value[i]+x.value[i]);
      for(int i=min;i<max;i++)ans.value.push_back(x.value[i]);
    }
    for(int i=0;i<(int)ans.value.size()-1;i++){
      while(ans.value[i]>=10){
	ans.value[i]-=10;
	ans.value[i+1]++;
      }
    }
    if(ans.value[ans.value.size()-1]>=10){
      ans.value[ans.value.size()-1]-=10;
      ans.value.push_back(1);
    }
    return ans;
  }

};

int main(){
  int n;
  string n1,n2;
  BigInt a1,a2,res;

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> n1;
    cin >> n2;

    a1.set(n1);
    a2.set(n2);

    res = a1.add(a2);

    if(res.value.size()>80)cout << "overflow" << endl;
    else res.print();
  }
}

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

using namespace std;


int main(){

	int n;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		string a, b;
		cin >> a;
		cin >> b;

		if(b.size() > a.size()){
			string temp;
			temp = a;
			a = b;
			b = temp;
		}
		if( (a[0] + b[0] - '0') > '9' ){
			string A;
			A += '0';
			A += a;
			a = A;
		}
		if(a.size() > 80){
			cout << "overflow" << endl;
		}else{
			for(int j=0 ; j<b.size() ; j++){
				a[a.size()-1-j] = a[a.size()-1-j] + b[b.size()-1-j] -'0';
				if(a[a.size()-1-j] > '9'){
					a[a.size()-1-j] -= 10;
					for(int l=0 ; l<a.size()-1 ; l++){
						a[a.size()-2-l] ++;
						if(a[a.size()-2-l] > '9'){
							a[a.size()-2-l] -= 10;
						}else break;
					}
				}
			}
		}
		cout << a << endl;

		}

	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
int n,i,j,k,l,m,u,v,c;
string s,t,w;
cin>>n;
for(k=0;k<n;k++){
cin>>s>>t;
l=s.size();if(l>80){cout<<"overflow"<<endl;continue;}
m=t.size();if(m>80){cout<<"overflow"<<endl;continue;}
if(l<m){w=s;s=t;t=w;c=l;l=m;m=c;}
for(c=0,i=l-1,j=m-1;j>=0;i--,j--){
u=s[i]-48;v=t[j]-48;
u+=(v+c);
if(c=(u>9))u-=10;
s[i]=u+48;
}
for(;i>=0;i--){
u=s[i]-48;
u+=c;
if(c=(u>9))u-=10;
s[i]=u+48;
}
if(l>=80&&c==1){cout<<"overflow"<<endl;continue;}
if(c==1)cout<<"1";cout<<s<<endl;
}
return 0;
}

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

using namespace std;

int string_to_d(const string &s){
	int num = 0;
	if(!s.empty())
	for(int i=s.size()-1;i>=0;--i){
		if('1'<=s[i]&&s[i]<='9') num += (s[i]-'0')*pow(10,(s.size()-i-1));
	}
	return num;
}

int main(void){
	int n;
	cin >> n;
	for(int a=0;a<n;++a){
		string s1,s2;
		cin >> s1 >> s2;
		int ex1num[10];//8*10=80桁
		int ex2num[10];
		int sum[10] = {0};
		for(int i=s1.size();i<80;++i) s1="0"+s1;
		for(int i=s2.size();i<80;++i) s2="0"+s2;
		for(int i=0;i<10;++i){
			sum[i] = 0;
			ex1num[i] = string_to_d(s1.substr((10-i-1)*8,8));
			ex2num[i] = string_to_d(s2.substr((10-i-1)*8,8));
		}
		int carry = 0;
		for(int i=0;i<10;++i){
			sum[i] = (ex1num[i]+ex2num[i]+carry)%(int)1e+008;
			carry = floor((ex1num[i]+ex2num[i]+carry)/(int)1e+008);
		}
		if(carry>0){
			cout << "overflow\n";
			continue;
		}
		bool zeroshow = false;
		for(int i=9;0<=i;--i){
			if(zeroshow&&sum[i]!=0) for(int j=0;j<7-(int)log10(sum[i]);j++) cout << "0";
			if(zeroshow&&sum[i]==0) for(int j=0;j<8;j++) cout << "0";
			if(sum[i]!=0) cout << sum[i];
			if(sum[i]>0) zeroshow = true;
		}
		cout << "\n";
	}
	return 0;
}