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<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long int ll;

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		int a[80];
		string sa1,sa2,s1="",s2="";
		for(int i=0;i<80;i++)a[i]=0;
		cin >> sa1 >> sa2;
		if(sa1.length()>80||sa2.length()>80){
			printf("overflow\n");
			continue;
		}
		for(int j=0;j<80-sa1.length();j++){
			s1+='0';
		}
		s1+=sa1;
		for(int j=0;j<80-sa2.length();j++){
			s2+='0'; 
		}
		s2+=sa2;
		for(int i=0;i<80;i++){
			a[i]+=(s1[i]-'0')+(s2[i]-'0');
		}
		for(int i=79;i>=1;i--){
			a[i-1]+=a[i]/10;
			a[i]%=10;
		}
		if(a[0]>=10){
			printf("overflow\n");
			continue;
		}
		int x=0;
		while(a[x]==0)x++;
		for(int i=x;i<=79;i++){
			cout << a[i];
		}
		if(x==80)printf("0\n");
		else printf("\n");
	}
    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,_MAX, &bstr, _MAX);
		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] = astr[y - j - 1];
					}
				}
			}
		}
		sum_n[i][0] = x; sum_n[i][1] = y; sum_n[i][2] = r;
		r = 0;
	}
	for (int i = 0; i < n; ++i) {
		x = sum_n[i][0]; y = sum_n[i][1]; r = sum_n[i][2];
		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");
	}
}

C++: #include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

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

		string result(80, '0');
		int over = 0;
		int j = a.length() - 1;
		int k = b.length() - 1;
		int l = 79;
		for (; l >= 0; --j, --k, --l) {
			int numa = j < 0 ? '0' : a[j];
			int numb = k < 0 ? '0' : b[k];
			int sum = numa + numb - '0' * 2 + over;
			if (sum >= 10) {
				over = 1;
				sum -= 10;
			} else {
				over = 0;
			}
			result[l] = sum + '0';
		}
		if (over == 1) {
			cout << "overflow" << endl;
		} else {
			int j = 0;
			for (; j < result.length() && result[j] == '0'; ++j);
			if (j == result.length()) cout << '0';
			for (; j < result.length(); ++j) cout << result[j];
			cout << endl;
		}
	}

	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	int n,s1[10001],s2[10001],s3[10001];
	int i,j,len,len2,x,flg;
	char buf[10001];
	scanf("%d",&n);
	for(j=0;j<n;j++)	{
		for(i=0;i<81;i++)	{
			s1[i]=0;	s2[i]=0;	s3[i]=0;
		}
		scanf("%s",buf);
		len=strlen(buf);
		for(i=len-1;i>=0;i--)	s1[len-1-i]=buf[i]-'0';
		scanf("%s",buf);
		len2=strlen(buf);
		for(i=len2-1;i>=0;i--)	s2[len2-1-i]=buf[i]-'0';		
		for(i=0;i<80;i++)	{
			x=s1[i]+s2[i]+s3[i];
			s3[i]=x%10;
			s3[i+1]=x/10;
		}
		if(s3[80]!=0 || len>80 || len2>80)	{
			printf("overflow\n");
		}
		else {
			flg=0;
			for(i=79;i>=0;i--)	{
				if(flg==1 || s3[i]!=0)	{
					printf("%d",s3[i]);
					flg=1;
				}
			}
			if(flg==0)	{
				printf("0");
			}
			printf("\n");
		}
	}
	return 0;
}