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 <stdio.h>
#include <string.h>
 
int main(void)
{
    unsigned char num1[100],num2[100];
    int ia,ib,i,j,k,l,num,ex,large,small;
    int size1,size2;
    int sum[100];
 
    scanf("%d",&num);//????????????????????°
 
    for (l = 0; l < num; ++l)
    {
        scanf("%s",num1);
        scanf("%s",num2);
 
        size1 = strlen(num1);
        size2 = strlen(num2);
 
        if (size2 >= size1)// ???>??????????????¨?????????????????°???
        {
            large = (size2 - 1);
            small = (size1 - 1);
        }
        else if (size1 >= size2)
        {
            large = (size1 - 1);
            small = (size2 - 1);
        }
 
        //80?????\?????§overflow
        if (large > 80)
        {
            printf("overflow\n");
            continue;
        }
 
 
        //num1?????°?????????????????????******************************************
        for(ia = 0; ia < 100; ia++)
        {
            if(num1[ia+1] == '\0')break;   //NULL?????????????????????????????????
             
            ex = num1[ia];
            num1[ia] = num1[ia+1];
            num1[ia+1] = ex;
        }
 
        for (j = ia; j > 0 ; --j) //ia?????????????????§??????????????£??????
        {
            for (k = 0; k < j-1; ++k) //????????????????????????????????£??????
                                      //??????????????¨??????????????? ?????????????????§
            {
                ex = num1[k];
                num1[k] = num1[k+1];
                num1[k+1] = ex;
            }
        }
 
        j=0;
        k=0;
 
        //num2?????°?????????????????????******************************************
        for(ib = 0; ib < 100; ib++)
        {
            if(num2[ib+1] == '\0')break;   //NULL?????????????????????????????????
             
            ex = num2[ib];
            num2[ib] = num2[ib+1];
            num2[ib+1] = ex;
        }
 
        for (j = ib; j > 0 ; --j) //ib?????????????????§??????????????£??????
        {
            for (k = 0; k < j-1; ++k) //????????????????????????????????£??????
                                      //??????????????¨??????????????? ?????????????????§
            {
                ex = num2[k];
                num2[k] = num2[k+1];
                num2[k+1] = ex;
            }
        }
 
        j=0;
        k=0;
 
 
        //??±????????????????????\???????????????
        //(large???0?????\???????????¨??????????????????????????????)
        if (ia == 0 && ib == 0)
        {
            printf("%d\n", (num1[0]-48) + (num2[0]-48));
            continue;
        }
 
        //??°??????????????\???????????????
        //??\???????¶???????????????????????????????????????????0???????´?
        if (ia != ib)
        {
            for (j = small + 1; j <= large ; ++j)
            {
                if (ia < ib)
                {
                    num1[j] = '0';
                }
                else if (ib < ia)
                {
                    num2[j] = '0';
                }
            }
        }
 
        //?????????
        for (i = 0; i <= large+1; ++i)
        {
            sum[i] = 0;
        }
 
        i = 0;
 
        for (i = 0; i <= large; ++i)
        {
            sum[i] += ((num1[i]-'0') + (num2[i]-'0'));
 
            if (sum[i] >= 10)//??????????????¢??¬??§10?¶?????????????
            {
                sum[i] -= 10;   //??????????????°????????\??????
                sum[i+1] += 1;; //??°?????????
 
                //(???)80 + 50?????????????????????????????´????????????
                if (i == large)
                {
                    large += 1;
                    break;
                }
            }
        }
 
        //?¶????????????????80????¶??????????overflow
        if (large > 80)
        {
            printf("overflow\n");
            continue;
        }
 
        for (i = large; i >= 0; --i)
        {
            printf("%d", sum[i]);
        }
        printf("\n");
 
        i = 0;
 
    }
 
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef vector<int> vi;

int n;
string s1, s2;
char n1[81], n2[81], sum[81];

int main() {
	scanf("%d", &n);
	rep(i,n) {
		memset(n1, 0, sizeof(n1));
		memset(n2, 0, sizeof(n2));
		memset(sum, 0, sizeof(sum));

		cin>>s1>>s2;
		int l1 = s1.size();
		int l2 = s2.size();
		if(min(l1,l2) > 80) {
			printf("overflow\n");
			return 0;
		}

		rep(k,l1) n1[k] = s1[l1-k-1] - '0';
		rep(k,l2) n2[k] = s2[l2-k-1] - '0';

		char a = 0;
		rep(i,80) {
			char c = n1[i] + n2[i] + a;
			a = c / 10;
			sum[i] = c % 10;
		}

		if(sum[80] != 0) {
			printf("overflow\n");
			return 0;
		}

		bool start = false;
		repd(i,80,0) {
			if(sum[i] != 0) start = true;
			if(!start && sum[i] == 0) continue;
			printf("%d", sum[i]);
		}
		printf("\n");
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	string a,b;
	cin >> n;
	while(n--) {
		cin >> a >> b;
		string ret = "";
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int a_len = a.size(),b_len = b.size();
		int num = max(a_len,b_len),carry = 0,v;
		char tmp[1];
		for(int i = 0; i < num; i++) {
			if(a_len <= i || b_len <= i) v = carry + (b_len <= i ? a[i] : b[i]) - '0';
			else v = carry + a[i] + b[i] - '0' * 2;
			carry = v / 10;
			sprintf(tmp,"%d",v % 10);
			ret += tmp;
		}
		sprintf(tmp,"%d",carry);
		if(carry != 0) ret += tmp;
		reverse(ret.begin(),ret.end());
		cout << (ret.size() > 80 ? "overflow" : ret) << endl;
	}
	return 0;
}