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<math.h>
using namespace std;
int main() {
	int N,a,b,c,d,f;
	int e = 0;
	string s,t,u;
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 2; j++) {
			if (j == 0) {
				cin >> s;
			}
			else if (j == 1) {
				cin >> t;
			}
		}
		a = s.size();
		b = t.size();
		if (a < b) {
			c = a;
		}
		else if (a >= b) {
			c = b;
		}
		for (int k =c; k >= 0; k++) {
			d = s[c - 1] + t[c - 1];
			while (e == 1) {
				e = 0;
				d += 1;
			}
			if (d < 10) {
				u[c - k] = d;
			}
			else {
				u[c - k] = d - 10;
				e = 1;
			}
		}
		f = u.size();
		while (f > 80) {
			cout << "overflow" << endl;
			break;
		}
		while (f <= 80) {
			for (int i2 = 0; i2 < f; i2++) {
				cout<< u[f - 1 - i2];
			}
			break;
		}
	}
	return 0;
}

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

using namespace std;

int main(){
	int n,l1,l2,i;
	string a, b;
	char ans[80];
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80){
			cout<<"overflow"<<endl;
			continue;
		}
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
				continue;
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		for(i=0;i<80;i++)ans[i]=0;
		for(i=1;i<l2+1;i++){
			ia=(int)a[l1-i]-(int)'0';
			ib=(int)b[l2-i]-(int)'0';
			sum=ia+ib;
			ans[80-i]+=sum+'0';
		}
		for(i=l2+1;i<l1+1;i++){
			ans[80-i]=a[l1-i];
		}
		for(i=79;i>=0;i--){
			if(ans[i]-'0'>9 && ans[i]!=0){
				ans[i]=ans[i]-10;
				if(ans[i-1]==0)ans[i-1]+=1+'0';
				else ans[i-1]+=1;
			}
		}
		for(i=0;i<80;i++){
			if(ans[i]!=0){
				cout<<(int)ans[i]-'0';
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
void add(string & ,string &,string &);
int main() {
	string a,b;
	int al,bl;
	int n;
	cin>>n;
	while(n--){
	        string ans="";
		cin>>a>>b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		al=a.size();
		bl=b.size();
		if(bl>al){
			swap(a,b);
			swap(al,bl);
		}
		for(int i=bl;i<al;i++){
			b+='0';
		}
		add(ans,a,b);
		if(ans.size()>80){
		  printf("overflow\n");
		}else{
		  reverse(ans.begin(),ans.end());
		  cout<<ans<<endl;
		}
	  	
	}
	return 0;
}
void add(string &ans,string &a,string &b){
	int x,y=0;
	int i;
	int al=a.size();
	for(i=0;i<al;i++){
		x=a[i]-'0'+b[i]-'0';
		if((x+y)>=10){
		        ans+= ((x+y)%10)+'0';
			y=1;
		}else{
		        ans+= (x+y)+'0';
			y=0;
		}
	}
	if(y==1)ans+='1';
}

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

int main() {
  int n;
  cin>>n;
  while(n--) {
    string s1,s2;
    cin >> s1 >> s2;

    int a = s1.length()-1;
    int b = s2.length()-1;
    int c = 0;
    vector<int> ans;
    for (; a>=0 || b>=0; a--, b--) {
      int s = c;
      if (a>=0) s+=s1[a]-'0';
      if (b>=0) s+=s2[b]-'0';
      c = s / 10;
      ans.push_back(s % 10);
    }
    if (c) ans.push_back(1);
    reverse(ans.begin(), ans.end());
    if (ans.size()<=80)
      for (int i=0; i<ans.size(); i++)
        cout << ans[i];
    else
      cout << "overflow";
    cout << endl;
  }
}

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

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], s[81];
	char c;
	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){
	char c;
	int k;
	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]>=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;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string s,n,final;
  int o,c=0,lim;
  cin>>lim;
  for(int j = 0 ; j < lim ; j++){
    cin>>s>>n;
      reverse(s.begin(),s.end());
    reverse(n.begin(),n.end());
    for(int i = 0; i < s.size() || i<n.size() || c;i++){
      o = (s.size() > i ? s[i]-'0' : 0) +(n.size() > i ? n[i]-'0' : 0) + c;
      
      //   o = (s[i]-'0')+(n[i]-'0')+c;
      c = o / 10;
      o %= 10;
      final.append(1,o+'0');
    }
    reverse(final.begin(),final.end());
    if(n.size()>=80 || s.size()>=80 || final.size()>=80) cout<<"overflow"<<endl;
    else cout<<final<<endl;
    final.clear();
  }
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <fstream>

using namespace std;

#define MAX_INT_LENGTH 80

//large integer upto 80 digits
struct largeInt{
    int vals[MAX_INT_LENGTH]; // MAX_INT_LENGTH digits
};

void toLargeInt(string str, largeInt &lv){
    int start = MAX_INT_LENGTH-str.length();
    for (int i = 0; i < MAX_INT_LENGTH; i++){
        if (i >= start)
            lv.vals[i] = (str[i-start] - '0');
        else
            lv.vals[i] = 0;
    }
}

largeInt addLargeInt(const largeInt &lv1, const largeInt &lv2){
    largeInt sum;
    int carry = 0;
    for (int i = MAX_INT_LENGTH-1; i >= 0; i--){
        int sub_sum = lv1.vals[i] + lv2.vals[i] + carry;
        sum.vals[i] = sub_sum % 10;
        carry = sub_sum / 10;
    }
    return sum;
}

string toString(const largeInt &v){
    stringstream ss;
    int i = 0;
    while (i < MAX_INT_LENGTH-1 && v.vals[i]==0) i++;
    while (i < MAX_INT_LENGTH){
        ss << v.vals[i];
        i++;
    }
    return ss.str();
}

int main()
{
    //ifstream cin("input.txt");
    
    // input data
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        string v1,v2;
        cin >> v1 >> v2;
        largeInt lv1, lv2;
        if (v1.length()>MAX_INT_LENGTH || v2.length()>MAX_INT_LENGTH){
            cout << "overflow" << endl;
            continue;
        }
        toLargeInt(v1,lv1);
        toLargeInt(v2,lv2);
        largeInt sum = addLargeInt(lv1,lv2);
        cout << toString(sum) << endl;
    }
   return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  cin.ignore();
  while(n--){
    string a,b;
    getline(cin,a);
    getline(cin,b);
    int num[150] = {0},tab = 0,i = 0;
    int as = a.size()-1;
    int bs = b.size()-1;
    int nmi = min(a.size(),b.size());
    int nma = max(a.size(),b.size());
    for(int x; i<nma; i++){
      if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;}
      else if(i>as){x = tab+b[bs-i]-'0';}
      else if(i>bs){x = tab+a[as-i]-'0';}
      tab = x/10;
      num[i] = x%10;
    }
    if(tab){num[nma] = tab;i++;}
    if(i>80){cout <<"overflow"<<endl;}
    else{
      for(int x=i-1; x>=0; x--){
	cout <<num[x];
      }
      cout <<endl;
    }
  }
  return 0;
}