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<string>
#include<algorithm>
#define SIZE 80
int main()
{
	int N, n, s;
	std::string d1, d2, sum;

	std::cin >> N;
	std::getline(std::cin, d1);
	for (n = 0; n < N; n ++) {
		std::getline(std::cin, d1);
		std::getline(std::cin, d2);
		if (d1.size() > SIZE || d2.size() > SIZE) {
			std::cout << "overflow" << std::endl;
		} else {
			std::reverse(d1.begin(), d1.end());
			std::reverse(d2.begin(), d2.end());
			s = 0;
			sum.clear();
			for (size_t i = 0; i < d1.size() || i < d2.size(); i ++) {
				s += (i < d1.size()) ? (d1[i] - '0') : 0;
				s += (i < d2.size()) ? (d2[i] - '0') : 0;
				sum += '0' + (s%10);
				s /= 10;
			}
			if (s)
				sum += '0' + s;
			if (sum.size() > SIZE) {
				std::cout << "overflow" << std::endl;
			} else {
				std::reverse(sum.begin(), sum.end());
				std::cout << sum << std::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,l;
    bool check;

    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; l = 0;
        cin >> c1 >> c2;
        for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k] = c1[j] - '0';
                k++;
            }
            if(j <= strlen(c2) - 1){
                i2[l] = c2[j] - '0';
                l++;
            }
        }
        rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[80] != 0){
            cout << "overflow";
        }else{
           /* for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }*/
        }
        cout << endl;
    }
}

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

using namespace std;

int main(void){
    int n;
    string a,b,ans;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        ans="";
        cin>>a>>b;
        if(a.size()>80||b.size()>80){
            cout<<"overflow"<<endl;
            continue;
        }
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        int size=(a.size()>b.size())?a.size():b.size();
        bool af=false,bf=false,uf=false;
        for(int j=0;j<size;j++){
            int pr=0;
            if(a.size()<j+1)af=true;
            if(b.size()<j+1)bf=true;
            if(!af){
                pr+=a[j];
                pr-=48;
            }
            if(!bf){
                pr+=b[j];
                pr-=48;
            }
            if(uf)pr++;
            if(pr>9){
                pr-=10;
                uf=true;
            }else uf=false;
            pr+=48;
            ans=(char)pr+ans;
        }
        if(uf)ans='1'+ans;
        if(ans.size()>80)cout<<"overflow"<<endl;
        else cout<<ans<<endl;
    }
}