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>
using namespace std;
bool checkOverFlow(string& p) {
  //80行超えているかを判定
  if(p.size() > 80) {
    return false;
  } else return true;
}

void addZero(string& p, int num) {
  //addZero(string型, 0を先頭に付け加える個数)
  for(int i=0; i<num; i++) {
    p = '0' + p;
  }
  return;
}

int main() {
  int N;//データセットの個数
  cin >> N;
  //データを配列にセット
  string* value1 = new string[N];
  string* value2 = new string[N];
  for(int i=0; i<N; i++) {
    cin >> value1[i] >> value2[i];
    //80行超えていたらoverflow
    if(value1[i].size() > 80 or value2[i].size() > 80) {
      value1[i] = "overflow";
    } else {
      //桁数を先頭に0をつけて揃える
      if(value1[i].size() > value2[i].size()) {
        addZero(value2[i], value1[i].size() - value2[i].size());
      } else {
        addZero(value1[i], value2[i].size() - value1[i].size());
      }
    }
  }
  
  ////////////////
  //足し算をする//
  ////////////////
  for(int i=0; i<N; i++) {
    if(value1[i] == "overflow") {
      cout << "overflow" << endl;
      continue;
    }
    //最大の桁数
    int length = max(value1[i].size(), value2[i].size());
    //繰り上がりの保存配列
    int* carryUp = new int[length +1];
    for(int i=0; i<length +1; i++) {
      carryUp[i] = 0;
    } 
    //答えの保存配列
    int* ans = new int[length +1];
   
    for(int j=0; j<length; j++) {
      int sum;
      sum = (value1[i][value1[i].size()-j-1] - '0')
        + (value2[i][value2[i].size()-j-1] - '0')
        + carryUp[j];
      if(sum>9) carryUp[j+1] = 1;
      ans[j] = sum % 10;

      /*
        cout << "value1:  " << value1[i][value1[i].size()-j-1] - '0' << endl;
        cout << "value2:  " << value2[i][value2[i].size()-j-1] - '0' << endl;
        cout << "carryUp: " << carryUp[j] << endl;
        cout << "ans      " << ans[j] << endl;
        cout << "===========" << endl;
      */
    }

    //出力
    int start;//桁数(1:length桁 0:length+1桁)
    if(carryUp[length] == 1){
      ans[length] = 1;
      start = 0;
    } else start = 1;

    string output = "";
    for(int i=start; i<=length; i++) {
      output += ans[length -i];
    }

    if(output.size() > 80) {
      cout << "overflow" << endl;
    } else {
      for(int i=start; i<=length; i++) {
        cout << ans[length -i];
      }
      cout << endl;
    }
    
    delete[] carryUp;
    delete[] ans;
  }
  delete[] value1;
  delete[] value2;
}

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#include <bits/stdc++.h>
using namespace std;


int main(){
  int n;
  cin>>n;
  
  string a,b;

  while(n--){
    cin>>a>>b;
    reverse(ALL(a));
    reverse(ALL(b));
    vector<int> c(81,0),d(81,0),e(81,0),f(81,0);
    if(a.size()>80 || b.size()>80) cout<<"overflow"<<endl;
    else{
      for(int i=0;i<(int)a.size();i++){
        c[i]=a[i]-'0';
      }
      for(int i=0;i<(int)b.size();i++){
        d[i]=b[i]-'0';
      }
      rep(i,80){
        e[i]=(c[i]+d[i]+f[i])%10;
        f[i+1]=(c[i]+d[i]+f[i])/10;
      }
      if(f[80]==1) cout<<"overflow"<<endl;
      else{
        reverse(ALL(e));
        if(e[80-max(a.size(),b.size())]!=0){
          for(int i=80-max(a.size(),b.size());i<81;i++) cout<<e[i];
        }
        else{
          for(int i=81-max(a.size(),b.size());i<81;i++) cout<<e[i];
        }
        cout<<endl;
      }
    }
  }
  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<sstream>
#include<string>
using namespace std;
int main(){
	int n;
	for(cin>>n;n--;){
		string a,b;
		cin>>a;
		cin>>b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		while(a.size()<b.size())a+='0';
		while(b.size()<a.size())b+='0';
		int f=0;
		for(int i=0;i<a.size();i++){
			if((a[i]-'0')+(b[i]-'0')+f>9){
				a[i]=a[i]+(b[i]-'0')+f-10;
				f=1;
			}else{
				a[i]=a[i]+(b[i]-'0');
				f=0;
			}
		}
		reverse(a.begin(),a.end());
		if(f)a="1"+a;
		if(a.size()>80){
			cout<<"overflow"<<endl;
		}else{
			for(int i=0;i<a.size();i++){
				if(a[i]!=0)
				cout<<a[i];
			}
			cout<<endl;
		}
	}
	return 0;
}