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 <stdlib.h>
#include <string>
#include <iostream>
#include <math.h>
#include <stack>

using namespace std;

int main(){
    
    char d[81];
    char e[81];

    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);

    for(int i=0; i<n; i++){
        scanf("%s",d);
        scanf("%s",e);
        
        if(strlen(d)>80||strlen(e)>80){
            printf("overflow");
        }else{
            for(int j=0; j<(strlen(d)); j++){
                st1.push(d[j]);
            }
            for(int j=0; j<(strlen(e)); j++){
                st2.push(e[j]);
            }
            int temp=0;
            char temp_char;
            while(st1.empty()==false||st2.empty()==false){
                if(st1.empty()==false&&st2.empty()==false){
                    temp_char=st1.top();
                    temp+=atoi(&temp_char);
                    temp_char=st2.top();
                    temp+=atoi(&temp_char);
                    st1.pop();
                    st2.pop();
                }else if(st1.empty()==false&&st2.empty()==true){
                    temp_char=st1.top();
                    temp+=atoi(&temp_char);
                    st1.pop();
                }else if(st1.empty()==true&&st2.empty()==false){
                    temp_char=st2.top();
                    temp+=atoi(&temp_char);
                    st2.pop();
                }
                st3.push(temp%10);
                temp=temp/10;
            }
            
            if(temp!=0){
                st3.push(temp);
            }
            
            if(st3.size()>80){
                printf("overflow");
            }else{
                while(st3.empty()==false){
                    printf("%d",st3.top());
                    st3.pop();
                }
            }
            printf("\n");
        }
    }
    
}

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

using namespace std;

vector<int> string_to_large_int(const string& str){
	vector<int> v;
	for(auto it = str.rbegin(); it != str.rend(); ++it){
		v.push_back(*it - '0');
	}
	return v;
}

string large_int_to_string(const vector<int>& v){
	string str;
	for(auto it = v.rbegin(); it != v.rend(); ++it){
		str += (char)*it + '0';
	}
	return str;
}

vector<int> add_large_int(const vector<int>& a, const vector<int>& b){
	vector<int> c;
	int carry = 0;
	for(int i = 0; i < max(a.size(), b.size()); ++i){
		int x = i < a.size() ? a[i] : 0;
		int y = i < b.size() ? b[i] : 0;
		int z = x + y + carry;
		c.push_back(z % 10);
		carry = z / 10;
	}
	if(carry != 0){
		c.push_back(carry);
	}
	return c;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i){
		string str;
		cin >> str;
		auto a = string_to_large_int(str);
		cin >> str;
		auto b = string_to_large_int(str);

		auto c = add_large_int(a, b);

		if(c.size() <= 80){
			cout << large_int_to_string(c) << endl;
		}
		else{
			cout << "overflow" << endl;
		}
	}
	return 0;
}

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,g;
    int k;
    bool check;

    while(cin >> n){
        rep(i,n){
            char c1[81], c2[81];
            int i1[81] = {0}, i2[81] = {0};
            int ans[82] = {0};
            check = false;
            k = 0;
            cin >> c1 >> c2;
            for(int j = strlen(c1) - 1; 0 <= j; j--, k++){
                i1[k] = c1[j] - '0';
            }
            k = 0;
            for(int j = strlen(c2) - 1; 0 <= j; j--, k++){
                i2[k] = c2[j] - '0';
            }
            rep(j, 81){
                ans[j] = i1[j] + i2[j];
            }
            rep(j, 81){
                if(ans[j] >= 10){
                    ans[j]-=10;
                    ans[j+1]++;
                }
            }
            for(int j = 81; 0 <= j; j--){
                if(ans[81] != 0){
                    cout << "overflow";
                    break;
                }
                if(ans[j] != 0)
                    check = true;
                if(check == true)
                    cout << ans[j];
            }cout << endl;
        }
    }
}