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<string>
#include<algorithm>
using namespace std;

int main(void){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		string a,b,ans;
		cin >> a;
		cin >> b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int c=0;
		for(int j=0;j<max(a.size(),b.size());j++){
			string d;
			int e;
			e=c;
			if(a.size()>j)e+=a[j]-'0';
			if(b.size()>j)e+=b[j]-'0';
			c=0;
			if(e>=10)c=1,e-=10;
			d=e+'0';
			ans+=d;
		}
		reverse(ans.begin(),ans.end());
		if(ans.size()<=80)cout << ans << endl;
		else cout << "overflow" << endl;
	}
    return 0;
}

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

int main(){
	const int size = 80;
	char str1[size + 10], str2[size + 10];
	int num1[size], num2[size], res[size];
	int n, leng1, leng2, loop, kuri;
	bool output;
	
	scanf("%d", &n);
	
	for(int a = 0; a < n; a++){
		fill(str1, str1 + size + 10, 0);
		fill(str2, str2 + size + 10, 0);
		fill(num1, num1 + size, 0);
		fill(num2, num2 + size, 0);
		fill(res, res + size, 0);
		scanf("%s", str1);
		scanf("%s", str2);
		
		//char -> int
		for(leng1 = 0; (int)str1[leng1 + 1] >= 48 && (int)str1[leng1 + 1] <= 57 && leng1 + 1 < size + 10; leng1++);//length of str1
		for(leng2 = 0; (int)str2[leng2 + 1] >= 48 && (int)str2[leng2 + 1] <= 57 && leng2 + 1 < size + 10; leng2++);//length of str2
		
		loop = 1;
		while(leng1 >= 0){
			num1[size - loop] = (int)str1[leng1] - 48;
			leng1--; loop++;
		}
		loop = 1;
		while(leng2 >= 0){
			num2[size - loop] = (int)str2[leng2] - 48;
			leng2--; loop++;
		}
		kuri = 0;
		for(int i = size - 1; i >= 0; i--){
			res[i] = num1[i] + num2[i] + kuri;
			kuri = res[i] / 10;
			if(kuri > 0) res[i] -= 10;
		}
		
		if(kuri > 0) printf("overflow\n");
		else{
			output = false;
			for(int i = 0; i < size; i++){
				if(!output && res[i] == 0) continue;
				else{
					output = true;
					printf("%d", res[i]);
				}
			}
			if(!output) printf("0");
			printf("\n");
		}
	}
	return 0;
}

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

class BigNum {
public:
	BigNum() : c(0), keta(0), size(0) {};

	BigNum(int n) : c(0), keta(0), size(0) {
		size = n;
		c = new char [size];
		memset(c, 0, size);
	};

	~BigNum() {
		if (c) {
			delete [] c;
		}
	};

	int getnum(const char* buf) {
		keta = strlen(buf);
		if (buf[keta-1] == '\n') {
			keta --;
		}
		if (keta == 0) {
			return -1;
		}
		if (c) {
			delete [] c;
		}
		size = keta;
		c = new char [size];
		int k = 0;
		for (int i = keta - 1; i >= 0; i--) {
			c[k++] = buf[i] - '0';
		}
		
		return 0;
	};

	void print(void) const {
		for (int i = keta - 1; i >= 0; i --) {
			printf("%d", c[i]);
		}
		printf("\n");
	};

	static int add(BigNum& x, BigNum& y) {
		BigNum* a;
		BigNum* b;

		if (x.keta > y.keta) {
			a = &x;
			b = &y;
		} else {
			a = &y;
			b = &x;
		}

		BigNum r(a->keta + 1);

		int h;
		int m = 0;
		for (int i = 0; i < a->keta; i++) {
			if (i < b->keta) {
				h = a->c[i] + b->c[i] + m;
			} else {
				h = a->c[i] + m;
			}
			
			m = h / 10;
			r.c[i] = h % 10;
		}

		r.keta = a->keta;
	
		if (m > 0) {
			r.c[r.keta] = m;
			r.keta ++;
		}

		if (r.keta > 80) {
			return 1;
		}

		r.print();

		return 0;
	};

	char* c;
	int keta;

private:
	size_t size;
};

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		BigNum a;
		if (a.getnum(line)) {
			return 1;
		}

		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		BigNum b;
		if (b.getnum(line)) {
			return 1;
		}

		if (BigNum::add(a, b)) {
			printf("overflow\n");
		}
	}

	return 0;
}

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

main(){
    int tcase, m; cin >> tcase;
    string s1, s2, s3;
    for ( int i = 0; i < tcase; i++ ){
	cin >> s1 >> s2; s3 = "";
	m = max(s1.size(), s2.size());
	while( s1.size() < m ) s1 = '0' + s1;
	while( s2.size() < m ) s2 = '0' + s2;
	int c = 0;
	for ( int i = m-1; i >= 0; i-- ){
	    char ch = ((s1[i]-'0')+(s2[i]-'0')+c)%10 + '0';
	    c = ((s1[i]-'0')+(s2[i]-'0')+c)/10;
	    s3 += ch;
	}
	if ( c ) s3 += c+'0';
	reverse(s3.begin(), s3.end());
	while( s3.size() > 1 && s3[0] == '0' ) s3.erase(s3.begin());
	if ( s3.size() > 80 ) cout << "overflow" << endl;
	else cout << s3 << endl;
    }
}

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");
		cout<<ans<<endl;
	}
}

C++: 






#include<iostream>
#include<algorithm>
#include<string>


#define MAX 1000


//99999999999999999999999999999999999999999999999999999999999999999999999999999999

using namespace std;


int main()
{
	int n = 0;
	string in[2];
	char out[MAX] = {NULL};

	cin >> n;

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

		in[0].resize(0);
		in[1].resize(0);

		cin >> in[0] >> in[1];

		for (int i = 0; i < MAX; i++){
			out[i] = '\0';
		}

		int count = in[0].size() - 1;

		for (int i = 0; i < in[0].size(); i++){
			out[count--] += in[0][i];
		}

		count = in[0].size();
		int count2 = in[1].size() - 1;

		count = max(count , count2) - 1;

		for (int i = 0; i < in[1].size(); i++){
			if (out[i] != '\0'){
				out[i] -= '0';
			}
			out[i] += in[1][count2--];
			count--;
		}
		
		int i = 0;
		for (i = 0; out[i] != '\0'; i++){
			;
		}

		bool flag = false;


		for (int j = 0; j < i; j++){
			if (out[j] > '9'){
				out[j] -= 10;
				out[j + 1] += 1;
			}
		}

		if (out[i] > '\0' && out[i] < '0'){
			out[i] += '0';
		}
		
		for (i = 0; i < out[i] != '\0'; i++){
			;
		}

		for (int j = 0; j < i / 2; j++){
			char tmp = out[j];
			out[j] = out[i - j - 1];
			out[i - j - 1] = tmp;
		}

		for (i = 0; out[i]; i++){
			;
		}

		if (i > 80){
			cout << "overflow" << endl;
		}else{
			cout << out << endl;
		}
	}

	return 0;
}