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<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n;
    cin >> n;
    rep(i,n){
        char input1[81], input2[81];
        cin >> input1 >> input2;
        //後ろから和を求める
        int ans[81] = {0};
        int size1 = strlen(input1) - 1;
        int size2 = strlen(input2) - 1;
        int i = 0;
        while(1){
            if(size1 - i >= 0 && size2 - i >= 0)
                ans[i] += input1[size1 - i] - '0' + input2[size2 - i] - '0';
            else if(size1 - i >= 0)
                ans[i] += input1[size1 - i] - '0';
            else if(size2 - i >= 0)
                ans[i] += input2[size2 - i] - '0';
            //桁数を繰り上げる
            if(ans[i] >= 10){
                ans[i] -= 10;
                ans[i + 1]++;
            }
            if(size1 - i < 0 && size2 - i < 0)
                break;
            i++;
        }
        //出力
        if(ans[80] == 1)
            cout << "overflow" << endl;
        else{
            for(int j = i; j >= 0; j--){
                if(ans[i] == 0 && j == i)
                    continue;
                cout << ans[j];
            }
        }
        cout << endl;
    }
}

C++: #include <iostream>
#include <string>

#define DIGIT  ( 80 )

using namespace std;

static
int N;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  cin >> N;

  while ( N-- )
  {
    string        A, B;
    int           C[ DIGIT + 1 ] = { 0 };
    const char  * p;

    cin >> A >> B;

    p = A.c_str ( );
    for ( size_t i = 0; i < A.length ( ); ++i )
    {
      C[ i ] = p[ A.length ( ) - i - 1 ] - '0';
    }

    p = B.c_str ( );
    for ( size_t i = 0; i < B.length ( ); ++i )
    {
      C[ i ]     += p[ B.length ( ) - i - 1 ] - '0';
    }

    for ( size_t i = 0; i < DIGIT; ++i )
    {
      C[ i + 1 ] += C[ i ] / 10;
      C[ i ]     %= 10;
    }

    if ( C[ DIGIT ] )
    {
      cout << "overflow";
    }
    else
    {
      int i = DIGIT;
      while ( !C[ i ] )
        --i;
      while ( i >= 0 )
      {
        cout << C[ i-- ];
      }
    }
    cout << endl;
  }

  return ( 0 );
}