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 <bits/stdc++.h>

using namespace std;

int main(){

    string s;
    int n, num1[101], num2[101], num3[102], ldigit;

    cin >> n;

    for(int i = 0; i < n; ++i){

        memset(num1, 0, sizeof(num1));
        memset(num2, 0, sizeof(num2));
        memset(num3, 0, sizeof(num3));

        cin >> s;

        for(int i = 0, len = s.size(); i < len; ++i){
            num1[i] = s[len - 1 - i] - '0';
        }

        cin >> s;

        for(int i = 0, len = s.size(); i < len; ++i){
            num2[i] = s[len - 1 - i] - '0';
        }

        for(int i = 0, num; i < 101; ++i){
            num = num1[i] + num2[i] + num3[i];
            num3[i] = num % 10;
            num3[i + 1] = num / 10;
        }

        for(int i = 101; i >= 0; i--){
            if(num3[i] != 0){
                ldigit = i;
                break;
            }
        }

        if((ldigit + 1) > 80){
            cout << "overflow" << endl;
        } else {
            for(int i = ldigit; i >= 0; i--){
                cout << num3[i];
            }
            cout << endl;
        }

    }

}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n;
    cin >> n;
    rep(k,n){
        char input1[82], input2[82];
        cin >> input1 >> input2;
        //後ろから和を求める
        int ans[81] = {0};
        int size1 = strlen(input1) - 1;
        int size2 = strlen(input2) - 1;
        int i = 0;
        if(size1 > 80 || size2 > 80){
            cout << "overflow" << endl;
            break;
        }
        while(1){
            if(size1 - i >= 0 && size2 - i >= 0)
                ans[i] += input1[size1 - i] - '0' + input2[size2 - i] - '0';
            else if(size1 - i >= 0)
                ans[i] += input1[size1 - i] - '0';
            else if(size2 - i >= 0)
                ans[i] += input2[size2 - i] - '0';
            //桁数を繰り上げる
            if(ans[i] >= 10){
                ans[i] -= 10;
                ans[i + 1]++;
            }
            if(size1 - i < 0 && size2 - i < 0)
                break;
            i++;
        }
        //出力
        if(ans[80] == 1)
            cout << "overflow";
        else{
            for(int j = i; j >= 0; j--){
                if(ans[i] == 0 && j == i)
                    continue;
                cout << ans[j];
            }
        }
        cout << endl;
    }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, n;
  vector<int> ans;
  int num,ai,bi, c =0;
  bool f;
  string a, b;

  cin >> n;
  while(n--){
    cin >> a >> b;
    f = false;

    rep(i,100){
      num = 0;
      ai = a.size()-i-1;
      bi = b.size()-i-1;
      if(ai < 0 && bi < 0 && c == 0 ) break;

      if(ai >= 0) num += a[ai] - '0';
      if(bi >= 0) num += b[bi] - '0';
      ans.push_back((num + c) % 10);
      if(num+c >= 10) c = 1;
      else c = 0;
    }

    if(ans.size() > 80){
      f = true;
    }
    if(f) cout << "overflow" << endl;
    else{
      for(int j = ans.size()-1; j >= 0; j--){
        printf("%d",ans[j]);
      }
    }
    printf("\n");
  }

  return 0;
}

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

using namespace std;

int main(){
    
    string d;
    string e;
    
    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        cin>>d;
        cin>>e;
        
    }
    
    for(int j=0; j<(int)(d.size()); j++){
        st1.push(d[j]);
    }
    for(int j=0; j<(int)(e.size()); j++){
        st2.push(e[j]);
    }
    int temp=0;
    char temp_char;
    while(st1.empty()==false||st2.empty()==false){
        if(st1.empty()==false&&st2.empty()==false){
            temp_char=st1.top();
            temp+=atoi(&temp_char);
            temp_char=st2.top();
            temp+=atoi(&temp_char);
            st1.pop();
            st2.pop();
        }else if(st1.empty()==false&&st2.empty()==true){
            temp_char=st1.top();
            temp+=atoi(&temp_char);
            st1.pop();
        }else if(st1.empty()==true&&st2.empty()==false){
            temp_char=st2.top();
            temp+=atoi(&temp_char);
            st2.pop();
        }
        st3.push(temp%10);
        temp=temp/10;
    }
    
    if(temp!=0){
        st3.push(temp);
    }
    
    if(st3.size()>=80){
        printf("overflow");
    }else{
        while(st3.empty()==false){
            printf("%d",st3.top());
            st3.pop();
        }
    }
    
    
    printf("\n");
}

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

using namespace std;



string sum(string& a, string& b){
	int i = a.length() - 1;
	int j = b.length() - 1;
	int carry = 0;
	string temp;

	while(i >= 0 && j >= 0){
		temp.push_back((a[i] + b[j] + carry - 2*'0') % 10 + '0');
		carry = (a[i] + b[j] - 2*'0') / 10;
		--i, --j;
	}

	string& longer = i > j ? a : b;
	int& index = i > j ? i : j;
	while(index >= 0){
		temp.push_back((longer[index] + carry - '0') % 10 + '0');
		carry = (longer[index] + carry - '0') / 10;
		--index;
	}

	return temp;
}

int main(){
	int n;
	cin >> n;

	vector<string> input(n*2);

	for(int i = 0; i < n*2; i++){
		cin >> input[i];
	}

	for(int i = 0; i < n; i++){
		string t = sum(input[2*i], input[2*i+1]);
		reverse(begin(t), end(t));
		if(t.size() <= 80)
			cout << t << endl;
		else
			cout << "overflow" << endl;
	}


	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
    int n;
    for(cin>>n;n--;){
        int k=0;
        string a,b;
        cin >> a;
        cin >> b;
        if(a.size() < b.size()) swap(a,b);//????????????a>b?????????
        while(b.size() < a.size()) b = '0' + b;//????????????a==b?????????
        for(int i=a.size()-1;i>=0;i--){//???????????????????????????
            a[i] += b[i] - '0' + k;
            if(a[i] > '9'){
                a[i]-=10;
                k = 1;
            }
            else k = 0;
        }
        if(k)   a="1"+a;//??°??????????????????????????????????¶?????????¨???
        if(a.size() > 80)   cout << "overflow" << endl;
        else    cout << a << endl;
    }
    return 0;
}