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>
#include<vector>

using namespace std;

void Swap(string&, string&);
vector<int> Atoi(string);

int main(){
  int i, j, n, a, b;
  vector<int> x, y, z;
  string s, t;

  cin >> n;

  for(i=0; i<n; ++i){
    cin >> s >> t;
    if(s.size() < t.size()) Swap(s, t);

    if(s.size() < 80){
      x = Atoi(s);
      y = Atoi(t);

      b = 0;
      for(j=0; j<y.size(); ++j){
	a = x[j] + y[j] + b;
	if(a >= 10){
	  a -= 10;
	  b = 1;
	}else{
	  b = 0;
	}
	z.push_back(a);
      }

      for(j=y.size(); j<x.size(); ++j){
	a = x[j] + b;
	if(a >= 10){
	  a -= 10;
	  b = 1;
	}else{
	  b = 0;
	}
	z.push_back(a);
      }
      if(b == 1) z.push_back(1);

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

      x.clear();
      y.clear();
      z.clear();

    }else{
      cout << "overflow" << endl;
    }
  }
  return 0;
}

void Swap(string& s, string& t){
  string u;
  u = s;
  s = t;
  t = u;
}

vector<int> Atoi(string s){
  int i, n;
  vector<int> x;

  for(i=s.size()-1; i>=0; --i){
    n = s[i]-48;
    x.push_back(n);
  }

  return x;
}

C++: #include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <math.h>

using namespace std;
double a,b,c;
int input; 

int main()
{
	scanf("%d",&input);
	for(int loop=1;loop<=input;loop++)
	{
	scanf("%lf %lf",&a,&b);
	c=a+b;
	if(c<10^80&&a<10^80&&b<10^80)
	printf("%.0lf\n",c);
	else
	printf("overflow\n");
	}
	return 0;
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;


int main(){
    int n;
    cin>>n;
    
    rep(i,n){
        int x[100]={},y[100]={};
        string a,b;
        cin>>a>>b;
        for(int i=a.size()-1;i>=0;i--){
            x[a.size()-1-i]=a[i]-'0';
        }
        for(int i=b.size()-1;i>=0;i--){
            y[b.size()-1-i]=b[i]-'0';
        }
        int ans[100]={};
        for(int i=0;i<80;i++){
            ans[i]+=x[i]+y[i];
            ans[i+1]+=ans[i]/10;
            ans[i]-=ans[i]/10*10;
        }
        if(ans[80]!=0)cout<<"overflow"<<endl;
        else{
            bool flag=false;
            for(int i=79;i>=0;i--){
                if(ans[i]!=0)flag=true;
                if(flag)cout<<ans[i];
            }
        }
        cout<<endl;
        
    }
    return 0;
}

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

int strToInt(string str) {
  int ans = 0;
  for(int i = 0; i < str.length(); i++) {
    ans += ((int)str[i] - (int)'0') * (str.length() - i);
  }
  return ans;
}

int charToInt(char c) {
  return (int)c - (int)'0';
}

string sumStr(string a, string b) {
  int pa = a.length()-1, pb = b.length()-1;
  string str(81, '0');
  int pstr = str.length()-1;
  int next = 0;
  while(pa >= 0 && pb >= 0) {
    int temp = charToInt(a[pa]) + charToInt(b[pb]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pa--;
    pb--;
    pstr--;
  }
  while(pa >= 0) {
    int temp = charToInt(a[pa]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pa--;
    pstr--;
  }
  while(pb >= 0) {
    int temp = charToInt(b[pb]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pb--;
    pstr--;
  }
  str[pstr] = (char)(next + (int)'0');

  for(int i = 0; i < str.length(); i++) {
    if(str[i] != '0') {
      return str.substr(i, str.length()-i);
    }
  }
  return "0";
}

int main(void) {
  int N;
  cin >> N;
  for(int i = 0; i < N; i++) {
    bool overflow = false;
    int data[N][8];
    string sum;
    for(int j = 0; j < 2; j++) {
      string str;
      cin >> str;

      if(!overflow) {
	if(j == 0) sum = str;
	else       sum = sumStr(sum, str);
        if(sum.length() > 80) overflow = true;
      }
    }

    if(overflow) cout << "overflow" << endl;
    else         cout << sum << endl;
  }
  return 0;
}

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

int main(){
    string a, b;
    vector<int> ans;
    int n, num, ai, bi, c=0;
    bool flag;
    
    cin >> n;
    
    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){
            printf("overflow");
        }else{
            for(int j=ans.size()-1 ; j>=0 ; --j){
                printf("%d", ans[j]);
            }
        }
        printf("\n");
        ans.clear();
    }
    return 0;
}