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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  for(int i=0;i<n;i++) {
    string s1,s2;
    cin >> s1;
    cin >> s2;
    int s1_itr = s1.length() - 1;
    int s2_itr = s2.length() - 1;
    bool is_shift = false;
    int digit;
    vector<int> sum;
    while(s1_itr >= 0 || s2_itr >= 0) {
      digit = 0;
      if(s1_itr >= 0)
        digit += s1[s1_itr] - '0';
      if(s2_itr >= 0)
        digit += s2[s2_itr] - '0';
      if(is_shift)
        digit += 1;

      if(digit >= 10) {
        is_shift = true;
        digit = digit - 10;
      }
      else {
        is_shift = false;
      }
      sum.push_back(digit);
      s1_itr--;
      s2_itr--;
    }
    if(is_shift)
      sum.push_back(1);

    if(sum.size() >= 80) {
      cout << "overflow" << endl;
    }
    else {
      for(int i=sum.size()-1;i>=0;i--) {
        cout << sum[i];
      }
      cout << endl;
    }
  }
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin >> n;
    rep(i, n)
    {
        char temp;
        stack<int> as, bs, cs;
        string a, b;
        cin >> a >> b;
        rep(j, a.length()) as.push(a[j] - '0');
        rep(j, b.length()) bs.push(b[j] - '0');
        int keta = max(as.size(), bs.size());
        int aa, bb, cc = 0;
        rep(j, keta)
        {
            if (as.size() != 0)
            {
                aa = as.top();
                as.pop();
            }
            else
            {
                aa = 0;
            }

            if (bs.size() != 0)
            {
                bb = bs.top();
                bs.pop();
            }
            else
            {
                bb = 0;
            }
            int hoge = aa + bb + cc;
            cc = hoge / 10;
            cs.push(hoge - 10 * cc);
        }
        if (cc != 0)
        {
            cs.push(cc);
        }
        if (cs.size() > 80)
        {
            cout << "overflow";
            if(DEBUG) cout<<cs.size();
        }
        else
        {
            while (cs.size() != 0)
            {
                cout << cs.top();
                cs.pop();
            }
        }
        cout << endl;
    }
    return 0;
}