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

int n;
char a[256], b[256];

int main()
{
        std::cin >> n;
	
	while( n-- ){
		char c[256];
		
		std::cin >> a >> b;
		
		int minlen = std::min( strlen( a ), strlen( b ) );
		int maxlen = std::max( strlen( a ), strlen( b ) );
		bool f = strlen( a ) > strlen( b );
		bool f2 = false;
		
		if( maxlen > 80 ){
		 	std::cout << "overflow" << std::endl;
			continue;
		}
		
		int sz = 0;
		int carry = 0;
		
		for( int i = 0; i < minlen; i++ ){
			int na = a[ strlen( a ) - 1 - i ] - '0';
			int nb = b[ strlen( b ) - 1 - i ] - '0';
			int nc = 0;
			
			if( na + nb + carry >= 10 ){
			 	nc = na + nb + carry - 10;
				carry = 1;
			}
			else{
			 	nc = na + nb + carry;
				carry = 0;
			}
			c[ maxlen - i - 1 ] = nc + '0';
		}
		
		for( int i = minlen; i < maxlen; i++ ){
			int na = f ? a[ maxlen - 1 - i ] - '0' : b[ maxlen - 1 - i ] - '0';
			int nc = 0;
			
			if( na + carry >= 10 ){
			 	nc = na + carry - 10;
				carry = 1;
				if( i == maxlen - 1 ){
					f2 = true;
				}
			}
			else{
			 	nc = na + carry;
				carry = 0;
			}
			
			c[ maxlen - i - 1 ] = nc + '0';
		}
		
		sz = maxlen + f2;
		
		if( sz >= 80 ){
		 	std::cout << "overflow" << std::endl;
		}
		else{
			c[sz-(f2?1:0)] = '\0';
			if( f2 )std::cout << "1";
			std::cout << c << std::endl;
		}
		sz = 0;
		carry = 0;
	}

 	return 0;
}

C++: #define scanf_s scanf
#define sscanf_s sscanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
//#define CONSTNUM 10000000
int main(void)
{
	int n, s = 0, x, y, r = 0, a, b;
	int sum_n[50][3] = { 0 };
	char sum[50][_MAX], astr[_MAX], bstr[_MAX], num[11] = { "0123456789" };
	char ca, cb;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%s %s", &astr, &bstr);
		for (x = 0; astr[x] != '\0'; ++x);
		for (y = 0; bstr[y] != '\0'; ++y);
		if (x >= 80 || y >= 80) {
			printf("overflow\n");
			continue;
		}
		for (int j = 0; j < x || j < y; ++j) {
			if (j < x && j < y) {
				ca = astr[x - j - 1]; cb = bstr[y - j - 1];
				sscanf_s(&ca, "%d", &a);
				sscanf_s(&cb, "%d", &b);
				if (x > y) sum[i][x - j] = num[(a + b + r) % 10];
				else sum[i][y - j] = num[(a + b + r) % 10];
				if (a + b + r >= 10) r = (a + b + r) / 10;
				else r = 0;
			}
			else {
				if (x > y) {
					if (r != 0) {
						ca = astr[x - j - 1];
						sscanf_s(&ca, "%d", &a);
						sum[i][x - j] = num[(a + r) % 10];
						if (a + r >= 10) r = (a + r) / 10;
						else r = 0;
					}
					else {
						sum[i][x - j] = astr[x - j - 1];
					}
				}
				else {
					if (r != 0) {
						cb = bstr[y - j - 1];
						sscanf_s(&cb, "%d", &b);
						sum[i][y - j] = num[(b + r) % 10];
						if (b + r >= 10) r = (b + r) / 10;
						else r = 0;
					}
					else {
						sum[i][y - j] = bstr[y - j - 1];
					}
				}
			}
		}
		if (y < 80 - r && x < 80 - r) {
			if (r == 1) printf("%d", r);
			for (int j = 1; j <= x || j <= y; ++j) {
				printf("%c", sum[i][j]);
			}
		}
		else {
			printf("overflow");
		}
		printf("\n");r = 0;
	}
}

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

class OverDigit{

public:

	int num_a[9];
	int num_b[9];
	OverDigit(string str_a, string str_b);
	void ChangeDigit(string str,int num[]);
	void Add();
};

OverDigit::OverDigit(string str_a,string str_b){

	ChangeDigit(str_a, num_a); 
	ChangeDigit(str_b, num_b);	
}

void OverDigit::ChangeDigit(string str, int num[]){

	vector <int> num_str(9, 0);
	int loc = 9, k = 8;
	int str_Max, str_rest;

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


	for (int j = str.length() - 9; str_Max > 0; j = j-9){
		num_str[k] = stoi(str.substr(j, 9));
		loc = k;
		k--;
		str_Max--;
	}
	//?????????????????????????????????????????\??????
	num_str[loc - 1] = stoi(str.substr(0, str_rest));

	for (int j = 0; j < 9; j++){
	num[j]=num_str[j];
	}
}
//80????????§????¶???????
void OverDigit::Add(){

	int num_ans[9] = {};
	int fat,overflow=0,count=0;

	for (int j = 8; 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 && j!=1){
			fat = (num_a[j] + num_b[j]) - 1000000000;
			num_ans[j] = fat;
			num_a[j - 1]++;		
		}
		else if (num_a[j] + num_b[j] > 999999999 && j ==1 ){
			overflow = 1;
		}
	
	}

	if (overflow == 1){
		cout << "overflow" << endl;
	}
	else {
		for (int j = 0; j < 9; j++){
			if (num_ans[j] != 0){
				count++;
				cout << num_ans[j];

			}
			else if (num_ans[j] == 0 && count >= 1){
				cout << "000000000";
			}

		}cout << endl;
	}

};


int main(){

	//vector???????????¨??????80???????¨????
	int N;
	string str_a, str_b;

	cin >> N;
	cin.ignore();

	for (int i = 0; i < N; i++){
		getline(cin, str_a);
		getline(cin, str_b);
		OverDigit OverDigit_a(str_a,str_b);//???????????§??????
		OverDigit_a.Add();
	}

	return 0;
}