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 <string>
#include <list>
using namespace std;

class bigdata
{
public:
  list < int >data;
  string to_str ()
  {
    string str (data.size (), '0');
    int i = 0;
    auto it = data.begin ();
    while (it != data.end ())
      {
	string buf = to_string (*it);
	  str[i] = buf[0];
	  it++;
	  i++;
      }
    return str;
  }
  bigdata & operator= (string str)
  {
    for (int i = 0; i < str.length (); i++)
      data.push_back (stoi (str.substr (i, 1)));
  }
  bigdata & operator+ (bigdata & obj)
  {
    if (this->data.size () < obj.data.size ())
      {
	int buf = obj.data.size () - this->data.size ();
	for (int i = 1; i <= buf; i++)
	  this->data.push_front (0);
      }
    if (this->data.size () > obj.data.size ())
      {
	int buf = this->data.size () - obj.data.size ();
	for (int i = 1; i <= buf; i++)
	  obj.data.push_front (0);
      }
    this->data.push_front (0);
    obj.data.push_front (0);

    auto it_a = this->data.begin ();
    auto it_b = obj.data.begin ();

    while (it_a != this->data.end ())
      {
	*it_a += *it_b;
	auto bufit = it_a;
	for (int i = 0; i < this->data.size () - 1; i++)
	  {
	    if (*bufit >= 10)
	      {
		bufit--;
		*bufit += 1;
		++bufit;
		*bufit -= 10;
		bufit--;
	      }
	  }
	it_a++;
	it_b++;
      }
    it_a = this->data.begin ();
    if (*it_a == 0)
      this->data.pop_front ();
    return *this;
  }
};

int
main ()
{
  string s1, s2;
  int loop;
  cin >> loop;
  while (loop-- > 0)
    {
      cin >> s1 >> s2;
      bigdata data1, data2;
      data1 = s1;
      data2 = s2;
      data1 = data1 + data2;
      cout << data1.to_str () << endl;
    }
}

C++: #include<stdio.h>
#include<math.h>
#include<string.h>

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k,q,leng1,leng2;
	char fi[10000],se[10000],ans[10000];

	scanf("%d",&N);

	for(i=0;i<N;i++){

		for(j=0;j<1000;j++){
			ans[j]='\0';
			fi[j]='\0';
			se[j]='\0';
		}

		scanf("%s",&fi);
		scanf("%s",&se);

		for(j=0;fi[j]!='\0';j++){
		}
		leng1=j;
		for(j=0;se[j]!='\0';j++){
		}
		leng2=j;
		if(leng1<=80&&leng2<=80){
		for(j=leng1-1,k=leng2-1,keta=0,kuri=0;j>=0||k>=0;j--,k--,keta++){
			if(j<0) math1=0;
			else math1=fi[j]-'0';
			if(k<0) math2=0;
			else math2=se[k]-'0';
            ans[keta]=((math1+math2+kuri)%10)+'0';
			kuri=(math1+math2+kuri)/10;
		}
		q=0;
		if(kuri==1) ans[keta]='1',q=1;
		if(keta+q<=80){
			for(j=keta-1+q;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		}
		else printf("overflow");
		printf("\n");
		for(j=0;j<1000;j++){
			ans[j]='\0';
			fi[j]='\0';
			se[j]='\0';
		}
	}

	return 0;
}

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

int main(){

  int n;
  string s,t;

  cin >> n;
  for(;n>0;n--){
    cin >> s >> t;

    reverse(s.begin(),s.end());
    reverse(t.begin(),t.end());

    int ns = s.size(), nt = t.size();
    int nn = max(ns,nt);

    for(int i=ns;i<nn;i++) s += '0';
    for(int i=nt;i<nn;i++) t += '0';

    int c = 0;
    string ss = "";
    
    for(int i=0;i<nn;i++){
      int k = c + s[i] + t[i] - '0';

      if(k <= '9') ss += k, c = 0;
      if(k > '9') ss += k - 10, c = 1;

    }

    if(c == 1) ss += '1';

    reverse(ss.begin(),ss.end());
    if(ss.size() > 80) cout << "overflow" << endl;
    else cout << ss << endl;

  }
}

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

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    char str1[82];
    char str2[82];
    string ans = "";
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1) - 1, m2 = strlen(str2) - 1, pre = 0;
    int m = max(m1, m2);
    for(int j = 0; j <= m; j++){
      int sum = pre;
      sum += (m1 >= 0) ? str1[m1--] - '0' : 0;
      sum += (m2 >= 0) ? str2[m2--] - '0' : 0;
      pre = sum / 10;
      sum -= pre * 10;
      ans += '0' + sum;
    }
    if(pre > 0)
      ans += '0' + pre;
    reverse(ans.begin(), ans.end());
    if(ans.length() > 80)
      cout << "overflow" << endl;
    else
      cout << ans << endl;
  }
}

C++: #include <stdio.h>
#include <string.h>

int main(){
int n,ans[100],kuri,i,j,ap,bp;
char a[1000],b[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%s",a,b);
if(strlen(a)>80||strlen(b)>80){
printf("overflow\n");
continue;
}
ap=strlen(a)-1;
bp=strlen(b)-1;
j=0;
kuri=0;
while(ap>=0||bp>=0){
ans[j]=kuri;
if(ap>=0)ans[j]+=a[ap]- '0';
if(bp>=0)ans[j]+=b[bp]- '0';
kuri=ans[j]/10;
ans[j]%=10;
j++;
ap--;
bp--;
}
if(kuri==1)ans[j]=1;
else j--;
if(j>=80){
printf("overflow\n");
continue;
}
for(;j>=0;j--){
printf("%d",ans[j]);
}
printf("\n");
}
return 0;
}