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>
#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, 81){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[81] != 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;
    }
}

C++: #include <stdio.h>
#include <string.h>

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	int num1[100];
	int num2[100];
	int sum[100];
	char str[100];
	int n;
	int i, j, k;
	
		printf("error");
	fgets(buf, sizeof(buf), stdin);
	sscanf(buf, "%d", &n);
	
	for (i=0; i<n; i++) {
		for (j=0; j<100; j++) {
			num1[j] = num2[j] = sum[j] = 0;
		}
		
		// first integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str)-1; j++)  ;
		for (k=0; j>=0; k++) {
			num1[k] = str[j] - '0';
			j--;
		}
		
		// second integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str)-1; j++)  ;
		for (k=0; j>0; k++) {
			num2[k] = str[j] - '0';
			j--;
		}
		
		// sum
		for (j=0; j<80; j++) {
			sum[j] += num1[j]+num2[j];
			if (sum[j]/10 >= 1) {
				sum[j+1] += sum[j]/10;
				sum[j] = sum[j]%10;
			}
		}
		
		if (sum[80] > 0) {
			printf("overflow\n");
		}
		else {
			for (j=79; sum[j]==0 && j!=0; j--)  ;
			for (; j>=0; j--) {
				printf("%d", sum[j]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

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

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		string a, b;
		cin >> a >> b;
		if(a.size()>80 || b.size()>80) {cout << "overflow" << endl;}
		else{
			vector<int> x, y, z;
			for(int j=0; j<80; j++){
				x.push_back(0);
				y.push_back(0);
				z.push_back(0);
			}

			for(int j=0; j<a.size(); j++)
				x[j] = atoi( a.substr(a.size()-1-j,1).c_str() );
			for(int j=0; j<b.size(); j++)
				y[j] = atoi( b.substr(b.size()-1-j,1).c_str() );
			
			for(int j=0; j<80; j++){
				z[j] = x[j]+y[j];
			}
			for(int j=0; j<79; j++){
				if( z[j]>=10 ){
					z[j+1]++;
					z[j]-=10;
				}
			}
			if(z[79]>=10) {cout << "overflow" << endl;}
			else {
				bool zeroume = false;
				for(int j=0; j<80; j++){
					if(z[79-j]==0 && zeroume==false){}
					else{cout << z[79-j];zeroume=true;}
				}
				cout << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
//#define scanf scanf_s

int main()
{
	int n;
	cin >> n;
	REP(i, n)
	{
		string a, b;
		vector<int> ans;
		cin >> a >> b;
		if (a.size() < b.size()) swap(a, b);
		bool kuri = 0;
		REP(i, b.size())
		{
			if (a[a.size()-i-1]-'0' + b[b.size()-1-i]-'0'+kuri < 10)
			{
				
				ans.push_back(a[a.size() - i - 1] - '0' + b[b.size() - 1 - i] - '0' + kuri);
				kuri = 0;
			}
			else
			{
				ans.push_back(a[a.size() - i - 1] - '0' + b[b.size() - 1 - i] - '0' + kuri - 10);
				kuri = 1;
			}
		}
		FOR(i, b.size(), a.size())
		{
			if (a[a.size()-i-1]-'0' + kuri < 10)
			{
				ans.push_back(a[a.size() - i - 1] - '0' + kuri);
				kuri = 0;
			}
			else
			{
				ans.push_back(a[a.size() - i - 1] - '0' + kuri-10);
				kuri = 1;
			}
		}
		if (kuri) ans.push_back(1);
		if (ans.size() > 80) cout << "overflow" << endl;
		REP(i, ans.size()) cout << ans[ans.size()-1-i];
		cout <<'\0' <<endl;
	}
	return 0;
}