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 <math.h>

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool FLG1,FLG2;
	int n,length1,length2,S1,S2,num1_index,num2_index,kuriagari=0;
	int output[9],num1[9],num2[9];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=80 || length2 >= 80)printf("overflow\n");
		else{
			FLG1=FLG2=false;
			num1_index = num2_index = 0;
			for(int k=0;k<9;k++){
				num1[k] = num2[k] = output[k]=-1;//????????¨??????????????????
			}

			for(int k=0;k<81&&(FLG1==false||FLG2==false);){
				S1=S2=0;
				for(int p=0;p<9&&k<81;p++,k++){
					if(k <= length1-1){
						S1 = 10*S1 + (buf1[k] - '0');
					}else{
						FLG1=true; //??????
					}

					if(k <= length2-1){
						S2 = 10*S2+(buf2[k] - '0');
					}else{
						FLG2=true; //??????
					}
				}
				if(S1!=0||FLG1==false){
					num1[num1_index++] = S1;
				}
				if(S2!=0||FLG2==false){
					num2[num2_index++] = S2;
				}
			}

			for(int calc=0;calc<=8;calc++){
				if(num1[calc] == -1 && num2[calc] == -1){
					break;
				}else{
					output[calc] = kuriagari;
					if(num1[calc] != -1){
						output[calc] += num1[calc];
					}
					if(num2[calc] != -1){
						output[calc] += num2[calc];
					}
					if(output[calc]/1000000000 >= 1){
						kuriagari = output[calc]/1000000000;
						output[calc] %= 1000000000;
					}else{
						kuriagari = 0;
					}
				}
			}

			if(output[8]/10000000 >= 1){
				printf("overflow\n");
			}else{
				bool firstFLG=true;
				for(int show=8;show>=0;show--){
					if(output[show] != -1){
						if(firstFLG == false && output[show] < 100000000){
							printf("%09d",output[show]);
						}else{
							printf("%d",output[show]);
							firstFLG = false;
						}
					}
				}
				printf("\n");
			}
		}
	}

    return 0;
}

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

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    char str1[81];
    char str2[81];
    string ans = "";
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1) - 1, m2 = strlen(str2) - 1, pre = 0;
    int m = max(m1, m2);
    if(m1 > 80 || m2 > 80)
      cout << "overflow" << endl;
    else if(atoi(str1) + atoi(str2) < 2147483647 && atoi(str1) + atoi(str2) > 0)
      cout << atoi(str1) + atoi(str2) << endl; 
    else{
      for(int j = 0; j <= m; j++){
	int sum = pre;
	sum += (m1 >= 0) ? str1[m1--] - '0' : 0;
	sum += (m2 >= 0) ? str2[m2--] - '0' : 0;
	pre = sum / 10;
	sum -= pre * 10;
	ans += '0' + sum;
      }
      if(pre > 0)
	ans += '0' + pre;
      reverse(ans.begin(), ans.end());
      if(ans.length() > 80)
	cout << "overflow" << endl;
      else
	cout << ans << endl;
    }
  }
}

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

int main() {
	int k,a,b,c,d,i,j,s;
	stack<int> st[3];
	char n[2][81];
	cin >> d;
	for (d;d>0;d--) {
	cin >> n[0] >> n[1];
	for (i=0;i<2;i++) for (j=0;n[i][j]!='\0';j++) st[i].push(n[i][j]-'0');
	k=0; c=0;
	while(!st[0].empty() || !st[1].empty()) {
		if (!st[0].empty()) {a=st[0].top(); st[0].pop();} else a=0;
		if (!st[1].empty()) {b=st[1].top(); st[1].pop();} else b=0;
		s=a+b+c; k++;
		if (s>9) { c=1; s-=10; } else c=0;
		st[2].push(s);
	}
	if ((c==1 && k==80) || k>80) { 
		cout << "overflow" << endl;
		while(!st[2].empty()) st[2].pop();
	}
	else {
		if (c==1) cout << 1;
		while(!st[2].empty()) { 
			cout << st[2].top();
			st[2].pop();
		}
		cout << endl;
	}
}
		return 0;
}

C++: #include <iostream>
#include <string.h>
#include <algorithm>
#include <stack>
using namespace std;

int main(){
	int n,i,j,flag;
	char ch1[100],ch2[100];
	cin >> n;
	fgets(ch1,100,stdin);
	for(i = 0;i < n;i++){
		fgets(ch1,100,stdin);
		fgets(ch2,100,stdin);
		if(strlen(ch1) > 80 || strlen(ch2) > 80){
			cout << "overflow" << endl;
		}
		else {
			stack<int> st1,st2,sum;
			sum.push(0);
			for(j = 0;j < strlen(ch1) - 1;j++) st1.push(ch1[j] - '0');
			for(j = 0;j < strlen(ch2) - 1;j++) st2.push(ch2[j] - '0');
			while(!st1.empty() || !st2.empty()){
				if(st1.empty()) st1.push(0);
				if(st2.empty()) st2.push(0);
				flag = sum.top();
				sum.pop();
				sum.push((st1.top() + st2.top() + flag) % 10);
				sum.push((st1.top() + st2.top() + flag) / 10);
				st1.pop();
				st2.pop();
			}
			if(!sum.top()) sum.pop();
			for(;!sum.empty();) {
				cout << sum.top();
				sum.pop();
			}
			cout << endl;
		}
	}
	return 0;
}

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

#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define PRINT(STR) cout << (STR) << endl

typedef long long ll;
using namespace std;

double nextDouble() {
	double d = -1;
	cin >> d;
	return d;
}

int nextInt() {
	int n = -1;
	cin >> n;
	return n;
}

string nextString() {
	string str;
	cin >> str;
	return str;
}

string reverse(string str) {
	string t = str;
	for (int i = 0; i < str.size(); i++) {
		t[i] = str[str.size() - i - 1];
	}
	return t;
}

int main() {
	cin.tie(0); //対話型には使えない
	int n = nextInt();
	while (n--) {
		string str1 = nextString();
		string str2 = nextString();
		int n[100];
		fill(n, n + 100, 0);
		str1 = reverse(str1);
		str2 = reverse(str2);

		REP(i, str1.size()) {
			n[i] = str1[i] - '0';
		}
		REP(i, str2.size()) {
			n[i] += str2[i] - '0';
		}
		if (str1.size() >= 80 || str2.size() >= 80) {
			PRINT("overflow");
			continue;
		}
		int M = max(str1.size(), str2.size());
		int k = M;
		REP(i, M) {
			if (n[i] >= 10) {
				n[i + 1] += n[i] / 10;
				n[i] %= 10;
				if (i == M - 1) k = M + 1;
			}
		}
		if (n[80] > 0) {
			PRINT("overflow");
			continue;
		}
		for (int i = k - 1; i >= 0; i--) {
			cout << n[i];
		}
		cout << endl;
		
	}
	
	return 0;
}