Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

C++: #include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;
void add(string& ans,string& a,string& b);
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[i]='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[i]= ((x+y)%10)+'0';
			y=1;
		}else{
		        ans[i]= (x+y)+'0';
			y=0;
		}
	}
	if(y==1)ans[i]='1';
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int mx;
void solve(vector<int> a,vector<int> b)
{
  vector<int>ans;
  int t = 0;
  for(int i = 0 ; i < mx ; i++ )
    {
      ans.push_back((a[i] + b[i] + t)%10);
      if(a[i] + b[i] + t >= 10)t = 1;
      else t = 0;
    }
  if(t == 1)ans.push_back(1);
  for(int i = ans.size()-1 ; i >= 0 ; i-- ){
    cout << ans[i];
  } 
  cout << endl;
}

int main(){
  int n;
  vector<int>ve1,ve2;
  cin >> n;
  while(n--){
    ve1.clear(),ve2.clear();
    string a,b;
    cin >> a >> b;
    mx = max(a.size(),b.size());
    for(int i = a.size()-1,j = 0 ; j < mx ; i--,j++ ){
      if(i < 0 )ve1.push_back(0);
      else ve1.push_back(a[i]-'0');
    }
    for(int i = b.size()-1,j = 0 ; j < mx ; i--,j++ ){
      if(i < 0 )ve2.push_back(0);
      else ve2.push_back(b[i]-'0');
    } 
    solve(ve1,ve2);
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int N,ans[82],a,b,la,lb,up,deg;
string sta,stb;

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>sta>>stb;
		la=sta.size();
		lb=stb.size();
		up=0;
		deg=1;
		for(int i=0;i<max(la,lb)+1;i++){
			if(i>=la)a='0';
			else a=sta[la-1-i];
			if(i>=lb)b='0';
			else b=stb[lb-1-i];
			if(min(a,b)>80){
				cout<<"overflow"<<endl;
				continue;
			}
			if(a+b+up>105){
				ans[i]=a+b+up-10-96;
				up=1;
			}
			else{
				ans[i]=a+b+up-96;
				up=0;
			}
			if(ans[i]!=0)deg=i+1;
		}
		if(deg>80)cout<<"overflow"<<endl;
		else{
			for(int i=0;i<deg;i++)cout<<ans[deg-1-i];
			cout<<endl;
		}
	}
}

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

using namespace std;

int main(){
	int n;
	string ret1,ret2;
	vector<int> result;
	int num = 0, ret = 0;
	int j;

	cin >> n;

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

		ret = 0;

		cin >> ret1 >> ret2;

		if (ret1.size() > 80 || ret2.size() > 80){
			cout << "overflow" << endl;
		}

		for (j = 1;j <= ret1.size() && j <= ret2.size();j++){
			num = (ret1.at(ret1.size() - j) - '0' + ret2.at(ret2.size() - j) - '0' + ret) % 10;
			ret = (ret1.at(ret1.size() - j) - '0' + ret2.at(ret2.size() - j) - '0' + ret);
			ret = (int)log10((double)ret);
			result.push_back(num);
		}

		if (ret1.size() == ret2.size()){
			if (ret != 0)
				result.push_back(ret);
		}
		else if(ret1.size() > ret2.size()){
			for (; j <= ret1.size(); j++){
				num = (ret1.at(ret1.size() - j) - '0' + ret) % 10;
				ret = ret1.at(ret1.size() - j) - '0' + ret;
				ret = (int)log10((double)ret);
				result.push_back(num);
			}
			if (ret != 0)
				result.push_back(ret);
		}
		else if (ret1.size() < ret2.size()){
			for (; j <= ret2.size(); j++){
				num = (ret2.at(ret2.size() - j) - '0' + ret) % 10;
				ret = ret2.at(ret2.size() - j) - '0' + ret;
				ret = (int)log10((double)ret);
				result.push_back(num);
			}
			if (ret != 0)
				result.push_back(ret);
		}


		while (result.empty() != true){
			cout << result[result.size()-1];
			result.pop_back();
		}
		cout << endl;

	}


	return 0;
}