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

int main() {
	int n;
	cin >> n;
	for(int k = 0; k < n; k++) {
		string str1, str2;
		cin >> str1 >> str2;
		int a = str1.size(), b = str2.size();
		if(a > 80 || b > 80) {
			cout << "overflow" <<endl;
		} else if(a >= b) {
			for(int i = 0; i < b; i++) {
				str1[a - b + i] += str2[i] - '0';
				for(int i = a - 1; i >= 0; i--) {
					if(str1[i] > '9') {                 //?????????//
						if(i != 0) {
							str1[i] = str1[i] - ':' + '0';
							str1[i - 1] = str1[i - 1] + 1;
						}
					}
				}
			}
			if(a == 80 && str1[0] > '9') {
				cout << "overflow" <<endl;
			} else {
				for (int j = 0; j < a; j++) {
					if(str1[j] > '9') {
						printf("%d",str1[j] - '0');
					} else cout<< str1[j];
				}
			}
		} else if(b > a) {
			for(int i = 0; i < a; i++) {
				str2[b - a + i] += str1[i] - '0';
				for(int i = b - 1; i >= 0; i--) {
					if(str2[i] > '9') {                    //?????????//
						if(i != 0) {
							str2[i] = str2[i] - ':' + '0';
							str2[i - 1] = str2[i - 1] + 1;
						}
					}
				}
			}
			if(b == 80 && str2[0] > '9') {
					cout << "overflow" <<endl;
			} else {
				for (int j = 0; j < b; j++) { 
					if(str2[j] > '9') {
						printf("%d",str2[j] - '0');
					} else cout << str2[j];
				}
			}
		}
		cout <<endl;
	}
	return 0;
}

C++: /*
2つの数の和を求める。80桁を超える場合は"overflow"と表示
int型やlong型では80桁は扱えないことに注意
*/
#include <iostream>
using namespace std;

int main(void) {
    char n1[100], n2[100];                       // 入力する数字を格納する整数文字列
    int size1, size2, size_sum;                  // 入力した数字とその和の桁数を格納する変数
    int N1, N2, Sum;                             // N1,N2はそれぞれの桁をint型で格納。Sumは繰り上がりの判定
    int sum[100 + 1];                           // 和を格納する整数文字列
    int n;
    
    cin >> n;
    
    for(int k = 0; k < n; ++k) {
        cin >> n1 >>n2;
        size1    = 0;
        size2    = 0;
        size_sum = 0;
        Sum      = 0;
        while(n1[size1] != '\0') {
            size1++;
        }
        while(n2[size2] != '\0') {
            size2++;
        }
        if(size1 > size2) {
            while(size1 != 0) {
                if(size2 != 0) {
                    N1 = n1[--size1] - '0';
                    N2 = n2[--size2] - '0';
                } else {
                    N1 = n1[--size1] - '0';
                    N2 = 0;
                }
                Sum += N1 + N2;
                if(Sum >= 10) {
                    sum[size_sum++] = Sum - 10;
                    Sum = 1;
                } else { 
                    sum[size_sum++] = Sum;
                    Sum = 0;
                }
            }
        } else {
            while(size2 != 0) {
                if(size1 != 0) {
                    N1 = n1[--size1] - '0';
                    N2 = n2[--size2] - '0';
                } else {
                    N1 = 0;
                    N2 = n2[--size2] - '0';
                }
                Sum += N1 + N2;
                if(Sum >= 10) {
                    sum[size_sum++] = Sum - 10;
                    Sum = 1;
                } else { 
                    sum[size_sum++] = Sum;
                    Sum = 0;
                }
            }
        }
        if(Sum == 1) {
            sum[size_sum++] = 1;
        }
        if(size_sum > 80) {
            cout << "overflow" << endl;
        } else {
            for(int i = 1; i <= size_sum; ++i) {
                cout << sum[size_sum - i];
            }
            cout << endl;
        }
    }
}

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

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool overflowFLG;
	int n,length1,length2,kuriagari,tmp,output[101];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=81 || length2 >= 81)printf("overflow\n");
		else{
			overflowFLG=false;
			kuriagari=0;
			if(length1>length2){
				for(int k=0;length1-1-k>=0;k++){
					tmp = kuriagari;
					if(length2-1-k>=0){
						tmp = (buf1[length1-1-k]-'0')+(buf2[length2-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;
						}else{
							kuriagari = 0;
						}
						output[length1-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length1-1-k] = buf1[length1-1-k]-'0';
						}else{
							output[length1-1-k] = buf1[length1-1-k]-'0' + kuriagari;
							if(output[length1-1-k]>=10){
								output[length1-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length1-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}else{
				for(int k=0;length2-1-k>=0;k++){
					tmp = kuriagari;
					if(length1-1-k>=0){
						tmp = (buf2[length2-1-k]-'0')+(buf1[length1-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;
						}else{
							kuriagari = 0;
						}
						output[length2-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length2-1-k] = buf2[length2-1-k]-'0';
						}else{
							output[length2-1-k] = buf2[length2-1-k]-'0' + kuriagari;
							if(output[length2-1-k]>=10){
								output[length2-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length2-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}
		}
	}

    return 0;
}