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>

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();
}