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

int main(){
	string s1,s2;
	int num;
	cin>>num;
	for(int j=0;j<num;j++){
		cin>>s1;
		cin>>s2;
		int size1=s1.size();
		int size2=s2.size();
		if(size1>80 || size2>80){
			cout<<"overflow"<<endl;
			continue;
		}
		if(size1>size2){
			for(int a=0;a<(size1-size2);a++){
				s2='0'+s2;
			}
		}else if(size1<size2){
			for(int a=0;a<(size2-size1);a++){
				s1='0'+s1;
			}
		}
		string ans="";
		int plus=0;
		for(int i=max(size1,size2)-1;i>=-1;i--){
			if(i==-1){
				if(plus!=0){
					ans=(char)(plus+'0')+ans;
					continue;
				}else{
					continue;
				}
			}
			int alt=(s1[i]-'0')+(s2[i]-'0')+plus;
			if(alt>=10){
				ans=(char)(alt%10+'0')+ans;
				plus=alt/10;
			}else ans=(char)(alt+'0')+ans;
		}
		if(ans.size()>80){
			cout<<"overflow"<<endl;
		}else{
			cout<<ans<<endl;
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>

int main()
{
	char  input1[1001]={0},input2[1001]={0};
	int   output[1002]={0};
	int lengs1=0,lengs2=0,lengs3=0,lengs4=0,count;
	
	scanf("%d",&count);

	for(int c=0;c<count;c++)
	{
		int i,j=1,k;
		for(k=0;k<1000;k++)
		{
			input1[k]=0;
			input2[k]=0;
			output[k]=0;
		}
		scanf("%s",&input1);
		scanf("%s",&input2);

		lengs1=strlen(input1);
		lengs2=strlen(input2);

		if(lengs1>80 || lengs2>80)
		{
			printf("overflow\n");
			continue;
		}

		lengs3=(lengs1>=lengs2)?lengs1+1:lengs2+1;
		lengs4=lengs3;
		while(lengs3>=0 && lengs1>=0 && lengs2>=0)
		{
			output[lengs3]+=(input1[lengs1--]-'0')+(input2[lengs2--]-'0');
			if(output[lengs3]>=10)
			{
				output[lengs3]%=10;
				output[lengs3-1]+=1;
			}
			lengs3--;
		}

		if(lengs1>=0||lengs2>=0)
		{
			while(lengs1>=0)
			{
				output[lengs3]+=(input1[lengs1--]-'0');
				if(output[lengs3]>=10)
				{
					output[lengs3]%=10;
					output[lengs3-1]+=1;
				}
				lengs3--;
			}
			while(lengs2>=0)
			{
				output[lengs3]+=(input2[lengs2--]-'0');
				if(output[lengs3]>=10)
				{
					output[lengs3]%=10;
					output[lengs3-1]+=1;
				}
				lengs3--;
			}
		}
		if(lengs4>=80)
		{
			printf("overflow\n");
			continue;
		}
		if(output[0]!=0)
			j=0;
		for(i=j;i<lengs4;i++)
		{
			printf("%d",output[i]);
		}
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
 
#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
 
int main(void){
    int n; cin >> n;

    while(n --){
        vi res(81);

        rep(i, 2){
            string in; cin >> in;
            if(in.size() > 80){ res[80] = 1; continue; }
            rep(j, in.size() + 1){
                if(j != in.size()) res[j] += in.at(in.size() - j - 1) - '0';
                for(int l = 0; res[j + l] > 9; l ++) res[j + l + 1] ++, res[j + l] %= 10;
            }
        }

        if(res[80]){ cout << "overflow" << endl; continue; }

        bool ok = false;
        for(int i = 79; i >= 0; i --){
            if(!ok) if(res[i]) ok = true;
            if(ok) cout << res[i];
        }
        cout << endl;
    }
 
    return 0;
}

C++: //56
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int N;
  cin>>N;
  while(N--){
    string s[2];
    for(int i=0;i<2;i++){
      cin>>s[i];
      reverse(s[i].begin(),s[i].end());
    }
    if(s[0].size()<s[1].size()){
      swap(s[0],s[1]);
    }
    string ans;
    int c=0;
    for(int i=0;i<s[0].size();i++){
      char d=(i<s[1].size())?s[1][i]:'0';
      d+=-'0'+s[0][i]+c;
      c=d>'9';
      if(d>'9'){
	d-=10;
      }
      ans+=d;
    }
    if(c){
      ans+='1';
    }
    reverse(ans.begin(),ans.end());
    if(ans.size()<=80){
      cout<<ans<<endl;
    }else{
      cout<<"overflow"<<endl;
    }
  }
  return 0;
}