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<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<stack>
#include<set>
#include<cmath>

#define REP(i,s,e) for(int i=int(s);i<int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-6

using namespace std;

int main(){

	int n;
	cin >> n;

	rep(i,n){

	string a,b;
	cin >> a >> b;

	int sa=a.size(); int sb=b.size(); int p=max(sa,sb);
	vector<char>s;

	if(sa>80 || sb>80)
	cout << "overflow" << endl;
	else{

	string z;
	if(sa>sb){
	rep(j,sa-sb)
	z+='0';
	b=z+b;
	}
	if(sb>sa){
	rep(j,sb-sa)
	z+='0';
	a=z+a;
	}

    int c=0;
	rep(j,p){

	c+=(a[p-1-j]-'0')+(b[p-1-j]-'0');

	s.push_back(c%10+'0');
	c=c/10;

	}

    if(c==1) s.push_back(c%10+'0');

    if(s.size()<=80){
    rep(k,s.size()) cout << s[s.size()-1-k];
    cout << endl;
    }
    else
    cout << "overflow" << endl;

    s.clear();

	}

	}

	return 0;
}

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

int add(char *retstr, char *str1, char *str2){

	int str1len=strlen(str1);
	int str2len=strlen(str2);
	char ad,i1,i2;
	char offset1,offset2;
	char c1,c2;
	bool carry=false;

	if(str1len>str2len){
		offset1=0;
		offset2=str1len-str2len;
	}else{
		offset1=str2len-str1len;
		offset2=0;
	}

	for(int i=max(str1len,str2len);i<82;++i){
		retstr[i]=0;
	}

	for(int i=max(str1len,str2len)-1;i>=0;--i){

		if(i-offset1>=0){c1=str1[i-offset1];}else{c1=48;}
		if(i-offset2>=0){c2=str2[i-offset2];}else{c2=48;}
		i1=c1-48;i2=c2-48;//Ascii code to Number

		ad=i1+i2;
		if(carry)++ad;//桁上がり分

		if(ad>=10){ad %= 10; carry=true;}else{carry=false;}
		retstr[i+1]=ad+48;
	}

	if(carry){
		retstr[0]=1+48;
	}else{
		retstr[0]=0+48;
		for(unsigned int i=0;i<strlen(retstr)-1;++i){
			retstr[i]=retstr[i+1];
		}
		retstr[strlen(retstr)-1]=0;
	}

	if(strlen(retstr)>=81)return 1;

	return 0;

}

int main(){

	int n,overflowed;
	char str1[82], str2[82], retstr[82];

	cin>>n;

	for(int i=0;i<n;++i){

		cin>>str1;
		cin>>str2;

		if(strlen(str1)>=81||strlen(str2)>=81){
			cout<<"overflow"<<endl;
		}else{
			overflowed=add(retstr, str1, str2);
			if(overflowed){
				cout<<"overflow"<<endl;
			}else{
				cout<<retstr<<endl;
			}
		}
	}

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k,l;
    bool check;

    cin >> n;
    rep(i,n){
        char c1[81], c2[81];
        int i1[81] = {0}, i2[81] = {0};
        int ans[82] = {0};
        check = false;
        k = 0; l = 0;
        cin >> c1 >> c2;
        for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k++] = c1[j] - '0';
            }
            if(j <= strlen(c2) - 1){
                i2[l++] = c2[j] - '0';
            }
        }
        rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[80] != 0){
            cout << "overflow";
        }else{
            for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }
        }
        cout << endl;
    }
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		//getchar();
		scanf("%s",num2);
		//getchar();
		l1 = strlen(num1);
		//cout << l1 << endl;
		l2 = strlen(num2);
		//printf("%s %s\n",num1,num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((a1[j] + a2[j] + kuriagari)>=10)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool p=false;
		/*for(int i=0;i<1002;i++)
		{
			cout << ans[i];
		}
		cout << endl;*/
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				p=true;
				break;
			}
		}
		if(p)
		{
			printf("overflow");
			continue;
		}
		else
		{
			for(j=79;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}