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<stdio.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;
char s[100],t[100];
int a[100],b[100],c[110];
int main()
{
    int T,d=0;
    int n=1;
    scanf("%d%*c",&T);
    while(T--)
    {
        memset(s,0x00,sizeof(s));
        memset(t,0x00,sizeof(t));
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        memset(c,-1,sizeof(c));
        scanf("%s",s);
        scanf("%s",t);
        if(strlen(s)>80||strlen(t)>80)
           {
               printf("overflow\n");
        break;
           } 
        int l=0;
        for(int i=strlen(s)-1; i>=0; i--)
            a[l++]=s[i]-'0';
        int k=0;
        for(int i=strlen(t)-1; i>=0; i--)
            b[k++]=t[i]-'0';
        if(l<k)
            l=k;
        int v=0;
        for(int i=0; i<=l; i++)
        {
            if(a[i]+b[i]+v>=10)
            {
                c[i]=a[i]+b[i]+v-10;
                v=1;
            }
            else
            {
                c[i]=a[i]+b[i]+v;
                v=0;
            }
        }
        if(c[l]!=0&&l>80)
        {
            printf("overflow\n");
            break;
        }
        else if(c[l]==0&&l-1>80)
        {
            printf("overflow\n");
            break;
        }
        if(c[l]!=0)
            printf("%d",c[l]);
        for(int i=l-1;i>=0;i--)
            printf("%d",c[i]);
        printf("\n");
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <utility>
using namespace std;
int toNumber(char c){
	switch (c)
	{
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	}
	return 0;
}
int main()
{
	int n, sa, sb, k, r, i;
	string a, b;
	int sum[100] = {};
	cin >> n;
	while (n--){
		cin >> a >> b;
		if (a.size() < b.size()) swap(a, b);
		sa = a.size();
		sb = b.size();
		if (sa > 80){
			cout << "overflow\n";
			continue;
		}
		k = i = 0;
		for (; i < sa; ++i){
			if (i < sb) k = toNumber(a[sa - 1 - i]) + toNumber(b[sb - 1 - i]) + k;
			else 		k = toNumber(a[sa - 1 - i]) + k;
			r = k % 10;
			k = k / 10;
			sum[i] = r;
		}
		if (0 != k) sum[i] = k;
		else --i;
		if (i >= 80){
			cout << "overflow\n";
			continue;
		}
		for (int d = i; d >= 0; --d)
			cout << sum[d];
		cout << "\n";
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  int N; cin >> N;

  for(int i=0; i<N; i++){
    string S1, S2;
    cin >> S1 >> S2;
    int l1 = S1.length(), l2 = S2.length();

    string S; int carry = 0;
    for(int i=0; i<max(l1, l2)+1; i++){
      if(i < l1 && i < l2){
        int s1 = S1[l1-1-i] - '0', s2 = S2[l2-1-i] - '0';
        char a = (s1+s2+carry) % 10 + '0';
        S.push_back(a);
        if(s1+s2+carry >= 10) carry = 1;
        else carry = 0;
      } else if (i == max(l1, l2)){
        if(carry == 1) S.push_back('1');
      } else if (i >= l1){
        int s2 = S2[l2-1-i] - '0';
        char a = (s2+carry) % 10 + '0';
        S.push_back(a);
        if(s2+carry >= 10) carry = 1;
        else carry = 0;
      } else if(i >= l2){
        int s1 = S1[l1-1-i] - '0';
        char a = (s1+carry) % 10 + '0';
        S.push_back(a);
        if(s1+carry >= 10) carry = 1;
        else carry = 0;
      }
    }
    reverse(S.begin(), S.end());

    if(S.length()>80){
      cout << "overflow" << endl;
    } else {
      cout << S << endl;
    }
  }
}

C++: 
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(){
    
    int ap,bp,cp,t;
    char a[999],b[999],c[82];
    
    scanf("%d",&t);
    while (scanf("%s %s",a,b)) {
        ap = strlen(a);
        bp = strlen(b);
        c[cp=(ap>80 || bp>80)? 0:81]='\0';
        t=0;
        while ((t||ap||bp) && cp>0) {
            t +=(ap? a[--ap]-'0':0) + (bp? b[--bp]-'0':0);
            c[--cp] = t%10 + '0';
            t /=10;
        }
        if(cp>0) printf(&c[cp]);
        else printf("overflow");
        printf("\n");
    }
    
    return 0;
    
}

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

string sum( string sa, string sb ){
    string ret = "0";
    int len = max( sa.size(), sb.size() );
    reverse( sa.begin(), sa.end() );
    reverse( sb.begin(), sb.end() );
    while( sa.size()<len )  sa += '0';
    while( sb.size()<len )  sb += '0';
    for( int i=0; i<len; i++ ){
        ret[i] += sa[i]-'0' + sb[i]-'0';
        if( ret[i] > '9' ){
            ret += '1';
            ret[i] -= 10;
        }else if( i!=len-1 ){
            ret += '0';
        }
    }
    reverse( ret.begin(), ret.end() );
    if( ret.size() > 80 ){
        ret = "overflow";
    }
    return ret;
}

int main(){
    int n;
    cin >> n;
    while(n--){
        string a, b;
        cin >> a >> b;
        cout << sum(a, b) << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	string a,b,c;
	int n;
	cin>>n;
	for(int fjal=0;fjal<n;fjal++){
	cin>>a>>b;
	c.clear();
	if(a.size()<b.size())swap(a,b);
	int as=a.size();
	while(as!=b.size())b="0"+b;
	//cout<<a<<" "<<b;
	bool kuri=false;
	for(int i=as-1;i>=0;i--){
		int _a=a[i]-'0',_b=b[i]-'0',ans=_a+_b;
		if(kuri)ans++;
		if(ans>=10){
			kuri=true;
			ans-=10;
		}
		else {kuri=false;}
		c.push_back(ans+'0');
	}
		if(kuri)c.push_back('1');
	
		if(c.size()<80){for(int i=c.size()-1;i>=0;i--)cout<<c[i]-'0';
		cout<<endl;
		}
		else cout<<"overfllow"<<endl;
	}
	return 0;
}

C++: //#define _USE_MATH_DEFINES
#include <iostream>
//#include <stdio.h>
//#include <iomanip>
#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <cmath>
//#include <time.h>

using namespace std;


int main(){

	int n, k1, k2, left, right, buf, flag;
	string s1, s2 , out;
	int aa1[10], aa2[10], ans[10];



	cin >> n;

	for (int i = 0; i < n; i++){
		for (int i = 0; i < 10; i++){
			aa1[i] = 0;
			aa2[i] = 0;
			ans[i] = 0;
		}
		flag = 0;

		cin >> s1 >> s2;
		k1 = s1.size();
		k2 = s2.size();

		if (k1 > 80 || k2 > 80){
			cout << "overflow" << endl;
		}
		else{
			buf = 8 - k1 % 8;
			for(int i = 0; i < buf; i++){
				s1.insert(0,"0");
			}
			buf = 8 - k2 % 8;
			for (int i = 0; i < buf; i++){
				s2.insert(0, "0");
			}
			left = s1.size()-8;
			for (int i = 0; i < 10; i++){
				aa1[i] = atoi(s1.substr(left, 8).c_str());
				left -= 8;
				if (left < 0)break;
			}
			left = s2.size() - 8;
			for (int i = 0; i < 10; i++){
				aa2[i] = atoi(s2.substr(left, 8).c_str());
				left -= 8;
				if (left < 0)break;
			}

			for (int i = 0; i < 10; i++){
				ans[i] += aa1[i] + aa2[i];
				if (ans[i] >= 100000000){
					ans[i + 1] += 1;
					ans[i] -= 100000000;
				}
			}
			if (ans[10] >= 100000000){
				cout << "overflow" << endl;
			}
			else{
				for (int i = 9; i >= 0; i--){
					if (flag == 0){
						if (ans[i] != 0){
							printf("%d",ans[i]);
							flag = 1;
						}
					}
					else{
						printf("%08d", ans[i]);
					}
				}
				cout << endl;
			}
		}

	}
	
	return 0;
}