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<algorithm>
#include<string>
using namespace std;
string a,b;
long long int s,cop,copp,last,n;
long long int latte[1000],cafe[1000],all[1000],ans[1000];
int main(){
    int cou=0;
    cin>>n;
    for(int l=0;l<n;l++){
        cou=0;
        fill(latte,latte+1000,0);
        fill(cafe,cafe+1000,0);
        fill(all,all+1000,0);
        fill(ans,ans+1000,0);
        cin>>a>>b;
        if(a.size()>b.size()){
            s=a.size();
            cop=a.size(),copp=b.size(),last=s;
        }
        else {
            s=b.size();
            cop=a.size(),copp=b.size(),last=s;
        }
        if(s>80){
            cout<<"overflow"<<endl;
            continue;
        }
        for(int i=0;i<a.size();i++){
            cop--;
            if(a[i]=='0')latte[cop]=0;
            if(a[i]=='1')latte[cop]=1;
            if(a[i]=='2')latte[cop]=2;
            if(a[i]=='3')latte[cop]=3;
            if(a[i]=='4')latte[cop]=4;
            if(a[i]=='5')latte[cop]=5;
            if(a[i]=='6')latte[cop]=6;
            if(a[i]=='7')latte[cop]=7;
            if(a[i]=='8')latte[cop]=8;
            if(a[i]=='9')latte[cop]=9;
            }
        for(int i=0;i<b.size();i++){
            copp--;
            if(b[i]=='0')cafe[copp]=0;
            if(b[i]=='1')cafe[copp]=1;
            if(b[i]=='2')cafe[copp]=2;
            if(b[i]=='3')cafe[copp]=3;
            if(b[i]=='4')cafe[copp]=4;
            if(b[i]=='5')cafe[copp]=5;
            if(b[i]=='6')cafe[copp]=6;
            if(b[i]=='7')cafe[copp]=7;
            if(b[i]=='8')cafe[copp]=8;
            if(b[i]=='9')cafe[copp]=9;
            }
         for(int i=0;i<=s;i++){
            all[i]+=latte[i]+cafe[i];
            if(all[i]>9){
                all[i]-=10;
                all[i+1]+=1;
            }
         }
         /*for(int i=s-1;i>-1;i--){
            if(all[last]!=0)cout<<all[last];
            cout<<all[i];
            all[last]=0;
         }*/
         for(int i=s-1;i>-1;i--){
            if(all[last]!=0){
                ans[last]=all[last];
                cou++;
                all[last]=0;
            }
            ans[i]=all[i];
            cou++;
         }
         if(cou>80)cout<<"overflow";
         else for(int i=s-1;i>-1;i--){
            if(ans[last]!=0)cout<<ans[last];
            cout<<ans[i];
            ans[last]=0;
         }
         cout<<endl;
    }
}
//99999999999999999999999999999999999999999999999999999999999999999999999999999999

C++: import java.util.Scanner;
import java.math.BigInteger;

public class Main{
    public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int N = scanner.nextInt();
	for (int i = 0; i < N; i++) {
	    String a = scanner.nextString(), b = scanner.nextString();
	    BigInteger sum = BigInteger(a) + BigInteger(b);
	    String n_80 = "1";
	    for (int j = 0; j < 79; j++) {
		n_80 += "0";
	    }
	    if (sum >= BigInteger(n_80)) {
		System.out.println("overflow");
	    }
	    else {
		System.out.println(sum.toString());
	    }
	}
    }
}

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

void add(char *buf1, char *buf2){
	int big1[100] = {}, big2[100] = {};
	
	int len1 = strlen(buf1);
	if(len1 > 80){
		printf("overflow\n");
		return;
	}
	int len2 = strlen(buf2);
	if(len2 > 80){
		printf("overflow\n");
		return;
	}
		
	for(int i = 0; i < len1; i++){
		big1[len1 - i - 1] = buf1[i] - 48;
	}
	for(int i = 0; i < len2; i++){
		big2[len2 - i - 1] = buf2[i] - 48;
	}
	
	int len = (len1 > len2) ? len1 : len2;
	for(int i = 0; i < len; i++){
		big1[i] += big2[i];
		if(big1[i] >= 10){
			big1[i + 1]++;
			big1[i] -= 10;
		}
	}
	
	int j = len + 1;
	for(; j >= 0; j--){
		if(big1[j] > 0){
			break;
		}
	}
	if(j >= 80){
		printf("overflow\n");
		return;
	}
	for(; j >= 0; j--){
		printf("%d", big1[j]);
	}
	printf("\n");
}

int main(){
	int n;
	char buf1[100], buf2[100];
	
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%s", buf1);
		scanf("%s", buf2);
		add(buf1, buf2);
	}
	
	return 0;
}