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<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k;
    bool check;

    while(cin >> n){
        rep(i,n){
            char c1[81], c2[81];
            int i1[81] = {0}, i2[81] = {0};
            int ans[82] = {0};
            check = false;
            k = 0;
            cin >> c1 >> c2;
            for(int j = strlen(c1) - 1; 0 <= j; j--, k++){
                i1[k] = c1[j] - '0';
            }
            k = 0;
            for(int j = strlen(c2) - 1; 0 <= j; j--, k++){
                i2[k] = c2[j] - '0';
            }
            rep(j, 81){
                ans[j]+= i1[j] + i2[j];
                if(ans[j] >= 10){
                    ans[j]-=10;
                    ans[j+1]++;
                }
            }
            for(int j = 81; 0 <= j; j--){
                if(ans[81] != 0){
                    cout << "overflow";
                    break;
                }
                if(ans[j] != 0)
                    check = true;
                if(check == true)
                    cout << ans[j];
            }cout << endl;
        }
    }
}

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

int main(){

	int n;

	string a, b;
	char N1[80], N2[80];
	char sum[80];
	string ans;

	cin >> n;

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

		cin >> a;
		
		if( a.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		cin >> b;

		if( b.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		for( int i=0;i<80;i++ ){
			N1[i] = -1; N2[i] = -1; sum[i] = 0;
		}

		for( int i=1;i<=a.length();i++ )
			N1[i] = a[a.length()-i] - '0';
		for( int i=1;i<=b.length();i++)
			N2[i] = b[b.length()-i] - '0';

		int over = 0;
		
		for( int i=0;i<80;i++ ){


			if( N1[i] == -1 && N2[i] == -1 ){
				if( over >= 10 ){
					sum[i] = over / 10;
					over = 0;
				}else
					sum[i] = -1;
				continue;
			}

			if( N1[i] != -1 )
				sum[i] += N1[i];
			if( N2[i] != -1 )
				sum[i] += N2[i];

			sum[i] += over / 10;

			over = floor((double)sum[i]/10)*10;

			sum[i] -= over;
			
		}

		if(over > 0)cout << "overflow" << endl;
		else{
			for( int i=1;i<=80;i++ ){
				if( sum[80-i] >= 0 )
					cout << (char)(sum[80-i] + '0');
			}
			cout << endl;
		}

	}
	return 0;
}

C++: #include<iostream>
#include<string.h>
#define MAX(x,y) (x>y?x:y)
using namespace std;

int N;
int sum[1000][100];
	char stra[1000][85],strb[1000][85];

int main(){
	int i,j;
	int a[100],b[100];
	cin >> N;
	for(i = 0;i < N;i++){
		for(j = 0;j < 100;j++){
			a[j] = 0;
			b[j] = 0;
		}
		cin >> stra[i];
		for(j = strlen(stra[i])-1;j >= 0;j--){
			a[j] = stra[i][strlen(stra[i])-1-j]-48;
		}
		cin >> strb[i];
		for(j = strlen(strb[i])-1;j >= 0;j--){
			b[j] = strb[i][strlen(strb[i])-1-j]-48;
		}
		for(j = 0;j < MAX(strlen(stra[i]),strlen(strb[i]));j++){
			sum[i][j] += (a[j]+b[j]);
			sum[i][j+1] += (sum[i][j])/10;
			sum[i][j] %= 10;
		}
	}
	for(i = 0;i < N;i++){
		for(j = 99;sum[i][j] == 0 && j > 0;j--);
		if(j >= 80)
			cout << "overflow" << endl;
		else{
			for(j;j >= 0;j--)
				cout << sum[i][j];
			cout << endl;
		}
	}
	return 0;
}

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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int n;
	cin >> n;
	while(n--) {
		string a, b;
		int x[84], y[84], s[84], max;
		cin >> a >> b;
		if(a.length() > 80 || b.length() > 80) {
			cout << "overflow" << endl;
			break;
		}
		int i = 0, j = 0;
		for(; a[i] != '\0'; ++i) {
			x[i] = a[i] - '0';
		}
		for(; b[j] != '\0'; ++j) {
			y[j] = b[j] - '0';
		}
		
		if(i > j) {
			for(int k = j - 1; k >= 0; k--) {
				y[i-j+k] = y[k];
			}
			rep(k,i-j) {
				y[k] = 0;
			}
			max = i;
		} else if(i < j) {
			for(int k = i - 1; k >= 0; k--) {
				x[j-i+k] = x[k];
			}
			rep(k,j-i) {
				x[k] = 0;
			}
			max = j;
		} else max = i;
		bool f = 0;
		for(int k = max - 1; k >= 0; k--) {
			int c = x[k] + y[k];
			if(f) c++;
			if(c >= 10) {
				f = 1, c -= 10;
			} else f = 0;
			s[k] = c;
		}
		if(f) {
			max++;
		}
		if(max > 80) cout << "overflow" << endl;
		else {
			string ans;
			if(f) {
				ans += "1";
				max--;
			}
			rep(k,max) {
				ans += s[k] + '0';
			}
			cout << ans << endl;
		}
	}
	return 0;
}