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++: #include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main(void)
{
	char a[256],b[256];
	int n,flag,count1,count2,count3,daisyo=0,miss=0;
	cin>>n;

	for (int i=0; i<n; i++) 
	{
		flag=0;
		daisyo=0;
		miss=0;

		cin>>a>>b;
		count1= strlen(a);
		count2= strlen(b);
		
		if (count1>80||count2>80) {
			flag=1;
		}
		count3=count1-count2;
		
		if(count2>count1)
		{
			count3*=-1;
			daisyo=1;
		}
		
		if(daisyo==0)
		{
			if(!(count1==count2))
			for(int j=0;j<=count2;j++)
			{
				b[count2-j+count3]=b[count2-j];
			}
			for (int j=0; j<count3; j++) {
				b[j]='0';
			}
			
			for (int j=1; j<=count1; j++) {
				a[count1-j]+=b[count1-j]-48;
				if (((int)a[count1-j])-48>9) 
				{
					if (j>=80) {
						flag=1;
						break;
					}
					a[count1-j]=(a[count1-j]-48)%10+48;
					if ((count1-j)==0) {
						miss=1;
					}
					else {
							a[count1-j-1]=a[count1-j-1]+1;

						
					}
				}
			}
		}
		
		else
		{
			for(int j=0;j<=count1;j++)
			{
				a[count1-j+count3]=a[count1-j];
			}
			for (int j=0; j<count3; j++) {
				a[j]='0';
			}
			
			for (int j=1; j<=count2; j++) {
				b[count2-j]+=a[count2-j]-48;
				if (((int)b[count2-j]-48)>9) 
				{
					if (j>=80) {
						flag=1;
						break;
					}
					b[count2-j]=(b[count2-j]-48)%10+48;
					if ((count2-j)==0) {
						miss=1;
					}
					else {
						b[count2-j-1]=b[count2-j-1]+1;
					}
				}
			}
		}
		
		if(flag==1)
		{
			cout << "overflow" << endl;
		}
		
		else 
		{
			if (miss==1) {
				cout << '1';
			}
			if(daisyo==0) 
			{
				for (int j=0; j<count1; j++) 
				{
					cout << (int)a[j]-48;
				}
			}
			
			else 
			{
				for (int j=0; j<count2; j++) 
				{
					cout << (int)b[j]-48;
				}
			}
			cout << endl;

		}
		
		
	}
		
		
	
	return (0);
}

C++: /*
 * Problem     : AOJ0015
 * Title       : Integral
 * Author      : mizo0203
 * Status      : Accepted
 * Date        : Sun Jun 24 20:50:52
 * Copyright   : Your copyright free
 * Description : 文字列・多倍長演算
 */

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

int N, f;
char str1[81], str2[81];
int sum[80];

void init() {
  scanf("%d", &N);
}

bool input() {
  char c;

  if (!N)
    return false;
  N--;

  f = 0;
  scanf("%80s", str1);
  scanf("%c", &c);
  if (c != '\n') {
    f = 1;
    return true;
  }
  scanf("%80s", str2);
  scanf("%c", &c);
  if (c != '\n') {
    f = 1;
    return true;
  }

  return true;
}

