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

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;   //("10000");
  std::string num2;   //("990000");
  char sum[100]={};
  int n,i,j,flag=0,temp;

  std::cin >> n;
  //n=1;
  for(i=0;i<100;i++){
    sum[i]='\0';
  }

  for(i=0;i<n;i++){
    std::cin >> num1 >> num2;
    if(num1.size()<num2.size()){
      num1.swap(num2);
    }
    //std::cout << num1 << std::endl;
    //std::cout << num2 << std::endl;
    for(j=0;j<num1.size();j++){
      if(j<num2.size()){
        temp = (num1[num1.size()-j-1]-'0')+(num2[num2.size()-j-1]-'0');
      }
      if(j>=num2.size()){
        temp = num1[num1.size()-j-1]-'0';
      }
      if(flag){
      ++temp;
      flag = 0;
      }
      if(temp>9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
    }
    if(flag){
      sum[j] = '1';
      flag = 0;
    }
    //printf("%s\n",sum);
    j=0;
    while(sum[j]!='\0'){
      ++j;
    }
    if(j>80){
      std::cout << "overflow" << std::endl;
    }else{
      while(j>0){
        printf("%c",sum[j-1]);
        --j;
      }
      std::cout << std::endl;
    }
  }
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <math.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int kk = 0; kk < n; ++kk)
	{
		int A[1000] = {},B[1000] = {},C[1000] = {},keta = 0;
		string in1,in2;
		cin >> in1 >> in2;
		if(in1.size() > 80 || in2.size() > 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < in1.size(); ++i)
			A[in1.size()-i] = (int)(in1[i]-'0');
		for (int i = 0; i < in2.size(); ++i)
			B[in2.size()-i] = (int)(in2[i]-'0');
		bool flag = 1;
		for (int i = 1; i < 1000; ++i)
		{
			C[i] += A[i]+B[i];
			if(C[i] >= 10)
			{
				C[i+1] += C[i]/10;
				C[i] -= C[i]/10*10;
			}
			if(C[i] != 0)
				keta = i;
		}
		if(keta > 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		cout << "[" << keta << "]" << endl;
		for (int i = keta; i > 0; --i)
		{
			cout << C[i];
		}
		cout << endl;
	}
}

C++: #include <stdio.h>
#include <string.h>

int chomp(char *str){
    int len = strlen(str);
    if(str[len-1]=='\n'){
        str[len-1] = '\0';
        len--;
    }
    return len;
}

int main(){
    int n;
    int i,j;
    int s1,s2,la,sm;
    char a1[102],a2[102],*pla,*psm,dummy[2];
    int carry,r;
    scanf("%d",&n);
    fgets(dummy,2,stdin);
    for(i=0;i<n;i++){
NEXT:
        fgets(a1,101,stdin);
        fgets(a2,101,stdin);
        s1 = chomp(a1);
        s2 = chomp(a2);
        if(s1>80||s2>80){
            printf("overflow\n");
            goto NEXT;
        }
        if(s1<s2){
            pla = a2;
            la = s2;
            psm = a1;
            sm = s1;
        }else{
            pla = a1;
            la = s1;
            psm = a2;
            sm = s2;
        }
        carry = 0;
        for(j=0;j<la;j++){
            r = (j<sm) ? (psm[sm-j-1]-'0') : 0;
            r += (pla[la-j-1]-'0')+carry;
            carry = r/10;
            pla[la-j] = '0' + r%10;
        }
        if(carry){
            pla[0] = '1';
        }else{
            pla = (s1<s2) ? &a2[1] : &a1[1];
        }
        if(j+carry>80){
                printf("overflow\n");
                goto NEXT;
        }
        printf("%s\n",pla);
    }
}

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


int main(){
  int n,i,j;
  string a,b;
  int sum[110]={};
  int up = 0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a >> b;
    int sa=a.size(),sb=b.size();
    int flag=0;
    if(sa>=80||sb>=80) flag =1;
    for(j=0;j<max(sa,sb);j++){
      if(sa>j&&sb>j){
	sum[j] = (a[sa-j-1]-'0') + (b[sb-j-1]-'0') + up;
      }else if(sa>j){
	sum[j] = (a[sa-j-1]-'0') + up;
      }else if(sb>j){
	sum[j] = (b[sb-j-1]-'0') + up;
      }
      up=0;
      if(sum[j]>9){
	up=1;
	sum[j]-=10;
      }
    }
    sum[max(sa,sb)]=up;
    int k=110-1;
    while(sum[k]==0&&k>0) k--;
    if(k>=80||flag==1) cout << "overflow";
    else
    for(j=k;j>=0;j--)
      cout << sum[j];
    cout << endl;
  }
}

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

using namespace std;

int main()
{
	int N; cin >> N;
	int a[80], b[80], c[80];
	string s, t, m;

	for(int i=0; i<N; i++){
		fill_n(a,80,0); fill_n(b,80,0); fill_n(c,80,0);
		cin >> s >> t;
		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 <iostream>
#include <string>

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
    std::cin.ignore(2);
 
	for (int i = 0; i < N; i++)
	{
		getline(std::cin, str_a);
		getline(std::cin, str_b);
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
 
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
 
#define CINT cpp_int 
 
int main() {
    int n; cin >> n; CINT a, b; 
    CINT REF = pow(CINT(10), 80);
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        if (a + b >= REF) cout << "overflow" << endl;
        else cout << a + b << endl;
    }
    return 0;
}