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 <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){

	int n;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		string a, b;
		cin >> a;
		cin >> b;

		if(b.size() > a.size()){
			string temp;
			temp = a;
			a = b;
			b = temp;
		}

		if(a.size() > 80){
			cout << "overflow" << endl;
		}else{
			for(int i=0 ; i<b.size() ; i++){
				a[a.size()-1-i] += b[b.size()-1-i] - '0';
				if(a[a.size()-1-i] > '9'){
					a[a.size()-1-i] -= 10;
					for(int j=i ; a.size()-2-j >= 0 ; j++){
						a[a.size()-2-j]++;
						if(a[a.size()-2-j] > '9'){
							a[a.size()-2-j] -= 10;
							if((a.size()-2-j) == 0){
								a = "1" + a;
								break;
							}
						}else break;
					}
				}
			}
		}
		if(a.size() > 80){
			cout << "overflow" << endl;
		}else{
			cout << a << endl;
		}
		

	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	string a, b;
	vector<int> m, n, s;
	int set;

	m.resize(81, 0);
	n.resize(81, 0);
	s.resize(81, 0);

	cin >> set;
	while(set-- > 0){
		a.clear();
		b.clear();
		cin >> a >> b;
		for(int i = 0; i < 81; i++){
			m[i] = n[i] = s[i] = 0;
		}		
		if(a.size() > 80 || a.size() > 80){
			cout << "overflow" << endl;
		}else{
			reverse(a.begin(), a.end());
			reverse(b.begin(), b.end());
			for(int i = 0; i < a.size(); i++){
				m[i] = a[i] - '0';
			}
			for(int i = 0; i < b.size(); i++){
				n[i] = b[i] - '0';
			}
			for(int i = 0; i < 80; i++){
				s[i] += m[i] + n[i];
				if(s[i] >= 10){
					s[i+1]++;
					s[i]-=10;
				}
			}
			int digit = 81;
			while(--digit > 0){
				if(s[digit] != 0)break;
			}
			if(digit >= 79){
				cout << "overflow" << endl;
			}else{
				for(int i = digit; i >= 0; i--){
					cout << s[i];
				}
				cout << endl;
			}
		}
	}

	return 0;
}

C++: #include <stdio.h>
#include <string.h>
int main(void){
    int n,ap,bp,cp,t;
    char a[81],b[81],c[81];
    scanf("%d",&n);
    while(~scanf("%s%s",&a,&b)){
        ap=strlen(a);
        bp=strlen(b);
        cp=sizeof(c);
        c[cp]='\0';
        t=0;
        while((t||ap||bp)&&cp>0){
            t+=(ap?a[--ap]-'0':0)+(bp?b[--bp]-'0':0);
            c[--cp]='0'+(t%10);
            t/=10;
        }
        if(t)printf("overflow\n");
        else printf("%s\n",&c[cp]);
    }
    return 0;
}

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

#define DIGIT  ( 80 )

using namespace std;

