Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

C++: /**
 *  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0015
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_DIGITS 80
#define MAX_INPUTS 101

char           *add(const char *n1, const char *n2);
char           *overflowmsg();
char           *stralloc(const size_t length);

int
main(int argc, char *argv[])
{
    int             n, i;
    char            n1[MAX_INPUTS];
    char            n2[MAX_INPUTS];
    char           *r;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s", n1);
        scanf("%s", n2);
        r = add(n1, n2);

        printf("%s\n", r);

        free(r);
    }

    return 0;
}

char           *
add(const char *n1, const char *n2)
{
    int             l1, l2, lr;
    int             c = 0;
    int             d;
    int             i = 0;
    char           *r;
    char           *n;

    l1 = strlen(n1);
    l2 = strlen(n2);
    if (l1 > MAX_DIGITS || l2 > MAX_DIGITS) {
        return overflowmsg();
    }
    lr = l1 > l2 ? l1 : l2;

    r = stralloc(lr + 1);
    while (lr >= 0) {
        d = c + (l1-- > 0 ? n1[l1] - '0' : 0) + (l2-- > 0 ? n2[l2] - '0' : 0);
        c = d / 10;
        r[lr--] = d % 10 + '0';
    }
    while (r[i] == '0') {
        i++;
    }
    if (strlen(r + i) > MAX_DIGITS) {
        free(r);
        return overflowmsg();
    }
    if (i != 0) {
        n = r;
        r = stralloc(strlen(n + i));
        strcpy(r, n + i);
        free(n);
    }
    return r;
}

char           *
overflowmsg()
{
    const char     *e = "overflow";
    char           *r;
    r = stralloc(strlen(e));
    strcpy(r, e);
    return r;
}

char           *
stralloc(const size_t length)
{
    char           *r;
    r = (char *)calloc(length + 1, sizeof(char));
    return r;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int a_len,b_len,m_len;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		a_len=in.size();
		b_len=in2.size();
		for(int i=0;i<a_len;i++){
			a[a_len-1-i]=in[i]-'0';
		}
		for(int i=0;i<b_len;i++){
			b[b_len-1-i]=in2[i]-'0';
		}
		m_len=max(a_len,b_len);
		if(m_len>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<m_len+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[m_len]!=0){
			printf("%d",ans[m_len]);
		}
		
		
	}
	
	
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <stack>
#include <cmath>
#include <cstring>
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define llong long long

int main() {
  int n;
  scanf("%d ",&n);
  char a[102],b[102];
  REP(i,n) {
    fgets(a,101,stdin);
    fgets(b,101,stdin);
    int al = strlen(a);
    int bl = strlen(b);
    if(a[al-1] == '\n') a[--al] = '\0';
    if(b[bl-1] == '\n') b[--bl] = '\0';
    char answer[103];
    REP(j,102) {
      answer[j] = '0';
    }
    answer[102] = '\0';
    REPR(j,101) {
      int anow,bnow;
      if(--al >= 0) anow = a[al]-'0';
      else anow = 0;
      if(--bl >= 0) bnow = b[bl]-'0';
      else bnow = 0;
      int t = (answer[j]-'0') + anow + bnow;
      answer[j] = t%10 + '0';
      if(j != 0) answer[j-1] += t/10;
    }
    int k = 0;
    while(k < 101 && answer[k] == '0'){
      k++;
    }
    if(k > 21)printf("%s\n",answer+k);
    else printf("overflow\n");
  }
  return 0;
}

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

struct bigint {
private:
    std::string s;
public:
    bigint(std::string s): s(s) {}
    bigint& operator +(bigint rhs)
    {
        int d = rhs.s.size() < this->s.size() ? this->s.size() - rhs.s.size() : rhs.s.size() - this->s.size();
        if (rhs.s.size() < this->s.size()) for (int i = 0; i < d; ++i) rhs.s = '0' + rhs.s;
        else for (int i = 0; i < d; ++i) this->s = '0' + this->s;

        int c = 0;
        for (int i = this->s.size() - 1; i >= 0; --i) {
            int a = this->s[i] - '0' + rhs.s[i] - '0' + c;
            this->s[i] = a % 10 + '0';
            c = a / 10;
        }
        if (c) this->s = (char)(c + '0') + this->s;
        return *this;
    }
    void print()
    {
        std::cout << s;
    }
};

int main()
{
    int n;
    std::cin >> n;
    std::cin.ignore();

    for (int i = 0; i < n; ++i) {
        std::string s1, s2;
        getline(std::cin, s1);
        getline(std::cin, s2);

        bigint bi1(s1), bi2(s2);
        (bi1 + bi2).print();
        std::cout << std::endl;
    }
}

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

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k;
	char fi[100],se[100],ans[100];

	scanf("%d",&N);

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

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

		if(strlen(fi)<=80&&strlen(se)){
		for(j=strlen(fi)-1,k=strlen(se)-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;
		}
		if(kuri==1) printf("1");
		if(keta-1<=80){
			for(j=keta-1;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		}
		else printf("overflow");
		printf("\n");
	}

	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int T; scanf("%d",&T);
	while(T--){
		char s[1024],t[1024]; scanf("%s%s",s,t);
		int m=strlen(s),n=strlen(t);

		int a[1024]={},b[1024]={};
		rep(i,m) a[i]=s[m-i-1]-'0';
		rep(i,n) b[i]=t[n-i-1]-'0';

		m=max(m,n);
		int c[1024]={};
		rep(i,m){
			int tmp=a[i]+b[i]+c[i];
			c[i]=tmp%10;
			c[i+1]+=tmp/10;
		}
		if(c[m]!=0) m++;

		if(m>80) puts("overflow");
		else{
			rep(i,m) putchar(c[m-i-1]+'0');
			puts("");
		}
	}

	return 0;
}

C++: import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main(){

    int n;
    readf("%d\n",&n);
    for(int i=0;i<n;i++){
	string s1,s2,res;
	s1 = chomp(readln());
	s2 = chomp(readln());
	res = "";
	int x = to!int(s1.length-1);
	int y = to!int(s2.length-1);
	if( y > x) {
	    swap(s1,s2);
	    swap(x,y);
	}
	int add = 0;
	while(x >= 0 || add > 0){
	    int sum = 0;
	    if(y >= 0)
		sum = to!int(s1[x] - '0') + to!int(s2[y] - '0');
	    else if(x >= 0)
		sum = to!int(s1[x] - '0');
	    else 
		sum = 0;
	    if( sum + add > 9){
		    res = to!string((sum + add)%10) ~ res;
		    add = 1;
	    }else{
		res = to!string(sum + add) ~ res;
		add = 0;
	    }
	    if(x >= 0) x--;
	    if(y >= 0) y--;
	}
	if(res.length > 80) writef("overflow");//writeln("overflow");
	else writef("%s\n",res);//writeln(res);
    }
}