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 <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    char str1[81];
    char str2[81];
    string ans = "";
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1) - 1, m2 = strlen(str2) - 1, pre = 0;
    int m = max(m1, m2);
    if(m1 > 80 || m2 > 80)
      cout << "overflow" << endl;
    else if(atoi(str1) + atoi(str2) < 2147483647 && atoi(str1) + atoi(str2) > 0)
      cout << atoi(str1) + atoi(str2) << endl; 
    else{
      for(int j = 0; j <= m; j++){
	int sum = pre;
	sum += (m1 >= 0) ? str1[m1--] - '0' : 0;
	sum += (m2 >= 0) ? str2[m2--] - '0' : 0;
	pre = sum / 10;
	sum -= pre * 10;
	ans += '0' + sum;
      }
      if(pre > 0)
	ans += '0' + pre;
      reverse(ans.begin(), ans.end());
      if(ans.length() > 80)
	cout << "overflow" << endl;
      else
	cout << ans << endl;
    }
  }
}

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

int main() {
	int k,a,b,c,d,i,j,s;
	stack<int> st[3];
	char n[2][81];
	cin >> d;
	for (d;d>0;d--) {
	cin >> n[0] >> n[1];
	for (i=0;i<2;i++) for (j=0;n[i][j]!='\0';j++) st[i].push(n[i][j]-'0');
	k=0; c=0;
	while(!st[0].empty() || !st[1].empty()) {
		if (!st[0].empty()) {a=st[0].top(); st[0].pop();} else a=0;
		if (!st[1].empty()) {b=st[1].top(); st[1].pop();} else b=0;
		s=a+b+c; k++;
		if (s>9) { c=1; s-=10; } else c=0;
		st[2].push(s);
	}
	if ((c==1 && k==80) || k>80) { 
		cout << "overflow" << endl;
		while(!st[2].empty()) st[2].pop();
	}
	else {
		if (c==1) cout << 1;
		while(!st[2].empty()) { 
			cout << st[2].top();
			st[2].pop();
		}
		cout << endl;
	}
}
		return 0;
}

C++: #include <iostream>
#include <string.h>
#include <algorithm>
#include <stack>
using namespace std;

int main(){
	int n,i,j,flag;
	char ch1[100],ch2[100];
	cin >> n;
	fgets(ch1,100,stdin);
	for(i = 0;i < n;i++){
		fgets(ch1,100,stdin);
		fgets(ch2,100,stdin);
		if(strlen(ch1) > 80 || strlen(ch2) > 80){
			cout << "overflow" << endl;
		}
		else {
			stack<int> st1,st2,sum;
			sum.push(0);
			for(j = 0;j < strlen(ch1) - 1;j++) st1.push(ch1[j] - '0');
			for(j = 0;j < strlen(ch2) - 1;j++) st2.push(ch2[j] - '0');
			while(!st1.empty() || !st2.empty()){
				if(st1.empty()) st1.push(0);
				if(st2.empty()) st2.push(0);
				flag = sum.top();
				sum.pop();
				sum.push((st1.top() + st2.top() + flag) % 10);
				sum.push((st1.top() + st2.top() + flag) / 10);
				st1.pop();
				st2.pop();
			}
			if(!sum.top()) sum.pop();
			for(;!sum.empty();) {
				cout << sum.top();
				sum.pop();
			}
			cout << endl;
		}
	}
	return 0;
}

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

#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define PRINT(STR) cout << (STR) << endl

typedef long long ll;
using namespace std;

double nextDouble() {
	double d = -1;
	cin >> d;
	return d;
}

int nextInt() {
	int n = -1;
	cin >> n;
	return n;
}

string nextString() {
	string str;
	cin >> str;
	return str;
}

string reverse(string str) {
	string t = str;
	for (int i = 0; i < str.size(); i++) {
		t[i] = str[str.size() - i - 1];
	}
	return t;
}

