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

#define MAX_DIGITS 80
#define RESULT_OVERFLOW "overflow"

int main()
{
    using namespace std;
    string num1, num2, result;
    vector<string> results;
    int count;
    cin >> count;
    for (int i = 0; i < count; ++i) {
        cin >> num1 >> num2;
        if (num1.size() > MAX_DIGITS || num2.size() > MAX_DIGITS) {
            result = RESULT_OVERFLOW;
        }
        else {
            int co = 0; // carryover
            reverse(num1.begin(), num1.end());
            reverse(num2.begin(), num2.end());
            size_t digits = min((int)max(num1.size(), num2.size())+1, MAX_DIGITS);
            result.resize(digits);
            for (int j = 0; j < digits; ++j) {
                string digit1, digit2;
                digit1 = j < num1.size() ? num1.substr(j, 1) : "0";
                digit2 = j < num2.size() ? num2.substr(j, 1) : "0";
                int tmp = atoi(digit1.c_str()) + atoi(digit2.c_str()) + co;
                co = tmp/10;
                // "integer to numeric character" conversion. see ascii table.
                result[j] = char(48 + tmp - co*10);
            }
            if (co == 1) result = RESULT_OVERFLOW;
            else {
                reverse(result.begin(), result.end());
                if (result[0] == '0') result = result.substr(1);
            }
        }
        results.push_back(result);
    }
    for (vector<string>::iterator itr = results.begin();
         itr != results.end(); ++itr) {
        cout << *itr << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
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--) {
		char a[84], b[84];
		int x[84], y[84], s[84], max;
		cin >> a >> b;
		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 > 80 || j > 80) {
			cout << "overflow" << endl;
			break;
		}
		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;
		}
		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 {
			if(f) {
				cout << 1;
				max--;
			}
			rep(k,max) {
				cout << s[k];
			}
			cout << endl;
		}
	}
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	while( n-- ){
		string num1, num2;
		cin >> num1 >> num2;
		char sum[101];
		int degit = 0;
		/*for( int i = 0; i < min(num1.size(), num2.size()); i++ ){
			int now = degit+(int)(num1[num1.size()-i-1]-'0')+(int)(num2[num2.size()-i-1]-'0');
			sum[i] = (char)(now%10);
			if( now >= 10 ) degit = 1;
			else degit = 0;
		}*/
		for( int i = 0; i < sizeof(sum); i++ ) sum[i] = '0';
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] += (int)(num1[num1.size()-i-1]-'0');
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now;
			if( i < num2.size() ){
				now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
			}else{
				now = (int)(sum[100-i]-'0') + degit;
			}
			//sum[100-i] = sum[100-i] + num2[num2.size()-i-1]-'0';
			sum[100-i] = (char)(now%10+'0');
			if( now >= 10 ) degit = 1;
			else degit = 0;
			//cout << "now" << now << endl;
			d = i;
		}
		for( int i = 100-d; i < 101; i++ ) cout << sum[i];
		cout << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    string a,b,c;
    int x = 0,y = 0;
    cin >>a>>b;
    int as = a.size(),bs = b.size();
    for(int i=0; i<as || i<bs; i++){
      if(i<as && i<bs) x = a[as-i-1]+b[bs-i-1]+y-'0'*2;
      else if(i<as) x = a[as-i-1]+y-'0';
      else if(i<bs) x = b[bs-i-1]+y-'0';
      y = x/10;
      x%=10;
      c+=x+'0';
    }
    if(y == 1) c+='1';
    if(c.size() > 80) cout <<"overflow"<<endl;
    else{
      for(int i=c.size()-1; i>=0; i--) cout <<c[i];
      cout <<endl;
    }
  }
  return 0;
}