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<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	string a,b;
	vector<int> ans;
	int n,tmp,carry,num;
	bool flag = true;
	cin >> n;
	for(int i=0; i<n; i++){
		ans.clear();
		cin >> a >> b;
		int ai = a.size()-1;
		int bi = b.size()-1;
		carry=0;
		if(a.size() > 80 || b.size() > 80){
			cout << "overflow" << endl;
			flag = false;
		}
		while(ai >= 0 || bi >= 0){
			tmp=0;
			if(ai >= 0) tmp += a[ai] - '0';
			if(bi >= 0) tmp += b[bi] - '0';
			ans.push_back((tmp+carry)%10);
			carry = (tmp+carry)/10;
			ai--; bi--;
		}
		if(carry != 0) ans.push_back(carry);
		if(ans.size() > 80 && flag == true){
			cout << "overflow" << endl;
			flag = false;
		}
		if(flag == true){
			for(int j=ans.size()-1; j>=0; j--)
				cout << ans[j];
			cout << endl;
		}
	}
	return 0;
}

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

#define NUMBER_DIGITS 80

int main()
{
  int N;
  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 >> N;
  for(int i = 0; i < N; i++){
    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;
      break;
    }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;
    }
  }
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k,l;
    bool check;

    cin >> n;
    rep(i,n){
        char c1[81], c2[81];
        int i1[81] = {0}, i2[81] = {0};
        int ans[82] = {0};
        check = false;
        k = 0; l = 0;
        cin >> c1 >> c2;
/*      for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k] = c1[j] - '0';
                k++;
            }
            if(j <= strlen(c2) - 1){
                i2[l] = c2[j] - '0';
                l++;
            }
        }*/
        rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[80] != 0){
            cout << "overflow";
        }else{
            for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }
        }
        cout << endl;
    }
}