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 <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    int n;
    cin>>n;
    rep(i,n){
        string a,b;
        cin>>a>>b;
        if(a.sz>b.sz)swap(a,b);
        reverse(all(a));
        reverse(all(b));
        int k=b.sz-a.sz;
        rep(i,k)a+='0';
        
        
        int ans[100]={};
        rep(i,b.sz){
            ans[i]+=a[i]-'0'+b[i]-'0';
            if(ans[i]>=10){
                ans[i]-=10;
                ans[i+1]++;
            }
        }
        if(ans[b.sz])cout<<ans[b.sz];
        for(int i=b.sz-1;i>=0;i--){
            cout<<ans[i];
        }
        cout<<endl;
    }
    return 0;
}

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

using namespace std;


int main(){
	int n;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		string a, b;
		cin >> a;
		cin >> b;

		if(a.size() < b.size()){
			string temp;
			temp = a;
			a = b;
			b = temp;
		}
		while(b.size() != a.size()){
			b = "0" + b;
		}

		if(a.size() > 80){
			cout << "overflow" << endl;
		}else{
			for(int i=0 ; i<a.size() ; i++){
				a[a.size()-1-i] += b[b.size()-1-i] - '0';
			}
			for(int j=0 ; j<a.size()-1 ; j++){
				if(a[a.size()-1-j] > '9'){
					a[a.size()-1-j] -= 10;
					a[a.size()-2-j]++;
				}
			}
			if(a[0] > '9'){
				a[0] -= 10;
				a = "1" + a;
			}

		}

		if(a.size() > 80) {
			cout << "overflow" << endl;
		}else{
			cout << a << endl;
		}

	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int a[81];
	int b[81];
	int ans[81];
	int n;
	cin>>n;
	rep(j,n){
		rep(i,81){
			a[i]=b[i]=ans[i]=0;
		}
		string s[2];
		cin>>s[0];
		int cnt=80;
		for(int i=s[0].size()-1;i>=0;i--){
			a[cnt]=s[0][i]-'0';
			cnt--;
		}
		cin>>s[1];
		if(s[0].size()>80 || s[1].size()>80){
			cout<<"overflow"<<endl;
			continue;
		}
		cnt=80;
		for(int i=s[1].size()-1;i>=0;i--){
			b[cnt]=s[1][i]-'0';
			cnt--;
		}
		bool check=true;
		for(int i=80;i>=0;i--){
			ans[i]=a[i]+b[i];
			//cout<<i<<":"<<a[i]<<"+"<<b[i]<<"="<<ans[i]<<endl;
			if(ans[i]>=10){
				a[i-1]++;
				ans[i]%=10;
			}
		}
		if(ans[0]>0){
			cout<<"overflow"<<endl;
			check=false;
		}
		int ite=0;
		rep(i,81){
			if(ans[i]!=0){
				ite=i;
				break;
			}
		}
		if(check){
			for(int i=ite;i<81;i++){
				cout<<ans[i];
			}
			cout<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;



string sum(string& a, string& b){
	int i = a.length() - 1;
	int j = b.length() - 1;
	int carry = 0;
	string temp;

	while(i >= 0 && j >= 0){
		temp.push_back((a[i] + b[j] + carry - 2*'0') % 10 + '0');
		carry = (a[i] + b[j] - 2*'0') / 10;
		--i, --j;
	}

	string& longer = i > j ? a : b;
	int& index = i > j ? i : j;
	while(index >= 0){
		temp.push_back((longer[index] + carry - '0') % 10 + '0');
		carry = (longer[index] + carry - '0') / 10;
		--index;
	}

	if(carry){
		temp.push_back('1');
	}

	reverse(begin(temp), end(temp));

	return temp;
}

int main(){
	int n;
	cin >> n;

	vector<string> input(n*2);

	for(int i = 0; i < n*2; i++){
		cin >> input[i];
	}

	for(int i = 0; i < n; i++){
		string t = sum(input[2*i], input[2*i+1]);
		if(t.size() <= 80)
			cout << t << endl;
		else
			cout << "overflow" << endl;
	}


	return 0;
}

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] = bstr[y - j - 1];
					}
				}
			}
		}
		if (y > 80 - r || x > 80 - r)
			printf("overflow\n");
//		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");
		r = 0;
	}
}

C++: #include <stdio.h>
#include <string.h>
int main() {
    char first[85],second[85],ans[85];int left,right,i,last,N;scanf("%d",&N);while (N--) {
    left=0,right=0;scanf("%s",&ans);for (i=strlen(ans)-1;i>=0;i--) first[left++]=ans[i];scanf("%s",&ans);for (i=strlen(ans)-1;i>=0;i--) second[right++]=ans[i];
    for (i=left;i<85;first[i++]='0');for (i=0,last=0;i<right;i++) {last+=(first[i]+second[i]-96);if (last>=10) first[i]=last%10+48,last/=10; else first[i]=last+48,last=0;}
    while (last) {last+=first[i]-48;if (last>=10) first[i]=last%10+48,last/=10,i++; else first[i]=last+48,last=0;}
	for (i=84;i>=0 && first[i]=='0';i--);if (i<0) puts("0"); else {for (;i>=0;printf("%c",first[i--]));puts("");}} return 0;
}