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<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    for(int j=0;j<n;j++){
        string a,b;
        cin>>a>>b;
        int numa[100000]={0},numb[100000]={0};
        int flag=0;
        vector<int> sum;
        if(80<max(a.size(),b.size())){
            puts("overflow");
            goto exit;
        }
        for(int i=a.size()-1,k=0;0<=i;i--,k++)numa[k]=a[i]-'0';
        for(int i=b.size()-1,k=0;0<=i;i--,k++)numb[k]=b[i]-'0';
        for(int i=0;i<max(a.size(),b.size());i++){
            sum.push_back((numa[i]+numb[i])%10);
            numa[i+1]+=(numa[i]+numb[i])/10;
            if(i==max(a.size(),b.size())-1&&(numa[i]+numb[i])/10==1)printf("1");
        }
        if(80<sum.size())puts("overflow");
        else{
            for(int i=sum.size()-1;0<=i;i--)printf("%d",sum[i]);
            puts("");
        }
exit:
;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		string a,b,c;
		char d=0,st;
		cin>>a>>b;
		for(int j=a.size();j<81;++j) a="0"+a;
		for(int j=b.size();j<81;++j) b="0"+b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		for(int j=0;j<80;++j){
			c+=(((a[j]-'0')+(b[j]-'0')+d)%10+'0');
			d=((a[j]-'0')+(b[j]-'0')+d)/10;
		}
		if(d) cout<<"overflow\n";
		else{
			reverse(c.begin(), c.end());
			for(st=0;st<c.size();++st)if(c[st]!='0')break;
			cout<<((st==c.size())?"0\n":c.substr(st,c.size()-st)+"\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
using namespace std;
typedef pair<int,int> P;
const int INF = ~(1<<31) / 2;

int main(){
    int k;
    cin >> k;
    for(int j=0;j<k;j++){
        int n[80];
        string a,b;
        cin >> a >> b;
        int n_a = a.size(),n_b = b.size();
        fill(n,n+80,0);

        bool is_over = false;
        for(int i=0;i<max(n_a,n_b);i++){
            int ai,bi;
            if (i<n_a) ai = a[n_a-i-1]-'0';
            else ai = 0;
            if (i<n_b) bi = b[n_b-i-1]-'0';
            else bi = 0;
            n[i] += ai + bi;
            if (n[i]>=10){
                if(i+1 == 80){
                    is_over = true;
                    break;
                }else{
                    n[i+1] += n[i]/10;
                    n[i] = n[i]%10;
                }
            }
        }
        if (is_over){
            cout << "overflow" << endl;
        }else{
            bool started = false;
            for(int i=79;i>=0;i--){
                if(!started && n[i]>0){
                    started = true;
                }
                if(started){
                    cout << n[i];
                }
            }
            cout << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int DIGIT=9;

int main() {
  int n;
  char buf[81];
  int l, x, y;
  char buf_part[DIGIT+1];
  int a[2][9];
  int b[9];

  cin >> n;
  while (n--) {
    for (int i=0; i<2; i++) {
      cin >> buf;
      l = strlen(buf);
      x = (l+DIGIT-1)/DIGIT;
      y = (l-1)%DIGIT+1;
      for (int j=0; j<9; j++) {
        a[i][j] = 0;
      }
      for (int j=0; j<x; j++) {
        if (!j) {
          memcpy(buf_part, buf, y);
          buf_part[y] = '\0';
        }
        else {
          memcpy(buf_part, &buf[y+DIGIT*(j-1)], DIGIT);
          buf_part[DIGIT] = '\0';
        }
        a[i][x-j-1] = atoi(buf_part);
      }
    }

    for (int i=0; i<9; i++) b[i] = 0;
    x = 0;
    for (int i=0; i<9; i++) {
      if (a[0][i] || a[1][i]) {
        b[i] = a[0][i] + a[1][i];
        if (b[i] >= 1000000000) {
          a[0][i+1]++;
          b[i] -= 1000000000;
        }
        x++;
      } else {
        break;
      }
    }
    if (b[8] >= 100000000) {
      cout << "overflow" << endl;
    } else {
      cout << b[x-1];
      for (int i=x-2; i>=0; i--) {
        cout.fill('0');
        cout.width(DIGIT);
        cout << b[i];
      }
      cout << endl;
    }
  }
  return 0;
}