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<stdio.h>
#include<string.h>
int main(void){
   int n;
   scanf("%d",&n);
   while(n--){
      char a[100],b[100],c[100];
      int j,len;

      for(j=0;j<81;j++){
         a[j]=0;
         b[j]=0;
         c[j]='0';
      }
      scanf("%s%s",a,b);
      len=strlen(a);
      if(len<strlen(b))
         len=strlen(b);
      if(len>80){
         printf("overflow\n");
         continue;
      }
      /*for(j=0;j<len+1;j++){
         c[j]='0';9999999999999999999999999999999999999999999999999999999999999999999999999999999
      }*/
      for(j=0;j<strlen(a);j++){
         c[j]=a[strlen(a)-j-1];
      }
      for(j=0;j<strlen(b);j++){
         c[j]+=b[strlen(b)-j-1]-'0';
      }
      for(j=0;j<len;j++){
         if(c[j]>=58){
            if(j==len-1){
               c[j+1]='0';
               len++;
            }
            c[j]-=10;
            c[j+1]+=1;
         };
      }
      if(len>80){
         printf("overflow\n");
         continue;
      }
      else{
         for(j=len-1;j>=0;j--){
            printf("%c",c[j]);
         }
         puts("");
      }
   }
   return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <stack>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
	int n;
    string a, b;
		
	cin>> n;	
	for(int i=0;i<n;i++){
		int x[81]={0}, y[81]={0};

		cin >> a;
		cin >> b;
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		
		for(int j=0;j<a.size();j++){
			x[j]=a[j]-'0';
		}
		for(int j=0;j<b.size();j++){
			y[j]=b[j]-'0';
		}
		
		for(int j=0;j<80;j++){
			x[j]=x[j]+y[j];
			if(x[j]>=10){
				x[j+1]++;
				x[j]-=10;
			}
		}
		//cout << 0 << endl;
		
		if(x[80]>0){
			cout << "overflow" <<endl;
		}else{
			bool flag = 0;
			for(int j=79;j>=0;j--){
				if(x[j]==0&& flag==0){
					continue;
				}else{
					flag=1;
				}
				cout<<x[j];
			}
			cout<<endl;
		}
		
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
 
#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

void str_to_vec(std::string str, std::vector<char> &v){
	v.clear();
	for(int i = str.size() - 1; i >= 0; i--){
		v.push_back(str[i] - 48);
	}
	return;
}

std::vector<char> sum(std::vector<char> &v0, std::vector<char> &v1){
	std::vector<char> ret;
	char carry = 0;

	if(v0.size() < v1.size()){
		std::swap(v0, v1);
	}
	for(unsigned int i = 0; i < v1.size() - v0.size(); i++){
		v1.push_back(0);
	}

	ret.resize(v1.size(), 0);

	for(unsigned int i = 0; i < ret.size(); i++){
		char tmp = v0[i] + v1[i] + carry;
		if(tmp >= 10){
			carry = 1;
			tmp -= 10;
		}
		else{
			carry = 0;
		}
		ret[i] = tmp;
	}
	if(carry == 1){
		ret.push_back(1);
	}

	return ret;
}

int main(int argc, char **argv){
	int n = 0;
	std::string buf;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif



#if INPUT_FROM_FILE
	std::getline(ifs, buf);
#else
	std::getline(std::cin, buf);
#endif
	n = std::stoi(buf);

	for(int i = 0; i < n; i++){
		std::vector<char> num0;
		std::vector<char> num1;
#if INPUT_FROM_FILE
		std::getline(ifs, buf);
#else
		std::getline(std::cin, buf);
#endif
		str_to_vec(buf, num0);
#if INPUT_FROM_FILE
		std::getline(ifs, buf);
#else
		std::getline(std::cin, buf);
#endif
		str_to_vec(buf, num1);

		if(num0.size() > 80 || num1.size() > 80){
			std::cout << "overflow" << std::endl;
		}
		else{
			std::vector<char> s = sum(num0, num1);

			if(s.size() > 80){
				std::cout << "overflow" << std::endl;
			}
			else{
				for(int i = s.size() - 1; i >= 0; i--){
					std::cout << (int)s[i];
				}
				std::cout << std::endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;


bool f(long long x) {
	if (log10(x) >= 80) return false;
	else return true;
}



int main()
{
	int n;
	cin >> n;
	long long a;
	long long b;
	while(cin>>a){
		cin >> b;
		if (f(a) && f(b) && f(a + b)) cout << a + b << endl;
		else cout << "overflow" << endl;
	}
	

}

C++: #include<iostream>
#include<string>
#define max(a,b) a>b?a:b
using namespace std;
int che(char a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(a==i){
			return j;
		}
		j++;
	}
	return 0;
}
char cha(int a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(j==a){
			return i;
		}
		j++;
	}
}
int main(){
	string a,b;
	int c=0;
	int i,j,k,m,n;
	int x,y;
	char d[200];
	cin>>n;
	for(k=0;k<n;k++){
		cin>>a>>b;
		x=a.size();
		y=b.size();
		m=max(x,y);
		for(i=1;i<=m;i++){
			j=che(a[x-i])+che(b[y-i])+c;
			if(j>=10){
				c=1;
				j-=10;
			}else{
				c=0;
			}
			d[i]=cha(j);
		}
		if(c==1){
			d[i]=cha(1);
			c=0;
			i++;
		}
		cout<<i<<endl;
		if(i>81){
			cout<<"overflow"<<endl;
			continue;
		}
		for(j=i-1;j>0;j--){
			cout<<d[j];
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<cstdio>

int main(){
	int a[82] = {};
	int b[82] = {};
	int c[82] = {};
	int n;
	int k,l,m,f;
	char t;
	int of;

	scanf("%d\n", &n);


	for(int i = 0; i < n; i++){
		of = k = l = 0;
		scanf("%c", &t);
		while(t - 10){
			k++;
			a[k] = t - '0';
			scanf("%c", &t);
			if(k == 81){
				of = 1;
				scanf("%c", &t);
				while(t - 10){
					scanf("%c", &t);
				}
			}
		}
		scanf("%c", &t); 

		while(t - 10){
			l++;
			b[l] = t - '0';
			scanf("%c", &t);
			if(l == 81){
				of = 1;
				scanf("%c", &t);
				while(t - 10){
					scanf("%c", &t);
				}
			}

		}

		m = 0;
		f = 0;

		while(k - m){
			c[m] = a[k - m];
			m++;
		}
		m = 0;
		while(l - m){
			c[m] += b[l - m ] + f;
			f = 0;
			if(c[m] > 9){
				c[m] -= 10;
				f = 1;
			}
			m++;
		}

		while(f){
			c[m] += 1;
			f = 0;
			if(c[m] > 9){
				c[m] -= 10;
				f = 1;
			}
			m++;
		}

		if(k > m){
			m = k;
		}

		for(int i = 0; i < m; i++){
			if(m == 81 || of){
				printf("overflow");
				i = m;
			}else{
				printf("%d", c[m - i - 1]);
			}
		}
		printf("\n");
	}
	return 0;
}