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>
#define MAX 80

using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int counter = 0; counter < n; counter++){
		string a, b;
		cin >> a >> b;
		if (a.length() > MAX || b.length() > MAX){
			cout << "overflow" << endl;
			continue;
		}
		if (a.length() == 1 && b.length() == 1 && a[0] == '0' && b[0] == '0'){
			cout << 0 << endl;
			continue;
		}
		int inta[MAX + 2], intb[MAX + 2], sum[MAX + 2];
		fill(inta, inta + MAX + 2, 0);
		fill(intb, intb + MAX + 2, 0);
		fill(sum, sum + MAX + 2, 0);
		for (int i = 0; i < (signed)a.length(); i++){
			inta[i] = a[a.length() - i - 1] - '0';
		}
		for (int i = 0; i < (signed)b.length(); i++){
			intb[i] = b[b.length() - i - 1] - '0';
		}

		int over = 0;
		for (int i = 0; i < MAX + 2; i++){
			sum[i] = inta[i] + intb[i] + over;
			if (sum[i] >= 10){
				sum[i] %= 10;
				over = 1;
			}
			else{
				over = 0;
			}
		}

		for (int i = MAX + 1;; i--){
			if (sum[i] != 0){
				if (i >= MAX){
					cout << "overflow" << endl;
					break;
				}
				for (int j = i; j >= 0; j--){
					cout << sum[j];
				}
				cout << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>

char iota(int n){
  switch (n) {
    case 0: return '0';
    case 1: return '1';
    case 2: return '2';
    case 3: return '3';
    case 4: return '4';
    case 5: return '5';
    case 6: return '6';
    case 7: return '7';
    case 8: return '8';
    case 9: return '9';
  }
  return '0';
}

int main(){
  std::string num1;
  std::string num2;
  char sum[102];
  int n,temp,flag=0,j;
  const char one = '1';

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> num1 >> num2;

    if(num1.size()<num2.size()){
      num1.swap(num2);
    }
    std::reverse(num1.begin(),num1.end());
    std::reverse(num2.begin(),num2.end());

    for(j=0;j<num2.size();j++){
      //std::cout << 1;
      temp = (num1[j] - '0') + (num2[j] - '0');
      if(flag){
        temp +=1;
        flag = 0;
      }
      if(temp > 9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
      //std::cout << temp << std::endl;
    }
    while(j<num1.size()){
      temp = num1[j] = '0';
      if(flag){
        temp += 1;
        flag = 0;
      }
      if(temp > 9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
    }
    if(flag){
      sum[j] = (char)one;
      sum[j+1] = '\0';
    }else{
      sum[j] = '\0';
    }
    std::string ssum = std::string(sum);
    //reverse(num1.begin(),num1.end());
    //reverse(num2.begin(),num2.end());
    reverse(ssum.begin(),ssum.end());
    //std::cout << num1 << std::endl;
    //std::cout << num2 << std::endl;
    std::cout << ssum << std::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;
}