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++: #define scanf_s scanf
#define sscanf_s sscanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
//#define CONSTNUM 10000000
int main(void)
{
	int n, s = 0, x, y, r = 0, a, b;
	char sum[50][_MAX], astr[_MAX], bstr[_MAX], num[11] = { "0123456789" };
	char ca, cb;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%s %s", &astr,_MAX, &bstr, _MAX);
		for (x = 0; astr[x] != '\0'; ++x);
		for (y = 0; bstr[y] != '\0'; ++y);
		if (x > 80 || y > 80) {
			printf("overflow\n");
			continue;
		}
		for (int j = 0; j < x || j < y; ++j) {
			if (j < x && j < y) {
				ca = astr[x - j - 1]; cb = bstr[y - j - 1];
				sscanf_s(&ca, "%d", &a);
				sscanf_s(&cb, "%d", &b);
				if (x > y) sum[i][x - j] = num[(a + b + r) % 10];
				else sum[i][y - j] = num[(a + b + r) % 10];
				if (a + b + r >= 10) r = (a + b + r) / 10;
				else r = 0;
			}
			else {
				if (x > y) {
					if (r != 0) {
						ca = astr[x - j - 1];
						sscanf_s(&ca, "%d", &a);
						sum[i][x - j] = num[(a + r) % 10];
						if (a + r >= 10) r = (a + r) / 10;
						else r = 0;
					}
					else {
						sum[i][x - j] = astr[x - j - 1];
					}
				}
				else {
					if (r != 0) {
						cb = bstr[y - j - 1];
						sscanf_s(&cb, "%d", &b);
						sum[i][y - j] = num[(b + r) % 10];
						if (b + r >= 10) r = (b + r) / 10;
						else r = 0;
					}
					else {
						sum[i][y - j] = astr[y - j - 1];
					}
				}
			}
		}
		if (y <= 80 - r && x <= 80 - r) {
			if (r == 1) 	printf("%d", r);
			for (int j = 1; j <= x || j <= y; ++j) {
				printf("%c", sum[i][j]);
			}
		}
		else {
			printf("overflow");
		}
		printf("\n");
		r = 0;
	}
}

C++: #include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

bool testcase_ends() {
    char buf[128];
    if (scanf("%s", buf) == EOF)
        return 1;

    string s(buf);
    scanf("%s", buf);
    string t(buf);

    if (s.length() > 80 || t.length() > 80)
        return !printf("overflow\n");

    reverse(s.begin(), s.end());
    reverse(t.begin(), t.end());

    if (s.length() > t.length()) {
        t += string(s.length()-t.length(), '0');
    } else if (s.length() < t.length()) {
        s += string(t.length()-s.length(), '0');
    }

    string u;
    int carry=0;
    for (size_t i=0; i<s.length(); ++i) {
        u.push_back(s[i]+t[i]+carry-'0');
        if (u.back() > '9') {
            carry = 1;
            u.back() -= 10;
        } else {
            carry = 0;
        }
    }
    if (carry)
        u.push_back('1');

    if (u.length() > 80)
        return !printf("overflow\n");

    reverse(u.begin(), u.end());
    printf("%s\n", u.c_str());
    return 0;
}

int main() {
    size_t n;
    scanf("%zu", &n);

    for (size_t i=0; i<n; ++i)
        if (testcase_ends())
            return 1;

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std ;

int f( char x ){
	switch (x){
		case '0' : return 0 ;
		case '1' : return 1 ;
		case '2' : return 2 ;
		case '3' : return 3 ;
		case '4' : return 4 ;
		case '5' : return 5 ;
		case '6' : return 6 ;
		case '7' : return 7 ;
		case '8' : return 8 ;
		case '9' : return 9 ;
	}
}

int main(){
	
	int n ;
	for( cin >> n ; n-- ; ){
		string a,b ;
		cin >> a >> b ;
		if( a.size() > b.size() ) swap(a,b) ;
		reverse( a.begin() , a.end() ) ;
		reverse( b.begin() , b.end() ) ;
		while( a.size() < b.size() ) a+='0' ;
		
		vector<int> c ;
		c.push_back(0) ;
		for( int i=0 ; i<a.size() ; i++ ){
			c[i] += f(a[i]) + f(b[i]) ;
			c.push_back( c[i]/10 ) ;
			c[i] %= 10 ;
		}
		if( c[c.size()-1] == 0 ) c.pop_back() ;
		//for( int i=c.size()-1 ; c[i]!=0 ; i-- ) c.pop_back() ;
		reverse( c.begin() , c.end() ) ;
		
		if( c.size() >= 81 ) cout << "overflow" << endl ;
		else {
			for( int i=0 ; i<c.size() ; i++ ) cout << c[i] ;
			cout << endl ;
		}
	}
	
return 0 ;
}