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<stdio.h>
#include<string.h>
int c[1000];
int a[1000];
int b[1000];
char s1[1000];
char s2[1000];
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        memset(c,0,sizeof(c));
        memset(s1,'\0',sizeof(s1));
        memset(s2,'\0',sizeof(s2));
        scanf("%s %s",s1,s2);
        int x=strlen(s1);
        int y=strlen(s2);
        int m;
        int j=0;
        if(x>80||y>80)
            printf("overflow\n");
        else
        {
            for(int i=x-1; i>=0; i--)
            {
                a[j++]=s1[i]-'0';
            }
            int k=0;
            for(int i=y-1; i>=0; i--)
            {
                b[k++]=s2[i]-'0';
            }
            if(x<y)
            {
                m=x;
                x=y;
                y=m;
            }
            int l=0;
            for(int i=0; i<x+1; i++)
            {
                c[i]=a[i]+b[i]+l;
                if(c[i]>=10)
                {
                    l=c[i]/10;
                    c[i]=c[i]%10;
                }
                else
                    l=0;
            }
            int n=0;
            for(int i=x; i>=0; i--)
            {
                if(c[i]!=0)
                {
                    n=i;
                    break;
                }
            }
            if(n==0&&a[0]==0&&b[0]==0)
                printf("0\n");
            else if(n>80)
                printf("overflow\n");
            else
            {
                for(int i=n; i>=0; i--)
                    printf("%d",c[i]);
                printf("\n");
            }
        }
    }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n--){
    string a,b;
    cin>>a>>b;
    if(a.size()<b.size())swap(a,b);
    while(a.size()!=b.size())b='0'+b;
    //cout<<a<<endl<<b<<endl;
    rep(i,a.size()){
      int tmp=a.size()-i-1;
      a[tmp]+=b[tmp]-'0';
      if(!tmp)break;
      if(a[tmp]>'9'){a[tmp]-=10;a[tmp-1]++;}
    }
    if(a[0]>'9'){a[0]-=10;a='1'+a;}
    if(a.size()>80)cout<<"overflow"<<endl;
    else cout<<a<<endl;
  }
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <math.h>
#include <stack>

using namespace std;

int main(){
    
    string d;
    string e;
    
    
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        int f[81]={0};
        int g[81]={0};
        int h[81]={0};
        
        cin>>d;
        cin>>e;
        
        int j=81;
        for(int i=(int)d.length()-1; i>=0; i--){
            f[j] = (d[i]-'0');
            j--;
        }
        j=81;
        for(int i=(int)e.length()-1; i>=0; i--){
            g[j] = (e[i]-'0');
            j--;
        }
        

        
//        for(int i=0; i<=81; i++){
//            printf("%d",f[i]);
//        }
//        printf("\n");
//        
//        for(int i=0; i<=81; i++){
//            printf("%d",g[i]);
//        }
//        printf("\n");
        
        int temp=0;
        for(int i=81; i>=0; i--){
            temp = temp + f[i]+g[i];
            h[i] = temp % 10;
            temp = temp /10;
        }
        j=0;
        while(h[j]==0){
            j++;
        }
        
        for(int i=j; i<=81; i++){
            printf("%d",h[i]);
        }
        printf("\n");
    }
    
    
}

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

  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 < 100 ; i++){
      a[i] = '0';
    }
    for(int i = strlen(b) ; i < 100 ; 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){
	//cout << "OK" << endl;
	//tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
	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;
}