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

int main(void)
{
int N,j,k=0;
cin >> N;
char strA[300],strB[300];
while(1){
k++;
if(k==N+1){
break;
}
cin >> strA >> strB;
int ans[81]={0};
ans[0]=11111;
if(strlen(strA)>80||strlen(strB)>80){
cout << "overflow" << endl;
continue;
}
int a[81]={0},b[81]={0};
if(strA[strlen(strA)-1]=='0'&&strB[strlen(strB)-1]=='0'){
    cout << 0 << endl;
    continue;
}
j=strlen(strA)-1;
for(int i=80 ; j>=0 ; i--){
a[i]=(int)strA[j]-48;
j--;
}
j=strlen(strB)-1;
for(int i=80 ; j>=0 ; i--){
b[i]=(int)strB[j]-48;
j--;
}
for(int i=80 ; i!=0 ; i--){
ans[i]=ans[i]+a[i]+b[i];
if(ans[i]>=10){
ans[i]=ans[i]-10;
ans[i-1]++;
}
}
if(ans[0]!=11111){
cout << "overflow" << endl;
continue;
}
for(int i=1 ; i<81 ; i++){
if(ans[i]!=0){
j=i;
break;
}
}
char c[3];
for(int i=j ; i<81 ; i++){
printf("%c",ans[i]+48);
}
cout << '\n';
}
return 0;
}

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

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool overflowFLG;
	int n,length1,length2,kuriagari,tmp,output[101];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=81 || length2 >= 81)printf("overflow\n");
		else{
			overflowFLG=false;
			kuriagari=0;
			if(length1>length2){
				for(int k=0;length1-1-k>=0;k++){
					tmp = kuriagari;
					if(length2-1-k>=0){
						tmp += (buf1[length1-1-k]-'0')+(buf2[length2-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;
						}else{
							kuriagari = 0;
						}
						output[length1-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length1-1-k] = buf1[length1-1-k]-'0';
						}else{
							output[length1-1-k] = buf1[length1-1-k]-'0' + kuriagari;
							if(output[length1-1-k]>=10){
								output[length1-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length1-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}else{
				for(int k=0;length2-1-k>=0;k++){
					tmp = kuriagari;
					if(length1-1-k>=0){
						tmp += (buf2[length2-1-k]-'0')+(buf1[length1-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;

						}else{
							kuriagari = 0;
						}
						output[length2-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length2-1-k] = buf2[length2-1-k]-'0';
						}else{
							output[length2-1-k] = buf2[length2-1-k]-'0' + kuriagari;
							if(output[length2-1-k]>=10){
								output[length2-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length2-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}
		}
	}

    return 0;
}

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

int main () {
    int n;
    string a, b;
    
    cin >> n;
    for(int i=0;i<n;i++){
        int x[81]={0}, y[81]={0}, z[81]={0};
        
        cin >> a;
        cin >> b;
        
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        
        for(int j=0;j<a.size();j++){
            x[j]=a[j]-'0';
        }
        for(int j=0;j<b.size();j++){
            y[j]=b[j]-'0';
        }
        int c=0;
        int r;
        for(int j=0;j<80;j++){
            r=x[j]+y[j]+c;
            if (r >= 10){
                z[j]=r%10;
                c=1;
            }else{
                z[j]=r;
                c=0;
            }
        }
        
//        if(z[80]==1){
//            cout << "overflow" <<endl;
//        }else{
            bool flag = 0;
            for(int j=79;j>=0;j--){
                if(z[j]==0 && flag==0){
                    continue;
                }else{
                    flag=1;
                }
                cout<<z[j];
            }
            if(flag==0){
                cout<<0;
            }
            cout<<endl;
            
//        }
    }
    return 0;
}