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>

#define MAX_SIZE 80

int strlen(const char* str) {
    int i;
    for(i=0; i<999+1; ++i) {
        if(!str[i]) {
            return i;
        }
    }
    return -1;
}

int main() {
    int n, i, j, num1_index, num2_index;
    char num1[999], num2[999];

    scanf("%d", &n);
    for(i=0; i<n; ++i) {
        scanf("%s %s", num1, num2);
        num1_index = strlen(num1);
        num2_index = strlen(num2);
        int sum=0, act=0, temp=0;
        char result[999] = {};
        for(j=0; j<MAX_SIZE && (num1_index > 0 || num2_index > 0); ++j) {
            if(num1_index <= 0) {
                temp = act + num2[--num2_index] - 48;
            }else if(num2_index <= 0) {
                temp = act + num1[--num1_index] - 48;
            }else {
                temp = act + num1[--num1_index] + num2[--num2_index] - 96;
            }
            result[j] = temp % 10;
            act = temp / 10;
        }
        if(j<MAX_SIZE) {
            result[j++] = act;
            act = 0;
        }
        if(j>=MAX_SIZE && (num1_index || num2_index || act)) {
            printf("overflow\n");
        }else {
            int zeros = 1;
            for(j=MAX_SIZE-1; j>=0; --j) {
                if(zeros && !result[j]) {
                    continue;
                }
                zeros = 0;
                printf("%d", result[j]);
            }
            if(zeros) {
                printf("0");
            }
            printf("\n");
        }

    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d); BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

string sum(string a, string b){
    reverse(ALL(a));
    reverse(ALL(b));

    string ans = "";
    if(a.size() > 80 || b.size() > 80) return "overflow";
    int t = 0;
    REP(k, max(a.size(), b.size())){
        int i = k < a.size() ? a[k] - '0' : 0;
        int j = k < b.size() ? b[k] - '0' : 0;
        int sum = i + j + t;
        ans += (char)(sum%10 + '0');
        t = sum / 10;
    }
    if(t) ans += (char)(t + '0');
    if(ans.size() > 80) return "overflow";
    reverse(ALL(ans));
    return ans;
}

signed main(){ INIT;
    VAR(int, n);
    REP(i, n){
        VAR(string, a, b);
        OUTL(sum(a, b));
    }
RET;}