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 <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

void arrangeDigits(string &str1, string &str2){

  reverse(str1.begin(), str1.end());
  reverse(str2.begin(), str2.end());
  
  while(str1.size() < str2.size()){
    str1 += '0';
  }
  while(str2.size() < str1.size()){
    str2 += '0';

  cout << "str1: " << str1 << endl;
  cout << "str2: " << str2 << endl;
  }
}

int main(){
  int numDatasets;
  cin >> numDatasets;
  
  for(int i=0;i<numDatasets;i++){
    bool flag = false;
    string str1, str2;

    cin >> str1;
    //80????¶?????????´???
    if(str1.length() > 80){
      flag = true;
    }

    cin >> str2;
    //80????¶?????????´???
    if(str2.length() > 80){
      flag = true;
    }

    // ??????????????????
    arrangeDigits(str1, str2);
      
    //?¨????

    int c = 0;
    string res;

    // cout << str1.length() << endl;
    
    for(int i=0;i<str1.size();i++){
      int now = c + str1[i] - '0' + str2[i] -'0';
      res += now%10 + '0';
      c = now/10;
    }


      // str1.pop_back();
      // str2.pop_back();
      // cout << "----" << endl;
      // cout << "i:" << i << endl;
      // cout << (int)(str1[str1.size()-i-1]-'0') << " + " << (int)(str2[str2.size()-i-1]-'0') << endl;
      // cout << "now:" << now << endl;
      // cout << "res:" << res << endl;


    // cout << "c:" << c << endl;

    if(c){
      res += (c+'0');
    }

    if(res.size()>80){
      flag == true;
    }

    reverse(res.begin(), res.end());
    
    if(flag == false){
      cout << res << endl;
    }else{
      cout << "overflow" << endl;
    }
    
  }
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
	int dsn; scanf("%d", &dsn);
	for(int dsi = 0; dsi < dsn; dsi++) {
		static char ais[10000],bis[10000];
		scanf("%s%s",ais,bis);
		int aislen = strlen(ais);
		int bislen = strlen(bis);
		if(aislen > 80 || bislen > 80) {
			printf("overflow\n");
			continue;
		}
		static int ad[90],bd[90];
		fill(ad,ad+90,0);
		fill(bd,bd+90,0);
		for(int i = 0; i < aislen; i++) ad[i] = ais[aislen-1-i]-'0';
		for(int i = 0; i < bislen; i++) bd[i] = bis[bislen-1-i]-'0';
		int cl = 0;
		for(int i = 0; i < 90; i++) {
			ad[i] += bd[i]+cl;
			cl = ad[i]/10;
			ad[i] %= 10;
		}
		if(ad[80]) {
			printf("overflow\n");
			continue;
		}
		bool flag = false;
		for(int i = 89; i >= 0; i--) {
			flag = flag || ad[i];
			if(flag) {
				printf("%d",ad[i]);
			}
		}
		if(!flag)printf("0");
		printf("\n");
	}
	return 0;
}

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

