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<stdio.h>
#include <algorithm>
#include<string>
#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]=in2[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){
		}
		
		
	}
	
	
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stack>
using namespace std;

int main(){
	int n,i,j,flag;
	char ch1[100],ch2[100];
	cin >> n;
	fgets(ch1,100,stdin);
	for(i = 0;i < n;i++){
		fgets(ch1,100,stdin);
		fgets(ch2,100,stdin);
		if(strlen(ch1) > 80 || strlen(ch2) > 80){
			cout << "overflow" << endl;
		}
		else {
			stack<int> st1,st2,sum;
			sum.push(0);
			for(j = 0;j < strlen(ch1) - 1;j++) st1.push(ch1[j] - '0');
			for(j = 0;j < strlen(ch2) - 1;j++) st2.push(ch2[j] - '0');
			while(!st1.empty() || !st2.empty()){
				if(st1.empty()) st1.push(0);
				if(st2.empty()) st2.push(0);
				flag = sum.top();
				sum.pop();
				sum.push((st1.top() + st2.top() + flag) % 10);
				sum.push((st1.top() + st2.top() + flag) / 10);
				st1.pop();
				st2.pop();
			}
			if(!sum.top()) sum.pop();
			if(sum.size() > 80) cout << "overflow" << endl;
			for(;!sum.empty();) {
				cout << sum.top();
				sum.pop();
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  int n, maxlen;
  char a[10001], b[10001];

  cin >> n;
  for(int ii = 0 ; ii < n ; ii++){
    string ans = "";
    scanf("%s%s", a, b);
    
    maxlen = max(strlen(a), strlen(b));

    reverse(a, a+strlen(a));
    reverse(b, b+strlen(b));
    
    for(int i = strlen(a) ; i < 10000 ; i++){
      a[i] = '0';
    }
    for(int i = strlen(b) ; i < 10000 ; i++){
      b[i] = '0';
    }

    int tmp, tmp2 = 0;
    bool flag = 0;

    for(int i = 0 ; i < maxlen ; i++){
      tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
      
      if(i == maxlen - 1){
	if(tmp >= 10){
	  tmp2 = 1;
	  tmp -= 10;
	  ans += tmp + '0';
	  ans += '1';
	}
	else ans += tmp + '0';
      }

      else if(tmp >= 10){
	tmp2 = 1;
	tmp -= 10;
	ans += tmp + '0';
      }
      else if(tmp <= 9){
	ans += tmp + '0';
	tmp2 = 0;
      }
    }

    reverse(ans.begin(), ans.end());

    int size = ans.size();

    if(size >= 80 || maxlen >= 80) cout << "overflow" << endl;
    else cout << ans << endl;
  }
  return 0;
}

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

int main(){
	int i,j,k,n,tmp,flag,length;
	int yosan[20];
	char str[81],str2[256];

	scanf("%d",&n);

	for(i = 0;i < n;i++){
		memset(yosan,0,sizeof(yosan));
		flag = 0;
		for(j = 0;j < 2;j++){
			scanf("%s",str2);
			length = strlen(str2);
			if(flag && length >= 81){
				flag = 1;
				break;
			}
			memset(str,'\0',sizeof(str));
			for(k = 0;k < 80;k++){
				if(k >= 80-length){
					str[k] = str2[k-80+length];
				}else{
					str[k] = '0';
				}
			}
			//printf("%s\n",str);
			tmp = 0;
			for(k = 0;k < 80;k++){
				tmp *= 10;
				tmp += (str[k] - '0');
				if(k % 4 == 3){
					yosan[k/4] += tmp;
					tmp = 0;
				}
			}
			for(k = 29;k > 0;k--){
				if(yosan[k] >= 10000){
					yosan[k-1]++;
					yosan[k] %= 10000;
				}
			}
			if(yosan[0] >= 10000){
				flag = 1;
				break;
			}
		}
		if(!flag){
			tmp = 0;
			while(yosan[tmp] == 0){
				tmp++;
			}
			printf("%d",yosan[tmp]);
			tmp++;
			for(j = tmp;j < 20;j++){
				printf("%04d",yosan[j]);
			}
			printf("\n");
		}else{
			printf("overflow\n");
		}
	}

	return 0;
}