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<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        char a[1000] = {0};
        char b[1000] = {0};
        scanf("%s%s",a,b);
        int len_a = strlen(a),len_b = strlen(b);
        char ans[1000] = {0};
        reverse(a,a+len_a);
        reverse(b,b+len_b);
        for(int i = 0; i < max(len_a,len_b); i++){
            if(ans[i] != 0){
                if(a[i] == 0 || b[i] == 0)
                    ans[i] += a[i] + b[i] - '0';
                else ans[i] += a[i] + b[i] - '0' - '0';
            }
            else if(a[i] == 0 || b[i] == 0) ans[i] += a[i] + b[i];
            else ans[i] += a[i] + b[i] - '0';
            if(ans[i] >= 58){
                ans[i+1]+='1';
                ans[i] -= 10;
            }
        }
        int len_ans = strlen(ans);
        reverse(ans,ans+len_ans);
        if(len_ans > 80){
            printf("overflow\n");
            continue;
        }
        for(int i = 0; ans[i] != 0; i++) printf("%c",ans[i]);
        printf("\n");
    }
    return 0;
}