int main() {
  int i;

  init();
  while (input()) {
    if (f) {
      printf("overflow\n");
      continue;
    }
    fill(sum, sum + 80, 0);
    for (i = 0; i < (int) strlen(str1); i++) {
      sum[i] = str1[strlen(str1) - i - 1] - '0';
    }
    f = 0;
    for (i = 0; i < (int) strlen(str2); i++) {
      sum[i] += str2[strlen(str2) - i - 1] - '0' + f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    for (; i < 80; i++) {
      sum[i] += f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    if (f) {
      printf("overflow\n");
      continue;
    }
    for (i = 0; i < 79; i++) {
      if (sum[79 - i] != 0)
        break;
    }
    for (; i < 80; i++) {
      printf("%d", sum[79 - i]);
    }
    printf("\n");
  }

  return 0;
}

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

int main()
{
	string s1, s2, temp;
	int sum, flag;
	int a, b;
	vector<int> v;
	int T;
	cin >> T;
	while (T--)
	{
		cin >> s1 >> s2;
		v.clear();
		sum = 0;
		flag = 0;
		reverse(s1.begin(), s1.end());
		reverse(s2.begin(), s2.end());
		if (s1.size() < s2.size())
		{
			temp = s1;
			s1 = s2;
			s2 = temp;
		}
		for (int i = 0; i < s1.size(); ++i)
		{
			if (s1[i] == '0')a = 0;
			else if (s1[i] == '1')a = 1;
			else if (s1[i] == '2')a = 2;
			else if (s1[i] == '3')a = 3;
			else if (s1[i] == '4')a = 4;
			else if (s1[i] == '5')a = 5;
			else if (s1[i] == '6')a = 6;
			else if (s1[i] == '7')a = 7;
			else if (s1[i] == '8')a = 8;
			else if (s1[i] == '9')a = 9;
			if (i >= s2.size())b = 0;
			else
			{
				if (s2[i] == '0')b = 0;
				else if (s2[i] == '1')b = 1;
				else if (s2[i] == '2')b = 2;
				else if (s2[i] == '3')b = 3;
				else if (s2[i] == '4')b = 4;
				else if (s2[i] == '5')b = 5;
				else if (s2[i] == '6')b = 6;
				else if (s2[i] == '7')b = 7;
				else if (s2[i] == '8')b = 8;
				else if (s2[i] == '9')b = 9;
			}
			sum = a + b + flag;
			if (sum > 9)
			{
				sum = sum - 10;
				flag = 1;
			}
			else
			{
				flag = 0;
			}
			v.push_back(sum);
		}
		if (flag == 1)
			v.push_back(1);
		if (v.size() > 80)
			cout << "overflow" << endl;
		else
		{
			for (int i = v.size() - 1; i >= 0; --i)
			{
				cout << v[i];
			}
			cout << endl;
		}
	}
	return 0;
}

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

int count(int data[]){
	int cnt = 0,i=0;
	while(1){
		if(data[i] == 10)break;
		cnt++;
		i++;
	}
	return cnt;
}

void sum(char data1[],char data2[],int ans[]){
	int i;
	for(i = 0;i < strlen(data1) || i < strlen(data2);i++){
		int st1,st2,st3;
		if(i >= strlen(data1)){
			st1 = 0;
		}else{
			st1 = data1[strlen(data1)-i-1];
			st1 = st1 - 48;
		}
		if(i >= strlen(data2)){
			st2 = 0;
		}else{
			st2 = data2[strlen(data2)-i-1];
			st2 = st2 - 48;
		}
		st3 = st1 + st2;
		if(st3 >= 10){
			if(ans[i] == 1){
				ans[i] = st3 - 9;
				ans[i + 1] = 1;
			}else{
				ans[i] = st3 - 10;
				ans[i + 1] = 1;
			}
		}else{
			if(ans[i] == 1){
				if(st3 == 9){
					ans[i] = 0;
					ans[i + 1] = 1;
				}else{
					ans[i] = st3 + 1;
				}
			}else{
				ans[i] = st3;
			}
		}
	}
	if(ans[i] == 1){
		ans[i + 1] = 10;
	}else{
		ans[i] = 10;
	}
}

int main(void){
	int cnt,i;
	scanf("%d",&cnt);
	for(i = 0;i < cnt;i++){
		int ans[82];
		char data1[82],data2[82];
		scanf(" %80s",data1);
		fflush(stdin);
		scanf(" %80s",data2);
		fflush(stdin);
		if(strlen(data1) > 80 || strlen(data2) > 80){
			printf("overflow\n");
		}else{
			sum(data1,data2,ans);
			if(count(ans) >= 80){
				printf("overflow\n");
			}else{
				int j;
				for(j = count(ans)-1;j >= 0;j--){
					printf("%d",ans[j]);
				}
				printf("\n");
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string.h>
#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 alen,blen,mlen;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		alen=in.size();
		blen=in2.size();
		for(int i=0;i<alen;i++){
			a[alen-1-i]=in[i]-'0';
		}
		for(int i=0;i<blen;i++){
			b[blen-1-i]=in[i]-'0';
		}
		mlen=max(alen,blen);
		if(mlen>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<mlen+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[mlen]!=0){
			if(mlen>79){
				//cout<<"overflow"<<endl;
				continue;
			//}
			//cout<<ans[mlen];
		}
		
		for(int i=0;i<mlen;i++){
			//cout<<ans[mlen-1-i];
		}cout<<endl;
		
		
	}
	return 0;
}