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 <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		string num1, num2;
		cin >> num1 >> num2;
		char sum[101];
		int degit = 0;
		for( int i = 0; i < 101; i++ ) sum[i] = '0';
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] = num1[num1.size()-i-1];
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now = 3;
			/*
			if( i < num2.size() ){
				now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
			}else{
				now = (int)(sum[100-i]-'0') + degit;
			}
			*/
			sum[100-i] = (char)(now%10)+'0';
			if( now >= 10 ) degit = 1;
			else degit = 0;
			d = i;
		}
		int d = 3;
		if( d < 80 ){
			for( int i = 100-d; i < 101; i++ ) cout << sum[i];
			cout << endl;
		}else{
			cout << "overflow" << endl;
		}
	}
}

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);
        for (int i=0; i<degits; i++){
            lint1[degits-i-1]= buf[i]-'0';
        }
        scanf("%s", buf);
        degits = strlen(buf);
        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 <iostream>
#include <cstring>

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::cin >> i1;
		if(strlen(i1)>80){
			std::cout << "overflow" << std::endl;
		}
		std::cin >> i2;
		if(strlen(i2)>80){
			std::cout << "overflow" << std::endl;
		}
		for(int j=0;j<80;j++){
			char c='0';
			if(cflag)
				c+=1;
			cflag=false;
			if(strlen(i1)>j){
				c+=i1[strlen(i1)-j-1]-'0';
			}
			if(strlen(i2)>j){
				c+=i2[strlen(i2)-j-1]-'0';
			}
			if(c > '9'){
				cflag=true;
				c-=10;
			}
			res[79-j]=c;
		}

		if(cflag){
			std::cout << "overflow" << std::endl;
		}else{
			char *p = res;
			while(*p++ == '0');
			std::cout << (p-1) << std::endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
using namespace std;
string toString(int n) {
    ostringstream os; os << n;
    return os.str();
}
string add(string a, string b) {
    if (a.size() > 80 || b.size() > 80) {
        return "overflow";
    }
    while (a.size() > b.size()) b = "0" + b;
    while (b.size() > a.size()) a = "0" + a;

    string res = "";
    int carry = 0;
    for (int i=a.size()-1; i>=0; --i) {
        int t = (a[i] - '0') + (b[i] - '0') + carry;
        res = toString(t % 10) + res;
        carry = t / 10;
    }
    if (carry) {
        res = "1" + res;
    }

    if (res.size() > 80) {
        return "overflow";
    }
    return res;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string a, b;
    for (int i=0; i<n; ++i) {
        cin >> a >> b;
        cout << add(a, b) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		string a, b;
		cin >> a >> b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		while(a.size() < 110) a += "0";
		while(b.size() < 110) b += "0";
		int carry = 0;
		string res = "";
		for(int i = 0; i< a.size(); i++) {
			res   += ((a[i] - '0') + (b[i] - '0') + carry) % 10 + '0';
			carry  = ((a[i] - '0') + (b[i] - '0') + carry) / 10;
		}
		while(res.size() > 1 && *(res.end()-1) == '0') res.erase(res.end()-1);
		reverse(res.begin(), res.end());
		cout << res << endl;
	}
}