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>

using namespace std;

int main() {
    int N;
    cin >> N;
    for (int i=0; i<N; i++) {
        string a, b;
        cin >> a >> b;
        int sum, ret=0;
        if (a.length() < b.length()) swap(a,b);
        int l = b.length()-1;
        for (int i=a.length()-1; i>=0; i--) {
            if (l >= 0) {
                sum = (a[i]-'0')+(b[l]-'0')+ret;
                l--;
            } else {
                sum = (a[i]-'0')+ret;
            }
            if (sum>=10) {
                ret = 1;
                sum -= 10;
            } else {
                ret = 0;
            }
            a[i] = sum+'0';
        }
        if (ret != 0) {
            a.insert(a.begin(), ret+'0');
        }
        if (a.length() > 80) cout << "overflow" << endl;
        else cout << a << endl;
    }
    return 0;
}

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

int reverse(string &s){
	int n = s.size(), n2 = n/2;
	for (int i=0; i<n2; i++)
		swap(s[i], s[n-1-i]);
	return 0;
}

int main(void){
	int n;
	cin>>n;
	for (int i=0; i<n; i++){
		string s1, s2, s3="";
		cin>>s1>>s2;

		reverse(s1);
		reverse(s2);

		while (s1.size()<s2.size()) s1 += '0';
		while (s2.size()<s1.size()) s2 += '0';

		int c=0, stmp;
		for (int i=0; i<s1.size(); i++){
			stmp = s1[i]-'0' + s2[i]-'0' + c;
			c = stmp / 10;
			s3 += stmp%10 +'0';
		}
		if (c!=0) s3 += c + '0';

		reverse(s3);
		if (s3.size()>80)
			cout<<"overflow"<<endl;
		else
			cout<<s3<<endl;

	}
	return 0;
}

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

using namespace std;

int main(){
    int n; cin >> n;
    while(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);
        b += "0";
        for(int i=0; i<b.size()-1; i++){
            int aa = i < a.size() ? a[i] - '0' : 0;
            int bb = b[i] - '0';
            int cc = aa + bb;
            b[i] = (cc%10) + '0';
            //cout << aa << "+" << bb << "=" << cc << endl;
            if(cc >= 10){
                b[i+1]++;
            }
        }
        if(b[b.size()-1] == '0')
            b = string(b.begin(), b.end()-1);
        reverse(b.begin(), b.end());
        if(b.size() > 80)
            cout << "overflow" << endl;
        else cout << b << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string.h>
#include <utility>
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[1000],b[1000],ans[1000];
	int f;
	int alen,blen,mlen;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		alen=in.size();
		blen=in2.size();
		for(int i=0;i<alen;i++){
			a[alen-1-i]=in[i]-'0';
		}
		for(int i=0;i<blen;i++){
			b[blen-1-i]=in[i]-'0';
		}
		mlen=max(alen,blen);
		if(mlen>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<mlen+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[mlen]!=0){
			if(mlen>79){
				cout<<"overflow"<<endl;
				continue;
			}
			cout<<ans[mlen];
		}
		
		for(int i=0;i<mlen;i++){
			cout<<ans[mlen-1-i];
		}cout<<endl;
		
		
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> sum(string A, string B);
int main() {
  int n;
  cin>>n;
  string a,b;
  for(int i=0;i<n;i++) {
    cin>>a;
    cin>>b;
    if((int)a.size()>80 || (int)b.size()>80)
      cout<<"overflow\n";
    else{
      vector<int> tmp=sum(a,b);
      if(tmp.size()>80)
	cout<<"overflow\n";
      else {
	string *s=new string[tmp.size()];
	for(int i=0;i<(int)tmp.size();i++) {
	  s[i]=to_string(tmp[i]);
	  cout<<s[i];
	}
	cout<<endl;
      }
    }
  }   
  return 0;
}
vector<int> sum(string A, string B) {
  int  a_size=A.size()-1;
  int  b_size=B.size()-1;
  int end=-1;
  vector<int> tmp;
  int Dr=0;
  while(true) {
    if(a_size<0 ){
      end=0;
      break;
    }
    if(b_size<0){
      end=1;
      break;
    }
    int a=(int)A[a_size]-(int)'0';
    int b=(int)B[b_size]-(int)'0';
    int n=a+b+Dr;
    if(n>=10){
      tmp.push_back(n-10);
      Dr=1;
    }
    else{
      Dr=0;
      tmp.push_back(n);
    }
    a_size--;
    b_size--;
  }

  if(end==0) {
    for(int i= b_size;i>=0;i--){
      int n=(int)B[b_size]-int('0')+Dr;
      if(n>=10) {
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  else if(end==1){
    for(int i=a_size;i>=0;i--){
      int n=(int)A[a_size]-int('0')+Dr;
      if(n>=10){
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  if(Dr==1)
    tmp.push_back(1);
  reverse(tmp.begin(),tmp.end());
  return tmp;
}

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<78;m++)
		{
			keta=keta/10;
		}

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

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

int main(void)
{
    int N,j,k=0;
    cin >> N;
    char strA[100],strB[100];
    while(1){
        k++;
        if(k==N+1){
            break;
        }
        cin >> strA >> strB;
        int ans[81]={0};
        ans[0]=11111;
        if(strlen(strA)>80||strlen(strB)>80){
            cout << "overflow" << endl;
            continue;
        }
        int a[81]={0},b[81]={0};
        j=strlen(strA)-1;
        for(int i=80 ; j>=0 ; i--){
            a[i]=(int)strA[j]-48;
            j--;
        }
        j=strlen(strB)-1;
        for(int i=80 ; j>=0 ; i--){
            b[i]=(int)strB[j]-48;
            j--;
        }
        for(int i=80 ; i!=0 ; i--){
            ans[i]=ans[i]+a[i]+b[i];
            if(ans[i]>=10){
                ans[i]=ans[i]-10;
                ans[i-1]++;
            }
        }
        if(ans[0]!=11111){
            cout << "overflow" << endl;
            continue;
        }
        for(int i=1 ; i<81 ; i++){
            if(ans[i]!=0){
                j=i;
                break;
            }
        }
        char c[3];
        for(int i=j ; i<81 ; i++){
            printf("%c",ans[i]+48);
        }
        cout << '\n';
    }
    return 0;
}