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



void add(char*a, char*b, char*c)  //鮟倩ョ、a豈巴髟ソ
{
    fill(c,c+100,0);      //蜥檎噪蜷?ス咲スョ髮カ
    int la=strlen(a), lb=strlen(b);
    int i,j;
    for( i=la,j=lb;i>la-lb&&j>0;i--,j--) // 菫晉蕗c豈泌刈謨ー譛?柄荳イ螟壻ク?ス?    {
            c[i]+=a[i-1]-'0'+b[j-1]-'0';
            if(c[i]>9)
            {
                c[i]-=10;
                c[i-1]++;
            }
    }
    for( i=la-lb;i>0;i--)
    {
            c[i]+=a[i-1]-'0';
            if(c[i]>9)
            {
                c[i]-=10;
                c[i-1]++;
            }
    }

    if(la==80&&c[0]==1)
        printf("overflow\n");
    else if(c[0]==0)
            {
                for( i=1;i<=la;i++)
                    printf("%d",c[i]);
                printf("\n");
            }
            else
            {
                for( i=0;i<=la;i++)
                   printf("%d",c[i]);
                printf("\n");
            }

}

int c[100];
int main()
{
    char a[100], b[100];
    int n;
    scanf("%d",&n);

    while(n--){
    scanf("%s%s",a,b);
    int la = strlen(a), lb = strlen(b);
    if(la>80 || lb>80)
        printf("overflow\n");
    else if(la>lb)
        add(a,b,c);
    else add(b,a,c);
    }
    return 0;
}

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

int main()
{
  int n;
  cin >> n;
  getchar();
  while( n --){
    int i;
    char s[1002] = {};
    int A[1000] = {} , B[1000] = {};
    stack<int> C;
    char a, b;
    int end;
    fgets(s, 1000, stdin);
    i = 100; int k = 0;
    while(1 ) {
      a = s[k++];
      if(a  == '\n') break;
      A[i] = a - '0';
      i--;
      if(i < 20)  break;
    }
    int j = 100;
     fgets(s, 1000, stdin);
     k = 0;
    while(1) {
      b = s[k++];
      if(b == '\n') break;
      B[j] = b - '0';
      j--;
      if(j < 20)  break;

    }
    if( i < 20  || j < 20 ) {  cout << "overflow" <<endl; continue; }

    if(i > j)
      end = 101 - j;
    else
      end = 101 - i;

    A[i++] += B[j++];
  
    for(int k = 0; k <= end ; i++, j++, k++) {
      A[i] += B[j];
      A[i] += A[i - 1] / 10;
      A[i - 1] %= 10;
      C.push(A[i - 1]);
    }
    if(C.top() == 0 && C.size() != 1) {
      C.pop();
    }
    end = C.size() - 1;
    if(end > 80){
      cout << "overflow" << endl;
      continue;
    }

    for(i = 0; i < end; i++) {
      cout << C.top();
      C.pop();
    }
  
    cout << endl;
  
  }
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string.h>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int a_len,b_len,m_len;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		a_len=in.size();
		b_len=in2.size();
		for(int i=0;i<a_len;i++){
			a[a_len-1-i]=in[i]-'0';
		}
		for(int i=0;i<b_len;i++){
			b[b_len-1-i]=in[i]-'0';
		}
		m_len=max(a_len,b_len);
		if(m_len>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<m_len+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[m_len]!=0){
			//if(m_len>79){
				//cout<<"overflow"<<endl;
				//continue;
			//}
			//cout<<ans[m_len];
		}
		
		for(int i=0;i<m_len;i++){
			cout<<ans[m_len-1-i];
		}cout<<endl;
		
		
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;

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

char itos(int a){
	return a+'0';
}

int main(){
	int n;
	string s1,s2,ans;
	int lmin , lmax , sum , tmp , tmp2;
	bool bs1=true;
	cin >> n;
	for(int i=0; i<n ; ++i){
		cin >> s1 >> s2;
		reverse(s1.begin(),s1.end());
		reverse(s2.begin(),s2.end());
		lmin=min(s1.length(),s2.length());
		lmax=max(s1.length(),s2.length());
		if(s1.length()<s2.length()) bs1=false;
		for(int j=0;j<lmin;++j){
			ans.resize(j+2 , '0');
			sum=stoi(s1[j])+stoi(s2[j]);
			if(sum>=10){
				ans[j+1]=itos(1);
				tmp=stoi(ans[j]);
				tmp+=sum%10;
				ans[j]=itos(tmp);
			} else {
				int tmp=stoi(ans[j]);
				tmp+=sum;
				if(tmp>=10){
					ans[j+1]=itos(1);
					tmp2=stoi(ans[j]);
					tmp2=tmp%10;
					ans[j]=itos(tmp2);
				} else {
					ans[j]=itos(tmp);
				}
			}
			
		}
		for(int k=lmin; k<lmax ; ++k){
			ans.resize(k+2, '0');
			if(bs1){
				sum=stoi(ans[k])+stoi(s1[k]);
				if(sum>=10){
				ans[k+1]=itos(1); 
				tmp=sum%10;
				ans[k]=itos(tmp);
				} else {
					ans[k]=itos(sum);
				}
			} else {
				sum=stoi(s2[k]);
				sum+=stoi(ans[k]);
				if(sum>=10){
				ans[k+1]=itos(1);
				tmp=sum%10;
				ans[k]=itos(tmp);
				} else {
				ans[k]=itos(sum);
				}
			}
		}
		reverse(ans.begin(),ans.end());
		if(ans[0]=='0') ans.erase(0,1);
		if(ans.length()>80 || s1.length()>80 || s2.length()>80) {cout << "overflow" << endl; ans.clear();}
		else {
			cout << ans << endl;
			ans.clear();
		}
	}
	return 0; 
}