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++: #define scanf_s scanf
#define sscanf_s sscanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
//#define CONSTNUM 10000000
int main(void)
{
	int n, s = 0, x, y, r = 0, a, b;
	int sum_n[50][3] = { 0 };
	char sum[50][_MAX], astr[_MAX], bstr[_MAX], num[11] = { "0123456789" };
	char ca, cb;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%s %s", &astr, &bstr);
		for (x = 0; astr[x] != '\0'; ++x);
		for (y = 0; bstr[y] != '\0'; ++y);
		if (x > 80 || y > 80) {
			printf("overflow\n");
			continue;
		}
		for (int j = 0; j < x || j < y; ++j) {
			if (j < x && j < y) {
				ca = astr[x - j - 1]; cb = bstr[y - j - 1];
				sscanf_s(&ca, "%d", &a);
				sscanf_s(&cb, "%d", &b);
				if (x > y) sum[i][x - j] = num[(a + b + r) % 10];
				else sum[i][y - j] = num[(a + b + r) % 10];
				if (a + b + r >= 10) r = (a + b + r) / 10;
				else r = 0;
			}
			else {
				if (x > y) {
					if (r != 0) {
						ca = astr[x - j - 1];
						sscanf_s(&ca, "%d", &a);
						sum[i][x - j] = num[(a + r) % 10];
						if (a + r >= 10) r = (a + r) / 10;
						else r = 0;
					}
					else {
						sum[i][x - j] = astr[x - j - 1];
					}
				}
				else {
					if (r != 0) {
						cb = bstr[y - j - 1];
						sscanf_s(&cb, "%d", &b);
						sum[i][y - j] = num[(b + r) % 10];
						if (b + r >= 10) r = (b + r) / 10;
						else r = 0;
					}
					else {
						sum[i][y - j] = bstr[y - j - 1];
					}
				}
			}
		}
		if (y <= 80 - r && x <= 80 - r) {
			if (r == 1) printf("%d", r);
			for (int j = 1; j <= x || j <= y; ++j) {
				printf("%c", sum[i][j]);
			}
		}
		else {
			printf("overflow");
		}
		printf("\n");r = 0;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef vector <int> VI;

VI string_to_vi( string number )
{
	VI converted( number.size() );
	for ( int i = 0; i < number.size(); i++ ) converted[i] = (int)( number[i] - '0' );
	return converted;
}

VI add( VI left, VI right )
{
	VI result;
	reverse( left.begin(), left.end() );
	reverse( right.begin(), right.end() );
	VI::iterator it_left = left.begin();
	VI::iterator it_right = right.begin();

	int carry = 0;
	while ( it_left != left.end() || it_right != right.end() )
	{
		int l = 0, r = 0;
		if ( it_left != left.end() ) l = *it_left;
		if ( it_right != right.end() ) r = *it_right;

		result.push_back( ( l + r + carry ) % 10 );
		carry = ( l + r + carry >= 10 ) ? 1 : 0;

		if ( it_left != left.end() ) it_left ++;
		if ( it_right != right.end() ) it_right ++;
	}
	if ( carry ) result.push_back( 1 );

	reverse( result.begin(), result.end() );
	return result;
}

void print_number( VI& number )
{
	for ( VI::iterator it = number.begin(); it != number.end(); it++ ) cout << *it;
	cout << endl;
}

int main( void )
{
	int n; cin >> n;
	for ( int i = 0; i < n; i++ )
	{
		string input_a, input_b;
		cin >> input_a >> input_b;

		VI a = string_to_vi( input_a );
		VI b = string_to_vi( input_b );
		VI c = add( a, b );

		if ( c.size() > 80 ) cout << "overflow" << endl;
		else print_number( c );

	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n--){
    string a,b;
    cin>>a>>b;
    int num[500] = {0},tab = 0,i = 0;
    int as = a.size()-1;
    int bs = b.size()-1;
    int nmi = min(a.size(),b.size());
    int nma = max(a.size(),b.size());
    for(int x; i<nma; i++){
      if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;}
      else if(i>as){x = tab+b[bs-i]-'0';}
      else if(i>bs){x = tab+a[as-i]-'0';}
      tab = x/10;
      num[i] = x%10;
    }
    if(tab){num[nma] = tab;i++;}
    if(i>80){cout <<"overflow"<<endl;}
    else{
      for(int x=i-1; x>=0; x--){
	cout <<num[x];
      }
      cout <<endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
using namespace std;

int main(){
	int N;
	char str1[90], str2[90];
	int num1[80], num2[80], sum[80];
	int pos, pos2, up;
	
	scanf("%d", &N);
	for(int n = 0; n < N; n++){
		for(int i = 0; i < 90; i++){
			str1[i] = 0;
			str2[i] = 0;
		}
		for(int i = 0; i < 80; i++){
			num1[i] = 0;
			num2[i] = 0;
			sum[i] = 0;
		}
		scanf("%s", str1);
		scanf("%s", str2);
		
		pos = 89;
		while(str1[pos] == 0 && pos >= 0) pos--;
		pos2 = 0;
		while(str1[pos] != 0 && pos >= 0){
			num1[pos2++] = str1[pos--] - 48;
		}
		pos = 89;
		while(str2[pos] == 0 && pos >= 0) pos--;
		pos2 = 0;
		while(str2[pos] != 0 && pos >= 0){
			num2[pos2++] = str2[pos--] - 48;
		}
		
		up = 0;
		for(int i = 0; i < 80; i++){
			sum[i] = num1[i] + num2[i] + up;
			up = sum[i] / 10;
			sum[i] = sum[i] % 10;
		}
		
		if(up > 0 || sum[79] > 0) printf("overflow\n");
		else{
			pos = 79;
			while(sum[pos] == 0 && pos >= 0) pos--;
			while(pos >= 0){
				printf("%d", sum[pos--]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
int main(void){
   int n;
   scanf("%d",&n);
   while(n--){
      char a[1000],b[1000],c[1000];
      int j,len;

      for(j=0;j<81;j++){
         a[j]=0;
         b[j]=0;
         c[j]='0';
      }
      scanf("%s%s",a,b);
      len=strlen(a);
      if(len<strlen(b))
         len=strlen(b);
      if(len>80){
         printf("overflow\n");
         continue;
      }
      /*for(j=0;j<len+1;j++){
         c[j]='0';9999999999999999999999999999999999999999999999999999999999999999999999999999999
      }*/
      for(j=0;j<strlen(a);j++){
         c[j]=a[strlen(a)-j-1];
      }
      for(j=0;j<strlen(b);j++){
         c[j]+=b[strlen(b)-j-1]-'0';
      }
      for(j=0;j<len;j++){
         if(c[j]>=58){
            if(j==len-1){
               c[j+1]='0';
               len++;
            }
            c[j]-=10;
            c[j+1]+=1;
         };
      }
      if(len>80){
         printf("overflow\n");
         continue;
      }
      else{
         for(j=len-1;j>=0;j--){
            printf("%c",c[j]);
         }
         puts("");
      }
   }
   return 0;
}

//9999999999999999999999999999999999999999999999999999999999999999999999999999999

C++: #include<iostream>
using namespace std;
int main(){
	int cnt, m;
	cin >> cnt;
	string s1, s2, ans;
	for(int i = 0; i < cnt; i++){
		cin >> s1 >> s2;
		ans = "";
		m = max(s1.size(), ans.size());
		while( s1.size() < m ) 
			s1 = '0' + s1;
		while( s2.size() < m )
			s2 = '0' + s2;		
		int c = 0;	
		for(int i = m-1; i >= 0; i--){
			char ch = ((s1[i] - '0') + (s2[i] - '0') + c) % 10 + '0';
			c = ((s1[i] - '0') + (s2[i] - '0') + c) / 10;
			ans += ch;
		}		
		if(c) 
			ans += c + '0';
		reverse(ans.begin(), ans.end());
		while(ans.size() > 1 && ans[0] == '0') 
			ans.erase(ans.begin());		
		if(ans.size() > 80)
			cout << "overflow" << endl;
		else
			cout << ans << endl;
	}
}