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<cstdio>
#include<algorithm>
#include<cstring>

#define A strlen(a)
#define B strlen(b)
#define ANS strlen(ans)

using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    char x=0;
    for(int q = 0;q < n; q++){
        int f = 0;
        bool check[1000]={0};
        char a[1000]={0},b[1000]={0},ans[1000]={0};
        scanf("%s%s",a,b);
        reverse(a,a+A);
        reverse(b,b+B);

        int len1 = max(A,B);
        int len2 = min(A,B);

        (len1 == A) ? f=1 : f=2;

        if(len2 > 80 || len1 > 80){
            printf("overflow\n");
            continue;
        }

        for(int i = 0;i < len1; i++){
            if(a[i] == '0' && b[i] != '0'&&b[i] != 0){
                b[i] -= 48;
                ans[i] = b[i];
                //printf("o_o\n");
                continue;
            }
            if(a[i] != '0' && b[i] == '0'&&a[i] != 0){
                a[i] -= 48;
                ans[i] = a[i];
                continue;
            }
            if(a[i] == '0' && b[i] == '0'){
                ans[i] = '0';
                check[i] = 1;
                continue;
            }
            //printf("uu%d %d\n",A,B);
            if(i >= len2){
                //printf("('ω')v\n");
                //printf("f = %d\n",f);
                if(f == 1)ans[i] = a[i];
                if(f == 2)ans[i] = b[i];
                check[i] = 1;
                //printf("yoyo\n");
                continue;
            }
            a[i] -= 48;
            b[i] -= 48;
            x = a[i] + b[i];
            ans[i]= x;
        }
        for(int i = 0;i < ANS; i++){
            if(check[i] == 1){
                if(ans[i] >= 58){
                    if(ans[i] == 58){
                        ans[i] = '0';
                        ans[i+1]++;
                        continue;
                    }
                    else {
                        ans[i] -= 10;
                        ans[i+1]++;
                    }
                }
                //printf("yo-\n");
                continue;
            }
            else if(ans[i] >= 10){
                //printf("yo-yo-\n");
                if(ans[i] == 10){
                    ans[i] = '0';
                    ans[i+1]++;
                    continue;
                }
                else {
                    ans[i] = ans[i] - 10;
                    ans[i+1]++;
                }
            }
            ans[i] += 48;
        }

        reverse(ans,ans+ANS);

        (ANS > 80) ? printf("overflow\n") : printf("%s\n",ans);
    }
    return 0;
}

C++: #include <stdio.h>

void rev_str(char str[128]) {
	int length = 0;
	char str2[128];
	int temp;

	int i;

	for(i = 0; i < 128; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[128];
	char input_b[128];
	char ans[128];
	char kuriagari = 0;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 128; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[i] = '\0';
		}

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}
		
		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[i] = kuriagari + '0';
		}
		
		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[i] = input_a[i];
			i++;
		}

		rev_str(ans);

		if(ans[81])
			printf("overflow");
		else
			printf("%s", ans);

		putchar('\n');
	}
	return 0;
}