static
int N;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  cin >> N;

  while ( N-- )
  {
    string  A, B;
    int     C[ DIGIT + 1 ] = { 0 };

    cin >> A >> B;

    for ( size_t i = 0; i < A.length ( ); ++i )
    {
      C[ i ]      = A[ A.length ( ) - i - 1 ] - '0';
    }
    for ( size_t i = 0; i < B.length ( ); ++i )
    {
      C[ i ]     += B[ B.length ( ) - i - 1 ] - '0';
    }
    for ( size_t i = 0; i < DIGIT; ++i )
    {
      C[ i + 1 ] += C[ i ] / 10;
      C[ i ]     %= 10;
    }

    if ( C[ DIGIT ] )
    {
      cout << "overflow";
    }
    else
    {
      int i = DIGIT;
      while ( !C[ i ] && i > 0 )  --i;
      while ( i >= 0 )
      {
        cout << C[ i-- ];
      }
    }
    cout << endl;
  }

  return ( 0 );
}

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

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int A[150] = {},B[150] = {},C[150] = {};
		string inA,inB;
		cin >> inA >> inB;
		for (int j = 0; j < inA.size(); ++j)
			A[inA.size()-j] = (int)(inA[j]-'0');
		for (int j = 0; j < inB.size(); ++j)
			B[inB.size()-j] = (int)(inB[j]-'0');
		int keta = 0;
		for (int j = 1; j < 150; ++j)
		{
			C[j] += A[j] + B[j];
			if(C[j] >= 10)
			{
				C[j+1] += C[j]/10;
				C[j] = C[j]%10;
			}
			if(C[j] != 0)
				keta = j;
		}
		if(keta >= 80)
			cout << "overflow" << endl;
		else
		{
			bool haji = 0;
			for (int j = 149; j > 0; --j)
			{
				if(C[j] != 0)
					haji = 1;
				if(haji)
				{
					cout << C[j];
				}
			}
			cout << endl;
		}
	}
}

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

int main(void){
  int N;
  string str1, str2;
  cin >> N;
  for(int k = 0; k < N; k++){
    vector<int> ans;
    cin >> str1 >> str2; 
    if(str1.size() > 80 || str2.size() > 80){
      cout << "overflow" << endl;
      continue;
    }

    int carry, sum;
    string *bigger;

    if(str1.size() > str2.size()){
      bigger = &str1;
    }else{
      bigger = &str2;
    }

    vector<int>::iterator ite = ans.begin();
    pair<int, int> P;
    P.first = min(str1.size(), str2.size());
    P.second = max(str1.size(), str2.size());

    for(int i = 0; i < P.first; i++){
      sum = (str2[str2.size() - 1 - i] - 48) + (str1[str1.size() - 1 - i] - 48) + carry;
      if((sum / 10) >= 0){
        carry = sum / 10;
        sum -= (sum / 10) * 10;
      }else{
        carry = 0;
      }
      ans.insert(ans.begin(), sum);
    }
    
    for(int i = P.first; i < P.second; i++){
      sum = (bigger->at(bigger->size() - 1 - i) - 48) + carry;
      if((sum / 10) >= 0){
        carry = sum / 10;
        sum -= (sum / 10) * 10;
      }else{
        carry = 0;
      }
      ans.insert(ans.begin(), sum);
    }

    for(int i = 0; i < ans.size(); i++){
      if(carry != 0){
        cout << carry;
        carry = 0;
      }
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;
void add(string& ans,string& a,string& b);
int main() {
	string a,b;
	int al,bl;
	int n;
	cin>>n;
	while(n--){
	        string ans= "";
		cin>>a>>b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		al=a.size();
		bl=b.size();
		if(bl>al){
			swap(a,b);
			swap(al,bl);
		}
		for(int i=0;i<(al-bl);i++){
			b+='0';
		}
		add(ans,a,b);
		if(ans.size()>80) ans="overflow";
		else{
		  reverse(ans.begin(),ans.end());
		}
	  	cout<<ans<<endl;
	}
	return 0;
}
void add(string& ans,string& a,string& b){
	int x,y=0;
	for(int i= 0;i<a.size();i++){
		x=a[i]-'0'+b[i]-'0';
		if(x>=10){
			ans+= (x%10)+'0';
			y=1;
		}else{
			ans+= x+y+'0';
			y=0;
		}
	}
	if(y==1)ans+='1';
}

C++: import java.util.Scanner;
import java.math.BigInteger;

public class a0015{
    public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int N = scanner.nextInt();
	for (int i = 0; i < N; i++) {
	    String a = scanner.next(), b = scanner.next();
	    BigInteger A = new BigInteger(a), B = new BigInteger(b);
	    BigInteger sum = A.add(B);
	    if ((sum.toString()).length() > 80) {
		System.out.println("overflow");
	    }
	    else {
		System.out.println(sum.toString());
	    }
	}
    }
}