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 "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

string addString(string a,string b ){
	if(a.size()<b.size())swap(a,b);         //len(a)>len(b)???
	b = string(a.size()-b.size(),'0')+b;    //b????????????a??¨??????????????????????????????0??§?????????
	
	string ans = string(a.size()+1,'0');    //a?????????+1 ?????????0??§???????????????
	for(int i=(int)a.size()-1;i>=0;i--){    //?¶??????? & ??°????????????
		ans[i+1] += (a[i]-'0') + (b[i]-'0');
		if(ans[i+1]>='0'+10){
			ans[i] += 1;
			ans[i+1] -= 10;
		}
	}
	string ret = "";                        //??????????????°???0????¶????
	rep(i,ans.size()){
		if(ans[i]!='0'||i==ans.size()-1){
			ret = ans.substr(i,ans.size()-i);
			break;
		}
	}
	return ret;
}


int main(){
	int n;
	cin>>n;
	rep(i,n){
		string a,b;
		cin>>a>>b;
		string res = addString(a,b);
		if(res.size()>80)cout<<"overflow"<<endl;
		else cout<<res<<endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    int ans[100] = {0};
    string a,b;
    cin >>a>>b;
    int as = a.size(),bs = b.size(),t = 0,s = 0,x = 0;
    int ms = (as>bs)? as:bs;
    for(int i=0; i<ms; i++,x++){
      if(i<as && i<bs){t = a[as-i-1]+b[bs-i-1]-2*'0'+s;}
      else if(i>=as){t = b[bs-i-1]-'0'+s;}
      else if(i>=bs){t = a[as-i-1]-'0'+s;}
      s = t/10;
      ans[x] = t%10;
    }
    if(s){ans[x] = s;x++;}
    if(x>=80){cout <<"over flow"<<endl;}
    else{
      for(int i=0; i<x; i++){cout <<ans[x-i-1];}
      cout <<endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    string A,B;
    int n,Ak,Bk,ans[81];
    
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        
        for(int j=0;j<80;j++){
            ans[j]=0;
        }
        
        cin >> A >> B;
        
        Ak=(int)A.size();
        Bk=(int)B.size();
        
        for(int i=0;i<max(Ak,Bk);i++){
            if(i<min(Ak,Bk))
                ans[79-i]+=(A[Ak-1-i]-'0')+(B[Bk-1-i]-'0');
            else if(i<Ak)
                ans[79-i]+=A[Ak-1-i]-'0';
            else if(i<Bk)
                ans[79-i]+=B[Bk-1-i]-'0';
            
            if(ans[79-i]>=10){
                if(i==79){
                    break;
                }
                ans[79-i-1]++;
                ans[79-i]-=10;
            }
        }
        
        if(ans[79-i]>=10){
            puts("overflow");
        }else{
            bool f = false;
            for(int i=0;i<80;i++){
                if(ans[i] || f){
                    printf("%1d",ans[i]);
                    f = true;
                }
            }
            printf("\n");
        }
    }
    
    return 0;
}

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

int count(int data[]){
	int cnt = 0,i=0;
	while(1){
		if(data[i] == 10)break;
		cnt++;
		i++;
	}
	return cnt;
}

void sum(char data1[],char data2[],int ans[]){
	int i;
	for(i = 0;i < strlen(data1) || i < strlen(data2);i++){
		int st1,st2,st3;
		if(i >= strlen(data1)){
			st1 = 0;
		}else{
			st1 = data1[strlen(data1)-i-1];
			st1 = st1 - 48;
		}
		if(i >= strlen(data2)){
			st2 = 0;
		}else{
			st2 = data2[strlen(data2)-i-1];
			st2 = st2 - 48;
		}
		st3 = st1 + st2;
		if(st3 >= 10){
			if(ans[i] == 1){
				ans[i] = st3 - 9;
				ans[i + 1] = 1;
			}else{
				ans[i] = st3 - 10;
				ans[i + 1] = 1;
			}
		}else{
			if(ans[i] == 1){
				if(st3 == 9){
					ans[i] = 0;
					ans[i + 1] = 1;
				}else{
					ans[i] = st3 + 1;
				}
			}else{
				ans[i] = st3;
			}
		}
	}
	if(ans[i] == 1){
		ans[i + 1] = 10;
	}else{
		ans[i] = 10;
	}
}

void reverse(int ans[]){
	if(count(ans) > 80){
		std::cout << "overflow" << std::endl;
	}else{
		int i;
		for(i = count(ans)-1;i >= 0;i--){
			printf("%d",ans[i]);
		}
	}
}

int main(void){
	int cnt,i;
	scanf("%d",&cnt);
	for(i = 0;i < cnt;i++){
		int ans[82];
		char data1[82],data2[82];
		scanf("%s",data1);
		scanf("%s",data2);
		if(strlen(data1) > 80 || strlen(data2) > 80){
			std::cout << "overflow" << std::endl;
		}else{
			sum(data1,data2,ans);
			reverse(ans);
		}
		printf("\n");
	}
	return 0;
}