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

int n;
char a[256], b[256], c[256];	
int sz = 0;
int carry = 0;

int main()
{
        std::cin >> n;
	
	while( n-- ){
		memset( a, '0', 80 );
		memset( b, '0', 80 );
		std::cin >> a >> b;
		
		int maxlen = std::max( strlen( a ), strlen( b ) );
		
		if( maxlen > 80 ){
		 	goto OVERFLOW;
		}
		
		std::reverse( a, a + strlen( a ) );
		std::reverse( b, b + strlen( b ) );
		
		a[strlen( a )] = '0';
		b[strlen( b )] = '0';
		
		for( int i = 0; i <= maxlen + 1; i++ ){
			int na = a[i] - '0' + carry;
			int nb = b[i] - '0';
			
			if( na + nb >= 10 ){
				na += nb - 10;
				carry = 1;
			}
			else{
				na += nb;
				carry = 0;
			}
			
			c[i] = na + '0';
		}
		
		sz = maxlen;
		
		if( c[sz] >= '1' && c[sz] <= '9' ){
		 	sz++;
		}
		
		if( sz >= 80 ){
	OVERFLOW:
		 	std::cout << "overflow" << std::endl;
		}
		else{
			std::reverse( c, c + sz );
			c[sz] = '\0';
			std::cout << c << std::endl;
		}
		sz = 0;
		carry = 0;
	}

 	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int T;
	cin >> T;
	while(T--){
		//char s[100] = "abc";
		string a,b;
		
		cin >> a >> b;
		if(a==b){
			if(a=="0"){
			cout<<"0"<<endl;
				continue;
			}
		}
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		while( a.size() < 100 ) a += "0";
		while( b.size() < 100 ) b += "0";
		string ans = "";
		int carry = 0;
		for(int i = 0 ; i < 100 ; i++){
			int d = (a[i]-'0') + (b[i]-'0') + carry;
			ans += d % 10 + '0';
			carry = d / 10;
		}
		reverse(ans.begin(),ans.end());
		if(ans.find_first_not_of('0')<20){
			cout << "overflow" << endl;
			continue;
		}
		ans = ans.substr(ans.find_first_not_of('0') );
		
		cout << ans << endl;
	}
	
	return 0;
}

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

int main(void){
  int N;
  scanf("%d", &N);

  int i,j,k;
  for(i=0; i<N; ++i){
    int digits[3][81];
    for(j=0; j<3; ++j){
      for(k=0; k<81; ++k){
        digits[j][k] = 0;
      }
    }

    int overflow = 0;
    for(j=0; j<2; ++j){
      char digit[80];
      scanf("%s", digit);
      if(strlen(digit)>80){
        overflow = 1;
        break;
      }
      for(k=0; k<strlen(digit); ++k){
        digits[j][k] = digit[strlen(digit)-1-k]-'0';
      }
    }
    if(overflow){
      printf("overflow\n");
    }else{
      for(j=0; j<80; ++j){
        digits[2][j] += (digits[0][j]+digits[1][j]);
        digits[2][j+1] += digits[2][j]/10;
        digits[2][j] %= 10;
      }

      int flag = 0;
      if(digits[2][80]>0){
        printf("overflow\n");
      }else{
        for(j=80; j>=0; --j){
          if(flag || digits[2][j]!=0){
            flag = 1;
            printf("%d", digits[2][j]);
          }
        }
        printf("\n");
      }
    }
  }
  
  return 0;
}

C++: #include<iostream>

using namespace std;

#define DATA_MAX 100

int get_length( char str[] );
void initialize_str( char str[] , int size_of_str );
int myatoi( char s );
char myitoa( int s );


int main(void)
{
	char a[DATA_MAX];
	char b[DATA_MAX];
	char ans[DATA_MAX];

	int n;

	cin >> n;

	int size_of_str_a = sizeof(a)/sizeof(a[0]);
	int size_of_str_b = sizeof(b)/sizeof(b[0]);
	int size_of_str_ans = sizeof(ans)/sizeof(ans[0]);

	for( int i = 0 ; i < n ; i++ )
	{
		initialize_str(a , size_of_str_a);
		initialize_str(b , size_of_str_b);
		initialize_str(ans , size_of_str_ans);

		cin >> a >> b;
		int length_a = get_length( a );
		int length_b = get_length( b );
		if( length_a >= 81 || length_b >= 81 ){
			cout << "overflow" << endl;
			break;
		}
		if( length_a > length_b ){
			while(1){
				for( int j = length_a ; j > 0 ; j-- )
				{
					b[j] = b[j-1];
				}
				b[0] = '0';
				if( b[length_a] == '\0' ) break;
			}
		}
		if( length_b > length_a ){
			while(1){
				for( int j = length_b ; j > 0 ; j-- )
				{
					a[j] = a[j-1];
				}
				a[0] = '0';
				if( a[length_b] == '\0' ) break;
			}
		}
		int length_ans = ( length_a > length_b ? length_a : length_b ) + 1;

		ans[length_ans] = '\0';
		int c[2] = {0};

		for( int j = length_ans-1 ; j >= 1 ; j-- )
		{
			int add = myatoi(a[j-1]) + myatoi(b[j-1]) + c[1];
			c[0] = add%10;
			ans[j] = myitoa(c[0]);
			c[1] = add/10;
		}
		ans[0] = myitoa(c[1]);
		
		if( ans[0] == '0' ){
			for( int i = 0 ; i <= length_ans - 1 ; i++ )
			{
				ans[i] = ans[i+1];
			}
		}
		if( get_length(ans) >= 81 ){
			cout << "overflow" << endl;
			break;
		}
		
		cout << ans << endl;
	}
}

int get_length( char str[] )
{
	int i;

	for( i = 0 ; str[i] != '\0' ; i++ )
	{
		;
	}

	return i;
}

void initialize_str( char str[] , int size_of_str )
{
	for( int i = 0 ; i < size_of_str ; i++ )
	{
		str[i] = '0';
	}

	return;
}

int myatoi( char s )
{
	return s-48;
}
char myitoa( int s )
{
	return s+48;
}