Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}

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

const int 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[1000], s2[1000];  
  for(int i=0;i<x;i++){
    scanf("%s %s",s1, s2);
    if(strlen(s1) > 80 || strlen(s2) > 80){
      puts("overflow");
      continue;
    }
    Z z1(s1);
    Z z2(s2);
    z1.add(z2);
    z1.print();
  }
  return 0;
}

C++: #include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
class N{
public:
  string s;
  int ln;
  N(){
  }
  N(int n){
    s.assign(n,'0');
    ln=n;
  }
  N(string t){
    s=t;
    ln=s.length();
    update();
  }
  N plus(const N& t){
    int i;
    N u(max(ln,t.ln)+1);
    int c=0;
    for(i=0;i<max(ln,t.ln);++i){  
      int p=(ln-i-1<0?0:s[ln-i-1]-'0')+(t.ln-i-1<0?0:t.s[t.ln-i-1]-'0')+c;
      u.s[u.ln-i-1]=p%10+'0';
      c=p/10;
    }
    u.s[u.ln-i-1]=c+'0';
    u.update();
    return u;
  }
  void update(){
    int i;
    for(i=0;i<ln-1&&s[i]=='0';++i);
    s.erase(0,i);
    ln-=i;
  }
};
int main(){
  int i;
  int n;
  cin>>n;
  for(i=0;i<n;++i){
    string s,t;
    cin>>s>>t;
    N a(s),b(t);
    N c=a.plus(b);
    if(c.ln>80)
      cout<<"overflow"<<endl;
    else
      cout<<c.s<<endl;
  }
  return 0;
}

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

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
 
	for (int i = 0; i < N; i++)
	{
		std::cin >> str_a;
		std::cin >> str_b;
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;
bool isover(int);
bool isover(int,int);
int main() {
	int n; string ans; bool is_str_use;
	string str, str1; int nexta; int memo, age;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		age = 0; ans = ""; is_str_use = false;
		cin >> str >> str1;
		if (isover(str.size(), str1.size())) {
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < str.size() / 2; ++i) {
			swap(str[i], str[str.size() - 1 - i]);

		}
		for (int i = 0; i < str1.size() / 2; ++i) {
			swap(str1[i], str1[str1.size() - 1 - i]);
		}
		if (str.size() < str1.size()) {
			is_str_use = true;
		}
		for (int i = 0; i < min(str.size(), str1.size()); ++i) {
			memo = (str[i] - '0') + (str1[i] - '0') + age;
			if (memo > 9) {
				age = memo / 10;
				memo -= (memo / 10) * 10;
			}
			ans += memo + '0';
		}
		if (str.size() == str1.size()&&age!=0) {
			ans += age + '0';
			age = 0;
		}
		if (isover(ans.size())) {
			cout << "overflow" << endl;
			continue;
		}
		if (is_str_use) {
			swap(str, str1);

		}
		for (int i = min(str.size(), str1.size()); i < str.size(); ++i) {
			memo = (str[i] - '0') + age;
			if (memo > 9) {
				age = memo / 10;
				memo -= (memo / 10) * 10;
			}
			ans += memo + '0';
		}
		if (age != 0)ans += age+'0';
		if (isover(ans.size())) {
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < ans.size() / 2; ++i) {
			swap(ans[i], ans[ans.size() - 1 - i]);
		}
		cout << ans << endl;
	}
	return 0;
}
bool isover(int a) {
	if (a > 80) {
		return true;
	}
	return false;
}
bool isover(int a, int b) {
	if (a > 80 || b > 80) {
		return true;
	}
	return false;
}

C++: #include <iostream>
#include <string>
using namespace std;


int main(){
  int n,i,j;
  string a,b;
  int sum[102]={};
  int up = 0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a >> b;
    int sa=a.size(),sb=b.size();
    for(j=0;j<max(sa,sb);j++){
      if(sa>j&&sb>j){
	sum[j] = (a[sa-j-1]-'0') + (b[sb-j-1]-'0') + up;
      }else if(sa>j){
	sum[j] = (a[sa-j-1]-'0') + up;
      }else if(sb>j){
	sum[j] = (b[sb-j-1]-'0') + up;
      }
      up=0;
      if(sum[j]>9){
	up=1;
	sum[j]-=10;
      }
    }
    sum[max(sa,sb)]=up;
    int k=101;
    while(sum[k]==0&&k>0) k--;
    //cout << k<< " "<<sum[k] << endl;
    for(j=k;j>=0;j--)
      cout << sum[j];
    cout << endl;
  }
    

  
}

C++: #include<iostream>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;
class BigInt{
  unsigned int i[11];
public:
  BigInt(string str){
    if(str.size()>80){i[0]=1; return;}
    i[0]=0;
    for(int j=80;j>0;j-=8){
      if((int)str.size()>j){
	stringstream ss;
	ss << str.substr(str.size()-j,8);
	ss >> i[11-j/8];
      }else if((int)str.size()+8>j){
	stringstream ss;
	ss << str.substr(0,str.size()+8-j);
	ss >> i[11-j/8];
      }else{
	i[11-j/8]=0;
      }
    }
  }
  BigInt():i{0,0,0,0,0,0,0,0,0,0,0}
  {}
  void print(){
    if(i[0]>0)
      cout << "overflow\n";
    else{
      int j=1;
      for(;j<11;j++)
	if(i[j]>0 || j == 10)
	  break;
      cout << i[j++];
      for(;j<11;j++)
	cout << setfill('0') << setw(8) << right << i[j];
      cout << "\n";
    }
  }
  BigInt operator+(const BigInt& rhs){
    BigInt result = rhs;
    for(int j=10;j>0;j--){
      result.i[j] += i[j];
      if(result.i[j]>=100000000){
	result.i[j]-=100000000;
	result.i[j-1]++;
      }
    }
    return result;
  }
};

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    string tmp;
    cin>>tmp;
    BigInt b(tmp);
    cin>>tmp;
    BigInt a(tmp);
    (a+b).print();
  }
}