Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}

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

int main(){
  int n;
  string s1,s2,ans;
  cin >> n;
  
  for(int i=0; i<n; i++){
    cin >> s1;
    cin >> s2;
    reverse(s1.begin(),s1.end());
    reverse(s1.begin(),s2.end()); //反転
    int m = max(s1.size(),s2.size());
    while(m>s1.size()) s1+='0';
    while(m>s2.size()) s2+='0';

    int carry = 0;
    for(int j=0; j<m; j++){
      char ch = ((s1[j]-'0') + (s2[j]-'0') + carry)%10 + '0';
      carry = ((s1[j]-'0') + (s2[j]-'0') + carry)/10;
      ans += ch;
    }
    if(carry) ans+=(carry+'0');
    reverse(ans.begin(),ans.end()); //元通り

    //頭の0を削除していく
    while(ans.size()>1 && ans[0] == '0') ans.erase(ans.begin());
    if(ans.size() > 80) cout << "overflow" << endl;
    cout << ans << endl;
  }
  return 0;
}

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, j, n;
  int len1, len2;
  char tmp;

  scanf("%d",&n);
  rep(i,n){
    string str1, str2, res;
    cin >> str1;
    cin >> str2;

    vector<int> a(200, 0), b(200, 0);
    len1 = (int)str1.size(); len2 = (int)str2.size();
    rep(j,len1) a[j] = str1[(int)len1-1-j] - '0';
    rep(j,len2) b[j] = str2[(int)len2-1-j] - '0';

    rep(j,200){
      int sum = a[j] + b[j];
      if(sum >= 10){ sum %= 10; a[j+1]++;}
      res += (sum + '0');
    }

    reverse(res.begin(), res.end());
    int f = 0;
    string tmp;
    rep(j,res.size()){
      if(res[j] != '0') f = 1;
      if(f) tmp += res[j];
    }

    if((int)tmp.size() > 80) cout << "overflow" << endl;
    else cout << tmp << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
        int N;
        cin>>N;
        for (int i = 0; i < N; i++) {
                string a,b,c,d;
                cin>>a;
                cin>>b;
                int x=max(a.length(),b.length());
                for (int j = 0; j < x-a.length()+1; j++) {
                        c+="0";
                }
                for (int j = 0; j < x-b.length()+1; j++) {
                        d+="0";
                }
                c+=a;
                d+=b;
                for (int j = 0; j < x+1; j++) {
                        c[j]+=d[j]-'0';
                }
                for (int j = x; j >= 0; j--) {
                        if(c[j]>'9'){
                                c[j]-=10;
                                c[j-1]++;
                        }
                }

                if(c[0]!='0'){
                        if(x>=79){
                                cout<<"overflow"<<endl;
                                continue;
                        }
                        cout<<c[0];
                }else{
                        if(x>=80){
                        cout<<"overflow"<<endl;
                        continue;}
                }
                for (int j = 1; j <= x; j++) {
                        cout<<c[j];
                }
                cout<<endl;
        }

}

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

int main(void){
	string s[55][2];
	int ans[100],k,i,p,q;
	bool flag;
	cin >> q;
	for(p=0; p<q; p++){
		cin >> s[p][0];
		cin >> s[p][1];
		fill(ans,ans+100,0);
		if( s[p][0].length()>80 || s[p][1].length()>80 ){
			cout << "overflow" << endl;
			continue;
		}
		for(k=0; k<2; k++){
			reverse(s[p][k].begin(),s[p][k].end());
			for(i=(s[p][k].length()-1); i>=0; i--){
				ans[i] += (s[p][k][i] - '0');
			}
		}
		for(i=0; i<80; i++){
			ans[i+1] += (ans[i]/10);
			ans[i] %= 10;
		}
		flag = true;
		for(i=99; i>79; i--){
			if(ans[i] != 0){
				cout << "overflow" << endl;
				flag = false;
				break;
			}
		}
		if(!flag){
			continue;
		}
		flag = false;
		for(i=79; i>=0; i--){
			if(flag){
				cout << ans[i];
			}else if(ans[i]!=0){
				cout << ans[i];
				flag = true;
			}
		}
		if(!flag){
			cout << "0";
		}
		cout << endl;
	}
	return 0;
}

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++: #include<iostream>
#include<stdio.h>
#include<string.h>

int n;
char a[1000];
int temp[1000], temp2[1000], temp3[1000];

int main()
{
        std::cin >> n;
	
	while( n-- ){
		memset( temp, -1, sizeof( temp ) );
		memset( temp2, -1, sizeof( temp2 ) );
		memset( temp3, 0, sizeof( temp3 ) );
		
		std::cin >> a;
		
		for( int i = 0; i < strlen( a ); i++ ){
			temp[strlen( a ) - i - 1] = a[i] - '0';
		}
		
		std::cin >> a;
		
		for( int i = 0; i < strlen( a ); i++ ){
			temp2[strlen( a ) - i - 1] = a[i] - '0';
		}
		
		int p = 0, f = 0;
		while( 1 ){
		 	if( temp[p] != -1 && temp2[p] != -1 ){
			 	temp3[p] = ( temp[p] + temp2[p] + f ) % 10;
				f = ( temp[p] + temp2[p] + f ) / 10;
			}
			else if( temp[p] != -1 ){
				temp3[p] = ( temp[p] + f ) % 10;
				f = ( temp[p] + f ) / 10;
			}
			else if( temp2[p] != -1 ){
				temp3[p] = ( temp2[p] + f ) % 10;
				f = ( temp2[p] + f ) / 10;
			}
			else break;
			
			p++;
		}
		
		if( p + f > 80 ){
			std::cout << "overflow" << std::endl;
			continue;
		}
		
		if( f )std::cout << -temp[p];
		
		for( int i = p - 1; i >= 0; i-- ){
		 	std::cout << temp3[i];
		}
		std::cout << std::endl;
	}

 	return 0;
}