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<string>
#include<vector>
#include<algorithm>

int main() {
	int n;	
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		int size=4;
		std::string a, b;
		std::vector<int> va, vb, out;
		std::cin >> a >> b;
		for (std::string::iterator aitr = a.begin(); aitr != a.end(); aitr++) {
			va.push_back((int)*aitr - '0');
		}
		for (std::string::iterator bitr = b.begin(); bitr != b.end(); bitr++) {
			vb.push_back((int)*bitr - '0');
		}
		std::reverse(va.begin(), va.end()); std::reverse(vb.begin(), vb.end());
		out.push_back(0);
		size = va.size() > vb.size() ? va.size() : vb.size();
		for (int i = 0; i < size; i++) {
			out[i] = out[i] + (i < va.size() ? va[i] : 0) + (i < vb.size() ? vb[i] : 0);
			if (out[i] > 9) {
				out[i] = out[i] % 10;
				out.push_back(1);
			}
			else {
				out.push_back(0);
			}
		}
		if (out.back() == 0) out.pop_back();
		if (out.size() > 80) std::cout << "overflow" << std::endl;
		else {
			std::reverse(out.begin(), out.end());
			for (std::vector<int>::iterator itr = out.begin(); itr != out.end(); itr++) {
				std::cout << *itr;
			}
			std::cout << std::endl;
		}
	}
}

C++: #include <stdio.h>
#include <string.h>
int main() {
	char L[85],R[85];int left,right,i,j,N;scanf("%d",&N);while (N--) {scanf("%s\n%s",&L,&R);left=strlen(L),right=strlen(R);
		if (left>=right) {for (i=right-1,j=left-1;i>=0;i--,j--) R[j]=R[i];right=left;for (;j>=0;R[j--]='0');} else {for (i=right-1,j=left-1;j>=0;i--,j--) L[i]=L[j];left=right;for (;i>=0;L[i--]='0');}
		L[left]=0;for (i=left-1,j=0;i>=0;i--) {L[i]+=R[i]+j-48;if (L[i]>'9') j=1,L[i]-=10; else j=0;}if (j) printf("1");puts(L);} return 0;}

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

using namespace std;

int main(){
	int n,l1,l2,i;
	string a, b;
	char *ans;
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80)cout<<"overflow"<<endl;
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		ans=new char[l1+1];
		for(i=0;i<l1;i++)ans[i]='0';
		for(i=1;i<l2+1;i++){
			ia=(int)a[l1-i]-(int)'0';
			ib=(int)b[l2-i]-(int)'0';
			sum=ia+ib;
			ans[l1-i]+=sum;
		}
		for(i=l2+1;i<l1+1;i++){
			ans[l1-i]=a[l1-i];
		}
		for(i=0;i<l1;i++){
			if(ans[i]-'0'>9){
				ans[i]=ans[i]-10;
				ans[i-1]+=1;
			}
		}
		for(i=0;i<l1;i++){
			cout<<(int)ans[i]-'0';
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int n,i,j,k,s,t,u;
	int carry = 0;
	string a, b;
	vector<int> c;
	cin >> n;
	for (i = 0; i < n; i++) {
		c.clear();
		cin >> a;
		cin >> b;
		while (a.size() > b.size()) {
			b = "0" + b;
		}
		while (b.size() > a.size()) {
			a = "0" + a;
		}
		s = a.size();
		for (j = s-1; j >=0; j--) {
			t = a[j]-'0' + b[j]-'0';
			if (carry == 1) {
				carry = 0;
				t += 1;
			}
			while (t >= 10) {
				t -= 10;
				carry += 1;
			}
			c.push_back(t);
		}
		while (carry == 1) {
			carry = 0;
			c.push_back(1);
		}
		u = c.size();
		if (u > 80) {
			cout << "overflow" << endl;
		}
		for (k = u - 1; k >= 0; k--) {
			cout << c[k];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;


int getValue(string str, int i){
	int endp,startp;

	endp = str.length() - 8 * i;
	startp = str.length() - 8 - 8 * i;
	if( endp <= 0 )
		return 0;
	else if( startp <= 0 ) {
		return atoi( str.substr(0,endp).c_str() );					
	}
	else {
		return atoi( str.substr(startp,8).c_str() );					
	}
	return -1;
}


int main()
{
	int num,i,j,startp,endp;
	string str1, str2;
	long v1,v2;
	int v[10];
	cin >> num;
	for(i = 0; i < num; i++ ) {
		cin >> str1;
		cin >> str2;
		if( str1.length() > 80 || str2.length() > 80 ){
			printf("overflow\n");
			continue;
		}
		//8桁ずつ分けて計算
		int flg = 0;
		for( j = 0; j < 10; j++ ) {
			v1 = getValue( str1, j );
			v2 = getValue( str2, j );
			
			v[j] = v1 + v2 + flg;
			if( v[j] >= 100000000 ) {
				flg = 1;
				v[j] -= 100000000;
			}
			else {
				flg = 0;
			}
		}
		if( flg == 1 )
			printf("overflow\n");
		else {
			flg = 0;
			for( j = 9 ; j >= 0; j-- ) {
				if( v[j] > 0 ){
					printf("%d",v[j] );
					flg = 1;
				}
				else if( flg == 1 ) {
					printf("%08d",v[j] );
				}
				
			}
			printf("\n");	
		}
	}




	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k,l;
    bool check;

    cin >> n;
    rep(i,n){
        char c1[81], c2[81];
        int i1[81] = {0}, i2[81] = {0};
        int ans[82] = {0};
        check = false;
        k = 0; l = 0;
        cin >> c1 >> c2;
/*        for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k] = c1[j] - '0';
                k++;
            }
            if(j <= strlen(c2) - 1){
                i2[l] = c2[j] - '0';
                l++;
            }*/
        }
        rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[80] != 0){
            cout << "overflow";
        }else{
            for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }
        }
        cout << endl;
    }
}

C++: #include<algorithm>
#include<iostream>
#include<cstdio>
#include<stdio.h>
#include<string>
#include<string.h>
#include"stdafx.h"
using namespace std;

int main()
{
	char a1,a2  ;
	long long a, b,c;
	int kaisu = 0;
	cin >> kaisu;
	for (int i = 0; i < kaisu; i++)
	{
		cin >> a;
		cin >> b;
		a1 =  GetDigit(a);
		a2 = GetDigit(a);
		if (a1 + a2 >= 80) { printf("overflow"); }
		else { c = a + b; printf(c + "\n"); }
	}
	return 0;
}
unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}