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*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	char number1[81];
	char number2[81];
	int sum[81];
	int digit1;
	int digit2;
	int digit_sum;
	int move_up;
	int i,j;
	/*****処理部*****/
	memset(number1,'0',sizeof(number1));
	memset(number2,'0',sizeof(number1));
	digit1 = 0;
	digit2 = 0;
	digit_sum = 0;
	cin >> number1;
	cin >> number2;
	while(number1[digit1] != '\0')	digit1++;
	while(number2[digit2] != '\0')	digit2++;
	move_up = 0;
	//cout << digit1 << " " << digit2 << endl;
	if(digit1 != digit2){
		if(digit1 > digit2){
			i = digit1;
			j = digit2;
			while(j>=0){
				number2[i] = number2[j];
				number2[j] = '0';
				i--;j--;
			}
		}else{
			i = digit1;
			j = digit2;
			while(i>=0){
				number1[j] = number1[i];
				number1[i] = '0';
				i--;j--;
			}
		}
	}
	/*for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
		cout << number1[i-1];
	}
	cout << endl;
	for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
		cout << number2[i-1];
	}
	cout << endl;*/
	//for(int i=0;i<4;i++)	cout << number2[i] << " " << atoi(&number2[i]) << endl;
	//for(int i=0;i<4;i++)	cout << number1[i] << " " << atoi(&number1[i]) << endl;
	digit_sum = 0;
	for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
		//cout << atoi(&number1[i-1]) << " " << atoi(&number2[i-1]) << endl;
		sum[digit_sum]
			= number1[i-1] - '0'
			+ number2[i-1] - '0'
			+ move_up;
		if(sum[digit_sum] >= 10){
			move_up = 1;
			sum[digit_sum] = sum[digit_sum] % 10;
		}else{
			move_up = 0;
		}
		digit_sum++;
	}
	if(move_up == 1){
		sum[digit_sum] = move_up;
		digit_sum++;
	}
	//cout << digit_sum << endl;
	if(digit_sum > 79)	cout << "overflow" << endl;
	else{
		for(int k=digit_sum-1;k>=0;k--){
			cout << sum[k];
		}
		cout << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<string>
#include<algorithm>
using namespace std;
int max(int a,int b){return a>b?a:b;}
int main(){
	int n;
	scanf("%d",&n);
	for(int d=0;d<n;d++){
		char a[100];
		char b[100];
		scanf(" %s",a);
		scanf(" %s",b);        
		if(strlen(a) > 80 || strlen(b) > 80) {
            printf("overflow\n");
            continue;
        }
		string s,t;
		int i=0;
		s.append(a);
		t.append(b);
		reverse(s.begin(),s.end());
		reverse(t.begin(),t.end());
		string ans;
		int k=0;
		for(i=0;i<max(s.size(),t.size())+1;i++){
			int x,y;
			if(i>=s.size())x=0;
			else x=s[i]-'0';
			if(i>=t.size())y=0;
			else y=t[i]-'0';
			int z=x+y+k;
			k=z/10;
			char c=z%10+'0';
			if(i!=max(s.size(),t.size())||c!='0')ans.append(1,c);
		}
		reverse(ans.begin(),ans.end());
		if(ans.size()>=81)printf("overflow\n");
		else printf("%s\n",ans.c_str());
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
	int N;
	string A, B, tmp;
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> A;
		cin	>> B;
		if(A.size()>80 || B.size()>80){
			cout << "overflow" << endl;
			continue;
		}
		if(A.size() < B.size()) tmp = B, B = A, A = tmp;
		int dif = A.size() - B.size();
		int carry = 0;
		for(int i=A.size(); i>=0; i--){
			if(i-dif>=0) A[i] = A[i]+B[i-dif]-'0'+carry;
			else A[i] += carry;
			if(A[i] >= '0'+10) carry = 1, A[i] -= 10;
			else carry = 0;
		}
		if(carry==1){
			if(A.size()==80){
				cout << "overflow" << endl;
				continue;
			}else cout << '1';
		}
		for(int i=0; i<A.size(); i++) cout << A[i];
		cout << endl;
	}
}