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 <cstdio>
#include <cstring>
using namespace std;

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[200], b[200], x[200], y[200];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		if(LA>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		
		int LB=strlen(b);
		if(LB>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[200];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(carry!=0){
			ans[big++]=carry+'0';
			ans[big]='\0';
			//printf("carries\n");
		}	
			
		int LS=strlen(ans);
		char fans[200];
		if(LS>80) printf("overflow\n");
		else{
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){

	int n;
	cin >> n;
	while(n > 0){
        char a[120] = {0};
        char b[120] = {0};
        scanf("%s%s",a,b);
        char ans[120] = {0};
        for(int i = 0; i < strlen(a)/2; i++){
            swap(a[i],a[strlen(a)-i-1]);
        }
        for(int i = 0; i < strlen(b)/2; i++){
            swap(b[i],b[strlen(b)-i-1]);
        }
        int len = max(strlen(a),strlen(b));
        for(int i = 0; i < len; i++){
            if(ans[i] != 0){
                if(a[i] == 0 || b[i] == 0)
                    ans[i] += a[i] + b[i] - '0';
                else ans[i] += a[i] + b[i] - '0' - '0';

            }
            else if(a[i] == 0 || b[i] == 0) ans[i] += a[i] + b[i];
            else ans[i] += a[i] + b[i] - '0';
            if(ans[i] >= 58){
                ans[i+1]+='1';
                ans[i] -= 10;
            }
        }
        for(int i = 0; i < strlen(ans)/2; i++){
            swap(ans[i],ans[strlen(ans)-i-1]);
        }
        int Len_a = 0,Len_b = 0,Len_ans = 0;
        for(int i = 0; a[i] != 0; i++) Len_a++;
        for(int i = 0; b[i] != 0; i++) Len_b++;
        for(int i = 0; ans[i] != 0; i++) Len_ans++;
        if(Len_a > 80 || Len_b > 80 || Len_ans > 80) printf("overflow");
        else for(int i = 0; ans[i] != 0; i++) printf("%c",ans[i]);
        printf("\n");
        n--;
	}

	return 0;
}

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

using namespace std;

int main() {
	int n;
	cin>>n;
	
	string str1, str2, of="overflow";
	for(int i=0; i<n; i++){
		cin>>str1>>str2;
		int size1=str1.size();
		int size2=str2.size();

		if(size1 > 80 || size2 > 80){
			cout<<of<<endl;
		}
		else{
			int num1[80] = {0}, num2[80] = {0}, buf[81] = {0};

			for(int i=0; i<size1; i++){ num1[size1-1-i] = (str1[i]-'0'); }
			for(int i=0; i<size2; i++){ num2[size2-1-i] = (str2[i]-'0'); }
			for(int i=0; i<80; i++){ buf[i] = num1[i]+num2[i]; }
			for(int i=0; i<80; i++){
				if(buf[i] > 9){
					buf[i+1] += buf[i]/10;
					buf[i] = buf[i]%10;
				}
			}
			if(buf[80] != 0) cout<<of<<endl;
			else{
				int flag = 79;
				while(buf[flag] == 0 && flag != 0){ flag--; }

				for(int i=flag; i>=0; i--){
					cout<<buf[i];
				}
				cout<<endl;
			}

		}
	}
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){

    int n;
    cin>>n;
    rep(i,n){
        string a,b;
        cin>>a>>b;
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        if(b.size()>a.size()){
            swap(a,b);
        }
        int keta=b.size();
        int ans[100];
        rep(i,n)ans[i]=0;
        int kuri=0;
        for(int i=0;i<b.size();i++){
           // char o=a[i];char oo=b[i];
           // int aa=atoi(&o);int bb=atoi(&oo);
            int aa=a[i]-'0';int bb=b[i]-'0';
            ans[i]=(aa+bb+kuri)%10;
           // cout<<a[i]<<b[i]<<endl;
            cout<<aa<<bb<<endl;
            kuri=(aa+bb+kuri)/10;
        }
        for(int i=b.size();i<=100&&i<a.size();i++){
            keta++;
            //char oo=a[i];
            int aa=a[i]-'0';
            ans[i]=kuri+aa;
            kuri=0;
        }
        if(keta>=80){
            cout<<"overflow"<<endl;
        }else{
            for(int i=keta-1;i>=0;i--){
                cout<<ans[i];
            }
            cout<<endl;
        }
    }
    
    return 0;
}