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<cstdlib>
#include<cmath>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string first,second;
        cin>>first;
        cin>>second;
        int carry=0;
        ostringstream sout;
        sout<<setfill('0')<<setw(max(first.length(),second.length()))<<first;
        first=sout.str();
        sout.str("");
        sout<<setfill('0')<<setw(max(first.length(),second.length()))<<second;
        second=sout.str();
        string ans="";
        for(int j=first.length()-1;j>=0;j--){
           int d1,d2;
           d1=first[j]-'0';
           d2=second[j]-'0';
           int sum=d1+d2+carry;
           carry=sum/10;
           char d3=sum%10+'0';
           ans=d3+ans;
        }
        if(carry==1)ans='1'+ans;
        if(ans.length()<=80)cout<<ans<<endl;
        else cout<<"overflow"<<endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <math.h>
#include <stack>

using namespace std;

int main(){
    
    char d;
    char e;
    using namespace std;
    stack<int> st1;
    stack<int> st2;
    stack<int> st3;
    int n;
    //scanf("%d",&n);
    while((d=getchar())!='\n'){
        n=atof(&d);
    }
    
    for(int i=0; i<n; i++){
        
        while((d=getchar())!='\n'){
            //printf("a%c\n",d);
            st1.push(atof(&d));
        }
        
        //while(getchar()!='\n'){}
        
        while((e=getchar())!='\n'){
            //printf("b%c\n",e);
            st2.push(atof(&e));
        }
        int temp=0;
        int num=0;
        
        while(st1.empty() != true || st2.empty() != true){
            if(st1.empty()==true && st2.empty()!=true){
                temp+=st2.top();
                st2.pop();
            }else if(st1.empty()!=true && st2.empty()==true){
                temp+=st1.top();
                st1.pop();
            }else{
                temp+=st1.top()+st2.top();
                st1.pop();
                st2.pop();
            }
            st3.push(temp%10);
            temp=temp/10;
            num++;
        }
        if(temp!=0){
            st3.push(temp);
        }
        if(st3.size()>=80){
            printf("overflow");
        }else{
            while(st3.empty()!=true){
                cout << st3.top();
                st3.pop();
            }
        }
        printf("\n");
        
        
        
    }
    
}

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

int main() {
   int n;
   string str_a;
   string str_b;
   string sum = "";

   scanf("%d", &n);
   for(int i=0; i < n; ++i){
       cin >> str_a >> str_b;

   int id_a = str_a.size();
   int id_b = str_b.size();
   int c = 0;

   // ???????????????????????°?????????????????????
   while (id_a > 0 || id_b > 0) {
     int a = 0, b = 0;
     // int??§??°???????????????
     if (id_a > 0) a = str_a[--id_a] - '0';
     if (id_b > 0) b = str_b[--id_b] - '0';
     // ?????¨???????????°???????????????c?????????????????????????????°???????????????
     sum = to_string(((a + b + c) % 10)) + sum;
     // ?¬???????????????°????????????????¨????
     c = (a + b + c) / 10;
   }
   if (c > 0) sum = to_string(c) + sum;
   cout << sum << endl;
   }
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		scanf("%s",num2);
		l1 = strlen(num1);
		l2 = strlen(num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool k=false;
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				k=true;
				break;
			}
		}
		if(k)
		{
			printf("overflow\n");
			continue;
		}
		else
		{
			for(j=1001;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    string a,b,ans;
    cin >>a>>b;
    int as = a.size(),bs = b.size(),s,c,t=0;
    s = (as<bs)? bs:as;
    for(int i=0; i<s; i++){
      if(i<as && i<bs) c = a[as-i-1]+b[bs-i-1]-'0'*2+t;
      else if(i<as) c = a[as-i-1]-'0'+t;
      else if(i<bs) c = b[bs-i-1]-'0'+t;
      t = c/10;
      ans+=('0'+c%10);
    }
    if(t) ans+='1';
    if(ans.size()>80) cout <<"overflow";
    else for(int i=ans.size()-1; i>=0; i--) cout <<ans[i];
    cout <<endl;
  }
}

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

int main() {
  
  int n,i,j;
  cin >> n;

  for(i=0;i<n;i++){
    string str1,str2,temp;
    int kuriagari=0;
    cin >> str1 >> str2;
    
    if (str1.size()<str2.size()){
      temp = str1;
      str1 = str2;
      str2 = temp;
    }
    int goukei[str1.size()+1];
    
    for(j=0;j<str1.size()+1;j++){
      
      if (j==str1.size()){
	goukei[0] = kuriagari;
      }else if (j<str2.size()){
	goukei[str1.size()-j] = str2[str2.size()-1-j] + str1[str1.size()-1-j] + kuriagari -'0' - '0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }else{
	goukei[str1.size()-j] = str1[str1.size()-1-j] + kuriagari -'0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }
    }
    
    if (goukei[0]!=0)
      cout << goukei[0] ;
    for(j=0;j<str1.size();j++)
      cout << goukei[j+1];
    cout <<endl;
  }
      
  return 0;
  
}

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

int main() {

  int n;
  cin >> n;

  string c = "0123456789";

  for ( int i = 0; i < n; i++ ) {

    string input1,input2;
    cin >> input1 >> input2;
    if ( input1.size() > 80 || input2.size() > 80 ) {
      cout << "overflow" << endl;
      continue;
    }

    string ans = "";

    int k = 0;
    for ( int j = 0; j < 80; j++ ) {

      int x = input1.size()-1-j;
      if ( x >= 0 ) {
	k += input1[x] - '0';
      }
      int y = input2.size()-1-j;
      if ( y >= 0 ) {
	k += input2[y] - '0';
      }
      ans = c[k%10] + ans;
      k /= 10;

    }

    if ( k != 0 ) {
      cout << "overflow" << endl;
    }else {
      bool flag = true;
      for ( int i = 0; i < ans.size(); i++ ) {
	if ( ans[i] == '0' && flag ) continue;
	flag = false;
	cout << ans[i];
      }
      if ( flag ) cout << "0";
      cout << endl;
    }

  }

  return 0;

}