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<math.h>
#include<string.h>

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k;
	char fi[10000],se[10000],ans[10000];

	scanf("%d",&N);

	for(i=0;i<N;i++){

		scanf("%s",&fi);
		scanf("%s",&se);

		if(strlen(fi)<=80&&strlen(se)<=80){
		for(j=strlen(fi)-1,k=strlen(se)-1,keta=0,kuri=0;j>=0||k>=0;j--,k--,keta++){
			if(j<0) math1=0;
			else math1=fi[j]-'0';
			if(k<0) math2=0;
			else math2=se[k]-'0';
            ans[keta]=((math1+math2+kuri)%10)+'0';
			kuri=(math1+math2+kuri)/10;
		}
		if(kuri==1) printf("1");
		if(keta+1<=80){
			for(j=keta-1;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		}
		else printf("overflow");
		printf("\n");
	}

	return 0;
}

C++:     #include <iostream>
    #include <vector>
    #include <string>
    #include <sstream>
     
    class BigInteger {
    	// use 18 digit a element
    	std::vector<uint64_t> splited_num_;
    public:
    	BigInteger(std::string str) {
    		set_data(str);
    	}
    	BigInteger(std::vector<uint64_t>&& splited_num) {
    		splited_num_ = std::move(splited_num);
    	}
    	BigInteger operator+(const BigInteger& rhs) {
    		return BigInteger(plus(splited_num_, rhs.get_data()));
    	}
    	std::vector<uint64_t> get_data() const {return splited_num_;}
    	std::string to_string() const {
    		std::string ret("");
    		const int size = splited_num_.size();
    		for (int i = 0; i < size; ++i) {
    			const uint64_t& n = splited_num_[size - i - 1];
    			ret += n == 0 ? "000000000000000000" : std::to_string(n);
    		}
    		return ret;
    	}
    private:
    	void set_data(const std::string& str) {
    		std::string sub;
    		int length = str.length();
    		while (length >= 18) {
    			int pos = length - 18;
    			sub = str.substr(pos, 18);
    			splited_num_.push_back(to_uint64(sub));
    			length -= 18;
    		}
    		if (length > 0) {
    			sub = str.substr(0, length);
    			splited_num_.push_back(to_uint64(sub));
    		}
		}
    	std::vector<uint64_t> plus(std::vector<uint64_t> lhs,
    						       std::vector<uint64_t> rhs) const {
    		std::vector<uint64_t> ret;
     		uint64_t carry = 0;
     		
     		const int max = std::max(lhs.size(), rhs.size());
     		const int min = std::min(lhs.size(), rhs.size());
     		// ensure that lhs.sizs() is larger than rhs.size()
     		if (lhs.size() < rhs.size()) {
     			std::swap(lhs, rhs);
     		}
     		// fit container size
     		for (int i = 0; i < (max - min); ++i) {
     			rhs.push_back(0);
     		}
     		
     		for (int i = 0; i < max; ++i) {
     			uint64_t sum = lhs.at(i) + rhs.at(i) + carry;
     			carry = sum / 1000000000000000000;
     			sum = sum % 1000000000000000000;
     			ret.push_back(sum);
     		}
     		if (carry > 0) {
     			ret.push_back(carry);
     		}
     		return ret;
    	}
    	uint64_t to_uint64(const std::string& str) const {
    		std::istringstream iss(str);
    		uint64_t ret = 0;
    		iss >> ret;
    		return ret;
    	}
    };
     
    int main() {
    	std::vector<BigInteger> ans_list;
    	int n;
    	std::cin >> n;
    	for (int i = 0; i < n; ++i) {
    		std::string str1, str2;
    		std::cin >> str1;
    		std::cin >> str2;
    		BigInteger bi1(str1);
    		BigInteger bi2(str2);
    		ans_list.push_back(bi1 + bi2);
    	}
    	
    	for (auto ans : ans_list) {
    		auto ans_str = ans.to_string();
    		std::cout << (ans_str.length() > 80 ? "overflow" : ans_str) << std::endl;
    	}
    }

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;


int a[1000],b[1000],c[1000];

int main(){
	int n;
	cin>>n;
	rep(i,n){
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		string s,s2;
		cin>>s;
		//cout<<s<<endl;
		//cout<<s.size()<<endl;
		if(s.size()>80){
			cout<<"overflow\n";
			cin>>s2;
			continue;
		}
		rep(j,s.size()){
			a[90-j]=s[s.size()-j-1]-'0';
			//cout<<s[s.size()-j-1]-'0';
		}
		//cout<<a[87]<<endl;
		cin>>s2;
		if(s2.size()>80){
			cout<<"overflow\n";
			continue;
		}
		rep(j,s2.size()){
			b[90-j]=s2[s2.size()-j-1]-'0';
		}
		/*
		rep(j,91) cout<<a[j];
		cout<<endl;
		rep(j,91) cout<<b[j];
		cout<<endl;
		*/
		int t=0;
		for(int j=90;j>=0;j--){
			c[j]=(a[j]+b[j]+t)%10;
			if((a[j]+b[j]+t)>9) t=1;
			else t=0;
		}
		bool f=true;
		/*
		rep(j,91) cout<<c[j];
		cout<<endl;
		*/
		rep(j,91){
			if(f&&c[j]!=0){
				f=false;
				if(j<=10){
					cout<<"overflow";
					break;
				}
			}
			if(!f) cout<<c[j];
		}
		cout<<endl;
		
	}
	return 0;
}