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 <cstdio>
using namespace std;

int main(){
	int N;
	char str1[90], str2[90];
	int num1[80], num2[80], sum[80];
	int pos, pos2, up;
	
	scanf("%d", &N);
	for(int n = 0; n < N; n++){
		for(int i = 0; i < 90; i++){
			str1[i] = 0;
			str2[i] = 0;
		}
		for(int i = 0; i < 80; i++){
			num1[i] = 0;
			num2[i] = 0;
			sum[i] = 0;
		}
		scanf("%s", str1);
		scanf("%s", str2);
		
		pos = 89;
		while(str1[pos] == 0) pos--;
		pos2 = 0;
		while(str1[pos] != 0){
			num1[pos2++] = str1[pos--] - 48;
		}
		pos = 89;
		while(str2[pos] == 0) pos--;
		pos2 = 0;
		while(str2[pos] != 0){
			num2[pos2++] = str2[pos--] - 48;
		}
		
		up = 0;
		for(int i = 0; i < 80; i++){
			sum[i] = num1[i] + num2[i] + up;
			up = sum[i] / 10;
			sum[i] = sum[i] % 10;
		}
		
		if(up > 0 || sum[79] > 0) printf("overflow\n");
		else{
			pos = 79;
			while(sum[pos] == 0) pos--;
			while(pos >= 0){
				printf("%d", sum[pos--]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		string num1, num2;
		cin >> num1 >> num2;
		char sum[101];
		int degit = 0;
		for( int i = 0; i < 101; i++ ) sum[i] = '0';
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] = num1[num1.size()-i-1];
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now;
			if( i < num2.size() ){
				now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
			}else{
				now = (int)(sum[100-i]-'0') + degit;
			}
			sum[100-i] = (char)(now%10+'0');
			if( now >= 10 ) degit = 1;
			else degit = 0;
			d = i;
		}
		for( int i = 100-d; i < 101; i++ ) cout << sum[i];
		cout << endl;
	}
}

C++: #include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,longth,sub1,sub2,num;
char a[100],b[100],ans[100] = {'0'};
int main()
{
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
    {
        scanf("%s%s",a,b);
        sub1 = strlen(a);
        sub2 = strlen(b);
        longth = max(sub1,sub2);
        for(int i = 0; i < longth; i++)
        {
            ans[i] = '0';
        }
        if(strlen(a) < longth)
        {
            for(int i = sub1 - 1; i >= 0; i--)
            {
                a[i + longth - sub1] = a[i];
            }
            for(int i = 0; i < longth - sub1; i++)
            {
                a[i] = '0';
            }
        }
        if(strlen(b) < longth)
        {
            for(int i = sub2 - 1; i >= 0; i--)
            {
                b[i + longth - sub2] = b[i];
            }
            for(int i = 0; i < longth - sub2; i++)
            {
                b[i] = '0';
            }
        }
        for(int i = 0; i < longth; i++)
        {
            num = a[longth - 1 - i] - '0' + b[longth - 1 - i] - '0' + ans[i] - '0';
            ans[i] = (num % 10) + '0';
            if(10 <= num)ans[i + 1] = '1';
        }
        if(strlen(ans) > 80)printf("overflow\n");
        else
        {
            for(int i = strlen(ans) - 1; i >= 0; i--)
            {
                printf("%c",ans[i]);
            }
            printf("\n");
        }
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<math.h>

using namespace std;

int main(){
	int n;
	string ret1,ret2;
	vector<int> result;
	int num = 0, ret = 0;
	int j;

	cin >> n;

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

		ret = 0;

		cin >> ret1 >> ret2;

		if (ret1.size() > 80 || ret2.size() > 80){
			cout << "overflow" << endl;
			continue;
		}

		for (j = 1;j <= ret1.size() && j <= ret2.size();j++){
			num = (ret1.at(ret1.size() - j) - '0' + ret2.at(ret2.size() - j) - '0' + ret) % 10;
			ret = (ret1.at(ret1.size() - j) - '0' + ret2.at(ret2.size() - j) - '0' + ret);
			ret = (ret - num)/10;
			//cout << "ret:" << ret << endl;
			result.push_back(num);
		}

		if (ret1.size() == ret2.size()){
			if (ret != 0)
				result.push_back(ret);
		}
		else if(ret1.size() > ret2.size()){
			for (; j <= ret1.size(); j++){
				num = (ret1.at(ret1.size() - j) - '0' + ret) % 10;
				ret = ret1.at(ret1.size() - j) - '0' + ret;
				ret = (ret - num) / 10;
				//cout << "ret:" << ret << endl;
				result.push_back(num);
			}
			if (ret != 0)
				result.push_back(ret);
		}
		else if (ret1.size() < ret2.size()){
			for (; j <= ret2.size(); j++){
				num = (ret2.at(ret2.size() - j) - '0' + ret) % 10;
				ret = ret2.at(ret2.size() - j) - '0' + ret;
				ret = (ret - num) / 10;
				//cout << "ret:" << ret << endl;
				result.push_back(num);
			}
			if (ret != 0)
				result.push_back(ret);
		}


		while (result.empty() != true){
			cout << result[result.size()-1];
			result.pop_back();
		}
		cout << endl;

	}


	return 0;
}

C++: #include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	int N;
	scanf("%d", &N);
	rep(i, N) {
		string a, b;
		string ans;
		cin >> a >> b;
		int a_tmp, b_tmp;
		int k = (a.size() > b.size()) ? a.size() : b.size();
		int tmp = max(a.size(), b.size()) - min(a.size(), b.size());
		rep(j, tmp) (a.size() > b.size()) ? b.insert(0, "0") : a.insert(0, "0");
		int keta = 0;
		repr(j, k - 1) {
			a_tmp = a[j] - 48; b_tmp = b[j] - 48;
			int sum = a_tmp + b_tmp + keta;
			if(sum < 10) {
				keta = 0;
				stringstream ss;
				ss << sum;
				ans.insert(0, ss.str());
			}
			else {
				keta = 1;
				sum = sum - 10;
				stringstream ss;
				ss << sum;
				ans.insert(0, ss.str());
			}
		}
		if(keta == 1) ans.insert(0, "1");
		if(ans.size() > 80) printf("overflow\n");
		else cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
 
	for (int i = 0; i < N; i++)
	{
		std::cin >> str_a;
		std::cin >> str_b;
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}