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 <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int n;
string s, t, ans;

string p(const string &s, const string &t) {
	string res;
	int l1 = s.length()-1, l2 = t.length()-1;
	int L = max(l1, l2);
	int pre = 0;
	for (int i = 0; i <= L; ++i) {
		int sum = pre;
		sum += (l1>=0 ? s[l1--]-'0' : 0);
		sum += (l2>=0 ? t[l2--]-'0' : 0);
		pre = sum/10;	// 繰り上げ分
		sum -= pre*10;
		res += '0' + sum;
	}
	if (pre) res += '0' + pre;
	reverse(res.begin(), res.end());
	return res;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	
	cin >> n;
	rep(T,n) {
		cin >> s >> t;
		ans = p(s, t);
		if (ans.length() > 80) cout << "overflow" << endl;
		else cout << ans << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define ALL(v) v.begin(),v.end()
string calc(string a,string b){
  reverse(ALL(a));
  reverse(ALL(b));
  while(a.size() < b.size())a += '0';
  while(b.size() < a.size())b += '0';
  int c=0;
  string res;
  for(int i=0;i<a.size();i++){
    c = c+a[i]-'0'+b[i]-'0';
    res += c%10+'0';
    c /= 10;
  }
  if(c)res += c+'0';
  if(res.size() > 80)return "overflow";
  reverse(ALL(res));
  return res;
}
int main(){
  int n;
  string a,b;
  cin>>n;
  while(n--){
    cin>>a>>b;
    cout<<calc(a,b)<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <cstdlib>

using namespace std;

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

  for (int N_i = 0; N_i < N; N_i++) {
    bool overflow = false;
    string str_data1, str_data2;
    cin >> str_data1;
    cin >> str_data2;

    stack<int> data1, data2; 
    for (int data1_i = 0; data1_i < str_data1.size(); data1_i++) {
      char buff[2];
      buff[0] = str_data1[data1_i];
      buff[1] = '\0';
      data1.push(atoi(buff));
    }
    if (data1.size() >= 80)
      overflow = true;
    for (int data2_i = 0; data2_i < str_data2.size(); data2_i++) {
      char buff[2];
      buff[0] = str_data2[data2_i];
      buff[1] = '\0';
      data2.push(atoi(buff));
    }
    if (data2.size() >= 80)
      overflow = true;

    stack<int> sum;
    int carry = 0;
    int flag = data1.size() < data2.size() ? 0 : 1;
    while(flag == 0 ? !data1.empty() : !data2.empty()) {
      int presum = data1.top() + data2.top() + carry;
      carry = presum / 10;
      sum.push(presum % 10);
      data1.pop();
      data2.pop();
    }
    stack<int> *data;
    data = data1.size() > data2.size() ? &data1: &data2;
    while(!data->empty()) {
      int presum = data->top() + carry;
      carry = presum / 10;
      sum.push(presum % 10);
      data->pop();
    }

    if (carry != 0)
      sum.push(carry);

    if (sum.size() >= 80)
      overflow = true;

    if (overflow) {
      cout << overflow << endl;
    } else {
      for (int sum_i = 0; !sum.empty(); sum_i++) {
        cout << sum.top();
        sum.pop();
      }
      cout << endl;
    }
  }

  return 0;
}