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 <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()

int main(){
	string in1,in2;
	int t; scanf("%d",&t);
	while(t--){
		char str[100];
		cin>>in1>>in2;
		reverse(all(in1)); reverse(all(in2));
		int k = 0;
		int i;
		for(i=0; i<min(in1.size(),in2.size()); i++){
			k = (in1[i]-'0')+(in2[i]-'0') + k;
			str[i] = (k%10)+'0';
			k /= 10;
		}
		if( i==in1.size() ){ //in2
			for(; i<in2.size(); i++){
				k = (in2[i]-'0')+k;
				str[i] = (k%10)+'0';
				k /= 10;
			}
		}else{ //in1
			for(; i<in1.size(); i++){
				k = (in1[i]-'0')+k;
				str[i] = (k%10)+'0';
				k /= 10;
			}
		}
		if( k!=0 )str[i++] = k+'0';
		str[i] = 0;
		reverse(str,str+i);
		puts(str);
	}
	
	return 0;
}

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

int main(){

	int n;
	std::cin >> n;

	for (int i = 0; i < n; i++){
		std::string str, str2, res;
		std::cin >> str >> str2;

		std::reverse(str.begin(), str.end());
		std::reverse(str2.begin(), str2.end());

		bool up = 0;
		for (int i = 0; up || i < std::max(str.size(), str2.size()); i++){

			int a = 0, b = 0;

			if (str.size() > i)a = str[i] - '0';
			if (str2.size() > i)b = str2[i] - '0';

			if (up + a + b >= 10){
				res += (up + a + b - 10 + '0');
				up = 1;
			}
			else{
				res += (up + a + b + '0');
				up = 0;
			}
		}

		std::reverse(res.begin(), res.end());

		if (res.size() >= 80)std::cout << "overflow" << std::endl;
		else std::cout << res << std::endl;
	}

	return 0;
}

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

int main(void){
    char buf[N*2];
    int datas;
    int degits;
    int lint1[N+1], lint2[N+1], sum[N+1];
    int cry;
    
    scanf("%d", &datas);
    for (int n=0; n<datas; n++){
        // reset
        for (int i=0; i<N; i++) lint1[i]=lint2[i]=0;
        // input
        scanf("%s", buf);
        degits = strlen(buf);
        if (degits > 80){
            scanf("%s", buf); // read another num.
            puts("overflow");
            continue;
        }
        for (int i=0; i<degits; i++){
            lint1[degits-i-1]= buf[i]-'0';
        }
        scanf("%s", buf);
        degits = strlen(buf);
        if (degits > 80){
            puts("overflow");
            continue;
        }
        for (int i=0; i<degits; i++){
            lint2[degits-i-1]= buf[i]-'0';
        }
        // calc
        cry=0;
        for (int i=0; i<N; i++){
            sum[i] = lint1[i]+lint2[i] + cry;
            cry = sum[i]>9 ? 1:0;
            if (cry) sum[i] -= 10;
        }
        // output
        if (cry){
            puts("overflow");
        } else {
            bool zero=true;
            if (cry) puts("1");
            for (int i=N-1; i>=0; i--){
                if (zero && sum[i] != 0) zero=false;
                if (!zero) printf("%d", sum[i], i);
            }
            printf("\n");
        }
        
    }
    
    return 0;
}

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

using namespace std;

/** Problem0015 : National Budget **/
int main()
{
	string a, b, s;
	int n, tmp, la, lb;
	bool up=false;
	
	cin >> n;
	for (int i=0; i<n; i++) {
		cin >> a >> b;
		s=""; up=0;
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		la=(int)a.length();
		lb=(int)b.length();
		
		if (la < lb) {
			swap(la, lb);
			swap(a, b);
		}
		
		for (int i = 0; i<la-lb; i++) b+='0';
		
		for (int i=0; i<la; i++) {
			tmp = (a[i]-'0') + (b[i] - '0') + (up?1:0);
			if (tmp>=10) {
				s += '0'+tmp%10;
				up = true;
			} else {
				s += '0'+tmp;
				up = false;
			}
		}
		
		if (up)
			s+='1';
		reverse(s.begin(), s.end());
		if (s.length()>80)
			cout << "overflow" << endl;
		else
			cout << s << endl;
	}
	return 0;
}