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() {
  int tcase;
  
  cin >> tcase;
  while(tcase--) {
    string A, B, C = "";
    cin >> A >> B;
    
    unsigned sz = max(A.size(), B.size());
    while(A.size()<sz) A = '0' + A;
    while(B.size()<sz) B = '0' + B;

    int c = 0;
    for(int i=sz-1; i>=0; i--) {
      // 確定情報
      C += (( (A[i]-'0') + (B[i]-'0') + c ) % 10 + '0');
      // 前座
      c = ( (A[i]-'0') + (B[i]-'0') + c ) / 10;
    }
    if(c>0) C += (c + '0');
    
    reverse(C.begin(), C.end());
    if(C.size() > 80) cout << "overflow" << endl;
    else cout << C << endl;
  }
  return 0;
}

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

int main(){
  std::string str1,str2,sumstr;
  while(std::cin>>str1>>str2){
    sumstr.clear();
    std::reverse(str1.begin(),str1.end());
    std::reverse(str2.begin(),str2.end());
    unsigned size=std::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;
    }
    std::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');
    std::reverse(sumstr.begin(),sumstr.end());
    sumstr.push_back('\0');
    if(sumstr.size()<=80)
      std::cout<<sumstr<<std::endl;
    else
      std::cout<<"overflow"<<std::endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    for(int j=0;j<n;j++){
        string a,b;
        cin>>a>>b;
        int numa[100000]={0},numb[100000]={0};
        int flag=0;
        vector<int> sum;
        if(80<max(a.size(),b.size())){
            puts("overflow");
            goto exit;
        }
        for(int i=a.size()-1,k=0;0<=i;i--,k++)numa[k]=a[i]-'0';
        for(int i=b.size()-1,k=0;0<=i;i--,k++)numb[k]=b[i]-'0';
        for(int i=0;i<max(a.size(),b.size());i++){
            sum.push_back((numa[i]+numb[i])%10);
            numa[i+1]+=(numa[i]+numb[i])/10;
            if(i==max(a.size(),b.size())-1&&(numa[i]+numb[i])/10==1)printf("1");
        }
        if(80<sum.size())puts("overflow");
        else{
            for(int i=sum.size()-1;0<=i;i--)printf("%d",sum[i]);
            puts("");
        }
exit:
;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		string a,b,c;
		char d=0,st;
		cin>>a>>b;
		for(int j=a.size();j<81;++j) a="0"+a;
		for(int j=b.size();j<81;++j) b="0"+b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		for(int j=0;j<80;++j){
			c+=(((a[j]-'0')+(b[j]-'0')+d)%10+'0');
			d=((a[j]-'0')+(b[j]-'0')+d)/10;
		}
		if(d) cout<<"overflow\n";
		else{
			reverse(c.begin(), c.end());
			for(st=0;st<c.size();++st)if(c[st]!='0')break;
			cout<<((st==c.size())?"0\n":c.substr(st,c.size()-st)+"\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
using namespace std;
typedef pair<int,int> P;
const int INF = ~(1<<31) / 2;

int main(){
    int k;
    cin >> k;
    for(int j=0;j<k;j++){
        int n[80];
        string a,b;
        cin >> a >> b;
        int n_a = a.size(),n_b = b.size();
        fill(n,n+80,0);

        bool is_over = false;
        for(int i=0;i<max(n_a,n_b);i++){
            int ai,bi;
            if (i<n_a) ai = a[n_a-i-1]-'0';
            else ai = 0;
            if (i<n_b) bi = b[n_b-i-1]-'0';
            else bi = 0;
            n[i] += ai + bi;
            if (n[i]>=10){
                if(i+1 == 80){
                    is_over = true;
                    break;
                }else{
                    n[i+1] += n[i]/10;
                    n[i] = n[i]%10;
                }
            }
        }
        if (is_over){
            cout << "overflow" << endl;
        }else{
            bool started = false;
            for(int i=79;i>=0;i--){
                if(!started && n[i]>0){
                    started = true;
                }
                if(started){
                    cout << n[i];
                }
            }
            cout << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int DIGIT=9;

int main() {
  int n;
  char buf[81];
  int l, x, y;
  char buf_part[DIGIT+1];
  int a[2][9];
  int b[9];

  cin >> n;
  while (n--) {
    for (int i=0; i<2; i++) {
      cin >> buf;
      l = strlen(buf);
      x = (l+DIGIT-1)/DIGIT;
      y = (l-1)%DIGIT+1;
      for (int j=0; j<9; j++) {
        a[i][j] = 0;
      }
      for (int j=0; j<x; j++) {
        if (!j) {
          memcpy(buf_part, buf, y);
          buf_part[y] = '\0';
        }
        else {
          memcpy(buf_part, &buf[y+DIGIT*(j-1)], DIGIT);
          buf_part[DIGIT] = '\0';
        }
        a[i][x-j-1] = atoi(buf_part);
      }
    }

    for (int i=0; i<9; i++) b[i] = 0;
    x = 0;
    for (int i=0; i<9; i++) {
      if (a[0][i] || a[1][i]) {
        b[i] = a[0][i] + a[1][i];
        if (b[i] >= 1000000000) {
          a[0][i+1]++;
          b[i] -= 1000000000;
        }
        x++;
      } else {
        break;
      }
    }
    if (b[8] >= 100000000) {
      cout << "overflow" << endl;
    } else {
      cout << b[x-1];
      for (int i=x-2; i>=0; i--) {
        cout.fill('0');
        cout.width(DIGIT);
        cout << b[i];
      }
      cout << endl;
    }
  }
  return 0;
}

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

int main(void){
	int n = 0;
	char i1[100], i2[100], o[100];
	int d1[81], d2[81], d[81];
	int c = 0;

	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%s", i1);
		scanf("%s", i2);
		if(strlen(i1) > 80 || strlen(i2) > 80){
			puts("overflow");
			continue;
		}
		for(int j=0;j<81;++j){
			d1[j] = d2[j] = d[j] = 0;
		}
		for(int j=strlen(i1)-1;j>=0;--j){
			d1[j] = *(i1 + j) - '0';
		}
		for(int j=strlen(i2)-1;j>=0;--j){
			d2[j] = *(i2 + j) - '0';
		}
		for(int j=0;j<81; ++j){
			d[j] = d1[j] + d2[j] + c;
			c = d[j] >= 10 ? 1 : 0;
			d[j] -= 10 * c;
		}
		for(c=80; c>=0; --c){
			if(d[c] != 0){
				break;
			}
		}
		if(c == 80){
			puts("overflow");
			continue;
		}
		for(int j = 0; j<=c; ++j){
			o[j] = d[c - j] + '0';
		}
		o[c + 1] = '\0';
		printf("%s\n", o);
	}
	return 0;
}