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<cstdio>
#include<stack>
#include<algorithm>
using namespace std;
string str1;
string str2;
stack<int> sta;

int main()
{
  int n;
  int i,j;
  int exc;//???????????????
  int sum;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>str1;
    cin>>str2;
    exc=0;
    for(j=1;j<=min(str1.size(),str2.size());j++){
      sum=str1[str1.size()-j]-'0'+str2[str2.size()-j]-'0'+exc;
      exc=sum/10;
      sta.push(sum%10);
    }
    if( str1.size() < str2.size() ){
      while(j<=str2.size()){
	sum=str2[str2.size()-j]-'0'+exc;
	exc=sum/10;
	sta.push(sum%10);
	j++;
      }
    }else if( str1.size() > str2.size() ){
      while(j<=str1.size()){
	sum=str1[str1.size()-j]-'0'+exc;
	exc=sum/10;
	sta.push(sum%10);
	j++;
      }
    }

    if(exc)
      cout<<exc;
    for(j=0;j<max(str1.size(),str2.size());j++){  
      cout<<sta.top();
      sta.pop();
    }
    cout<<endl;
  }//endfori
}

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<200;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){
				if(i==79){
					i++;
					flg=true;
					break;
				}
				ans[i+1]=ans[i+1]+1;
				sum=sum%10;
				flg=true;
			}

			if(ans[i]+sum>'9'){
				if(i==79){
					i++;
					flg=true;
					break;
				}
				ans[i]=ans[i]+(sum-10);
				ans[i+1]+=1;
				flg=true;
			}
			else ans[i]+=sum;
		}
		if(flg){
			i++;
		}
		ans[i]='\0';
		if(i>=80)cout<<"overflow"<<endl;
		else{
			for(--i;i>=0;i--){
				if(i>=0)cout<<ans[i];
			}
			cout<<endl;
		}
//		cout<<"size:"<<strlen(ans)<<endl;
	}
	return 0;
}

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

int main()
{
  int N;
  char str1[82];
  char str2[82];
  int j = 0, k = 0, c;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    if(j > 80 || k > 80)
      cout << "overflow" << endl;
    else{
      int n1[42] = {};
      int n2[42] = {};
      int m1 = strlen(str1), m2 = strlen(str2);
      for(int i = 1, j = 41; (m1 - i - 1 >= 0) || (m1 - i >= 0); i += 2, j--)
	if(str1[m1 - i - 1] == '0')
	  if(str1[m1 - i] == '0')
	    n1[j] = 1000;
	  else 
	    n1[j] = str1[m1 - i] - '0';
	else
	  if(m1 - i - 1 < 0)
	    n1[j] = str1[m1 - i] - '0';
	  else
	    n1[j] = (str1[m1 - i] - '0') + (str1[m1 - i - 1] - '0') * 10; 
      for(int i = 1, j = 42; (m2 - i - 1 >= 0) || (m2 - i >= 0); i += 2, j--)
	if(str2[m2 - i - 1] == '0')
	  if(str2[m2 - i] == '0')
	    n2[j] = 1000;
	  else
	    n2[j] = (str2[m2 - i] - '0');
	else
	  if(m2 - i - 1 < 0)
	    n2[j] = str2[m2 - i] - '0';
	  else
	    n2[j] = (str2[m2 - i] - '0') + (str2[m2 - i - 1] - '0') * 10;
      int ans[41] = {};
      int i = 0;
      int m = (m1 > m2) ? m1 : m2;
      for(int j = 41; 40 - m / 2 < ((m % 2) ? j + 1 : j); i++, j--)
	if(n1[j] + n2[j] >= 100)
	  if(n1[j] == 1000 && n2[j] < 10){
	    n1[j - 1] *= 10;
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] < 10){
	    n2[j - 1] *= 10;
	    ans[i] = n1[j];
	  }else if(n1[j] == 1000 && n2[j] == 1000){
	    if(n1[j - 1] % 10 != 0)
	      n1[j - 1] *= 10;
	    ans[i] = 1000;
	  }else if(n1[j] == 1000 && n2[j] >= 10){
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] >= 10){
	    ans[i] = n1[j];
	  }else if(n1[j] + n2[j] < 110){
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] + 900;
	  }else{
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] - 100;
	  }
	else
	  ans[i] = n1[j] + n2[j];
      int k = i;
      for(; i > 0; i--)
	if((i == k) && (ans[i - 1] == 0))
	  ;
	else if(ans[i - 1] == 1000)
	  cout << "00";
	else if(ans[i - 1] > 1000)
	  cout << "0" << ans[i - 1] % 1000;
	else
	  cout << ans[i - 1];
      cout << endl;
    }
  }
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){

    int n;
    cin>>n;
    rep(i,n){
        string a,b;
        cin>>a>>b;
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        if(b.size()>a.size()){
            swap(a,b);
        }
        int keta=0;
        int ans[200];
        rep(i,n)ans[i]=0;
        int kuri=0;
        for(int i=0;i<b.size();i++){
            keta++;
           // char o=a[i];char oo=b[i];
           // int aa=atoi(&o);int bb=atoi(&oo);
            int aa=a[i]-'0';int bb=b[i]-'0';
            ans[i]=(aa+bb+kuri)%10;
           // cout<<a[i]<<b[i]<<endl;
         //   cout<<aa<<bb<<endl;
            kuri=(aa+bb+kuri)/10;
        }
        for(int i=b.size();i<=200&&i<a.size();i++){
            keta++;
            //char oo=a[i];
            int aa=a[i]-'0';
            ans[i]=(kuri+aa)%10;
            kuri=(aa+kuri)/10;
            
        }
        if(keta>=80){
            cout<<"overflow"<<endl;
        }else{
            for(int i=keta-1;i>=0;i--){
                cout<<ans[i];
            }
            cout<<endl;
        }
    }
    
    return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        //???????????±?????§????????????
        char c1[1000],c2[1000];
        scanf("%s",&c1);
        scanf("%s",&c2);
        string s1,s2;
        s1=c1, s2=c2;
        if(s1=="0" && s2=="0"){
            printf("0\n");
            continue;
        }
        //?????¢?????????0????????§?????°???????????????
        reverse(s1.begin(),s1.end());
        reverse(s2.begin(),s2.end());
        int n=max(s1.size(),s2.size())+1;
        for(int i=s1.size();i<n;i++){
            s1+='0';
        }
        for(int i=s2.size();i<n;i++){
            s2+='0';
        }
        string res;

        //b?????°?????????????????¨??????????????¨
        int b=0;
        for(int i=0;i<max(s1.size(),s2.size());i++){
            int u=s1[i]-'0'+s2[i]-'0'+b;
            b=(u>=10); u%=10;
            res+=u+'0';
        }

       
        reverse(res.begin(),res.end());
        string res2;

        //????????¨?????´???0??????????????????0??\????????°??????????????¨?????????????????¨???????????????????¶????
        int j=0;
        while(res[j]=='0') j++;
        for(;j<res.size();j++){
            res2+=res[j];
        }

        if(res2.size()>80){
            printf("overflow\n");
        }else{
            printf("%s\n",res2.c_str());
        }
    }
    return 0;
}