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 <stdio.h>
#include <string.h>

class overflow {
public:
	overflow() {};
};

class BigNum {
public:
	BigNum() : c(0), keta(0), size(0) {} ;

	BigNum(int n) : keta(0) {
		size = n;
		c = new char [size];
		memset(c, 0, size);
	};

	BigNum(const char* buf) {
		keta = strlen(buf);
		if (buf[keta-1] == '\n') {
			keta --;
		}
		if (keta > 80) {
			throw overflow();
		}
		size = keta;
		c = new char [size];
		int k = 0;
		for (int i = keta - 1; i >= 0; i--) {
			c[k++] = buf[i] - '0';
		}
	};

	BigNum(BigNum& b) {
		size = b.size;
		keta = b.keta;
		c = new char [size];
		memcpy(c, b.c, size);
	};

	BigNum& operator=(const BigNum& b) {
		size = b.size;
		keta = b.keta;
		c = new char [size];
		memcpy(c, b.c, size);

		return *this;
	};

	~BigNum() {
		if (c) {
			delete [] c;
		}
	};

	BigNum add(BigNum& n) {
		BigNum* a;
		BigNum* b;

		if (keta > n.keta) {
			a = this;
			b = &n;
		} else {
			a = &n;
			b = this;
		}

		BigNum r(a->keta + 1);

		int h;
		int m = 0;
		int i;
		for (i = 0; i < a->keta; i++) {
			if (i < b->keta) {
				h = a->c[i] + b->c[i] + m;
				m = h / 10;
				r.c[i] = h % 10;
			} else {
				h = a->c[i] + m;
				m = h / 10;
				r.c[i] = h % 10;
			}
		}
		if (m > 0) {
			r.c[i] = m;
			r.keta = i+1;
		} else {
			r.keta = i;
		}

		if (r.keta > 80) {
			throw overflow();
		}

		return r;
	};

	void print(void) const {
		for (int i = keta - 1; i >= 0; i --) {
			printf("%d", c[i]);
		}
		printf("\n");
	};

	char* c;
	int keta;

private:
	size_t size;
};

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	try {
		for (int i = 0; i < n; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			BigNum a(line);

			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			BigNum b(line);

			BigNum r;
			r = a.add(b);

			r.print();
		}
	}
	catch (overflow) {
		printf("overflow\n");
	}

	return 0;
}

C++: 
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

using namespace std;

void Solution()
{
    int i, j, n, f;
    
    string s1,s2;
    
    cin>>n;
    
    while(n--)
    {
        cin>>s1>>s2;
        
        f=0;
        
        if(s1.size() < s2.size())
        {
            swap(s1, s2);
        }
        
        for(i = 0; i < s2.size(); i++)
        {
            s1[i + s1.size() - s2.size()] += s2[i] - '0';
        }
        
        for(i = s1.size() - 1; i > 0; i--)
        {
            if(s1[i] > '9')
            {
                s1[i] -= 10;
                s1[i - 1]++;
            }
        }
        
        if(s1[0] > '9')
        {
            s1[0] -= 10;
            
            f++;
        }
        
        if(s1.size() + f <= 80)
        {
            if(f) cout<<"1";
           
            cout<<s1;
        }
        else
        {
            cout<<"overflow";
        }
        
        cout<<endl;
    }
}

int main()
{
    Solution();
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	cin>>n;
	rep(i,n){
		string a,b;
		cin>>a>>b;
		if(a.size()<b.size())swap(a,b);
		while(a.size()!=b.size())b="0"+b;
		for(int i=a.size()-1;i>=0;i--){
			a[i]+=b[i]-'0';
			if(a[i]>'9'){
				a[i]-=10;
				if(i)a[i-1]++;
				else a="1"+a;
			}
		}
		if(a.size()>80)cout<<"overflow"<<endl;
		else cout<<a<<endl;
	}
}

C++: import sys

n = int(input())
for i in range(n):
    a = int(input())
    b = int(input())
    if a + b >= 10**80:
        print ("overflow")
    else:
        print(a + b)