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++: #define scanf_s scanf
#define sscanf_s sscanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
//#define CONSTNUM 10000000
int main(void)
{
	int n, s = 0, x, y, r = 0, a, b;
	int sum_n[50][3] = { 0 };
	char sum[50][_MAX], astr[_MAX], bstr[_MAX], num[11] = { "0123456789" };
	char ca, cb;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%s %s", &astr, &bstr);
		for (x = 0; astr[x] != '\0'; ++x);
		for (y = 0; bstr[y] != '\0'; ++y);
		if (x > 80 || y > 80) {
			printf("overflow\n");
			continue;
		}
		for (int j = 0; j < x || j < y; ++j) {
			if (j < x && j < y) {
				ca = astr[x - j - 1]; cb = bstr[y - j - 1];
				sscanf_s(&ca, "%d", &a);
				sscanf_s(&cb, "%d", &b);
				if (x > y) sum[i][x - j] = num[(a + b + r) % 10];
				else sum[i][y - j] = num[(a + b + r) % 10];
				if (a + b + r >= 10) r = (a + b + r) / 10;
				else r = 0;
			}
			else {
				if (x > y) {
					if (r != 0) {
						ca = astr[x - j - 1];
						sscanf_s(&ca, "%d", &a);
						sum[i][x - j] = num[(a + r) % 10];
						if (a + r >= 10) r = (a + r) / 10;
						else r = 0;
					}
					else {
						sum[i][x - j] = astr[x - j - 1];
					}
				}
				else {
					if (r != 0) {
						cb = bstr[y - j - 1];
						sscanf_s(&cb, "%d", &b);
						sum[i][y - j] = num[(b + r) % 10];
						if (b + r >= 10) r = (b + r) / 10;
						else r = 0;
					}
					else {
						sum[i][y - j] = astr[y - j - 1];
					}
				}
			}
		}
		sum_n[i][0] = x; sum_n[i][1] = y; sum_n[i][2] = r;
		r = 0;
	}
	for (int i = 0; i < n; ++i) {
		x = sum_n[i][0]; y = sum_n[i][1]; r = sum_n[i][2];
		if (y <= 80 - r && x <= 80 - r) {
			if (r == 1) printf("%d", r);
			for (int j = 1; j <= x || j <= y; ++j) {
				printf("%c", sum[i][j]);
			}
		}
		else {
			printf("overflow");
		}
		printf("\n");
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int main(){
	int N;
	cin>>N;
	REP(i,N){
		string s1,s2;
		string comp;
		cin>>s1>>s2;
		reverse(s1.begin(),s1.end());
		reverse(s2.begin(),s2.end());
		int n1=s1.size();
		int n2=s2.size();
		int ma=max(n1,n2);
		FOR(j,n1,ma){
			s1+='0';
		}
		FOR(j,n2,ma){
			s2+='0';
		}
		int c=0;
		REP(j,ma){
			int k=c+s1[j]+s2[j]-'0';
			if (k<='9'){
				comp+=k;
				c=0;
			}
			else{
				comp+=k-10;
				c=1;
			}
		}
		if (c==1) comp+='1';
		reverse(comp.begin(),comp.end());
		if (comp.size()>80) cout<<"overflow"<<endl;
		else cout<<comp<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <stack>

using namespace std;

int main(void){
	stack <char> buffer;
	int a[80],n,i,j;
	char buffer2;
	cin >> n;
	scanf(" ");
	for (int i = 0; i < n; i++)
	{
		for(j=0;j<80;j++) a[j]=0;
		while(1){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			buffer.push(buffer2);
		}
		buffer2 = 0;
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		while(1){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			buffer.push(buffer2);
		}
		buffer2 = 0;
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		for(j=0;a[j]!=0;j++){
			if(a[j]>=10){a[j]-=10;a[j+1]++;}
		}
		for(j=79;a[j]==0;j--);
		for(;j>=0;j--){
			cout << a[j];
		}
		cout << endl;
	}
	return 0;
}

C++: /*
 * Problem     : AOJ0015
 * Title       : Integral
 * Author      : mizo0203
 * Status      : Accepted
 * Date        : Sun Jun 24 20:50:52
 * Copyright   : Your copyright free
 * Description : 文字列・多倍長演算
 */

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

int N;
char str1[81], str2[81];
int sum[80];

void init() {
  scanf("%d", &N);
}

bool input() {

  if (!N)
    return false;
  N--;

  scanf("%s", str1);
  scanf("%s", str2);

  return true;
}

int main() {
  int i, f;

  init();
  while (input()) {
    fill(sum, sum + 80, 0);
    for (i = 0; i < (int) strlen(str1); i++) {
      sum[i] = str1[strlen(str1) - i - 1] - '0';
    }
    f = 0;
    for (i = 0; i < (int) strlen(str2); i++) {
      sum[i] += str2[strlen(str2) - i - 1] - '0' + f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    for (; i < 80; i++) {
      sum[i] += f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    if (f) {
      printf("overflow\n");
      continue;
    }
    for (i = 0; i < 79; i++) {
      if (sum[79 - i] != 0)
        break;
    }
    for (; i < 80; i++) {
      printf("%d", sum[79 - i]);
    }
    printf("\n");
  }

  return 0;
}

C++: int add(char *retstr, char *str1, char *str2){

	int str1len=strlen(str1);
	int str2len=strlen(str2);
	char ad,i1,i2;
	char offset1,offset2;
	char c1,c2;
	bool carry=false;

	if(str1len>str2len){
		offset1=0;
		offset2=str1len-str2len;
	}else{
		offset1=str2len-str1len;
		offset2=0;
	}

	for(int i=max(str1len,str2len);i<82;++i){
		retstr[i]=0;
	}

	for(int i=max(str1len,str2len)-1;i>=0;--i){

		if(i-offset1>=0){c1=str1[i-offset1];}else{c1=48;}
		if(i-offset2>=0){c2=str2[i-offset2];}else{c2=48;}
		i1=c1-48;i2=c2-48;//Ascii code to Number

		ad=i1+i2;
		if(carry)++ad;//桁上がり分

		if(ad>=10){ad %= 10; carry=true;}else{carry=false;}
		retstr[i+1]=ad+48;
	}

	if(carry){
		retstr[0]=1+48;
	}else{
		retstr[0]=0+48;
		for(unsigned int i=0;i<strlen(retstr)-1;++i){
			retstr[i]=retstr[i+1];
		}
		retstr[strlen(retstr)-1]=0;
	}

	if(strlen(retstr)>=81)return 1;

	return 0;

}

int main(){

	int n,overflowed;
	char str1[82], str2[82], retstr[82];

	cin>>n;

	for(int i=0;i<n;++i){

		cin>>str1;
		cin>>str2;

		if(strlen(str1)>=81||strlen(str2)>=81){
			cout<<"overflow"<<endl;
		}else{
			overflowed=add(retstr, str1, str2);
			if(overflowed){
				cout<<"overflow"<<endl;
			}else{
				cout<<retstr<<endl;
			}
		}
	}

	return 0;
}

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,l;
    bool check;

    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; l = 0;
        cin >> c1 >> c2;
        for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k++] = c1[j] - '0';
            }
            if(j <= strlen(c2) - 1){
                i2[l++] = c2[j] - '0';
            }
        }
        rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[80] != 0){
            cout << "overflow";
        }else{
            for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }
        }
        cout << endl;
    }
}