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<algorithm>
#include<string>


#define MAX 1000


using namespace std;


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

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> in[0] >> in[1];

		for (int i = 0; i < MAX; i++){
			out[i] = '\0';
		}

		int count = in[0].size() - 1;

		for (int i = 0; i < in[0].size(); i++){
			out[count--] += in[0][i];
		}

		count = in[0].size();
		int count2 = in[1].size() - 1;

		count = max(count , count2) - 1;

		for (int i = 0; i < in[1].size(); i++){
			if (out[i] != '\0'){
				out[i] -= '0';
			}
			out[i] += in[1][count2--];
			count--;
		}
		
		int i = 0;
		for (i = 0; out[i] != '\0'; i++){
			;
		}

		bool flag = false;


		for (int j = 0; j < i; j++){
			if (out[j] > '9'){
				out[j] -= 10;
				out[j + 1] += 1;
			}
		}

		if (out[i] > '\0' && out[i] < '0'){
			out[i] += '0';
		}
		
		for (i = 0; i < out[i] != '\0'; i++){
			;
		}

		for (int j = 0; j < i / 2; j++){
			char tmp = out[j];
			out[j] = out[i - j - 1];
			out[i - j - 1] = tmp;
		}

		for (i = 0; out[i]; i++){
			;
		}

		if (i >= 81 || (flag == true && i >= 79)){
			cout << "overflow" << endl;
		}else{
			cout << out << endl;
		}
	}

	return 0;
}

C++: #include <stdio.h>

void rev_str(char str[1024]) {
	int length = 0;
	char str2[1024];
	int temp;

	int i;

	for(i = 0; i < 1024; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[1024];
	char input_b[1024];
	char ans[286][1024];
	char kuriagari;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 1024; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[j][i] = '\0';
		}

		kuriagari = 0;

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[j][i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}

		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[j][i] = kuriagari + '0';
		}

		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[j][i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[j][i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[j][i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[j][i] = input_a[i];
			i++;
		}

		rev_str(ans[j]);
		
		if(ans[j][80])
			printf("overflow");
		else
			printf("%s", ans[j]);

		putchar('\n');

	}

	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
int main()
{
	std::vector<std::string>result;
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++)
	{
		std::string s1, s2;
		std::cin >> s1 >> s2;
		std::string shorter, longer;
		if (s1.length() < s2.length())
		{
			shorter = s1;
			longer = s2;
		}
		else
		{
			shorter = s2;
			longer = s1;
		}
		std::string sum;
		int remainder = 0;
		for (int j = (int)shorter.length() - 1, k = (int)longer.length() - 1; j >= 0; j--, k--)
		{
			int digit = (int)(shorter[j] - '0' + longer[k] - '0');
			sum.push_back((char)((digit + remainder) % 10 + '0'));
			remainder = (digit + remainder) / 10;
		}
		for (int j = (int)(longer.length() - shorter.length() - 1); j >= 0; j--)
		{
			int digit = (int)(longer[j] - '0');
			sum.push_back((char)((digit + remainder) % 10 + '0'));
			remainder = (digit + remainder) / 10;
		}
		if (remainder != 0)
		{
			sum.push_back((char)(remainder + '0'));
		}
		result.push_back(sum);
	}
	for (auto i : result)
	{
		if (i.length() > 80)
		{
			std::cout << "overflow";
		}
		else
		{
			for (int j = (int)i.length() - 1; j >= 0; j--)
			{
				std::cout << i[j];
			}
		}
		std::cout << std::endl;
	}
	return 0;
}