int main() {
	cin.tie(0); //対話型には使えない
	int n = nextInt();
	while (n--) {
		string str1 = nextString();
		string str2 = nextString();
		int n[100];
		fill(n, n + 100, 0);
		str1 = reverse(str1);
		str2 = reverse(str2);

		REP(i, str1.size()) {
			n[i] = str1[i] - '0';
		}
		REP(i, str2.size()) {
			n[i] += str2[i] - '0';
		}
		if (str1.size() >= 80 || str2.size() >= 80) {
			PRINT("overflow");
			continue;
		}
		int M = max(str1.size(), str2.size());
		int k = M;
		REP(i, M) {
			if (n[i] >= 10) {
				n[i + 1] += n[i] / 10;
				n[i] %= 10;
				if (i == M - 1) k = M + 1;
			}
		}
		if (n[80] > 0) {
			PRINT("overflow");
			continue;
		}
		for (int i = k - 1; i >= 0; i--) {
			cout << n[i];
		}
		cout << endl;
		
	}
	
	return 0;
}

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

int sum(char a[],char b[],int as,int bs,char c[]){
	int cs = (as>bs) ? as + 1 : bs + 1;
	int size = cs;
	while(as >=0 && bs >=0){
		c[cs] = a[as] + b[bs];
		if(c[cs]>9){
			c[cs] -= 10;
			c[cs-1] += 1;
		}
		as--;bs--;cs--;
	}
	while(as >=0){
		c[cs] += a[as];
		if(c[cs]>9){
			c[cs] -= 10;
			c[cs-1] += 1;
		}

	}
	while(bs >=0){
		c[cs--] += b[bs--];
		if(c[cs]>9){
			c[cs] -= 10;
			c[cs-1] += 1;
		}
	}
	return (c[0]>0) ? size + 1 : size;
}

int main(){
	char a[256],b[256],c[256];
	bool flag = true;
	int len1,len2,len3,n;
	scanf("%d",&n);
	while(n--){
		scanf("%s",a);
		scanf("%s",b);
		len1 = strlen(a);
		len2 = strlen(b);
		if(len1 > 80 || len2 >80){
			printf("overflow\n");
			continue;
		}
		for(int i=0;i<len1;i++) a[i] -= 0x30;
		for(int i=0;i<len2;i++) b[i] -= 0x30;
		for(int i=0;i<256;i++)  c[i] = 0;
		len3 = sum(a,b,len1-1,len2-1,c);
		if(len3>80){
			printf("overflow\n");
			continue;
		}
		if(c[0]>0) for(int i=0;i<len3;i++) printf("%d",c[i]);
		else for(int i=1;i<=len3;i++) printf("%d",c[i]);
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  string num1,num2,tmp;
  int n;

  cin >> n;
  cin.clear();
  while(n--){

    cin >> num1;
    cin.clear();
    cin >> num2;
    cin.clear();
    if((int)num1.size() < (int)num2.size()){
      tmp = num2;
      num2 = num1;
      num1 = tmp;
    }

    if(num1.size() > 80){
      cout << "overflow" << endl;
      continue;
    }

    for(int i = 0 ; i < (int)num1.size() ; i++ )tmp[i] = num1[i];

    for(int i = (int)num1.size() - 1 ; i >= 0 ; i-- )
      {
	num1[i] = tmp[(int)num1.size() - 1 - i];
      }
    for(int i = 0 ; i < (int)num2.size() ; i++ )tmp[i] = num2[i];

    for(int i = (int)num2.size() - 1  ; i >= 0 ; i-- )
      {
	num2[i] = tmp[(int)num2.size() - 1 - i];
      }

    for(int i = (int)num2.size() ; i < (int)num1.size() ; i++ )num2+='0';

    char tmp2 = '0';
    string ans;

    for(int i = 0 ; i < num1.size() ; i++ ){
      if((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') > 9){
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') - 10) + '0');
	tmp2 = '1';
      } else {
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0')) + '0');
	tmp2 = '0'; 
      }
    }
  
    if((int)((tmp2 - '0') + (num1[num1.size() - 1] - '0') + (num2[num1.size() - 1] - '0')) > 9)ans+='1'; 
    if(ans.size() > 80){
      cout << "overflow" << endl;

    }else{

      for(int i = (int)ans.size() ; i >= 0 ; i-- ){
	cout << ans[i];
      }  
      cout << endl;
    }
  }

  return 0;
}