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<bits/stdc++.h>
using namespace std;

string ans;
string s1,s2;

void Calc(int up,int indx1,int indx2){


  if(indx1==-1){
    if(up!=0){ans.insert(ans.begin(),(char)(up+(int)'0'));}
    return;
  }


  if(indx2>=0){
    int work = s1[indx1]-'0' + s2[indx2]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }

  else{
    int work = s1[indx1]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }


  Calc(up,indx1-1,indx2-1);
}

int main(){

  char head1,head2;
  string tmp;
  int size;
  int n;


  cin >> n;

  for(int i=0; i<n; i++){
    ans="";
    cin >> s1;
    cin >> s2;
    if(s1.size()<s2.size()){ tmp=s1;s1=s2;s2=tmp; }

    if(s1.size()>=80 || s2.size()>=80)
      cout<<"overflow"<<endl;
    else if((s1.size()>=79 || s2.size()>=79) && s1[0]-'0'+s2[0]-'0'>=10)
      cout<<"overflow"<<endl;
    else{
      Calc(0,s1.size()-1,s2.size()-1);
      cout << ans << endl;
    }
  }

  return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
	int N, c = 0, tmp;
	cin >> N;
	string ans;
	for (int i = 0; i < N; i++) {
		ans = "";
		string a, b;
		cin >> a >> b;
		for (int j = 0; j < max(a.length(), b.length()); j++) {
			int A, B;
			A = a.length() - j - 1;
			B = b.length() - j - 1;
			tmp = (A >= 0 ? a[A] - '0' : 0) + (B >= 0 ? b[B] - '0' : 0) + c;
			ans = (char)(tmp % 10 + '0') + ans;
			c = tmp / 10;
		}
		if (c) {
			ans = '1' + ans;
		}
		cout << (ans.length() > 80 ? "overflow" : ans) << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;
const int N = 80;

vector<int> makeDx(string str){
    reverse(str.begin(), str.end());
    vector<int> ret(N, 0);
    REP(i, str.size()) ret[i] = str[i] - '0';
    return ret;
}

int main(){
    int n; cin >>n;
    REP(z, n){
        string str[2]; cin >>str[0] >>str[1];
        vector<int> dx[2] = {makeDx(str[0]), makeDx(str[1])};
        vector<int> ans(N, 0);
        bool okflg = true;
        REP(i, N){
            int sum = dx[0][i] + dx[1][i];
            ans[i] += sum;
            if(i == N - 1 && ans[i] >= 10){
                cout <<"overflow" <<endl;
                okflg = false;
            }else if(ans[i] >= 10){
                ans[i + 1] = ans[i] / 10;
                ans[i] %= 10;
            }
        }
        if(okflg){
            reverse(ans.begin(), ans.end());
            int s = 0;
            while(ans[s] == 0) s++;
            FOR(i, s, N) cout <<ans[i];
            cout <<endl;
        }
    }
    return 0;
}

C++: #include <iostream>

int lastIndex(char*);
void charAdd(char*, char*,char*, const int&, const int&);
void outputNumber(char*);

int main(){
	int datasetNumber;
	std::cin >> datasetNumber;
	for (int i = 0; i < datasetNumber; ++i){
		char number1[101];
		char number2[101];
		char sumNumber[102];

		for (int j = 0; j < 101; j++){
			sumNumber[j] = '0';
		}

		std::cin >> number1 >> number2;

		int lastIndex1 = lastIndex(number1);
		int lastIndex2 = lastIndex(number2);

		charAdd(number1, number2, sumNumber, lastIndex1, lastIndex2);
		outputNumber(sumNumber);
	}
}

int lastIndex(char* charNumber){
	int index;
	for (index = 0; charNumber[index + 1] != '\0'; ++index);
	return index;
}

void charAdd(char* number1, char* number2,char* sumNumber,
	const int& lastIndex1, const int& lastIndex2){

	int index1, index2;
	if (lastIndex1 > lastIndex2){
		index1 = lastIndex1;
		index2 = lastIndex2;
	}
	else{
		index1 = lastIndex1;
		index2 = lastIndex2;
	}

	sumNumber[101] = '\0';
	for (int i = lastIndex1, sumIndex = 100;
		i >= 0; --i, --sumIndex){

		sumNumber[sumIndex] += number1[i] - '0';
	}
	for (int j = lastIndex2, sumIndex = 100;
		j >= 0; --j, --sumIndex){

		sumNumber[sumIndex] += number2[j] - '0';
		for (int index = sumIndex; sumNumber[index] > '9'; --index){
			sumNumber[index] -= 10;
			sumNumber[index - 1] += 1;
		}
	}
}

void outputNumber(char* sumNumber){
	int i;
	for (i = 0; sumNumber[i] == '0'; ++i);
	
	if (i <= 20){
		std::cout << "overflow" << std::endl;
	}
	else if (sumNumber[i] == '\0'){
		std::cout << 0 << std::endl;
	}
	else{
		for (int j = i; sumNumber[j] != '\0'; ++j){
			std::cout << sumNumber[j];
		}
		std::cout << std::endl;
	}
}