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 <cstring>
using namespace std;

int main()
{
  int N;
  char str1[81] = {};
  char str2[81] = {};
  char s1[81] = {};
  char s2[81] = {};
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > 80 || m2 > 80)
      cout << "overflow" << endl;
    else if(atoi(str1) + atoi(str2) < 2147483647 && atoi(str1) + atoi(str2) > 0)
      cout << atoi(str1) + atoi(str2) << endl; 
    else{
      if(m1 > m2){
	for(int j = 0; j < m1 - m2 + 1; j++)
	  s1[j] = '0';
	s1[m1 - m2] = '\0';
	strcat(s1, str2);
	strcpy(s2, str1);
      }else if(m2 > m1){
	for(int k = 0; k < m2 - m1; k++)
	  s2[k] = '0';
	s2[m2 - m1] = '\0';
	strcat(s2, str1);
	strcpy(s1, str2);
      }else{
	strcpy(s1, str2);
	strcpy(s2, str1);
      }
      char ans[81] = {};
      int n = 0;
      for(int l = ((m1 > m2) ? m1 : m2) - 1; l >= 0; l--, n++)
	if((s1[l] - '0') + (s2[l] - '0') >= 10){
	  s1[l - 1] = s1[l - 1] + 1;
	  ans[l] = (s1[l]- '0') + (s2[l] - '0') + 38;
	}else
	  ans[l] = (s1[l] - '0') + (s2[l] - '0') + 48;
      ans[n] = '\0';
      if(n > 80)
	cout << "overflow" << endl;
      else{
	if((s1[0] - '0') + (s2[0] - '0') >= 10)
	  cout << "1";
	cout << ans << endl;
      }
    }
  }
}

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

string reverse(const string& str) {
	string ret;
	string::const_reverse_iterator it = str.rbegin();
	for (; it != str.rend(); it++) {
		ret.push_back(*it);
	}
	return ret;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string S1;
		string S2;
		cin >> S1 >> S2;
		if (S1.size() > 80 || S2.size() > 80) {
			cout << "overflow" << endl;
			continue;
		}
		S1 = reverse(S1);
		S2 = reverse(S2); 
		S1.resize(80, '0');
		S2.resize(80, '0');
		int a = 0;
		for (int i = 0; i < 80; i++) {
			S1[i] += S2[i]-'0';
			if (S1[i]> '9') {
				if (i + 1 > 79) {
					cout << "overflow" << endl;
					break;
				}
				S1[i + 1] += 1;
				S1[i] -= 10 ;
			}
			if (S1[i] != '0')
				a=i;
		}
		S1 = reverse(S1);
		for (int i = 79-a;i<80; i++) {
			cout << S1[i];
		}
		}
	
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
int main(void)
{
	int y;
	scanf("%d",&y);
	for(int z = 0;z < y;z++)
	{
		char suji1[100000],suji2[100000];
		char ans[100000] = {0};

		for(int i = 0;i<82;i++)
		{
			suji1[i] = '0';
			suji2[i] ='0';
		}

		int overflow = 0;

		scanf("%s",suji1);
		scanf("%s",suji2);
		int suji1s = strlen(suji1);
		int suji2s = strlen(suji2);

		int anss;
		if(suji1s>suji2s)  anss = suji1s;
		else anss = suji2s;

		suji1[suji1s] = '0';
		suji2[suji2s] = '0';

		reverse(suji1,suji1+suji1s);
		reverse(suji2,suji2+suji2s);

		for(int i = 0;i < 81;i++)
		{
			ans[i] = suji1[i]+suji2[i] - '0';
			if(ans[i] >= ':')
			{
				ans[i]  = ans[i] - 10;
				suji2[i+1] = suji2[i+1]+1;
			}
		}
		if(ans[anss]> '0')
		{
			anss++;
		}
		
		if(anss > 80) overflow = 1;
		reverse(ans,ans+anss);
		ans[anss] = 0;
		if(overflow >= 1)
		{
			printf("overflow");
		}
		else
		{
			printf("%s",ans);
		}
		printf("\n");
		
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <typeinfo>
#include <cmath>

using namespace std;

int main() {
	int n;
	cin >> n;

	string a, b, res;
	int temp, size, hoge, as, bs;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		hoge = 0;
		res = "";

		as = a.size();
		bs = b.size();
		size = as > bs ? as : bs;
		while (a.size() < size) { a = "0" + a; }
		while (b.size() < size) { b = "0" + b; }

		for (int i = 0; i < size; i++) {
			temp = a[size-i-1]+b[size-i-1]-'0'-'0'+hoge;

			if (temp > 9) {
				res = to_string(temp % 10) + res;
				hoge = temp / 10;
			}
			else {
				res = to_string(temp % 10) + res;
				hoge = 0;
			}
		}
		if (hoge > 0) {
			res = to_string(hoge) + res;
		}
		
		if (res.size() > 80) {
			cout << "overflow";
		}
		else {
			cout << res;
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <math.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int kk = 0; kk < n; ++kk)
	{
		int A[1000] = {},B[1000] = {},C[1000] = {},keta = 0;
		string in1,in2;
		cin >> in1 >> in2;
		if(in1.size() > 80 || in2.size() > 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < in1.size(); ++i)
			A[in1.size()-i] = (int)(in1[i]-'0');
		for (int i = 0; i < in2.size(); ++i)
			B[in2.size()-i] = (int)(in2[i]-'0');
		bool flag = 1;
		for (int i = 1; i < 1000; ++i)
		{
			C[i] += A[i]+B[i];
			if(C[i] >= 10)
			{
				C[i+1] += C[i]/10;
				C[i] -= C[i]/10*10;
			}
			if(C[i] != 0)
				keta = i;
		}
		if(keta > 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = keta; i > 0; --i)
		{
			cout << C[i];
		}
		cout << endl;
	}
}