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<cstring>

#define MAX 80

int main(){
	int i, j, n, na, nb, flg;
//	long a[10], b[10];
	char a[MAX*10]={'\0'}, b[MAX*10]={'\0'}, tp;

	scanf("%d", &n);
	while(n--){

	scanf("%s", a);
	na=strlen(a);
	for(i=0, j=na; i<na/2; i++, j--){
		tp=a[i]; a[i]=a[j-1]; a[j-1]=tp;
	}
	scanf("%s", b);
	nb=strlen(b);
	for(i=0, j=nb; i<nb/2; i++, j--){
		tp=b[i]; b[i]=b[j-1]; b[j-1]=tp;
	}


	if(na>nb){
 		for(i=0, flg=0; i<nb; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}	
		for(i=nb; i<na; i++){
			flg+=a[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}
	else {
		for(i=0, flg=0; i<na; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}			
		for(i=na; i<nb; i++){
			flg+=b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}


	j=strlen(a);

	if((na>MAX) || (nb>MAX)||(j>MAX))
		printf("overflow\n");
	else{
		for(i=j; i>0; i--) printf("%c",a[i-1]);
		printf("\n");
	}
	}
	return 0;
}

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

string tasu(string& a, string& b) {
    string s = "";
    if (a.size() < b.size()) swap(a, b);
    int prev = 0;
    for (int i = 1; i <= a.size(); i++) {
        int ac, bc, sum;
        ac = a[a.size()-i] - '0';
        if (b.size() < i) {
            bc = 0;
        } else {
            bc = b[b.size() - i] - '0';
        }
        sum = ac + bc + prev;
        prev = 0;
        if (sum >= 10) {
            prev = 1;
            sum -= 10;
        }
        s.push_back(sum + '0');
    }
    if (prev) s.push_back('1');
    reverse(s.begin(), s.end());
    if (s.size() > 80) s = "overflow";
    return s;
}

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        string a, b;
        cin >> a >> b;
        cout << tasu(a, b) << endl;
    }
    return 0;
}

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

#define NUMBER_DIGITS 80

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    char str1[NUMBER_DIGITS + 1];
    char str2[NUMBER_DIGITS + 1];
    char str3[NUMBER_DIGITS / 2 + 1][3];
    char str4[NUMBER_DIGITS / 2 + 1][3];
    int n1[NUMBER_DIGITS / 2 + 1] = {};
    int n2[NUMBER_DIGITS / 2 + 1] = {};
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > NUMBER_DIGITS || m2 > NUMBER_DIGITS)
      cout << "overflow" << endl;
    else if(atoi(str1) <= 2000000000 && atoi(str2) <= 2000000000 && atoi(str1) + atoi(str2) <= 2000000000){
      cout << atoi(str1) + atoi(str2) << endl;
    }else{
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m1 + 1; i += 2, j--){
	if(m1 % 2 == 1 && m1 - i < 0){
	  str3[j][0] = str1[0];
	  str3[j][1] == '\0';
	}else{
	  strncpy(str3[j], &str1[m1 - i], 2);
	  str3[j][2] == '\0';
	}
      }
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m2 + 1; i += 2, j--){
	if(m2 % 2 == 1 && m2 - i < 0){
	  str4[j][0] = str2[0];
	  str4[j][1] == '\0';
	}else{	  
	  strncpy(str4[j], &str2[m2 - i], 2);
	  str4[j][2] == '\0';
	}
      }
      for(int i = NUMBER_DIGITS / 2; i + ((m1 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m1 / 2; i--)
	if(str3[i][0] == '0' && str3[i][1] == '0')
	  n1[i] = 1000;
	else
	  n1[i] = atoi(str3[i]);
      for(int i = NUMBER_DIGITS / 2; i + ((m2 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m2 / 2; i--)
	if(str4[i][0] == '0' && str4[i][1] == '0')
	  n2[i] = 1000;
	else
	  n2[i] = atoi(str4[i]);
      int ans[NUMBER_DIGITS / 2 + 1] = {};
      int i = 0;
      int m = (m1 > m2) ? m1 : m2;
      for(int j = NUMBER_DIGITS / 2; NUMBER_DIGITS / 2 - 1 - m / 2 < ((m % 2) ? j + 1 : j); i++, j--)
	if(n1[j] + n2[j] >= 100)
	  if(n1[j] == 1000 && n2[j] < 10){
	    n1[j - 1] *= 10;
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] < 10){
	    n2[j - 1] *= 10;
	    ans[i] = n1[j];
	  }else if(n1[j] == 1000 && n2[j] == 1000){
	    if(n1[j - 1] % 10 != 0)
	      n1[j - 1] *= 10;
	    ans[i] = 1000;
	  }else if(n1[j] == 1000 && n2[j] >= 10){
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] >= 10){
	    ans[i] = n1[j];
	  }else if(n1[j] + n2[j] < 110){
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] + 900;
	  }else{
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] - 100;
	  }
	else
	  ans[i] = n1[j] + n2[j];
      int k = i;
      for(; i > 0; i--)
	if((i == k) && (ans[i - 1] == 0))
	  ;
	else if(ans[i - 1] == 1000)
	  cout << "00";
	else if(ans[i - 1] > 1000)
	  cout << "0" << ans[i - 1] % 1000;
	else
	  cout << ans[i - 1];
      cout << endl;
    }
  }
}