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 <cmath>
#include <cstdlib>
#include <cstdio>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>



int main() {

  std::string a, b;
  long x[81] = {};
  long y[81] = {};
  long N;
  char temp;
  long len;

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> a >> b;
    for(int j = 0; j < 81; ++j) {
      x[j] = y[j] = 0;
    }
    for(int j = 0; j < a.size(); ++j) x[j] = a[ a.size()-j-1 ] - '0';
    for(int j = 0; j < b.size(); ++j) y[j] = b[ b.size()-j-1 ] - '0';

    temp = 0;
    for(int j = 0; j < 81; ++j) {
      temp = x[j] + y[j] + temp;
      x[j] = (temp % 10);
      temp /= 10;
    }

    len = std::max(a.size(), b.size());
    if( x[len] != 0 ) {
      if( len == 80 ) { 
	std::cout << "overflow" << std::endl;
	continue;
      }
      for(int j = len; j >= 0; --j) {
	std::cout << x[j];
      }
      std::cout << std::endl;
      continue;
    }
    for(int j = len-1; j >= 0; --j) {
      std::cout << x[j];
    }
    std::cout << std::endl;
  }
    
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <stack>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
	int n;
    string a, b;
		
	cin>> n;	
	for(int i=0;i<n;i++){
		int x[81]={0}, y[81]={0};

		cin >> a;
		cin >> b;
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		
		for(int j=0;j<a.size();j++){
			x[j]=a[j]-'0';
		}
		for(int j=0;j<b.size();j++){
			y[j]=b[j]-'0';
		}
		
		for(int j=0;j<80;j++){
			x[j]=x[j]+y[j];
			if(x[j]>=10){
				x[j+1]++;
				x[j]-=10;
			}
		}
		//cout << 0 << endl;
		
		if(x[80]>0){
			cout << "overflow" <<endl;
		}else{
		/*
			bool flag = 0;
			for(int j=79;j>=0;j--){
				if(x[j]==0&& flag==0){
					continue;
				}else{
					flag=1;
				}
				cout<<x[j];
			}
			cout<<endl;
			*/
			cout<<0<<endl;
		}
		
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	int n;scanf("%d",&n);
	rep(i,n){
		string s,t;cin>>s>>t;
		string ans;
		int back=0;
		for(int j=1;j<=min(s.size(),t.size());j++){
			int d=s[s.size()-j]-'0'+t[t.size()-j]-'0'+back;
			ans=(char)(d%10+'0')+ans;
			back=d/10;
		}
		string u;
		if(s.size()>t.size())u=s;
		else u=t;
		for(int j=min(s.size(),t.size())+1;j<=u.size();j++){
			int d=u[u.size()-j]-'0'+back;
			ans=(char)(d%10+'0')+ans;
			back=d/10;
		}
		if(back)ans='1'+ans;
		if(ans.size()>80)puts("overflow");
		else cout<<ans<<endl;
	}
}

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

