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<stdio.h>
#include <algorithm>
#include<string.h>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in[90],in2[90];
	int a[90],b[90],ans[90];
	int f;
	int a_len,b_len,m_len;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		a_len=in.size();
		b_len=in2.size();
		for(int i=0;i<a_len;i++){
			a[a_len-1-i]=in[i]-'0';
		}
		for(int i=0;i<b_len;i++){
			b[b_len-1-i]=in[i]-'0';
		}
		m_len=max(a_len,b_len);
		/*
		if(m_len>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<m_len+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[m_len]!=0){
			if(m_len>79){
				cout<<"overflow"<<endl;
				continue;
			}
			cout<<ans[m_len];
		}
		for(int i=0;i<m_len;i++){
			cout<<ans[m_len-1-i];
		}cout<<endl;
		
		*/
	}
	return 0;
}

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

char iota(int n){
  switch (n) {
    case 0: return '0';
    case 1: return '1';
    case 2: return '2';
    case 3: return '3';
    case 4: return '4';
    case 5: return '5';
    case 6: return '6';
    case 7: return '7';
    case 8: return '8';
    case 9: return '9';
  }
  return '0';
}

int main(){
  std::string num1;
  std::string num2;
  char sum[102];
  int n,temp,flag=0,j;
  const char one = '1';

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> num1 >> num2;

    if(num1.size()<num2.size()){
      num1.swap(num2);
    }
    std::reverse(num1.begin(),num1.end());
    std::reverse(num2.begin(),num2.end());

    for(j=0;j<num2.size();j++){
      //std::cout << 1;
      temp = (num1[j] - '0') + (num2[j] - '0');
      if(flag){
        temp +=1;
        flag = 0;
      }
      if(temp > 9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
      //std::cout << temp << std::endl;
    }
    while(j<num1.size()){
      temp = num1[j] = '0';
      if(flag){
        temp += 1;
        flag = 0;
      }
      if(temp > 9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
    }
    if(flag){
      sum[j] = (char)one;
      sum[j+1] = '\0';
    }else{
      sum[j] = '\0';
    }
    std::string ssum = std::string(sum);
    //reverse(num1.begin(),num1.end());
    //reverse(num2.begin(),num2.end());
    reverse(ssum.begin(),ssum.end());
    //std::cout << num1 << std::endl;
    //std::cout << num2 << std::endl;
    std::cout << ssum << std::endl;
  }
}

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

using namespace std;

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

	for(int i=0; i<N; i++){
		int a[80], b[80], c[80];
		string s, t, m;
		cin >> s >> t;
		if((s.length() > 80)||(t.length()>80)){
			cout << "overflow";
		}
		else{
			for(int j=0; j<80; j++){ a[j]=0; b[j]=0; c[j]=0;}
			for(int j=s.length()-1, k=0; j>=0; j--, k++){
				m=s.substr(k,1);
				if(m=="0"){ a[j]=0;}
				else if(m=="1"){ a[j]=1;}
				else if(m=="2"){ a[j]=2;}
				else if(m=="3"){ a[j]=3;}
				else if(m=="4"){ a[j]=4;}
				else if(m=="5"){ a[j]=5;}
				else if(m=="6"){ a[j]=6;}
				else if(m=="7"){ a[j]=7;}
				else if(m=="8"){ a[j]=8;}
				else{ a[j]=9;}
			}
			for(int j=t.length()-1, k=0; j>=0; j--,k++){
				m=t.substr(k,1);
				if(m=="0"){ b[j]=0;}
				else if(m=="1"){ b[j]=1;}
				else if(m=="2"){ b[j]=2;}
				else if(m=="3"){ b[j]=3;}
				else if(m=="4"){ b[j]=4;}
				else if(m=="5"){ b[j]=5;}
				else if(m=="6"){ b[j]=6;}
				else if(m=="7"){ b[j]=7;}
				else if(m=="8"){ b[j]=8;}
				else{ b[j]=9;}
			}

			int d=0;
			bool flag=false;
			for(int j=0; j<80; j++){
				c[j] = (a[j]+b[j]+d)%10;
				d = (a[j]+b[j]+d)/10;
				if(j==79 && d>0){ flag=true;}
			}
		
			if(flag){cout << "overflow";}	
			else{
					flag = false;
					for(int j=79; j>=0; j--){
						if(flag){ cout << c[j];}
						else if(c[j] != 0){ cout << c[j]; flag=true;}
					}
			}
			cout << endl;
		}
	}

	return 0;
}

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

int main(void){
	string s[2];
	int ans[100],sum,k,i,p,q;
	bool flag;
	cin >> q;
	for(p=0; p<q; p++){
		cin >> s[0];
		cin >> s[1];
		fill(ans,ans+100,0);
		if( s[0].length()>80 || s[1].length()>80 ){
			cout << "overflow" << endl;
			continue;
		}
		for(k=0; k<2; k++){
			reverse(s[k].begin(),s[k].end());
			for(i=(s[k].length()-1); i>=0; i--){
				ans[i] += (s[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;
			}
		}
		cout << endl;
	}
	return 0;
}

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

string ans;
string s1,s2;

void Calc(int up,int indx1,int indx2){


  if(indx1==-1){
    if(up!=0){ans.insert(ans.begin(),(char)(up+(int)'0'));}
    return;
  }


  if(indx2>=0){
    int work = s1[indx1]-'0' + s2[indx2]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }

  else{
    int work = s1[indx1]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }


  Calc(up,indx1-1,indx2-1);
}

int main(){

  char head1,head2;
  string tmp;
  int size;
  int n;


  cin >> n;

  for(int i=0; i<n; i++){
    ans="";
    cin >> s1;
    cin >> s2;
    if(s1.size()<s2.size()){ tmp=s1;s1=s2;s2=tmp; }

    if(s1.size()>=80 || s2.size()>=80)
      cout<<"overflow"<<endl;
    else if((s1.size()>=79 || s2.size()>=79) && s1[0]-'0'+s2[0]-'0'>=10)
      cout<<"overflow"<<endl;
    else{
      Calc(0,s1.size()-1,s2.size()-1);
      cout << ans << endl;
    }
  }

  return 0;
}

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

using namespace std;

int main() {
	int N, c = 0, tmp;
	cin >> N;
	string ans;
	for (int i = 0; i < N; i++) {
		ans = "";
		string a, b;
		cin >> a >> b;
		for (int j = 0; j < max(a.length(), b.length()); j++) {
			int A, B;
			A = a.length() - j - 1;
			B = b.length() - j - 1;
			tmp = (A >= 0 ? a[A] - '0' : 0) + (B >= 0 ? b[B] - '0' : 0) + c;
			ans = (char)(tmp % 10 + '0') + ans;
			c = tmp / 10;
		}
		if (c) {
			ans = '1' + ans;
		}
		cout << (ans.length() > 80 ? "overflow" : ans) << endl;
	}
	return 0;
}