string reverse(const string& str) {
	string ret;
	string::const_reverse_iterator it = str.rbegin();
	for (; it != str.rend(); it++) {
		ret.push_back(*it);
	}
	return ret;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string S1;
		string S2;
		int overflow = 0;
		cin >> S1 >> S2;
		if (S1.size() > 80 || S2.size() > 80) {
			cout << "overflow";
			overflow++;
		}
		S1 = reverse(S1);
		S2 = reverse(S2);
		S1.resize(80, '0');
		S2.resize(80, '0');
		int a = 0;
		int d = 0;
		for (int i = 0; i < 80; i++) {
			S1[i] += S2[i] - '0';
			if (S1[i] > '9') {
				if (i + 1 > 79) {
					cout << "overflow";
					d++;
				}
				S1[i + 1] += 1;
				S1[i] -= 10;
			}
			if (S1[i] != '0')
				a = i;
		}
		S1 = reverse(S1);
		if (d == 0)
			for (int i = 79 - a; i < 80; i++) {
				cout << S1[i];
			}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int number(char c){
	if(c>='0'&&c<='9')
	return (c-'0');
	else
		return 0;
}
int main(){
	int n;
	cin>>n;
	
	while(n>0){
		string a;
		string b;
	int k=0;
	int c=0;
	string s="";
	
		cin>>a;
		cin>>b;
		
	
	for(int i=a.length()-1,j=b.length()-1;i>=0||j>=0;i--,j--){
		int d;
		int n1=0,n2=0;
		if(i>=0)
			n1=number(a[i]);
		if(j>=0)
			n2=number(b[j]);
		d=n1+n2+k;
		k=d/10;
		d=d%10;
		c++;
		s=to_string(d)+s;
	}
	if(c>=80&&k>0)
		cout<<"overflow"<<endl;
		else{
			if(k>0){
		s=to_string(k)+s;
			}
		cout<<s<<endl;
		}
		n--;
	}
}

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

int main(){
	int i,j,k,n,tmp,flag,length;
	int yosan[20];
	char str[81],str2[256];

	scanf("%d",&n);

	for(i = 0;i < n;i++){
		memset(yosan,0,sizeof(yosan));
		flag = 0;
		for(j = 0;j < 2;j++){
			scanf("%s",str2);
			length = strlen(str2);
			if(flag && length >= 81){
				flag = 1;
				continue;
			}
			memset(str,'\0',sizeof(str));
			for(k = 0;k < 80;k++){
				if(k >= 80-length){
					str[k] = str2[k-80+length];
				}else{
					str[k] = '0';
				}
			}
			//printf("%s\n",str);
			tmp = 0;
			for(k = 0;k < 80;k++){
				tmp *= 10;
				tmp += (str[k] - '0');
				if(k % 4 == 3){
					yosan[k/4] += tmp;
					tmp = 0;
				}
			}
			for(k = 29;k > 0;k--){
				if(yosan[k] >= 10000){
					yosan[k-1]++;
					yosan[k] %= 10000;
				}
			}
			if(yosan[0] >= 10000){
				flag = 1;
				//break;
			}
		}
		if(!flag){
			tmp = 0;
			while(yosan[tmp] == 0){
				tmp++;
			}
			printf("%d",yosan[tmp]);
			tmp++;
			for(j = tmp;j < 20;j++){
				printf("%04d",yosan[j]);
			}
			printf("\n");
		}else{
			printf("overflow\n");
		}
	}

	return 0;
}

C++: using namespace std;

void sum80(int* a, int* b);
int get80(string str, int* num);

int main(void){
	string a80, b80;
	int a[81], b[81];
	int i, N;
	cin>>N;
	i=0;
	while(i<N){
		cin>>a80;
		cin>>b80;
		if(get80(a80, a)<0 || get80(b80, b)<0){
			cout<<"overflow"<<endl;
		}else{
			sum80(a, b);
		}
		i++;
	}
	return 0;
}

int get80(string str, int* num){
	int d=str.length();
	if(d<=80){
		for(int i=0; i<d; i++){
			num[i]=str[d-1-i]-'0';
		}
		for(int i=d;i<81; i++){
			num[i]=0;
		}
		return d;
	}else{
		return -1;
	}

}

void sum80(int* a, int* b){
	int s[81], amari;
	amari=0;
	for(int i=0; i<81; i++){
		s[i]=(a[i]+b[i]+amari)%10;
		if(a[i]+b[i]+amari>=10){
			amari=1;
		}else{
			amari=0;
		}
	}
	if(s[80]!=0){
		cout<<"overflow"<<endl;
	}else{
		bool flag=false;
		for(int i=79; i>=0; i--){
			if(flag==true || s[i]!=0){
				flag=true;
				cout<<s[i];
			}
		}
		cout<<endl;
	}
}