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

void storeReverse(char ch[], string str){
    for (int i=0; i<str.size(); i++) {
        ch[i] = str[str.size()-i-1];
    }
}

void calcSum(char ch1[], char ch2[]){
    int c = 0;
    int result[80];
    for (int i=0; i<80; i++) {
        int num1 = ch1[i] - '0';
        int num2 = ch2[i] - '0';
        int sum = num1 + num2 + c;
        if (sum >= 10) {
            sum %= 10;
            c = 1;
        }else{
            c = 0;
        }
        result[i] = sum;
    }
    if (c == 1){
        cout << "overflow" << endl;
    }else{
        int idx;
        for (int i=80-1; i>=0; i--) {
            if (result[i] != 0){
                idx = i;
                break;
            }
        }
        for (int i=idx; i>=0; i--) {
            cout << result[i];
        }
        cout << endl;
    }
}

int main()
{
    int n;
    char ch1[80], ch2[80];
    string str1, str2;
    
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> str1;
        cin >> str2;
        for (int j=0; j<80; j++) {
            ch1[j] = '0';
            ch2[j] = '0';
        }
        storeReverse(ch1, str1);
        storeReverse(ch2, str2);
        calcSum(ch1, ch2);
        
    }

    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

using namespace std;

int main()
{
	int i,j,n,f;
	string s1,s2;

	cin>>n;
	
	while(n--){
		cin>>s1>>s2; f=0;
		if(s1.size()<s2.size())swap(s1,s2);

		for(i=0;i<s2.size();i++){s1[i+s1.size()-s2.size()]+=s2[i]-'0';}

		for(i=s1.size()-1;i>0;i--){
			if(s1[i]>'9'){s1[i]-=10; s1[i-1]++;}
		}

		if(s1[0]>'9'){s1[0]-=10;f++;}

		if(s1.size()+f<80){
			if(f) cout<<"1";
			cout<<s1;
		}
		else cout<<"overflow";

		cout<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

#define MAX_SIZE 90

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = 0;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == 0&& r.d[i] == 0){
	if(!updigit)
	  goto end;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i])
	  a = toI(this->d[i]);
	if(r.d[i])
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
  end:
    this->size = tmp;
    return;
  }

  void print()
  {
    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
    puts("");
  }

  int sz()
  {
    return this->size;
  }
};

int main()
{
  int x;
  scanf("%d", &x);
  char s1[MAX_SIZE], s2[MAX_SIZE];  
  for(int i=0;i<x;i++){
 /*   scanf("%s%s",s1, s2);
   Z z1(s1);
    Z z2(s2);
    if(z1.sz() > 80 || z2.sz() > 80){
      puts("overflow");
      continue;
    }
    z1.add(z2);
    z1.print(); */
  }
  return 0;
}

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

void swap(std::string& str1, std::string& str2)
{
	std::string temp;

	temp = str1;

	str1 = str2;

	str2=temp;
}

int main()
{
	int n=0;

	std::cin >> n;

	for(int i=0; i<n; ++i)
	{
		std::vector<int> a, b;

		std::string stra, strb;

		std::cin >> stra >> strb;

		if(stra.length()<strb.length())
		{
			swap(stra,strb);
		}

		for(size_t i=0; i<stra.length(); ++i)
		{
			a.push_back(stra[stra.length()-1-i]-48);
		}

		for(size_t i=0; i<strb.length(); ++i)
		{
			b.push_back(strb[strb.length()-1-i]-48);
		}

		for(size_t i=0; i<b.size(); ++i)
		{
			a[i] += b[i];
		}

		for(size_t i=0; i<a.size()-1; ++i)
		{
			if(a[i]>=10)
			{
				++a[i+1];

				a[i] %= 10;
			}
		}

		if(a[a.size()-1]>=10)
		{
			a[a.size()-1] %= 10;

			a.push_back(1);
		}
		
		if(a.size()>80)
		{
			std::cout << "overflow";
		}
		else
		{
			for(size_t i=0; i<a.size(); ++i)
			{
				std::cout << a[a.size()-1-i];
			}	
		}

		std::cout << '\n';
	}
}