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>

#define STR_MAX 80
#define ASCII_BIAS 48

char h_adder(char n1, char n2, char *n3, char carry)
{
  char result = n1 + n2 + carry;
  
  if(result<10){ *n3 = result + ASCII_BIAS; return 0; }
  else{ *n3 = result-10+ASCII_BIAS; return 1; }
}

int main(void)
{
  int i, j;
  int dataset;
  char in[2][STR_MAX+2], out[STR_MAX+2], result[STR_MAX+2];
  int len_in[2], idx_min, idx_max, lmin, lmax, lout, dif;
  char carry;

  scanf("%d\n", &dataset);

  for(i=0;i<dataset;i++){
    fgets(in[0], sizeof in[0], stdin); rewind(stdin);
    fgets(in[1], sizeof in[1], stdin); rewind(stdin);
    len_in[0] = strlen(in[0])-1; len_in[1] = strlen(in[1])-1;

    // check # of digits
    if(in[0][len_in[0]]!='\n' || in[1][len_in[1]]!='\n'){
      printf("overflow\n"); continue;
    }
    in[0][len_in[0]] = '\0';
    in[1][len_in[1]] = '\0';
    
    idx_min = (len_in[0]>len_in[1]) ? 1 : 0; // idx of shoter str
    idx_max = (idx_min + 1) & 1; // idx of longer str
    lmin = len_in[idx_min]-1; lmax = len_in[idx_max]-1;
    dif = (len_in[0]>len_in[1]) ? len_in[0]-len_in[1] : len_in[1]-len_in[0]; // difference in digits

    // execute addition
    carry = 0;
    for(j=0;j<lmin+1;j++){
      carry = h_adder(in[idx_min][lmin-j]-ASCII_BIAS, in[idx_max][lmin-j+dif]-ASCII_BIAS, &out[j+1], carry);
    }
    for(j=lmin+1;j<lmax+1;j++){
      carry = h_adder(0, in[idx_max][lmin-j+dif]-ASCII_BIAS, &out[j+1], carry);
    }
    
    // if carry is 0, validate overflow
    if(carry==1){
      if(lmax==STR_MAX-1){
  	printf("overflow\n"); continue;
      }    
    }

    lout = carry ? lmax+2 : lmax+1;
    out[lmax+2] = carry ? 1+ASCII_BIAS : 0+ASCII_BIAS;

    
    // if overflow does not occur, addition succeeded
    out[0] = '\0';
    for(j=0;j<lout+1;j++){
      result[j] = out[lout-j];
    }
    printf("%s\n", result);
  }
  
}

C++: #include<bits/stdc++.h>
using namespace std;

struct Integer{
    int num[100];
    Integer(char *s){
        fill_n(num,100,0);
        int l=strlen(s);
        for(int i=0;i<l;i++){
            num[l-i-1]=s[i]-'0';
        }
    }
};
const Integer operator+(const Integer &lint,const Integer &rint){
    Integer ret("0");

    for(int i=0;i<100;i++){
        int v=ret.num[i]+lint.num[i]+rint.num[i];
        ret.num[i]=v%10;
        if(i+1>=100)continue;
        ret.num[i+1]+=v/10;

    }
    return ret;
}

char a[200],b[200];
int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        scanf("%s %s",a,b);
        Integer ans=Integer(a)+Integer(b);
        int s=0;
        for(int i=0;i<100;i++)if(ans.num[i])s=i;
        if(s>=80){
            puts("overflow");
            continue;
        }
        for(int i=s;i>=0;i--)printf("%d",ans.num[i]);
        puts("");
    }
    return 0;
}

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

string reverse(const string& str) {
	string ret;
	string::const_reverse_iterator it = str.rbegin();
	for (; it != str.rend(); it++) {
		ret.push_back(*it);
	}
	return ret;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string S1;
		string S2;
		int overflow = 0;
		cin >> S1 >> S2;
		if (S1.size() > 80 || S2.size() > 80) {
			cout << "overflow"<<endl;
		}
		else {
			S1 = reverse(S1);
			S2 = reverse(S2);
			S1.resize(80, '0');
			S2.resize(80, '0');
			int a = 0;
			for (int i = 0; i < 80; i++) {
				S1[i] += S2[i] - '0';
				if (S1[i] > '9') {
					if (i + 1 > 79) {
						cout << "overflow";
						overflow++;
					}
					S1[i + 1] += 1;
					S1[i] -= 10;
				}
				if (S1[i] != '0')
					a = i;
			}
			S1 = reverse(S1);
			if (overflow == 0)
				for (int i = 79 - a; i < 80; i++) {
					cout << S1[i];
				}
		}
		cout << endl;
	}
	return 0;
}