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

string pls(string a,string b){
	string ret;
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	if(a.size()<b.size())swap(a,b);
	while(a.size()!=b.size())b+='0';
	while(a.size()+1!=ret.size())ret+='0';
	for(int i=0;i < a.size(); i++){
		ret[i] = a[i] + b[i] + ret[i] - '0'*3;
		if(ret[i]>9){
			ret[i] = '0' + ret[i]%10;
			ret[i+1] = '1';
		}else{
			ret[i]= '0' + ret[i];
		}
	}
	
	reverse(ret.begin(),ret.end());
	if(~ret.find_first_not_of('0'))return ret.substr(ret.find_first_not_of('0'),ret.size()-ret.find_first_not_of('0'));
	else return "0";
}

int main(){
	string a,b;
	int n;
	
	cin >> n;
	while(n--){
		cin >> a >> b;
		if(pls(a,b).length()>80)cout << "overflow" << endl;
		else cout << pls(a,b) << endl;
	}
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;

int n;
char a[85],b[85],answer[86];
char aa[85],bb[85];
int na=0,nb=0;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		na=0,nb=0;
		//配列aa(bb)を'0'で初期化
		fill(aa,aa+85,'0');
		fill(bb,bb+85,'0');
		fill(a,a+85,0);
		fill(b,b+85,0);
		fill(answer,answer+85,0);
		scanf("%s%s",a,b);
		for(int i=0;a[i]!='\0';i++)
		{
			na++;
		}
		for(int i=0;b[i]!='\0';i++)
		{
			nb++;
		}
		//配列a(b)を右詰めでaa(bb)に収納する
		memcpy(aa+85-na,a,sizeof(char)*na);
		memcpy(bb+85-nb,b,sizeof(char)*nb);
		//以下足し算
		for(int j=84;j>=0;j--)
		{
			answer[j]+=aa[j]+bb[j]-'0';
			//繰り上げ
			if(answer[j]>'9')
			{
				answer[j-1]++;
				answer[j]-=10;
			}
		}
		int count=0;
		for(int j=0;(j<84)&&answer[j]=='0';j++)
		{
			count++;
		}
		if(count<5)
		{
			printf("overflow\n");
		}
		else
		{
		answer[85]='\0';//文字列終了のお知らせ
		memcpy(answer,answer+count,85-count+1);
		//出力
		printf("%s\n",answer);
		}
	}
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;

int main(){
	string s1,s2;
	int num;
	cin>>num;
	for(int j=0;j<num;j++){
		cin>>s1;
		cin>>s2;
		int size1=s1.size();
		int size2=s2.size();
		if(size1>80 || size2>80){
			cout<<"overflow"<<endl;
			continue;
		}
		if(size1>size2){
			for(int a=0;a<(size1-size2);a++){
				s2='0'+s2;
			}
		}else if(size1<size2){
			for(int a=0;a<(size2-size1);a++){
				s1='0'+s1;
			}
		}
		string ans="";
		int plus=0;
		for(int i=size1-1;i>=-1;i--){
			if(i==-1){
				if(plus!=0){
					ans=(char)(plus+'0')+ans;
					continue;
				}else{
					continue;
				}
			}
			int alt=(s1[i]-'0')+(s2[i]-'0')+plus;
			if(alt>=10){
				ans=(char)(alt-10+'0')+ans;
				plus=alt/10;
			}else ans=(char)(alt+'0')+ans;
		}
		if(ans.size()>80){
			cout<<overflow<<endl;
		}else{
			cout<<ans<<endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
int main(void){
    int n,ap,bp,cp,t;
    char a[81],b[81],c[81];
    scanf("%d",&n);
    while(~scanf("%s%s",&a,&b)){
        ap=strlen(a);
        bp=strlen(b);
        cp=sizeof(c)-1;
        c[cp]='\0';
        t=0;
        while((t||ap||bp)&&cp>0){
            t+=(ap?a[--ap]-'0':0)+(bp?b[--bp]-'0':0);
            c[--cp]='0'+(t%10);
            t/=10;
        }
        if(t)puts("overflow");
        else puts("%s",&c[cp]);
    }
    return 0;
}

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

using namespace std;

int main(){
	int N; cin >> N;
	for(int i = 0; i < N; i++){
		long double a, b;
		cin >> a >> b;
		if(log10(a + b) + 1 > 80){
			cout << "overflow" << endl; 
			return 0;
		}
		cout << a + b << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
//ðÇÁ·é
void addplace(unsigned int *a, unsigned int *last, int num){
	if( a == last ) return; //[·¬ÜÛÀ
	
	int carry = (*a * 10 + num) / 100000000;
	addplace(a+1, last, carry);
	*a = (*a * 10 + num) % 100000000;
}
bool trace(unsigned int *a, unsigned int *last){
	if( a == last ) return false; //[·¬ÜÛÀ
	if( !trace(a+1, last) ){
		if( *a > 0 ){
			std::cout << *a;
			return true;
		}
	}else{
		char b[11]={};
		sprintf(b,"%d",*a+100000000);
		std::cout<<b+1;
		return true;
	}
	return false;
}
void add(unsigned int *a, unsigned int *alast, unsigned int *b, int num=0){
	if( a == alast ) return; //[·¬ÜÛÀ
	
	int carry = (*a + *b + num) / 100000000;
	add(a+1, alast, b+1, carry);
	*a = (*a + *b + num) % 100000000;
}
int main(){
	int n;
	std::cin>>n;
	std::string a,b;
	std::getline(std::cin, a);//üsÇÝÌÄ
	for(;n--;){
		std::getline(std::cin, a);
		std::getline(std::cin, b);
		//uint ½è1 0000 0000-1ÜÅJEg·é
		unsigned int _a[11]={},_b[11]={};
		for(std::string::iterator it=a.begin();
			it!=a.end(); it++){
			addplace(_a, _a+10, *it-'0');
		}
		for(std::string::iterator it=b.begin();
			it!=b.end(); it++){
			addplace(_b, _b+10, *it-'0');
		}
		add(_a, _a+11, _b);
		if( _a[10] >= 1 ){
			std::cout<<"overflow\n";
		}else{
			trace(_a, _a+10);
			std::cout<<'\n';
		}
	}
}