Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	string a,b;
	vector<int> ans;
	int n,tmp,carry,num;
	bool flag = true;
	cin >> n;
	for(int i=0; i<n; i++){
		ans.clear();
		cin >> a >> b;
		int ai = a.size()-1;
		int bi = b.size()-1;
		carry=0;
		if(ai < 0 && bi < 0 && carry==0){
			flag = false;
		}
		while(ai >= 0 || bi >= 0){
			tmp=0;
			if(ai >= 0) tmp += a[ai] - '0';
			if(bi >= 0) tmp += b[bi] - '0';
			ans.push_back((tmp+carry)%10);
			carry = (tmp+carry)/10;
			ai--; bi--;
		}
		if(carry != 0) ans.push_back(carry);
		if(flag == true){
			if(ans.size() > 80){
				cout << "overflow" << endl;
				flag = false;
			}
			else{
				for(int j=ans.size()-1; j>=0; j--)
					cout << ans[j];
				cout << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){

	int n;

	string a, b;
	char N1[80], N2[80];
	char sum[80], temp[82];
	string ans;

	cin >> n;

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

		cin >> a;
		
		cin >> b;

		if( a.length() > 80 ){
			cout << "overflow" << endl;
			continue;
		}

		if( b.length() > 80 ){
			cout << "overflow" << endl;
			continue;
		}

		for( int i=0;i<80;i++ ){
			N1[i] = -1; N2[i] = -1; sum[i] = 0;
		}

		for( int i=1;i<=a.length();i++ )
			N1[i] = a[a.length()-i] - '0';
		for( int i=1;i<=b.length();i++)
			N2[i] = b[b.length()-i] - '0';

		int over = 0;
		
		for( int i=0;i<80;i++ ){


			if( N1[i] == -1 && N2[i] == -1 ){
				if( over >= 10 ){
					sum[i] = over / 10;
					over = 0;
				}else
					sum[i] = -1;
				continue;
			}

			if( N1[i] != -1 )
				sum[i] += N1[i];
			if( N2[i] != -1 )
				sum[i] += N2[i];

			sum[i] += over / 10;

			over = floor((double)sum[i]/10)*10;

			sum[i] -= over;
			
		}

		if(over > 0)cout << "overflow" << endl;
		else{
			int j=0;
			for( int i=1;i<80;i++ ){
				if( sum[80-i] >= 0 ){
					temp[j] = sum[80-i] + '0';
					j++;
					continue;
				}
				
			}
			temp[j] = '\0';

			ans = temp;

			


			cout << ans << endl;
		}

	}
	return 0;
}

C++: #include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	int n;
	cin >> n;
	rep(i, n) {
		vector<int> v1(101), v2(101);
		string s1, s2;
		cin >> s1 >> s2;

		rep(j, s1.size()) v1[j] = s1[s1.size() - j - 1] - '0';
		rep(j, s2.size()) v2[j] = s2[s2.size() - j - 1] - '0';
		
		rep(j, 100) {
			v1[j] += v2[j];
			if (v1[j] >= 10) {
				v1[j] -= 10;
				v1[j + 1]++;
			}
		}
		int digit = 0;
		for (int j = 100; j >= 0; j--) {
			if (v1[j] != 0) {
				digit = j;
				break;
			}
		}
		if (digit >= 80) cout << "overflow" << endl;
		else {
			for (int j = digit; j >= 0; j--) cout << v1[j];
			cout << endl;
		}
	}

}




int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	solve();
	//system("PAUSE");
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>
#include <cstdlib>
#include <typeinfo>
using namespace std;



int main(){
	int n;
	string x, y;
	int a, b, c;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x >> y;
		if (x.length() > 80 || y.length() > 80){
			cout << "overflow" << endl;
		}
		else{
			a = stoi(x);
			b = stoi(x);
			if (to_string(a + b).length() > 80){
				cout << "overflow" << endl;
			}
			else cout << a + b << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <utility>
using namespace std;
int toNumber(char c){
	switch (c)
	{
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	}
	return 0;
}
int main()
{
	int n, sa, sb, k, r, i;
	string a, b;
	int sum[100] = {};
	cin >> n;
	while (n--){
		cin >> a >> b;
		if (a.size() < b.size()) swap(a, b);
		sa = a.size();
		sb = b.size();
		k = i = 0;
		for (; i < sa; ++i){
			if (i < sb) k = toNumber(a[sa - 1 - i]) + toNumber(b[sb - 1 - i]) + k;
			else 		k = toNumber(a[sa - 1 - i]) + k;
			r = k % 10;
			k = k / 10;
			sum[i] = r;
		}
		if (0 != k) sum[i] = k;
		else --i;
		for (int d = i; d >= 0; --d)
			cout << sum[d];
		cout << "\n";
	}
	return 0;
}

C++: #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char* add(const char* a, const char* b)
{
    int sizeA, sizeB, sizeX;
    int A, B, C;
    char* x;
    char* t;
    const char* ap;
    const char* bp;
    char* xp;
    C = 0;
    sizeA = strlen(a);
    sizeB = strlen(b);
    sizeX = (sizeA > sizeB ? sizeA : sizeB)+1;
    x = (char*)malloc(sizeX);
    ap = a + sizeA-1;
    bp = b + sizeB-1;
    xp = x + sizeX-1;
    
    while(xp >= x){
        A = ap < a ? 0 : *ap - '0';
        B = bp < b ? 0 : *bp - '0';
        *xp = '0' + (A + B + C) % 10;
        C = (A + B + C) / 10;
        ap--;
        bp--;
        xp--;
    }
    if (*x == '0'){
        t = (char*)malloc(sizeX - 1);
        strcpy(t, x + 1);
        free(x);
        return t;
    }
    return x;
}
int main()
{
    int i;
    int N;
    scanf("%d", &N);
    for(i = 0; i < N; ++i){
        char first[201];
        char second[201];
        scanf("%s", first);
        scanf("%s", second);
        if(strlen(first) > 80
        || strlen(second) > 80){
            printf("overflow\n");
            continue;
        }
        char* result = add(first, second);
        if(strlen(result) <= 80){
            printf("%s\n", result);
            free(result);
        }else{
            printf("overflow\n");
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	for(cin>>n;n--;){
		string a,b;
		cin>>a;
		cin>>b;
		if(a.size()<b.size())swap(a,b);
		while(b.size()<a.size())b="0"+b;
		int f=0;
		for(int i=a.size()-1;i>=0;i--){
			a[i]+=(b[i]-'0'+f);
			if(a[i]>'9'){
				a[i]-=10;
				f=1;
			}else f=0;
		}
		if(f)a="1"+a;
		if(a.size()>80)
			cout<<"overflow"<<endl;
		else
			cout<<a<<endl;
		
	}
	return 0;
}