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 <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <string>
#include <climits>

#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define PRINT(STR) cout << (STR) << endl

typedef long long ll;
using namespace std;

double nextDouble() {
	double d = -1;
	cin >> d;
	return d;
}

int nextInt() {
	int n = -1;
	cin >> n;
	return n;
}

string nextString() {
	string str;
	cin >> str;
	return str;
}

string reverse(string str) {
	string t = str;
	for (int i = 0; i < str.size(); i++) {
		t[i] = str[str.size() - i - 1];
	}
	return t;
}

int main() {
	cin.tie(0); //対話型には使えない
	int n = nextInt();
	while (n--) {
		string str1 = nextString();
		string str2 = nextString();
		int n[100];
		fill(n, n + 100, 0);
		str1 = reverse(str1);
		str2 = reverse(str2);

		REP(i, str1.size()) {
			n[i] = str1[i] - '0';
		}
		REP(i, str2.size()) {
			n[i] += str2[i] - '0';
		}
		if (str1.size() >= 80 || str2.size() >= 80) {
			PRINT("overflow");
			continue;
		}
		int M = max(str1.size(), str2.size());
		int k = M;
		REP(i, M) {
			if (n[i] >= 10) {
				n[i + 1] += n[i] / 10;
				n[i] %= 10;
				if (i == M - 1) k = M + 1;
			}
		}
		if (n[80] > 0) {
			PRINT("overflow");
			continue;
		}
		for (int i = k - 1; i >= 0; i--) {
			cout << n[i];
		}
		cout << 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 num1,num2;
    cin>>num1>>num2;
    if(num1.size()==num2.size()&&num1.size()>80||num2.size()>80){
      cout<<"overflow"<<endl;
      continue;
    }
    int ma,mi;
    stack<int> sum;
    string lnum,snum;
    if(num1.size()>num2.size()){
      ma=num1.size();lnum=num1;
      mi=num2.size();snum=num2;
    }else{
      ma=num2.size();lnum=num2;
      mi=num1.size();snum=num1;
    }
    int keta=0;
    for(int i=ma-1;i>=0;i--){
      int a,b;
      a=lnum[i]-'0';
      if(mi<=0)
	b=0;
      else{
	b=snum[mi-1]-'0';
	mi--;
      }
      int summ=a+b+keta;
      if(summ>=10){
	sum.push(summ%10);
	keta=1;
      }else if(summ<=9){
	sum.push(summ);
	keta=0;
      }
    }
    if(keta==1)
      sum.push(1);
    if(sum.size()>80)
      cout<<"overflow"<<endl;
    else{
      int k=sum.size();
      for(int i=0;i<k;i++){
	cout<<sum.top();
	sum.pop();
      }
      cout<<endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int max(int a,int b){return a>b?a:b;}
int main(){
	int n;
	cin>>n;
	for(int d=0;d<n;d++){
		string s,t;
		cin>>s;
		cin>>t;
		int i=0;
		reverse(s.begin(),s.end());
		reverse(t.begin(),t.end());
		string ans;
		int k=0;
		for(i=0;i<max(s.size(),t.size())+1;i++){
			int x,y;
			if(i>=s.size())x=0;
			else x=s[i]-'0';
			if(i>=t.size())y=0;
			else y=t[i]-'0';
			int z=x+y+k;
			k=z/10;
			char c=z%10+'0';
			if(i!=max(s.size(),t.size())||c!='0')ans.append(1,c);
		}
		reverse(ans.begin(),ans.end());
		if(ans.size()>=81)cout<<"overflow"<<endl;
		else cout<<ans<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  string num1,num2,tmp;
  int n;

  cin >> n;

  while(n--){

    cin >> num1 >> num2;

    if((int)num1.size() < (int)num2.size()){
      tmp = num2;
      num2 = num1;
      num1 = tmp;
    }

    for(int i = 0 ; i < (int)num1.size() ; i++ )tmp[i] = num1[i];

    for(int i = (int)num1.size() - 1 ; i >= 0 ; i-- )
      {
	num1[i] = tmp[(int)num1.size() - 1 - i];
      }
    for(int i = 0 ; i < (int)num2.size() ; i++ )tmp[i] = num2[i];

    for(int i = (int)num2.size() - 1  ; i >= 0 ; i-- )
      {
	num2[i] = tmp[(int)num2.size() - 1 - i];
      }

    for(int i = (int)num2.size() ; i < (int)num1.size() ; i++ )num2+='0';

    char tmp2 = '0';
    string ans;

    for(int i = 0 ; i < num1.size() ; i++ ){
      if((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') > 9){
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') - 10) + '0');
	tmp2 = '1';
      } else {
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0')) + '0');
	tmp2 = '0'; 
      }
    }
  
    if((int)((tmp2 - '0') + (num1[num1.size() - 1] - '0') + (num2[num1.size() - 1] - '0')) > 9)ans+='1'; 

  for(int i = (int)ans.size() ; i >= 0 ; i-- ){
    cout << ans[i];
  }  
  cout << endl;
}
return 0;
}

C++: #include <cstdio>
#include <vector>
using namespace std;

const int size = 80;
char str1[size + 10], str2[size + 10];
int num1[size], num2[size], res[size];
int n, leng1, leng2, rep, kuri;
bool output;

int main(){
	scanf("%d", &n);
	
	for(int a = 0; a < n; a++){
		fill(str1, str1 + size + 10, 30);
		fill(str2, str2 + size + 10, 30);
		fill(num1, num1 + size, 0);
		fill(num2, num2 + size, 0);
		fill(res, res + size, 0);
		scanf("%s", str1);
		scanf("%s", str2);
		
		//char -> int
		for(leng1 = 0; (int)str1[leng1 + 1] >= 48 && (int)str1[leng1 + 1] <= 57 && leng1 + 1 < size + 10; leng1++);//length of str1
		for(leng2 = 0; (int)str2[leng2 + 1] >= 48 && (int)str2[leng2 + 1] <= 57 && leng2 + 1 < size + 10; leng2++);//length of str2
		
		rep = 1;
		while(leng1 >= 0){
			num1[size - rep] = (int)str1[leng1] - 48;
			leng1--; rep++;
		}
		rep = 1;
		while(leng2 >= 0){
			num2[size - rep] = (int)str2[leng2] - 48;
			leng2--; rep++;
		}
		kuri = 0;
		for(int i = size - 1; i >= 0; i--){
			res[i] = num1[i] + num2[i] + kuri;
			kuri = res[i] / 10;
			if(kuri > 0) res[i] -= 10;
		}
		
		if(kuri > 0) printf("overflow\n");
		else{
			output = false;
			for(int i = 0; i < size; i++){
				if(!output && res[i] == 0) continue;
				else{
					output = true;
					printf("%d", res[i]);
				}
			}
			if(!output) printf("0");
			printf("\n");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	string a,b,c;
	int n;
	cin>>n;
	for(int fjal=0;fjal<n;fjal++){
	cin>>a>>b;
	c.clear();
	if(a.size()<b.size())swap(a,b);
	int as=a.size();
	while(as!=b.size())b="0"+b;
	//cout<<a<<" "<<b;
	bool kuri=false;
	for(int i=as-1;i>=0;i--){
		int _a=a[i]-'0',_b=b[i]-'0',ans=_a+_b;
		if(kuri)ans++;
		if(ans>=10){
			kuri=true;
			ans-=10;
		}
		else {kuri=false;}
		//cout<<ans<<" "<<i;
		c.push_back(ans+'0');
	}
		if(kuri)c.push_back('1');
		string ans;
		if(c.size()<80){for(int i=c.size()-1;i>=0;i--)ans.push_back(c[i]);
		cout<<ans<<endl;
		}
		else cout<<"overfllow"<<endl;
	}
	return 0;
}