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<string.h>
#include<string>
#include<algorithm>
using namespace std;
int max(int a,int b){return a>b?a:b;}
int main(){
	int n;
	scanf("%d",&n);
	for(int d=0;d<n;d++){
		char a[10000];
		char b[10000];
		scanf(" %s",a);
		scanf(" %s",b);        
		if(strlen(a) > 80 || strlen(b) > 80) {
            printf("overflow\n");
            continue;
        }
		string s,t;
		int i=0;
		s.append(a);
		t.append(b);
		reverse(s.begin(),s.end());
		reverse(t.begin(),t.end());
		string ans;
		int k=0;
		for(i=0;i<max(s.size(),t.size())+1;i++){
			int x,y;
			if(i>=s.size())x=0;
			else x=s[i]-'0';
			if(i>=t.size())y=0;
			else y=t[i]-'0';
			int z=x+y+k;
			k=z/10;
			char c=z%10+'0';
			if(i!=max(s.size(),t.size())||c!='0')ans.append(1,c);
		}
		reverse(ans.begin(),ans.end());
		if(ans.size()>=81)printf("overflow\n");
		else printf("%s\n",ans.c_str());
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cmath>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		int p1[100],p2[100];
		for(int i=0;i<100;i++){
			p1[i] = 0; p2[i] = 0;
		}
		string a,b;
		cin >> a ;
		cin >> b ;
		if(a.size() > 80 || b.size() > 80){
			cout << "overflow" << endl;
			continue;
		}

		int pos = 0;
		for(unsigned i=a.size();i>0;i--){
			stringstream sst;
			sst << a[i-1];
			sst >> p1[pos++];
		}
		pos = 0;
		for(unsigned i=b.size();i>0;i--){
			stringstream sst;
			sst << b[i-1];
			sst >> p2[pos++];
		}
		for(int i=0;i<100;i++){
			int ans = p1[i]+p2[i];
			p1[i] = ans % 10;
			p1[i+1] += ans/10;
		}
		bool flag = true;
		for(int i=99;i>=0;i--){
			if(flag){
				if(p1[i] == 0)
					continue;
				else{
					if(i > 79){
						cout << "overflow" ;
						break;
					}
					flag = false;
				}
			}
			cout << p1[i];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include<string>
#include<sstream>

#define CAPACITY 9

 
namespace stoi{
 
    int stoi(std::string str){
        int ret;
        std:: stringstream ss;
        ss << str;
        ss >> ret;
        return ret;
    }
 
}
class OverDigit
{
public:
    int num_a[CAPACITY];
    int num_b[CAPACITY];
    OverDigit(std::string str_a, std::string str_b);
    void ChangeDigit(std::string str,int num[]);
    void Add();
};
 
OverDigit::OverDigit(std::string str_a,std::string str_b)
{
    ChangeDigit(str_a, num_a); 
    ChangeDigit(str_b, num_b);
}

void OverDigit::ChangeDigit(std::string str, int num[])
{
	std::vector <int> num_str(CAPACITY, 0);
    int loc = CAPACITY, k = 8;
    int str_Max, str_rest;

    str_Max = str.length() / CAPACITY;//
    str_rest = str.length() % CAPACITY;


	for (int j = str.length() - CAPACITY; str_Max > 0; j = j-CAPACITY)
	{
        num_str[k] = stoi::stoi(str.substr(j, CAPACITY));
        loc = k;
        k--;
        str_Max--;
    }

	 
    if(str_rest!=0)
	{
		num_str[loc - 1] = stoi::stoi(str.substr(0, str_rest));
	}
 
    for (int j = 0; j < CAPACITY; j++)
	{
		num[j]=num_str[j];
    }
}

void OverDigit::Add()
{
    int num_ans[CAPACITY] = {};
    int fat,overflow=0,count=0;
 
    for (int j = CAPACITY-1; j >0; j--)
	{
        if (num_a[j] + num_b[j]<=999999999)
		{
            num_ans[j] = num_a[j] + num_b[j];
        }
        else
		 if (num_a[j] + num_b[j] > 999999999)
		{
            fat = (num_a[j] + num_b[j]) - 1000000000;
            num_ans[j] = fat;
            num_a[j - 1]++;     
        }
    }

    if (num_a[0] + num_b[0] > 99999999)
	{
        overflow = 1;
    }
    else
	{
		 num_ans[0]= num_a[0] + num_b[0];
    }
 
    if (overflow == 1)
	{
        std::cout << "overflow" << std::endl;
    }
    else
	{
        for (int j = 0; j < CAPACITY; j++)
		{
            if (num_ans[j] != 0)
			{
                count++;
                std::cout << num_ans[j];
            }
            else
			 if (num_ans[j] == 0 && count >= 1)
			{
                std::cout << "000000000";
            }
        }
		std::cout << std::endl;
    }
}
 
 
int main(){
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
    std::cin.ignore();
 
   for (int i = 0; i < N; i++){
        getline(std::cin, str_a);
        getline(std::cin, str_b);
        OverDigit OverDigit_a(str_a,str_b);
       OverDigit_a.Add();
   }
 
    return 0;
}