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 <iomanip>
#include <string.h>
#include <stdio.h>
using namespace std;

void checkArray(char str[])
// 配列の内容確認(テスト用)
{
	int size = strlen(str);
	for(int i = 0; i < size; ++i)
	{
		cout << "str[" << i << "]: " << str[i] << endl;
	}
}
void str_reverse(char s[])
// 文字列を反転する
{
     int i, l = strlen(s);
     char t;
     for(i = 0; i < l/2; i++) {
         t = s[i]; s[i] = s[l-i-1]; s[l-i-1] = t;
     }
}
void add(char num1[], char num2[])
// 足し算した結果を文字列として返す
{
	char res[82];
	bool carry = false; //繰り上がりの有無
	int maxlen = (strlen(num1) > strlen(num2)) ? strlen(num1) : strlen(num2);
	int flag1 = 0, flag2 = 0;

	str_reverse(num1);
	str_reverse(num2);

	for(int i = 0; i < maxlen+1; ++i){
		// '\n'以降は値を0とする
		if(num1[i] == '\0') flag1 = 1;
		if(num2[i] == '\0') flag2 = 1;
		res[i] = carry;
		if(!flag1)	res[i] += num1[i]-48;
		if(!flag2)	res[i] += num2[i]-48;
		carry = res[i] / 10;
		res[i] = res[i] % 10 + 48;
	}
	// 終端文字をつける
	if(res[maxlen] == '0')
		res[maxlen] = '\0';
	else res[maxlen+1] = '\0';

	// 元に戻す
	str_reverse(num1);
	str_reverse(num2);
	str_reverse(res);
	cout << res << endl;
}

int main() {
	int dataset;
	char num1[80];
	char num2[80];

	cin >> dataset; // データセットの個数

	for(int i = 0; i < dataset; ++i){
			// 80桁以下の数字を入力
			cin >> setw(80) >> num1;
			cin >> setw(80) >> num2;
			// 足し算した結果を表示
			add(num1, num2);
	}
}

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

using namespace std;

int main() {

	string a;
	string b;
	int kari;

	cin >> kari;

	for (int o = 0; o < kari; o++) {
		int c[80] = {0};
		int d[80] = {0};
		int e[81] = {0};
		int counter = 0;

		cin >> a;
		cin >> b;
	
		if (a.size() > 80 || b.size() > 80) {
			cout << "overflow" << endl;
			continue;
		} else {
			for (int i = a.size() - 1; i >= 0; i--) {
				c[a.size() - 1 - i] = a[i] - '0';
			}

			for (int i = b.size() - 1; i >= 0; i--) {
				d[b.size() - 1 - i] = b[i] - '0';
			}

			for (int j = 0; j < 80; j++) {
				e[j] += c[j] + d[j];
				if (e[j] >= 10) {
					e[j+1] = e[j] / 10;
					e[j] = e[j] % 10;
				} 
			}
		}

		if (e[80] > 0) {
			cout << "overflow" << endl;
		} else {
			for (int k = 79; k >= 0; k--) {
				if (e[k] != 0) {
					counter = k;
					break;
				}
			}
			for (int k = counter; k >= 0; k--) {
				cout << e[k];
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
	int N;
	cin >> N;
	while(N--){
		string a,b;
		cin >> a >> b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		while(a.size()>b.size())b += '0';
		while(a.size()<b.size())a += '0';
		string r;
		int c = 0; 
			for(int i = 0 ; i < a.size() ; i++){
			int d = a[i] + b[i] + c - 2 * '0';
			if( d >= 10 ) c = 1;
			else c = 0;
			r += d%10 + '0';
		}
		if(c)r += '0' + c;
		reverse(r.begin(),r.end());
		if( r.size() > 80 ) cout << "overflow" << endl;
		else cout << r << endl;
	}
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]-'0';
				if(in[NMin][ien[NMin]+1]>9+'0'){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			max10=0;
			
			for(;ien[NMin]>-1;ien[NMin]--){
				in[NMin][ien[NMin]]=in[NMin][ien[NMin]]-'0';
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			
			
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

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

using namespace std;

string reverse(const string& str){
  string ret;
  string::const_reverse_iterator it = str.rbegin();
  for(; it != str.rend(); it++) {
    ret.push_back(*it);
  }
  return ret;
}

void cut0(string& str){
  while(str[str.size() - 1] == '0' && str.size() > 1){
    str.erase(str.size() - 1);
  }
}

int main () {
  int n;
  string a, b, sum;
  
  cin >> n;
  while(n--) {
    bool overflow = false;

    cin >> a >> b;
    a = reverse(a);
    b = reverse(b);
    a.resize(80, '0');
    b.resize(80, '0');
    sum.clear();
    sum.resize(80, '0');
    
    for(size_t i = 0; i < 80; i++) {
      sum[i] += a[i] - '0' + b[i] - '0';
      if(sum[i] > '9'){
        sum[i] -= 10;
        if(i < 79) {
          sum[i+1] = '1';
        }
        else {
          overflow = true;
          break;
        }
      }
    }
    if(overflow){
      cout << "overflow" << endl;
    }
    else {
      cut0(sum);
      cout << reverse(sum) << endl;
    }
  }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	string s1, s2;
	int n, n1[100], n2[100];cin >> n;
	for(int g = 0;g < n;g++){
		int f = 0;
		cin >> s1 >> s2;
		for(int i = 0;i < 100;i++)n1[i] = n2[i] = 0;
		if(s1.size()>80 || s2.size()>80)f = 1;
		if(!f){
		for(int i = 0;i < s1.size();i++)n1[i] = s1[s1.size()-i-1] - '0';
		for(int i = 0;i < s2.size();i++)n2[i] = s2[s2.size()-i-1] - '0';
		
		
		for(int i = 0;i < 90;i++){
			n1[i] += n2[i];
			if(n1[i] > 9){n1[i] = n1[i]%10;n1[i+1]++;}
		}
		int flag = 0;
		for(int i = 90;i >= 0;i--){
			if(!flag && i == 0)cout << 0;
			if(flag && i >= 80)break;
			if(flag)cout << n1[i];
			if(!flag && i > 0 && n1[i-1] != 0)flag = 1;
		}
		if(!f)cout << endl;
		}
		if(f)cout << "overflow" << endl;
	}
	return 0; 
}