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 <string>
#include <fstream>

using namespace std;

#define MAX_INT_LENGTH 80

//large integer upto 80 digits
struct largeInt{
    int vals[MAX_INT_LENGTH]; // MAX_INT_LENGTH digits
};

void toLargeInt(string str, largeInt &lv){
    int start = MAX_INT_LENGTH-str.length();
    for (int i = 0; i < MAX_INT_LENGTH; i++){
        if (i >= start)
            lv.vals[i] = (str[i-start] - '0');
        else
            lv.vals[i] = 0;
    }
}

largeInt addLargeInt(const largeInt &lv1, const largeInt &lv2){
    largeInt sum;
    int carry = 0;
    for (int i = MAX_INT_LENGTH-1; i >= 0; i--){
        int sub_sum = lv1.vals[i] + lv2.vals[i] + carry;
        sum.vals[i] = sub_sum % 10;
        carry = sub_sum / 10;
    }
    return sum;
}

string toString(const largeInt &v){
    string str(MAX_INT_LENGTH,'0');
    for (int i = 0; i < MAX_INT_LENGTH; i++)
        str[i] = v.vals[i] + '0';
    return str;
}

int main()
{
    ifstream cin("input.txt");
    
    // input data
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        string v1,v2;
        cin >> v1 >> v2;
        largeInt lv1, lv2;
        toLargeInt(v1,lv1);
        toLargeInt(v2,lv2);
        largeInt sum = addLargeInt(lv1,lv2);
        cout << toString(sum) << endl;
    }
   return 0;
}

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()-1, y = b.size()-1, t = 0, max = (x>y)?x:y;
		for(int i=0; i<max; i++){
			if(i<=x && i<=y){t = (int)a[x-i]+(int)b[y-i]-2*'0'+t/10;}
			else if(i<=x){t = (int)a[x-i]-'0'+t/10;}
			else if(i<=y){t = (int)b[y-i]-'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 <cmath>
#include <cstdlib>
#include <cstdio>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>



int main() {

  std::string a, b;
  long x[100] = {};
  long y[100] = {};
  long N;
  char temp;
  long len;

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> a >> b;
    for(int j = 0; j < 100; ++j) {
      x[j] = y[j] = 0;
    }
    for(int j = 0; j < a.size(); ++j) x[j] = a[ a.size()-j-1 ] - '0';
    for(int j = 0; j < b.size(); ++j) y[j] = b[ b.size()-j-1 ] - '0';

    temp = 0;
    for(int j = 0; j < 100; ++j) {
      temp = x[j] + y[j] + temp;
      x[j] = (temp % 10);
      temp /= 10;
    }

    len = std::max(a.size(), b.size());
    if( x[len] != 0 ) {
      if( len == 80 ) { 
	std::cout << "overflow" << std::endl;
	continue;
      }
      for(int j = len; j >= 0; --j) {
	std::cout << x[j];
      }
      std::cout << std::endl;
      continue;
    }
    for(int j = len-1; j >= 0; --j) {
      std::cout << x[j];
    }
    std::cout << std::endl;
  }
    
  return 0;
}

C++: #include<string>
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;
string a,b,sum;
void check(int z,int x);
int A,B;
int main(void){

    int n;
    cin>>n;
    while(n--){
        a="",b="",sum="";

        cin>>a>>b;
        cout<<"a="<<a<<"b="<<b<<"sum="<<sum<<endl;
        if(a.length()>80||b.length()>80){
            sum="overflow";
            goto end;
        }
        A=a.length(),B=b.length();
        //cout<<A<<B<<endl;
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        if(A<B)swap(A,B),swap(a,b);
        for(int i=0;i<=A-B;i++){
            b+="0";
        }
        check(0,0);
        //cout<<sum<<endl;
        if(sum.length()>80){
            sum="overflow";
            goto end;
        }
        reverse(sum.begin(),sum.end());
        end:;
        cout<<sum<<endl;
    }
    return 0;
}

void check(int z,int x){
    int i;


    if(a[z]==0)a[z]='0';
    if(b[z]==0)b[z]='0';
    //cout<<a[z]<<"."<<b[z]<<"."<<sum<<endl;
    //cout<<"--"<<z<<endl;
    if(z==80||(z>A&&z>B&&x==1)||(z>=A&&z>=B&&x==0)){
            x=0;
            return;
    }
    i=(int)a[z]-'0' + (int)b[z]-'0' + x,x=0;
    //cout<<"*"<<i<<endl;
    //cout<<"-"<<z<<endl;
    if(i>=10)x=1,i-=10;
    sum+=i+'0';
    //cout<<"+"<<sum<<endl;

    check(z+1,x);

}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int number(char c){
	if(c>='0'&&c<='9')
	return (c-'0');
	else
		return 0;
}
int main(){
	int n;
	cin>>n;
	
	while(n>0){
		string a;
		string b;
	int k=0;
	int c=0;
	string s="";
	
		cin>>a;
		cin>>b;
		
	
	for(int i=a.length()-1,j=b.length()-1;i>=0||j>=0;i--,j--){
		int d;
		int n1=0,n2=0;
		if(i>=0)
			n1=number(a[i]);
		if(j>=0)
			n2=number(b[j]);
		d=n1+n2+k;
		k=d/10;
		d=d%10;
		c++;
		s=to_string(d)+s;
	}
	if(c>=80&&k>0)
		cout<<"overflow"<<endl;
		else{
			if(k>0){
		s=to_string(k)+s;
			}
		cout<<s<<endl;
		}
		n--;
	}
}