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>

void rev_str(char str[1024]) {
	int length = 0;
	char str2[1024];
	int temp;

	int i;

	for(i = 0; i < 1024; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[1024];
	char input_b[1024];
	char ans[286][1024];
	char kuriagari;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 1024; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[j][i] = '\0';
		}

		kuriagari = 0;

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[j][i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}

		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[j][i] = kuriagari + '0';
		}

		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[j][i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[j][i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[j][i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[j][i] = input_a[i];
			i++;
		}

		rev_str(ans[j]);

	}

	for(j = 0; j < n; j++) {
		if(ans[j][81])
			printf("overflow");
		else
			printf("%s", ans[j]);

		putchar('\n');
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 

int main(void){  
  int n;
  cin >> n;
  REP(i,n){
    string num1s;
    string num2s;
    cin >> num1s >> num2s;
    if(num1s.size()>80||num2s.size()>80)
      cout << "overflow" << endl;
    else{
      int num1[81] = {0}, num2[81] = {0}, sum[81] = {0} ;
      REP(i,num1s.size()) num1[num1s.size()-1-i] = ( num1s[i] - '0' );
      REP(i,num2s.size()) num2[num2s.size()-1-i] = ( num2s[i] - '0' );
      REP(i,80) sum[i] = num1[i] + num2[i];
      REP(i,80) if(sum[i] > 9){
        sum[i+1] += sum[i]/10;
        sum[i] = sum[i]%10;
      }
      if(sum[80] != 0) cout << "overflow" << endl;
      else{
        int first = 79;
        while(sum[first] == 0 && first !=0) first--;
        for(int i=first; i>=0; i--)
          cout << sum[i];
        cout << endl;
      }
    }
  }
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		scanf("%s",num2);
		l1 = strlen(num1);
		l2 = strlen(num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		if(ans[80] != 0)
		{
			printf("overflow\n");
		}
		else
		{
			for(j=1001;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

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;
    
    
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        int f[81]={0};
        int g[81]={0};
        int h[81]={0};
        
        cin>>d;
        cin>>e;
        
        if((int)d.length()>80||(int)e.length()>80){
            printf("overflow\n");
        }else{
            int j=80;
            for(int i=(int)d.length()-1; i>=0; i--){
                f[j] = (d[i]-'0');
                j--;
            }
            j=80;
            for(int i=(int)e.length()-1; i>=0; i--){
                g[j] = (e[i]-'0');
                j--;
            }
            
//            for(int i=0; i<81; i++){
//                printf("%d",f[i]);
//            }
//            printf("\n");
//            
//            for(int i=0; i<81; i++){
//                printf("%d",g[i]);
//            }
//            printf("\n");
            
            int temp=0;

            for(int i=80; i>=0; i--){
                temp = temp + f[i] + g[i];
                h[i] = temp % 10;
                temp = temp / 10;
            }
            j=0;
            if(h[j]!=0){
                printf("overflow\n");
            }else{
                while(h[j]==0){
                    j++;
                }
                for(int i=j; i<81; i++){
                    printf("%d",h[i]);
                }
            }
            printf("\n");
        }
        
        
        
    }
    
    
}

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

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    string A,B;
    int n,Ak,Bk,ans[81];
    
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        
        for(int j=0;j<80;j++){
            ans[j]=0;
        }
        
        cin >> A >> B;
        
        Ak=(int)A.size();
        Bk=(int)B.size();
        
        for(int i=0;i<max(Ak,Bk);i++){
            if(i<min(Ak,Bk))
                ans[79-i]+=(A[Ak-1-i]-'0')+(B[Bk-1-i]-'0');
            else if(i<Ak)
                ans[79-i]+=A[Ak-1-i]-'0';
            else if(i<Bk)
                ans[79-i]+=B[Bk-1-i]-'0';
            
            if(ans[79-i]>=10){
                if(i==79){
                    break;
                }
                ans[79-i-1]++;
                ans[79-i]-=10;
            }
        }
        
        if(ans[79]>=10){
            puts("overflow");
        }else{
            bool f = false;
            for(int i=0;i<80;i++){
                if(ans[i] || f){
                    printf("%1d",ans[i]);
                    f = true;
                }
            }
            printf("\n");
        }
    }
    
    return 0;
}