int main() {
	int n,x1,x2,y1,y2,p,q,a=0,b=0;
	vector<int> E,F;
	vector<long long int> S, T;
	vector<vector<long long int>> I,J;
	string s, t;
	vector<string> U;
	vector<vector<string>> UU;

	cin >> n;
	for (int k = 0; k < n; k++) {
		cin >> s >> t;
		int f = 0;
		if (s.size() > 80 || t.size() > 80) {
			f = 1;
			F.push_back(f);
		}
		else F.push_back(0);
		x1 = s.size() % 10; y1 = (s.size()+9) / 10;p = 8 - y1;
		for (int i = 0; i < p; i++)S.push_back(0);
		if (x1 == 0) for (int i = 0; i < y1; i++)S.push_back(stoll(s.substr(i * 10, 10)));
		else {
			S.push_back(stoll(s.substr(0, x1)));
			for (int i = 1; i < y1; i++)S.push_back(stoll(s.substr(x1 + i * 10, 10)));
		}

		x2 = t.size() % 10; y2 = (t.size()+9) / 10;q = 8 - y2;
		for (int i = 0; i < q; i++)T.push_back(0);
		if (x2 == 0) for (int i = 0; i < y2; i++)T.push_back(stoll(t.substr(i * 10, 10)));
		else {
			T.push_back(stoll(t.substr(0, x2)));
			for (int i = 1; i < y2; i++)T.push_back(stoll(t.substr(x2 + i * 10, 10)));
		}
		I.push_back(S); S.clear();
		J.push_back(T); T.clear();
	}
	for (int k = 0; k < I.size(); k++) {
		for (int i = 0; i < 8; i++) U.push_back(to_string(I[k][i] + J[k][i]));
		UU.push_back(U); U.clear();
	}
	
	for (int k = 0; k < I.size(); k++) {
		for (int i = 7; i >= 0; i--) {
			UU[k][i] = to_string(stoll(UU[k][i]) + b);
			if (UU[k][i].size() == 11 && i == 0) {
				UU[k][i] = "a";
				b = 1;
			}
			else if (UU[k][i].size() == 11) {
				UU[k][i] = UU[k][i].substr(1, 10);
				b = 1;
			}
			else if (UU[k][i].size() < 10) {
				for (int j = 0; j < 10 - UU[k][i].size()+j; j++) UU[k][i] = "0" + UU[k][i];
				b = 0;
			}
			else b = 0;
		}
		b = 0;
	}

	for (int k = 0; k < UU.size(); k++) {
		int e = 0;
		for (int i = 0; i < UU[k].size(); i++) {
			if (UU[k][i] == "a") {
				e = 100;
				break;
			}
			else if (stoll(UU[k][i]) == 0);
			else {
				e = i;
				E.push_back(e);
				break;
			}
		}
	}

		for(int k=0;k<UU.size();k++){
			if (E[k] == 100)cout << "overflow" << endl;
			else if (F[k] == 1)cout << "overflow" << endl;
			else {
				cout << stoll(UU[k][E[k]]);
				for (int i = E[k]+1; i < UU[k].size(); i++) cout << UU[k][i];
			}
			cout << endl;
		}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int N = 85;

char a[N], b[N];

void reverse(char a[]) {
	int len = strlen(a);
	for (int i=0, j=len-1; i<j; ++i, --j) {
		char tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	}
}

void add(char a[], char b[]) {
	int lenA = strlen(a);
	int lenB = strlen(b);
	int i, j, tmp, jin = 0;
	for (i=0; i<lenA && i<lenB; ++i) {
		tmp = (a[i] - '0') + (b[i] - '0') + jin;
		a[i] = tmp % 10 + '0';
		jin = tmp / 10;  
	}
	if (!a[i] && !b[i] && jin) {
		a[lenA] = jin + '0';
		a[lenA + 1] = '\0';
	}
	else if (a[i] && !b[i] && jin) {
		for (; i<lenA; ++i) {
			tmp = a[i] - '0' + jin;
			a[i] = tmp % 10 + '0';
			jin = tmp / 10;
		}
		if (jin) {
			a[lenA] = jin + '0';
			a[lenA + 1] = '\0';
		} 
	}
	else if (!a[i] && b[i] && jin) {
		for (; i<lenB; ++i) {
			tmp = b[i] - '0' + jin;
			a[i] = tmp % 10 + '0';
			jin = tmp / 10;
		}
		if (jin) {
			a[lenB] = jin + '0';
			a[lenB + 1] = '\0';
		}
		else a[lenB] = '\0';
	}
}

int main() {
	int t;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%s%s", a, b);
		if (strlen(a) > 80 || strlen(b) > 80) printf ("overflow\n");
		else {
			reverse(a);
			reverse(b);
			add(a, b);
			if (strlen(a) > 80) printf ("overflow\n");
			else reverse(a), printf ("%s\n", a);
		}
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int N,ans[82],a,b,la,lb,up,deg;
string sta,stb;

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>sta>>stb;
		la=sta.size();
		lb=stb.size();
		up=0;
		deg=1;
		for(int i=0;i<max(la,lb)+1;i++){
			if(i>=la)a='0';
			else a=sta[la-1-i];
			if(i>=lb)b='0';
			else b=stb[lb-1-i];
			if(a+b+up>105){
				ans[i]=a+b+up-10-96;
				up=1;
			}
			else{
				ans[i]=a+b+up-96;
				up=0;
			}
			if(ans[i]!=0)deg=i+1;
		}
		if(deg>80)cout<<"overflow"<<endl;
		else{
			for(int i=0;i<deg;i++)cout<<ans[deg-1-i];
			cout<<endl;
		}
	}
}