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 <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

void stlip(vector<int> &v, string &s) {
  for (auto i = s.rbegin(), e = s.rend(); i != e; i++) {
    v.push_back(*i - 48);
  }
}

void print(vector<int> &v) {
  int n;
  string s;
  for (auto i = v.rbegin(), e = v.rend(); i != e; i++) {
    s += to_string(*i);
  }
  if (s.size() > 80)
    cout << "overflow" << endl;
  else
    cout << s << endl;
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    vector<int> v1, v2, ret;
    string a, b;
    bool flag = true;
    cin >> a >> b;
    if (a.size() > 80 || b.size() > 80) {
      cout << "overflow" << endl;
      continue;
    }
    if (a.size() < b.size())
      swap(a, b);
    stlip(v1, a);
    stlip(v2, b);
    v2.resize(v1.size());
    for (int i = 0; i < v1.size(); i++) {
      int tmp;
      tmp = v1[i] + v2[i];
      if (tmp > 9) {
        if (i == v1.size() - 1) {
          v1.resize(v1.size() + 1);
          v2.resize(v1.size() + 1);
        }
        v2[i + 1] += 1;
        tmp -= 10;
      }
      ret.push_back(tmp);
    }
    if (flag)
      print(ret);
  }

  return 0;
}

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

using namespace std;

int main(){
    
    string d[10000];
    string e[10000];
    
    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        cin>>d[i];
        cin>>e[i];
    }
    
    
    for(int i=0; i<n; i++){
        for(int j=0; j<(int)(d[i].size()); j++){
            st1.push(d[i][j]);
        }
        for(int j=0; j<(int)(e[i].size()); j++){
            st2.push(e[i][j]);
        }
        int temp=0;
        char temp_char;
        while(st1.empty()==false||st2.empty()==false){
            if(st1.empty()==false&&st2.empty()==false){
                temp_char=st1.top();
                temp+=atoi(&temp_char);
                temp_char=st2.top();
                temp+=atoi(&temp_char);
                st1.pop();
                st2.pop();
            }else if(st1.empty()==false&&st2.empty()==true){
                temp_char=st1.top();
                temp+=atoi(&temp_char);
                st1.pop();
            }else if(st1.empty()==true&&st2.empty()==false){
                temp_char=st2.top();
                temp+=atoi(&temp_char);
                st2.pop();
            }
            st3.push(temp%10);
            temp=temp/10;
        }
        
        if(temp!=0){
            st3.push(temp);
        }
        
        if(st3.size()>=80){
            printf("overflow");
        }else{
            while(st3.empty()==false){
                printf("%d",st3.top());
                st3.pop();
            }
        }
        printf("\n");
    }
    
}

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

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::cin >> i1;
		std::cin >> i2;
		for(int j=0;j<80;j++){
			char c='0';
			if(cflag)
				c+=1;
			cflag=false;
			if(strlen(i1)>j){
				c+=i1[strlen(i1)-j-1]-'0';
			}
			if(strlen(i2)>j){
				c+=i2[strlen(i2)-j-1]-'0';
			}
			if(c > '9'){
				cflag=true;
				c-=10;
			}
			res[79-j]=c;
		}

		if(cflag){
			std::cout << "overflow" << std::endl;
			continue;
		}
		char *p = res;
		while(*p++ == '0');
		std::cout << (p-1) << std::endl;
	}
	return 0;
}

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

int main(){

	int n;

	string a, b;
	char N1[80], N2[80];
	char sum[80];

	cin >> n;

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

		cin >> a;
		
		if( a.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		cin >> b;

		if( b.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		for( int i=0;i<80;i++ ){
			N1[i] = -1; N2[i] = -1; sum[i] = 0;
		}

		for( int i=1;i<=a.length();i++ )
			N1[i] = a[a.length()-i] - '0';
		for( int i=1;i<=b.length();i++)
			N2[i] = b[b.length()-i] - '0';

		int over = 0;
		
		for( int i=0;i<80;i++ ){


			if( N1[i] == -1 && N2[i] == -1 ){
				if( over >= 10 ){
					sum[i] = over / 10;
					over = 0;
				}else
					sum[i] = -1;
				continue;
			}

			if( N1[i] != -1 )
				sum[i] += N1[i];
			if( N2[i] != -1 )
				sum[i] += N2[i];

			sum[i] += over / 10;

			over = floor((double)sum[i]/10)*10;

			sum[i] -= over;
			
		}

		if(over > 0)cout << "overflow" << endl;
		else{		
			for( int i=1;i<=80;i++ ){
				if( sum[80-i] >= 0 )
					cout << (int)sum[80-i];
			}
			cout << endl;
		}


	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;
char s[100],t[100];
int a[100],b[100],c[110];
int main()
{
    int T,d=0;
    int n=1;
    scanf("%d%*c",&T);
    while(T--)
    {
        memset(s,0x00,sizeof(s));
        memset(t,0x00,sizeof(t));
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        memset(c,0,sizeof(c));
        scanf("%s",s);
        scanf("%s",t);
//        if(strlen(s)>80||strlen(t)>=80)
//           {
//               printf("overflow\n");
//        break;
//           }
        int l=0;
        for(int i=strlen(s)-1; i>=0; i--)
            a[l++]=s[i]-'0';
        int k=0;
        for(int i=strlen(t)-1; i>=0; i--)
            b[k++]=t[i]-'0';
        if(l<k)
            l=k;
        int v=0;
        for(int i=0; i<=l; i++)
        {
            if(a[i]+b[i]+v>=10)
            {

                c[i]=a[i]+b[i]+v-10;
                v=1;
            }
            else
            {
                c[i]=a[i]+b[i]+v;
                v=0;
            }
        }
        if(c[l]!=0&&l>=80)
        {
            printf("overflow\n");
            break;
        }
        else if(c[l]==0&&l-1>=80)
        {
            printf("overflow\n");
            break;
        }
        if(c[l]!=0)
            printf("%d",c[l]);
        for(int i=l-1;i>=0;i--)
            printf("%d",c[i]);
        printf("\n");
    }
    return 0;
}

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,in2;
	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;
}