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 <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
#include <list>
using namespace std;
 
int main()
{
    int n;
    cin>> n;
    string str1,str2;
    vector<string>s1;
    vector<string>s2;
    bool bo=false;
    for(int i=0;i<n;i++){
       cin>>str1;
       s1.push_back(str1);  
       cin>>str2;    
       s2.push_back(str2);
       if(str1.size()>80 ||str2.size()>80) bo=true;
    }
    if(bo){cout<<"overflow"<<endl;}
    else{
       for(int i=0;i<n;i++){
           string str3=s1[i];
           string str4=s2[i];
           int k=str3.size();
           int l=str4.size();
           int max=k>l?k:l;
           int a[80]={0};
           int b[80]={0};
           for(int j=0;j<k;j++){
                a[j]=str3[j]-'0'; } 
           for(int j=0;j<l;j++){
                b[j]=str4[j]-'0'; }
           int temp=0;
           char s[80];
           for(int i=0;i<max;i++){
               int d;
               if(l>i&&k>i) d=a[k-1-i]+ b[l-1-i]+temp;
               if(l<=i&&k>i) d=a[k-1-i]+temp;
               if(l>i&&k<=i) d=b[l-1-i]+temp;
               s[max-1-i]=(d%10)+'0';
               if(d>=10) temp=1;
               else temp=0;
           }
           if(strlen(s)+temp>80) cout<<"overflow"<<endl;
           else{ 
                 if(temp==1) cout<<"1";
                 for(int i=0;i<max;i++){
                    cout<<s[i];}
                }
          cout<<endl;
        } 
    }   
    return 0; 
}

C++: //RE
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;
const int N = 100;

vector<int> makeDx(string str){
    reverse(str.begin(), str.end());
    vector<int> ret(N, 0);
    REP(i, str.size()) ret[i] = str[i] - '0';
    return ret;
}

bool isOver80(vector<int> dx){
    FOR(i, 80, dx.size()) if(dx[i] != 0) return true;
    return false;
}

int main(){
    int n; cin >>n;
    REP(z, n){
        string str[2]; cin >>str[0] >>str[1];
        vector<int> dx[2] = {makeDx(str[0]), makeDx(str[1])};
        vector<int> ans(N, 0);

        if(isOver80(dx[0]) || isOver80(dx[1])){
            cout <<"NA" <<endl;
            continue;
        }

        REP(i, max(dx[0].size(), dx[1].size())){
            ans[i] += (dx[0][i] + dx[1][i]);
            ans[i + 1] += (ans[i] / 10);
            ans[i] = ans[i] % 10;
        }

        if(isOver80(ans)){
            cout <<"NA" <<endl;
            continue;
        }

        reverse(ans.begin(), ans.end());
        int s = 0;
        while(ans[s] == 0 && s < N - 1) s++;
        FOR(i, s, N) cout <<ans[i];
        cout <<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

const int MAX_SIZE = 90;

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = 0;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == 0&& r.d[i] == 0){
	if(!updigit)
	  goto end;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i])
	  a = toI(this->d[i]);
	if(r.d[i])
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
  end:
    this->size = tmp;
    return;
  }

  void print()
  {
    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
    puts("");
  }

  int sz()
  {
    return this->size;
  }
};

int main()
{
  int x;
  scanf("%d", &x);
  char s1[1000], s2[1000];  
  for(int i=0;i<x;i++){
    scanf("%s %s",s1, s2);
    if(strlen(s1) > 80 || strlen(s2) > 80){
      puts("overflow");
      continue;
    }
    Z z1(s1);
    Z z2(s2);
    z1.add(z2);
    z1.print();
  }
  return 0;
}