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 <list>
#include <vector>
#include <cstdlib>
#include <algorithm>

#define MAX_DIGIT 80
#define ERROR ("overflow")

int main(void){
	using namespace std;

	int N;
	cin >> N;

	list< pair<string,string> > input;

	for(int i=1; i<=N; i++){

		string slhs, srhs;
		cin >> slhs >> srhs;

		reverse(slhs.begin(), slhs.end());
		reverse(srhs.begin(), srhs.end());

		input.push_back(make_pair(slhs,srhs));

	}

	for(auto p=input.begin(); p!=input.end(); p++){

		auto slhs = p->first, srhs = p->second;
		if(slhs.size()>MAX_DIGIT || srhs.size()>MAX_DIGIT){
			cout << ERROR << endl;
			continue;
		}

		int headDigit = std::max(slhs.size(),srhs.size());
		vector<int> lhs(headDigit), rhs(headDigit);
		list<int> res;

		auto atoi_digit = [] (char x) -> int {
			return atoi(&x);
		};
		transform(slhs.begin(), slhs.end(), lhs.begin(), atoi_digit);
		transform(srhs.begin(), srhs.end(), rhs.begin(), atoi_digit);

		int carry = 0;
		for (auto itr=lhs.begin(); itr!=lhs.end(); itr++){
			int index = itr - lhs.begin();
			auto d = div(lhs[index]+rhs[index]+carry,10);
			carry = d.quot;
			res.push_back(d.rem);
		}

		if(headDigit==MAX_DIGIT && carry !=0){
			cout << ERROR << endl;
		}
		else{
			if (carry!=0){
				res.push_back(carry);
			}
			for(auto itr=res.rbegin(); itr!=res.rend();itr++){
				cout << *itr;
			}
			cout << endl;
		}

	}
}

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

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[200], b[200], x[200], y[200];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		if(LA>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		
		int LB=strlen(b);
		if(LB>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[81];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(big>=80 && carry!=0) printf("overflow\n");
		else{
			if(carry!=0){
				ans[big++]=carry+'0';
				ans[big]='\0';
				//printf("carries\n");
			}	
			
			int LS=strlen(ans);
			char fans[82];
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}	
		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}

C++: 






#include<iostream>
#include<algorithm>
#include<string>
#include<vector>


#define MAX 1000


//99999999999999999999999999999999999999999999999999999999999999999999999999999999

using namespace std;


int main()
{
	int n = 0;
	string in[2];
	char out[MAX] = {NULL};

	cin >> n;

	for (int i = 0; i < n; i++){
		vector<int>v;

		cin >> in[0] >> in[1];

		int len[2];
		len[0] = in[0].size();
		len[1] = in[1].size();

		//けた上がり
		int up = 0;

		for (int i = 0; i < max(len[0] , len[1]) || up == 1; i++){
			
			//足す値
			int push = up;
			up = 0;

			//indexの範囲内
			if(i < len[0]){
				push += in[0][len[0] - i - 1] - '0';
			}
			if (i < len[1]){
				push += in[1][len[1] - i - 1] - '0';
			}
			if (push > 9){
				push -= 10;
				up = 1;
			}

			v.push_back(push);
		}

		if (v.size() > 80){
			cout << "overflow" << endl;
			continue;
		}
		for (int i = v.size() - 1; i >= 0; i--){
			cout << v[i];
		}
		cout << endl;
	}

	return 0;
}