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;

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s1, s2;
		int l1, l2;
		cin >> s1 >> s2;
		l1 = s1.length();
		l2 = s2.length();
		if (l1>80 || l2 > 80)
			cout << "overflow";
		else
		{
			int result[100], r = 0, m = max(l1, l2), t;
			reverse(s1.begin(), s1.end());
			reverse(s2.begin(), s2.end());
			s1.resize(m + 1, '0');
			s2.resize(m + 1, '0');
			for (int j = 0; j < m; j++)
			{
				t = r + s1[j] + s2[j] - 48 * 2;
				result[j] = t % 10;
				r = t / 10;
			}
			if (r == 1)
				result[m++] = 1;
			if (m>80)
				cout << "overflow";
			else
				for (int j = m - 1; j >= 0; j--)
					cout << result[j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main(void)
{
	int x,y,n,m,sum;
	scanf("%d",&n);

	for(int t=0;t<n;t++)
	{
		scanf("%d",&x);
		scanf("%d",&y);

		sum=x+y;
		int keta;
		keta=sum/10;
		for(m=1;m<79;m++)
		{
			keta=keta/10;
		}

		if(keta>=0)
		{
			printf("overflow\n");
		}
		else
		{
			printf("%d",sum);
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        char moneywrite[2][1000];
        int money[2][1000];
        int stl[2]={0,0};
        int stlstl;
        int sum[81];
        scanf("%s",moneywrite[0]);
        scanf("%s",moneywrite[1]);
        for(int j=0;moneywrite[0][j]!='\0';j++){
            money[0][j]=moneywrite[0][j]-'0';
            stl[0]++;
        }
        for(int j=0;moneywrite[1][j]!='\0';j++){
            money[1][j]=moneywrite[1][j]-'0';
            stl[1]++;
        }
        if(stl[0]>stl[1]){
            stlstl=stl[0];
            int p;
            p=stl[0]-stl[1];
            for(int j=0;j<stl[0];j++){
                money[1][stl[0]-j]=money[1][stl[0]-j-p];
            }
            for(int k=0;k<p;k++)
                money[1][k]=0;
        }
        else if(stl[1]>stl[0]){
            stlstl=stl[1];
            int p;
            p=stl[1]-stl[0];
            for(int j=0;j<stl[1];j++){
                money[0][stl[1]-j]=money[0][stl[1]-j-p];
            }
            for(int k=0;k<p;k++)
                money[0][k]=0;
        }
        else{
            stlstl=stl[1];
        }
/*
        for(int j=0;j<stlstl;j++)
            printf("[%d][%d]\n",money[0][j],money[1][j]);
*/
        if(81<=stlstl){
            printf("overflow");
            goto exit;
        }
        for(int j=stlstl-1;0<=j;j--){
            sum[j]=money[0][j]+money[1][j];
            if(10<=sum[j]){
                if(stlstl==80&&j==0){
                    printf("overflow");
                    goto exit;
                }
                else if(j==0){
                    printf("1");
                    sum[j]%=10;
                }
                else{
                    money[0][j-1]++;
                    sum[j]%=10;
                }
            }
        }
        for(int j=0;j<stlstl;j++)
            printf("%d",sum[j]);
exit:
        puts("");
    }
    return 0;
}

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

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    char str1[81];
    char str2[81];
    string ans = "";
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1) - 1, m2 = strlen(str2) - 1, pre = 0;
    int m = max(m1, m2);
    for(int j = 0; j <= m; j++){
      int sum = pre;
      sum += (m1 >= 0) ? str1[m1--] - '0' : 0;
      sum += (m2 >= 0) ? str2[m2--] - '0' : 0;
      pre = sum / 10;
      sum -= pre * 10;
      ans += '0' + sum;
    }
    if(pre > 0)
      ans += '0' + pre;
    reverse(ans.begin(), ans.end());
    if(ans.length() > 80)
      cout << "overflow" << endl;
    else
      cout << ans << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int a[81];
	int b[81];
	int ans[81];
	int n;
	cin>>n;
	rep(j,n){
		rep(i,81){
			a[i]=b[i]=ans[i]=0;
		}
		string s[2];
		cin>>s[0];
		int cnt=80;
		for(int i=s[0].size()-1;i>=0;i--){
			a[cnt]=s[0][i]-'0';
			cnt--;
		}
		cin>>s[1];
		if(s[0].size()>80 || s[1].size()>80){
			cout<<"overflow"<<endl;
			continue;
		}
		cnt=80;
		for(int i=s[1].size()-1;i>=0;i--){
			b[cnt]=s[1][i]-'0';
			cnt--;
		}
		bool check=true;
		for(int i=80;i>=0;i--){
			ans[i]=a[i]+b[i];
			//cout<<i<<":"<<a[i]<<"+"<<b[i]<<"="<<ans[i]<<endl;
			if(ans[i]>=10){
				a[i-1]++;
				ans[i]%=10;
			}
		}
		if(ans[0]>0){
			cout<<"overflow"<<endl;
			check=false;
		}
		int ite=0;
		rep(i,81){
			if(ans[i]!=0){
				ite=i;
				break;
			}
		}
		if(check){
			if(ite!=0){
				for(int i=ite;i<81;i++){
					cout<<ans[i];
				}
				cout<<endl;
			}else{
				cout<<0<<endl;
			}
		}
	}
	return 0;
}

C++: #include <cstdio>
  2 #include <iostream>
  3 #include <vector>
  4 #include <cstring>
  5 using namespace std;
  6 
  7 int main(){
  8   int n;
  9   cin >> n;
 10   while( n-- > 0 ){
 11     string num1, num2;
 12     cin >> num1 >> num2;
 13     char sum[101];
 14     int degit = 0;
 15     for( int i = 0; i < 101; i++ ) sum[i] = '0';
 16     for( int i = 0; i < num1.size(); i++ ){
 17       sum[100-i] = num1[num1.size()-i-1];
 18     }
 19     int d;
 20     for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
 21       int now;
 22       if( i < num2.size() ){
 23         now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
 24       }else{
 25         now = (int)(sum[100-i]-'0') + degit;
 26       }
 27       sum[100-i] = (char)(now%10)+'0';
 28       if( now >= 10 ) degit = 1;
 29       else degit = 0;
 30       d = i;
 31     }
 32     if( d < 80 ){
 33       for( int i = 100-d; i < 101; i++ ) cout << sum[i];
 34       cout << endl;
 35     }else{
 36       cout << "overflow" << endl;
 37     }
 38   }