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<stdio.h>
#include<string.h>

int n;
char a[1000];
int temp[1000], temp2[1000], temp3[1000];

int main()
{
        std::cin >> n;
	
	while( n-- ){
		memset( temp, -1, sizeof( temp ) );
		memset( temp2, -1, sizeof( temp2 ) );
		memset( temp3, 0, sizeof( temp3 ) );
		
		std::cin >> a;
		
		for( int i = 0; i < strlen( a ); i++ ){
			temp[strlen( a ) - i - 1] = a[i] - '0';
		}
		
		std::cin >> a;
		
		for( int i = 0; i < strlen( a ); i++ ){
			temp2[strlen( a ) - i - 1] = a[i] - '0';
		}
		
		int p = 0, f = 0;
		while( 1 ){
		 	if( temp[p] != -1 && temp2[p] != -1 ){
			 	temp3[p] = ( temp[p] + temp2[p] + f ) % 10;
				f = ( temp[p] + temp2[p] + f ) / 10;
			}
			else if( temp[p] != -1 ){
				temp3[p] = ( temp[p] + f ) % 10;
				f = ( temp[p] + f ) / 10;
			}
			else if( temp2[p] != -1 ){
				temp3[p] = ( temp2[p] + f ) % 10;
				f = ( temp2[p] + f ) / 10;
			}
			else break;
			
			p++;
		}
		
		if( p + f > 80 ){
			std::cout << "overflow" << std::endl;
			continue;
		}
		
		if( f )std::cout << -temp[p];
		
		for( int i = p - 1; i >= 0; i-- ){
		 	std::cout << temp3[i];
		}
		std::cout << std::endl;
	}

 	return 0;
}

C++: #include <stdio.h>
#define MAX 80

int scanLI(int *n);
int addLI(int *a, int *b);
void printLI(int *n);

int main(void){
    int a[MAX],b[MAX];
    char buf[128];
    int n;
    bool of;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        for (int j=0; j<MAX; j++){
            a[j] = b[j] = 0;
        }
        of = false;
        if (scanLI(a) == -1) of = true;
        if (scanLI(b) == -1) of = true;
        if (addLI(a, b) == -1) of = true;
        if (!of){
            printLI(a);
            printf("\n");
        } else {
            printf("overflow\n");
        }
    }
    
    return 0;
}

int scanLI(int *n){
    char buf[128];
    int len;
    
    scanf("%s", buf);
    for (len=0; buf[len]!='\0'; len++);
    if (len>MAX){
        return -1;
    }
    for (int i=0; i<len; i++){
        n[i] = buf[len-i-1]-'0';
    }
    return 0;
}

int addLI(int *a, int *b){
    int c=0;
    
    for (int i=0; i<MAX; i++){
        a[i] += b[i]+c;
        c = a[i]/10;
        a[i] %= 10;
    }
    return c ? -1 : 0;
}

void printLI(int *n){
    bool zero=true;
    
    for (int i=MAX-1; i>=0; i--){
        if (n[i]==0){
            if (!zero) printf("0");
        } else{
            zero = false;
            printf("%d", n[i]);
        }
    }
}