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 <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[81], b[81], x[81], y[81];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		int LB=strlen(b);
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[81];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(big==81 && carry!=0) printf("overflow\n");
		else{
			if(carry!=0){
				ans[big++]=carry+'0';
				ans[big]='\0';
				//printf("carries\n");
			}	
			
			int LS=strlen(ans);
			char fans[81];
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}	
		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}

C++: /*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	char number1[81];
	char number2[81];
	int sum[81];
	int digit1;
	int digit2;
	int digit_sum;
	int move_up;
	int i,j;
	/*****処理部*****/
	memset(number1,'0',sizeof(number1));
	memset(number2,'0',sizeof(number1));
	digit1 = 0;
	digit2 = 0;
	digit_sum = 0;
	cin >> number1;
	cin >> number2;
	while(number1[digit1] != '\0')	digit1++;
	while(number2[digit2] != '\0')	digit2++;
	move_up = 0;
	//cout << digit1 << " " << digit2 << endl;
	if(digit1 != digit2){
		if(digit1 > digit2){
			i = digit1;
			j = digit2;
			while(j>=0){
				number2[i] = number2[j];
				number2[j] = '0';
				i--;j--;
			}
		}else{
			i = digit1;
			j = digit2;
			while(i>=0){
				number1[j] = number1[i];
				number1[i] = '0';
				i--;j--;
			}
		}
	}
	/*for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
		cout << number1[i-1];
	}
	cout << endl;
	for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
		cout << number2[i-1];
	}
	cout << endl;*/
	//for(int i=0;i<4;i++)	cout << number2[i] << " " << atoi(&number2[i]) << endl;
	//for(int i=0;i<4;i++)	cout << number1[i] << " " << atoi(&number1[i]) << endl;
	digit_sum = 0;
	for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
		//cout << atoi(&number1[i-1]) << " " << atoi(&number2[i-1]) << endl;
		sum[digit_sum]
			= number1[i-1] - '0'
			+ number2[i-1] - '0'
			+ move_up;
		if(sum[digit_sum] >= 10){
			move_up = 1;
			sum[digit_sum] = sum[digit_sum] % 10;
		}else{
			move_up = 0;
		}
		digit_sum++;
	}
	if(move_up == 1){
		sum[digit_sum] = move_up;
		digit_sum++;
	}
	//cout << digit_sum << endl;
	if(digit_sum > 79)	cout << "overflow" << endl;
	else{
		for(int k=digit_sum-1;k>=0;k--){
			cout << sum[k];
		}
		cout << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<string>
#include<algorithm>
using namespace std;
int max(int a,int b){return a>b?a:b;}
int main(){
	int n;
	scanf("%d",&n);
	for(int d=0;d<n;d++){
		char a[100];
		char b[100];
		scanf(" %s",a);
		scanf(" %s",b);        
		if(strlen(a) > 80 || strlen(b) > 80) {
            printf("overflow\n");
            continue;
        }
		string s,t;
		int i=0;
		s.append(a);
		t.append(b);
		reverse(s.begin(),s.end());
		reverse(t.begin(),t.end());
		string ans;
		int k=0;
		for(i=0;i<max(s.size(),t.size())+1;i++){
			int x,y;
			if(i>=s.size())x=0;
			else x=s[i]-'0';
			if(i>=t.size())y=0;
			else y=t[i]-'0';
			int z=x+y+k;
			k=z/10;
			char c=z%10+'0';
			if(i!=max(s.size(),t.size())||c!='0')ans.append(1,c);
		}
		reverse(ans.begin(),ans.end());
		if(ans.size()>=81)printf("overflow\n");
		else printf("%s\n",ans.c_str());
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
	int N;
	string A, B, tmp;
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> A;
		cin	>> B;
		if(A.size()>80 || B.size()>80){
			cout << "overflow" << endl;
			continue;
		}
		if(A.size() < B.size()) tmp = B, B = A, A = tmp;
		int dif = A.size() - B.size();
		int carry = 0;
		for(int i=A.size(); i>=0; i--){
			if(i-dif>=0) A[i] = A[i]+B[i-dif]-'0'+carry;
			else A[i] += carry;
			if(A[i] >= '0'+10) carry = 1, A[i] -= 10;
			else carry = 0;
		}
		if(carry==1){
			if(A.size()==80){
				cout << "overflow" << endl;
				continue;
			}else cout << '1';
		}
		for(int i=0; i<A.size(); i++) cout << A[i];
		cout << endl;
	}
}

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

void storeReverse(char ch[], string str){
    for (int i=0; i<str.size(); i++) {
        ch[i] = str[str.size()-i-1];
    }
}

void calcSum(char ch1[], char ch2[]){
    int c = 0;
    int result[80];
    for (int i=0; i<80; i++) {
        int num1 = ch1[i] - '0';
        int num2 = ch2[i] - '0';
        int sum = num1 + num2 + c;
        if (sum >= 10) {
            sum %= 10;
            c = 1;
        }else{
            c = 0;
        }
        result[i] = sum;
    }
    if (c == 1){
        cout << "overflow" << endl;
    }else{
        int idx;
        for (int i=80-1; i>=0; i--) {
            if (result[i] != 0){
                idx = i;
                break;
            }
        }
        for (int i=idx; i>=0; i--) {
            cout << result[i];
        }
        cout << endl;
    }
}

int main()
{
    int n;
    char ch1[80], ch2[80];
    string str1, str2;
    
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> str1;
        cin >> str2;
        for (int j=0; j<80; j++) {
            ch1[j] = '0';
            ch2[j] = '0';
        }
        storeReverse(ch1, str1);
        storeReverse(ch2, str2);
        calcSum(ch1, ch2);
        
    }

    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

using namespace std;

int main()
{
	int i,j,n,f;
	string s1,s2;

	cin>>n;
	
	while(n--){
		cin>>s1>>s2; f=0;
		if(s1.size()<s2.size())swap(s1,s2);

		for(i=0;i<s2.size();i++){s1[i+s1.size()-s2.size()]+=s2[i]-'0';}

		for(i=s1.size()-1;i>0;i--){
			if(s1[i]>'9'){s1[i]-=10; s1[i-1]++;}
		}

		if(s1[0]>'9'){s1[0]-=10;f++;}

		if(s1.size()+f<80){
			if(f) cout<<"1";
			cout<<s1;
		}
		else cout<<"overflow";

		cout<<endl;
	}
	return 0;
}