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 <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;
			}
		}
		
		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];
			}
			if(flag==0){
				cout<<0;
			}
			cout<<endl;
			
		}
		
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,longth,sub1,sub2,num,mem;
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';
        }
        mem = strlen(ans);
        if(mem > 80)printf("overflow\n");
        else
        {
            for(int i = mem - 1; i >= 0; i--)
            {
                printf("%c",ans[i]);
            }
            printf("\n");
        }
        for(int i = 0; i < mem; i++)
        {
            ans[i] = 0;
        }
    }
    return 0;
}

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++){

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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    while (N--) {
        string s1, s2;
        cin >> s1;
        cin >> s2;
        vector<int> n1, n2, res;
        for (int i = s1.size(); i--;) {
            n1.push_back((int)(s1[i] - '0'));
        }
        for (int i = s2.size(); i--;) {
            n2.push_back((int)(s2[i] - '0'));
        }
        if (n1.size() < n2.size()) {
            for (int i = n1.size(); i < n2.size(); i++) {
                n1.push_back(0);
            }
        } else if (n2.size() < n1.size()) {
            for (int i = n2.size(); i < n1.size(); i++) {
                n2.push_back(0);
            }
        }
        int s, c = 0;
        for (int i = 0; i < n1.size(); i++) {
            s = n1[i] + n2[i] + c;
            res.push_back(s % 10);
            c = s / 10;
        }
        if (c != 0) {
            res.push_back(c);
        }
        if (res.size() > 80) {
            cout << "overflow" << endl;
        } else {
            int i = res.size();
            while (i > 0 && res[i - 1] == 0) {
                i--;
            }
            while (i--) {
                cout << res[i];
            }
            cout << endl;
        }
    }
    return 0;
}

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

using namespace std;

int main(){
  string str1,str2;
  int testnum;

  cin>>testnum;
  int t=0;
  while(t<testnum&&cin>>str1>>str2){
    string sumstr;
    reverse(str1.begin(),str1.end());
    reverse(str2.begin(),str2.end());

    unsigned size=min(str1.size(),str2.size());
    unsigned i;
    unsigned carry=0;
    for(i=0;i<size;++i){
      unsigned sum=str1[i]+str2[i]+carry-'0'*2;
      sumstr.push_back(sum%10+'0');
      carry=sum/10;
    }

    string large=(str1.size()>str2.size())?str1:str2;
    for(;i<large.size();++i){
      unsigned sum=large[i]+carry-'0';
      sumstr.push_back(sum%10+'0');
      carry=sum/10;
    }

    if(carry) sumstr.push_back(carry+'0');
    reverse(sumstr.begin(),sumstr.end());
    
    if(sumstr.size()<=80)
      cout<<sumstr<<endl;
    else
      cout<<"overflow"<<endl;
    t++;
  }
}