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>
using namespace std;

int main(void){
	string a,b;
	vector<int> ans;
	int n,num,ai,bi,c=0;
	bool flag;

	cin >> n;

	if(n>0&&n<=100){
		for(int i=0;i<n;i++){
			cin >> a >> b;
			flag=false;	

			for(int j=0;j<100;j++){
				num=0;
				ai=a.size()-j-1;
				bi=b.size()-j-1;
				if(ai<0&&bi<0&&c==0) break;
				if(ai>=0) num+=a[ai]-48;
				if(bi>=0) num+=b[bi]-48;
				ans.push_back((num+c)%10);
				if(num+c>=10) c=1;
				else c=0;
			}
			if(ans.size()>80){
				flag=true;
			}
			if(flag){
				cout << "overflow";
			}else{
				for(int j=ans.size()-1;j>=0;--j){
					cout << ans[j];
				}
			}
			cout << endl;
			ans.clear();
		}
	}
	return 0;
}

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

int add(int a[], int b[]);

int main(){
	const int smax = 81;
	int n;
	int a[smax + 1];
	int b[smax + 1];
	int sum[smax + 1];
	string s1, s2;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s1 >> s2;
		if(s1.size() >= smax || s2.size() >= smax){
			cout << "overflow" << endl;
		} else {
			int i = 1;
			for(int i = 1; i <= smax; i++){
				a[i] = 0; b[i] = 0; sum[i] = 0;
			}
			for(string::const_reverse_iterator iter = s1.rbegin();
				iter != s1.rend(); iter++)
			{
				a[i++] = ((int)(*iter) - 48);
			}
			i = 1;
			for(string::const_reverse_iterator iter = s2.rbegin();
				iter != s2.rend(); iter++)
			{
				b[i++] = ((int)(*iter) - 48);
			}
			int c = 0;
			for(int j = 1; j < smax; j++){
				sum[j] = (a[j] + b[j] + c) % 10;
				c = (a[j] + b[j] + c) / 10;
			}
			if(c){
				cout << "overflow" << endl;
			} else {
				int sum_sz = max(s1.size(), s2.size());
				if(sum[sum_sz + 1]) cout << 1;
				for(int k = sum_sz; k >= 1; k--)
					cout << sum[k];
				cout << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string s,n,final;
  int o,c=0;
  cin>>s>>n;
  reverse(s.begin(),s.end());
  reverse(n.begin(),n.end());
  for(int i = 0; i < s.size() || i<n.size() || c;i++){
    if( n.size() == i || s.size() == i){ 
      final.append(1,'1');
      break;
    }
    o = (s[i]-'0')+(n[i]-'0')+c;
    c = o / 10;
    o %= 10;
    final.append(1,o+'0');
  }
  reverse(final.begin(),final.end());
  if(n.size()>=80 || s.size()>=80 || final.size()>=80) cout<<"overflow"<<endl;
  else cout<<final<<endl;
}

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

#define MAX_SIZE 80

int main()
{
    int n;
    cin >> n;

    string n1, n2;

    while(cin >> n1 >> n2)
    {

        if( n1.size()>80 || n2.size()>80 ){
                cout << "overflow" << endl;
                continue;
        }

        // 先頭を0で埋めて80桁に合わせる
        char num1[MAX_SIZE], num2[MAX_SIZE];
        for(int i=n1.size(); i<80; i++) n1.insert(0, "0");
        for(int i=n2.size(); i<80; i++) n2.insert(0, "0");

        int c=0; // carry out
        char s=0; // sum
        for(int i=0; i<MAX_SIZE; i++){
            s = n1.at(n1.size()-i-1) + n2.at(n2.size()-i-1) - 2*'0' + c;
            // 桁上がりの有無
            if(s>=10){ 
                c = 1;
                s -= 10;
            }else{
                c = 0;
            }
            n1.at(n1.size()-i-1) = s + '0';
        }
 
        if(c){ 
            cout << "overflow" << endl; 
        }else{
            while(n1.at(0)=='0') n1.erase(0,1); // 先頭の0を除く処理
            cout << n1 << endl;
        }

        n1.clear();
        n2.clear();
    }

    return 0;
}

C++: #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <queue>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a[80], b[80], r[81];
    fill(a, a+80, 0);
    fill(b, b+80, 0);
    fill(r, r+81, 0);
    string sa, sb;
    cin >> sa >> sb;
    reverse(sa.begin(), sa.end());
    reverse(sb.begin(), sb.end());
    for (unsigned int j = 0; j < sa.length(); j++)
      a[j] = sa[j] - '0';
    for (unsigned int j = 0; j < sb.length(); j++)
      b[j] = sb[j] - '0';
    for (int j = 0; j < 80; j++) {
      r[j] += a[j] + b[j];
      r[j+1] += r[j] / 10;
      r[j] %= 10;
    }
    if (r[80]) {
      cout << "overflow" << endl;
      continue;
    }
    int k = 79;
    for (; k >= 1 && !r[k]; k--);
    for (int j = k; j >= 0; j--)
      cout << r[j];
    cout << endl;
  }
  return 0;
}