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 <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

const int MAX_INPUT = 1000000;
const int ARRAY_SIZE = 9;
const int MAX_LEN = 8;
char inputA[MAX_INPUT];
char inputB[MAX_INPUT];

void toBigInt(char *str, long *r) {
    int len = strlen(str);
    int startIndex = ARRAY_SIZE - (len / MAX_LEN) - 1;

    {
        int offset = 0;
        for (int i = 0; i < ARRAY_SIZE; ++i) {
            char temp[MAX_LEN + 1] = { 0 };
            char* start = str + ((i == 0) ? 0 : offset);
            int readLen = ((len - offset) < MAX_LEN) ? len - offset : MAX_LEN;

            strncpy(temp, start, readLen);
            r[ARRAY_SIZE - i - 1] = (long)atoi(temp);
            offset += readLen;
        }
    }
}

int main() {
    while (scanf("%s\n%s", &inputA, &inputB) != EOF) {
        long a[ARRAY_SIZE] = { 0 };
        long b[ARRAY_SIZE] = { 0 };
        long r[10] = { 0 };
        int lenA = 0;
        int lenB = 0;
        const int MAX_INPUT_LEN = 80;
        lenA = strlen(&inputA[0]);
        lenB = strlen(&inputB[0]);
        if ((MAX_INPUT_LEN < lenA) || (MAX_INPUT_LEN < lenB)) {
            printf("overflow\n");
            continue;
        }

        toBigInt(inputA, a);
        toBigInt(inputB, b);
        for (int i = 0; i < ARRAY_SIZE; ++i) {
            int curRIndex = 10 - i - 1;
            r[curRIndex] += a[ARRAY_SIZE - i - 1] + b[ARRAY_SIZE - i - 1];
            const int MAX = 99999999;
            if (MAX < r[curRIndex]) {
                r[curRIndex - 1] = r[curRIndex] / (MAX + 1);
                r[curRIndex] %= (MAX + 1);
            }
        }

        {
            bool started = false;
            bool noOutput = true;
            for (int i = 0; i < 10; ++i) {
                if (!started && (0 < r[i])) {
                    started = true;
                    printf("%d", r[i]);
                    noOutput = false;
                    continue;
                }

                if (started) {
                    long temp = (r[i] == 0) ? 1 : r[i];
                    for (int j = 0; temp * pow(10, j) < 10000000; ++j) {
                        printf("0");
                    }

                    printf("%d", r[i]);
                }
            }

            if (noOutput) {
                printf("0");
            }
        }
        printf("\n");
    }

    return 0;
}

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

int main(){
  int n;
  string a,b;
  cin>>n;
  for(int j=0;j<n;j++){
    cin>>a>>b;
    int asize=a.length();
    int bsize=b.length();
    int smax=max(asize,bsize);
    bool flag=false;
    int s;
    stringstream ss;
    for(int i=0;i<smax;i++){
      if(asize-i-1<0) s=strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      else if(bsize-i-1<0) s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0);
      else s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0)+strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      if(flag) s++;
      ss<<s%10;
      if(s>9)
	flag=true;
      else
	flag=false;
    }
    string ans=ss.str();
    if(ans.length()+flag>80){
      cout<<"overflow"<<endl;
      continue;
    }
    if(flag) cout<<1;
    for(string::reverse_iterator rit=ans.rbegin();rit!=ans.rend();rit++)
    cout<<*rit;
    cout<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		int ans[85]={},n1[81]={},n2[81]={};
		string s1,s2;
		cin>>s1>>s2;
		int sz1=s1.size(),sz2=s2.size();

		rep(j,0,sz1) n1[j]=s1[sz1-1-j]-'0';
		rep(j,0,sz2) n2[j]=s2[sz2-1-j]-'0';

		for(int j=0;j<81;j++){
			//cout<<"  "<<j<<" "<<n1[j]<<n2[j]<<endl;
			int a=ans[j]+n1[j]+n2[j];
			ans[j]=a%10;
			ans[j+1]=a/10;
			//cout<<" "<<j<<" "<<ans[j]<<endl;
		}
		if(ans[80]>=0){
			cout<<"overflow"<<endl; return 0;
		}
		bool f=0;
		for(int i=80;i>=0;i--){
			if(f==0 && ans[i]>0){
				f=1; cout<<ans[i];
			}else if(f) cout<<ans[i];
		}
		cout<<endl;
	}
}