Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

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

using namespace std;

char c[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

int main() {
	int n; cin >> n;
	string s1, s2;
	
	for (int i=0; i<n; i++) {
		cin >> s1 >> s2;
		reverse(s1.begin(), s1.end());
		reverse(s2.begin(), s2.end());
		
		string s = "";
		
		if (s1.size() == s2.size()) {
			int r = 0, t = 0;
			for (int i=0; i<(int)s1.size(); i++) {
				int x = s1[i]-c[0], y = s2[i]-c[0];
				int z = x + y + t;
				r = z%10;
				t = z/10;
				s += c[r];
			}
			if (t) s += c[t];
		} else if (s1.size() > s2.size()) {	
			int r = 0, t = 0;
			for (int i=0; i<(int)s2.size(); i++) {
				int x = s1[i]-c[0], y = s2[i]-c[0];
				int z = x + y + t;
				r = z%10;
				t = z/10;
				s += c[r];
			}
			if (t) {
				for (int i=(int)s2.size(); i<(int)s1.size(); i++) {
					int z = s1[i]-c[0]+t;
					r = z%10;
					t = z/10;
					s += c[r];
				}
				if (t) s += c[t];
			} else {
				for (int i=(int)s2.size(); i<(int)s1.size(); i++) s += c[s1[i]-c[0]];
			}
		} else {
			int r = 0, t = 0;
			for (int i=0; i<(int)s1.size(); i++) {
				int x = s1[i]-c[0], y = s2[i]-c[0];
				int z = x + y + t;
				r = z%10;
				t = z/10;
				s += c[r];
			}
			if (t) {
				for (int i=(int)s1.size(); i<(int)s2.size(); i++) {
					int z = s2[i]-c[0]+t;
					r = z%10;
					t = z/10;
					s += c[r];
				}
				if (t) s += c[t];
			} else {
				for (int i=(int)s1.size(); i<(int)s2.size(); i++) s += c[s2[i]-c[0]];
			}
		}
		
		if (s.size() > 80) cout << "overflow" << endl;
		else {
			reverse(s.begin(), s.end());
			cout << s << endl;
		}
	}
	
	return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    int n;
    for(cin>>n;n--;){
        int k=0;
        string a,b;
        cin >> a;
        cin >> b;
        if(a.size() < b.size()) swap(a,b);//????????????a>b?????????
        while(b.size() < a.size()) b = '0' + b;//????????????a==b?????????
        for(int i=a.size()-1;i>=0;i--){//???????????????????????????
            a[i] += b[i] - '0' + k;
            if(a[i] > '9'){
                a[i]-=10;
                k = 1;
            }
            else k = 0;
        }
        if(k)   a="1"+a;//??°??????????????????????????????????¶?????????¨???
        if(a.size() > 80)   cout << "overflow" << "\n";
        else    cout << a << "\n";
    }
    return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
	int n;
	cin >>n;
	for(int i=0; i<n; i++){
		char num[2][90];
		int ans[90],up=0,t,l;
		cin >>num[0]>>num[1];
		int a = strlen(num[0]), b = strlen(num[1]), max = (b>a)? b:a, min = (b>a)? a:b;
		for(l=0; l<max; l++){
			if(l<min){t = (int)num[0][a-l-1]+(int)num[1][b-l-1]-48*2+up;}
			else if(a<b){t = (int)num[1][b-l-1]-48+up;}
			else{t = (int)num[0][a-l-1]-48+up;}
			if(t>9){t-=10;up = 1;}
			else{up = 0;}
			ans[l] = t;
		}
		if(up == 1){ans[max] = 1;l++;}
		if(l<=80)for(int m=l-1; m>=0; m--){cout <<ans[m];}
		else{cout<<"overflow";}
		cout <<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
	int d;
	for(cin>>d;d>0;d--){
		char ans[200];
		char n1[200];
		char n2[200];
		for(int i=0;i<=100;i++)ans[i]='0';
		scanf("%s",n1);
		scanf("%s",n2);
		int h1=strlen(n1)-1;
		int h2=strlen(n2)-1;
		int limit=max(h1,h2);
		int i;
		bool flg=false;
		for( i=0;i<=limit;i++,h1--,h2--){
			flg=false;
			int n1_tmp=0;
			int n2_tmp=0;
			if(h1>=0){
				n1_tmp=n1[h1]-'0';
			}
			if(h2>=0){
				n2_tmp=n2[h2]-'0';
			}
			int sum=n1_tmp+n2_tmp;
			if(sum>=10){
				ans[i+1]=ans[i+1]+1;
				sum=sum%10;
				flg=true;
			}
			ans[i]+=sum;
			if(ans[i]>'9'){
				ans[i]=ans[i]-(10);
				ans[i+1]+=1;
				flg=true;
			}
		}
		if(flg){
			i++;
		}
		ans[i]='\0';
		if(i>80)cout<<"overflow"<<endl;
		else{
			for(i--;i>=0;i--){
				cout<<ans[i];
			}
			cout<<endl;
		}
//		cout<<"size:"<<strlen(ans)<<endl;
	}
	return 0;
}

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

using namespace std;

void initiate(int* a)
{
	for (int j=0; j<100; j++) a[j] = 0;
}

int main()
{
	int a[101], b[101];
	char buf[101];
	
	int datasets;
	cin >> datasets;
	
	int len;
	
	for (int i=0; i<datasets; i++) {
		initiate(a); initiate(b);
		cin >> buf;
		len = strlen(buf);
		for (int j=0; j<len; j++) a[j] = static_cast<int>(buf[len-j-1] - 48);
		cin >> buf;
		len = strlen(buf);
		for (int j=0; j<len; j++) b[j] = static_cast<int>(buf[len-j-1] - 48);
		
		//test
		//for (int j=0; j<100; j++) cout << a[j];
		//cout << endl;
		//for (int j=0; j<100; j++) cout << b[j];
		//cout << endl;
		
		char carry = 0;
		for (int j=0; j<100; j++) {
			a[j] += b[j] + carry;
			carry = a[j] / 10;
			a[j] -= carry * 10;
		}
		
		bool nonzeroFlg = false;
		for (int j=99; j>=0; j--) {
			if (j>=80 && a[j]>0) {
				cout << "overflow";
				break;
			}
			if (a[j]>0) nonzeroFlg = true;
			if (nonzeroFlg) cout << a[j];
		}
		cout << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#define N 80

int main(void){
    char buf[N*2];
    int datas;
    int degits;
    int lint1[N*2], lint2[N*2], sum[N*2];
    int cry;
    
    scanf("%d", &datas);
    for (int n=0; n<datas; n++){
        // reset
        for (int i=0; i<N; i++) lint1[i]=lint2[i]=0;
        // input
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint1[degits-i-1]= buf[i]-'0';
        }
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint2[degits-i-1]= buf[i]-'0';
        }
        // calc
        cry=0;
        for (int i=0; i<N; i++){
            sum[i] = lint1[i]+lint2[i] + cry;
            cry = sum[i]>9 ? 1:0;
            if (cry) sum[i] -= 10;
        }
        // output
        if (cry){
            puts("overflow");
        } else {
            bool zero=true;
            if (cry) puts("1");
            for (int i=N-1; i>=0; i--){
                if (zero && sum[i] != 0) zero=false;
                if (!zero) printf("%d", sum[i], i);
            }
            printf("\n");
        }
    }
    
    return 0;
}