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<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k;
    bool check;

    while(cin >> n){
        rep(i,n){
            char c1[81], c2[81];
            int i1[81] = {0}, i2[81] = {0};
            int ans[82] = {0};
            check = false;
            k = 0;
            cin >> c1 >> c2;
            for(int j = strlen(c1) - 1; 0 <= j; j--, k++){
                i1[k] = c1[j] - '0';
            }
            k = 0;
            for(int j = strlen(c2) - 1; 0 <= j; j--, k++){
                i2[k] = c2[j] - '0';
            }
            rep(j, 81){
                ans[j] = i1[j] + i2[j];
            }
            rep(j, 81){
                if(ans[j] >= 10){
                    ans[j]-=10;
                    ans[j+1]++;
                }
            }
            for(int j = 81; 0 <= j; j--){
                if(ans[81] != 0){
                    cout << "overflow";
                    break;
                }
                if(ans[j] != 0)
                    check = true;
                if(check == true)
                    cout << ans[j];
            }cout << endl;
        }
    }
}

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

int main(){
	string s1,s2;
	int num;
	cin>>num;
	for(int j=0;j<num;j++){
		cin>>s1;
		cin>>s2;
		int size1=s1.size();
		int size2=s2.size();
		if(size1>80 || size2>80){
			cout<<"overflow"<<endl;
			continue;
		}
		if(size1>size2){
			for(int a=0;a<(size1-size2);a++){
				s2='0'+s2;
			}
		}else if(size1<size2){
			for(int a=0;a<(size2-size1);a++){
				s1='0'+s1;
			}
		}
		string ans="";
		int plus=0;
		for(int i=max(size1,size2)-1;i>=-1;i--){
			if(i==-1){
				if(plus!=0){
					ans=(char)(plus+'0')+ans;
					continue;
				}else{
					continue;
				}
			}
			int alt=(s1[i]-'0')+(s2[i]-'0')+plus;
			if(alt>=10){
				ans=(char)(alt%10+'0')+ans;
				plus=alt/10;
			}else ans=(char)(alt+'0')+ans;
		}
		if(ans.size()>80){
			cout<<"overflow"<<endl;
		}else{
			cout<<ans<<endl;
		}
	}
	return 0;
}

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

int main()
{
	char  input1[1001]={0},input2[1001]={0};
	int   output[1002]={0};
	int lengs1=0,lengs2=0,lengs3=0,lengs4=0,count;
	
	scanf("%d",&count);

	for(int c=0;c<count;c++)
	{
		int i,j=1,k;
		for(k=0;k<1000;k++)
		{
			input1[k]=0;
			input2[k]=0;
			output[k]=0;
		}
		scanf("%s",&input1);
		scanf("%s",&input2);

		lengs1=strlen(input1);
		lengs2=strlen(input2);

		if(lengs1>80 || lengs2>80)
		{
			printf("overflow\n");
			continue;
		}

		lengs3=(lengs1>=lengs2)?lengs1+1:lengs2+1;
		lengs4=lengs3;
		while(lengs3>=0 && lengs1>=0 && lengs2>=0)
		{
			output[lengs3]+=(input1[lengs1--]-'0')+(input2[lengs2--]-'0');
			if(output[lengs3]>=10)
			{
				output[lengs3]%=10;
				output[lengs3-1]+=1;
			}
			lengs3--;
		}

		if(lengs1>=0||lengs2>=0)
		{
			while(lengs1>=0)
			{
				output[lengs3]+=(input1[lengs1--]-'0');
				if(output[lengs3]>=10)
				{
					output[lengs3]%=10;
					output[lengs3-1]+=1;
				}
				lengs3--;
			}
			while(lengs2>=0)
			{
				output[lengs3]+=(input2[lengs2--]-'0');
				if(output[lengs3]>=10)
				{
					output[lengs3]%=10;
					output[lengs3-1]+=1;
				}
				lengs3--;
			}
		}
		if(lengs4>=80)
		{
			printf("overflow\n");
			continue;
		}
		if(output[0]!=0)
			j=0;
		for(i=j;i<lengs4;i++)
		{
			printf("%d",output[i]);
		}
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
 
#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
 
int main(void){
    int n; cin >> n;

    while(n --){
        vi res(81);

        rep(i, 2){
            string in; cin >> in;
            if(in.size() > 80){ res[80] = 1; continue; }
            rep(j, in.size() + 1){
                if(j != in.size()) res[j] += in.at(in.size() - j - 1) - '0';
                for(int l = 0; res[j + l] > 9; l ++) res[j + l + 1] ++, res[j + l] %= 10;
            }
        }

        if(res[80]){ cout << "overflow" << endl; continue; }

        bool ok = false;
        for(int i = 79; i >= 0; i --){
            if(!ok) if(res[i]) ok = true;
            if(ok) cout << res[i];
        }
        cout << endl;
    }
 
    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin>>N;
  while(N--){
    string s[2];
    for(int i=0;i<2;i++){
      cin>>s[i];
      reverse(s[i].begin(),s[i].end());
    }
    if(s[0].size()<s[1].size()){
      swap(s[0],s[1]);
    }
    string ans;
    int c=0;
    for(int i=0;i<s[0].size();i++){
      char d=(i<s[1].size())?s[1][i]:'0';
      d+=-'0'+s[0][i]+c;
      c=d>'9';
      if(d>'9'){
	d-=10;
      }
      ans+=d;
    }
    if(c){
      ans+='1';
    }
    reverse(ans.begin(),ans.end());
    if(ans.size()<=80){
      cout<<ans<<endl;
    }else{
      cout<<"overflow"<<endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
				in[i][ie[i]]=in[i][ie[i]]-'0';
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]+'0';
				if(in[NMin][ien[NMin]+1]>9+'0'){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			max10=0;
			
			for(;ien[NMin]>-1;ien[NMin]--){
				in[NMin][ien[NMin]]=in[NMin][ien[NMin]]+'0';
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			
			
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}