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

std::string add(std::string,std::string);

int main(){
  std::string n,m;
  int size;
  std::cin>>size;
  std::vector<std::string> sums;
  for(int i=0;i<size;++i){
    std::cin>>n>>m;
    std::string sum = add(n,m);
    if(sum.length()<=80)
      sums.push_back(sum); 
    else
      sums.push_back("overflow"); 
  }

  for(auto s:sums)
    std::cout<<s<<std::endl;

  return 0;
}

std::string add(std::string n,std::string m){
  if(n.length()>m.length()) std::swap(n,m);
  std::reverse(n.begin(),n.end());
  std::reverse(m.begin(),m.end());
  std::string sum;
  char c=0,s,t;
  for(int i=0;i<m.length()||c==1;++i){
    t = (i<n.length()?n[i]-'0':0)+(i<m.length()?m[i]-'0':0)+c;
    s = t%10;
    c = t/10;
    sum.push_back(s+'0');
  }
  
  std::reverse(sum.begin(),sum.end());
  sum.push_back('\0');
  return sum;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	string s,t,ans;
	int nn,mm;
	int i,j,k;
	int flg[101];
	int x,y,z;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>s>>t;
		reverse(s.begin(),s.end());
		reverse(t.begin(),t.end());
		for(j=0;j<max(s.size(),t.size());j++)	flg[j]=0;
		if(s.size()>t.size()){
			nn=s.size()-t.size();
			for(j=0;j<nn;j++)	t+='0';
		}
		else{
			nn=t.size()-s.size();
			for(j=0;j<nn;j++)	s+='0';
		}
		ans.clear();
		for(j=0;j<s.size();j++){
			x=s[j]-'0';
			y=t[j]-'0';
			z=x+y+flg[j];
			flg[j+1]=z/10;
			ans+=z%10+'0';
		}
		if(flg[s.size()]>0)		ans+=flg[s.size()]+'0';
		if(ans.size()>80)	cout<<"overflow"<<endl;
		else{
			reverse(ans.begin(),ans.end());
			cout<<ans<<endl;
		}
		//cout<<ans.size()<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int n,i,j,k,s,t,u;
	int carry = 0;
	string a, b,d;
	vector<int> c;
	cin >> n;
	for (i = 0; i < n; i++) {
		c.clear();
		cin >> a;
		cin >> b;
		while (a.size() > b.size()) {
			b = "0" + b;
		}
		while (b.size() > a.size()) {
			a = "0" + a;
		}
		s = a.size();
		for (j = s-1; j >=0; j--) {
			t = a[j]-'0' + b[j]-'0';
			if (carry == 1) {
				carry = 0;
				t += 1;
			}
			while (t >= 10) {
				t -= 10;
				carry += 1;
			}
			c.push_back(t);
		}
		while (carry == 1) {
			carry = 0;
			c.push_back(1);
		}
		u = c.size();
		if (u > 80||a.size()>80||b.size()>80) {
			cout << "overflow" << endl;
		}
		else if(u<=80){
			for (k = u - 1; k >= 0; k--) {
				cout << c[k];
			}
			cout << endl;
		}
	}
	return 0;
}

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

using namespace std;

class longint
{
// friend
	friend ostream& operator<< (ostream&, const longint&);
	friend istream& operator>> (istream&, longint&);

// variable
private:
	string m_data;

// structor

public:
	longint(const string& data = "0") :
		m_data(data)
	{

	}

// operator
public:
	longint operator+(const longint& rhs) const
	{
		string data1 = m_data;
		string data2 = rhs.m_data;
		reverse(data1.begin(), data1.end());
		reverse(data2.begin(), data2.end());

		string result;
		int carry = 0;
		for(unsigned int i = 0; i < data1.length() || i < data2.length(); i++)
		{
			int num1 = 0;
			int num2 = 0;
			if(i < data1.length())
				num1 = ctoi( data1[i] );
			if(i < data2.length())
				num2 = ctoi( data2[i] );

			int sum = num1 + num2 + carry;
			result.push_back( itoc( sum % 10) );
			carry = sum / 10;
		}

		reverse(result.begin(), result.end());
		return longint(result);
	}

// method
private:
	inline static int ctoi(char c)
	{
		if(c < '0' || '9' < c)
			throw exception();

		return c - '0';
	}

	inline static char itoc(int i)
	{
		if(i < 0 || 9 < i)
			throw exception();

		return '0' + i;
	}
};

ostream& operator<< (ostream& stream, const longint& rhs)
{
	stream << rhs.m_data;
	return stream;
}

istream& operator>> (istream& stream, longint& rhs)
{
	stream >> rhs.m_data;
	return stream;
}

int main()
{
	longint result;

	int n;
	cin >> n;
	while(n-- > 0)
	{
		longint input;
		cin >> input;
		result = result + input;
	}

	cout << result << endl;

	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 alen,blen,mlen;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		alen=in.size();
		blen=in2.size();
		for(int i=0;i<alen;i++){
			a[alen-1-i]=in[i]-'0';
		}
		for(int i=0;i<blen;i++){
			b[blen-1-i]=in[i]-'0';
		}
		mlen=max(alen,blen);
		if(mlen>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<mlen+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[mlen]!=0){
			//if(mlen>79){
				//cout<<"overflow"<<endl;
				continue;
			//}
			//cout<<ans[mlen];
		}
		
		for(int i=0;i<mlen;i++){
			//cout<<ans[mlen-1-i];
		}cout<<endl;
		
		
	}
	return 0;
}