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 <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;


int a[1000],b[1000],c[1000];
string s;

int main(){
	int n;
	cin>>n;
	rep(i,n){
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		cin>>s;
		//cout<<s<<endl;
		//cout<<s.size()<<endl;
		if(s.size()>80){
			cout<<"overflow\n";
			cin>>s;
			continue;
		}
		rep(j,s.size()){
			a[90-j]=s[s.size()-j-1]-'0';
			//cout<<s[s.size()-j-1]-'0';
		}
		//cout<<a[87]<<endl;
		cin>>s;
		if(s.size()>80){
			cout<<"overflow\n";
			continue;
		}
		rep(j,s.size()){
			b[90-j]=s[s.size()-j-1]-'0';
		}
		/*
		rep(j,91) cout<<a[j];
		cout<<endl;
		rep(j,91) cout<<b[j];
		cout<<endl;
		*/
		int t=0;
		for(int j=90;j>=0;j--){
			c[j]=(a[j]+b[j]+t)%10;
			if((a[j]+b[j]+t)>9) t=1;
			else t=0;
		}
		bool f=true;
		/*
		rep(j,91) cout<<c[j];
		cout<<endl;
		*/
		rep(j,91){
			if(f&&c[j]!=0){
				f=false;
				if(j<=10){
					cout<<"overflow";
					break;
				}
			}
			if(!f) cout<<c[j];
		}
		cout<<endl;
		
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int a_len,b_len,m_len;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		a_len=in.size();
		b_len=in2.size();
		for(int i=0;i<a_len;i++){
			a[a_len-1-i]=in[i]-'0';
		}
		for(int i=0;i<b_len;i++){
			b[b_len-1-i]=in2[i]-'0';
		}
		m_len=max(a_len,b_len);
		if(m_len>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<m_len+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[m_len]!=0){
			if(m_len>79){
				cout<<"overflow"<<endl;
				continue;
			}
			cout<<ans[m_len];
		}
		for(int i=0;i<m_len;i++){
			cout<<ans[m_len-1-i];
		}cout<<endl;
		
		
		
	}
	
	
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#define	BCD_SIZE	96

int checkOverFlow(char *numStr) {
	return strlen(numStr) > 80;
}

template <typename T> void mySwap(T &a, T &b) {
	T t = a; a = b; b = t;
}

template <typename T> void reverseArray(T a[], int n) {
	for (int i = n / 2 - 1; i >= 0; --i) { mySwap(a[i], a[n - i - 1]); }
}

void str2bcd(char *str, int n) {
	int len = (int)strlen(str), i;
	reverseArray(str, len);
	for (i = 0; i < len; ++i) { str[i] &= 0xf; }
	for (; i < n; ++i) { str[i] = 0; }
}

void bcd2str(char *bcd, int n) {
	int len;
	for (int i = n - 1; i >= 0 && bcd[i] == 0; --i) { len = i; }
	reverseArray(bcd, len);
	for (int i = 0; i < len; ++i) { bcd[i] |= 0x30; }
}

void calcLargeIntSum(char sumStr[], char numStr[][BCD_SIZE], int numNum) {
	char carry = 0;
	for (int i = 0; i < numNum; ++i) { str2bcd(numStr[i], BCD_SIZE); }
	for (int i = 0; i < BCD_SIZE; ++i) {
		sumStr[i] = carry;
		for (int j = 0; j < numNum; ++j) { sumStr[i] += numStr[j][i]; }
		carry = sumStr[i] / 10;
		sumStr[i] %= 10;
	}
	bcd2str(sumStr, BCD_SIZE);
	for (int i = 0; i < numNum; ++i) { bcd2str(numStr[i], BCD_SIZE); }
}

int main() {
	char numStr[2][BCD_SIZE], sumStr[BCD_SIZE];
	int dataSet;
	for (scanf("%d", &dataSet); dataSet > 0; --dataSet) {
		scanf("%82s\n%82s", numStr[0], numStr[1]);
		if (checkOverFlow(numStr[0]) || checkOverFlow(numStr[1])) {
			puts("overflow");
			continue;
		}
		calcLargeIntSum(sumStr, numStr, 2);
		if (checkOverFlow(sumStr)) {
			puts("overflow");
			continue;
		}
		printf("%s\n", sumStr);
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <math.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int kk = 0; kk < n; ++kk)
	{
		int A[1000] = {},B[1000] = {},C[1000] = {},keta = 0;
		string in1,in2;
		cin >> in1 >> in2;
		if(in1.size() >= 80 || in2.size() >= 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < in1.size(); ++i)
			A[in1.size()-i] = (int)(in1[i]-'0');
		for (int i = 0; i < in2.size(); ++i)
			B[in2.size()-i] = (int)(in2[i]-'0');
		bool flag = 1;
		for (int i = 1; i < 1000; ++i)
		{
			C[i] += A[i]+B[i];
			if(C[i] >= 10)
			{
				C[i+1] += C[i]/10;
				C[i] -= C[i]/10*10;
			}
			if(C[i] != 0)
				keta = i;
		}
		if(keta >= 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = keta; i > 0; --i)
		{
			cout << C[i];
		}
		cout << endl;
	}
}