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 <stdlib.h>
#include <string>
#include <iostream>
#include <math.h>
#include <stack>

using namespace std;

int main(){
    
    string d;
    string e;

    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);

    for(int i=0; i<n; i++){
        cin>>d;
        cin>>e;
        
        if((int)(d.size())>80||(int)(e.size())>80){
            printf("overflow");
        }else{
            for(int j=0; j<(int)(d.size()); j++){
                st1.push(d[j]);
            }
            for(int j=0; j<(int)(e.size()); j++){
                st2.push(e[j]);
            }
            int temp=0;
            char temp_char;
            while(st1.empty()==false||st2.empty()==false){
                if(st1.empty()==false&&st2.empty()==false){
                    temp_char=st1.top();
                    temp+=atoi(&temp_char);
                    temp_char=st2.top();
                    temp+=atoi(&temp_char);
                    st1.pop();
                    st2.pop();
                }else if(st1.empty()==false&&st2.empty()==true){
                    temp_char=st1.top();
                    temp+=atoi(&temp_char);
                    st1.pop();
                }else if(st1.empty()==true&&st2.empty()==false){
                    temp_char=st2.top();
                    temp+=atoi(&temp_char);
                    st2.pop();
                }
                st3.push(temp%10);
                temp=temp/10;
            }
            
            if(temp!=0){
                st3.push(temp);
            }
            
            if(st3.size()>80){
                printf("overflow");
            }else{
                while(st3.empty()==false){
                    printf("%d",st3.top());
                    st3.pop();
                }
            }
            printf("\n");
        }
    }
    
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
	int n;
    string a, b;
		
	cin>> n;	
	for(int i=0;i<n;i++){
		int x[81]={0}, y[81]={0};

		cin >> a;
		cin >> b;
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		
		for(int j=0;j<a.size();j++){
			x[j]=a[j]-'0';
		}
		for(int j=0;j<b.size();j++){
			y[j]=b[j]-'0';
		}
		
		for(int j=0;j<80;j++){
			x[j]=x[j]+y[j];
			if(x[j]>=10){
				x[j+1]++;
				x[j]-=10;
			}
		}
		
		if(x[80]>0){
			cout << "overflow" <<endl;
		}else{
			bool flag = 0;
			for(int j=79;j>=0;j--){
				if(x[j]!=0){
					cout<<x[j];
					flag=1;
				}else if(flag){
					cout<<x[j];
				}
			}
			cout<<endl;
		}
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;
string S, T; int n, x[10000], a[10000], b[10000], cnt; char U[11] = "0123456789";
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> S >> T;
		memset(x, 0, sizeof(x));
		for (int i = 0; i < S.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == S[i]) {
					a[i] = j;
				}
			}
		}
		for (int i = 0; i < T.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == T[i]) {
					b[i] = j;
				}
			}
		}
		if (S.size() > 80 || T.size()>80) {
			cout << "OVERFLOW" << endl; goto E;
		}
		for (int i = 0; i < 80; i++) {
			x[i] += (a[i] + b[i]) % 10;
			x[i + 1] += (a[i] + b[i]) / 10;
		}
		if (x[80] > 0) {
			cout << "OVERFLOW" << endl;
		}
		else {
			for (int i = 79; i >= 0; i--) {
				if (x[i] > 0) { cnt++; }
				if (cnt) { cout << x[i]; }
			}
			cout << endl;
		}
	E:;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

const int MAX_SIZE = 128;

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = -1;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == -1 && r.d[i] == -1){
	if(!updigit)
	  continue;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i] != -1)
	  a = toI(this->d[i]);
	if(r.d[i] != -1)
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
    this->size = tmp;
    return;
  }

  void print()
  {
    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
    puts("");
  }
};

int main()
{
  int d;
  scanf("%d", &d);
  while(d--){
    char s1[128], s2[128];

    scanf("%s",s1);
    scanf("%s",s2);
    Z z1(s1);
    Z z2(s2);
    z1.add(z2);

    z1.print();
  }
  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]);
		cout<<"Min"<<Min<<endl;
		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]];
				if(in[NMin][ien[NMin]+1]>9){
					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]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			for(int i=0;i<2;i++){
				for(int j=0;j<ie[i]+1;j++){
					in[i][j]=in[i][j]+'0';
				}
			}
			
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  cin.ignore();
  while(n--){
    string a,b;
    getline(cin,a);
    int as = a.size()-1;
    int bs = b.size()-1;
    int nmi = min(a.size(),b.size());
    int nma = max(a.size(),b.size());
    for(int x; i<nma; i++){
      if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;}
      else if(i>as){x = tab+b[bs-i]-'0';}
      else if(i>bs){x = tab+a[as-i]-'0';}
      tab = x/10;
      num[i] = x%10;
    }
    if(tab){num[nma] = tab;i++;}
    if(i>80){cout <<"overflow"<<endl;}
    else{
      for(int x=i-1; x>=0; x--){
	cout <<num[x];
      }
      cout <<endl;
    }
  }
  return 0;
}