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<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  cin.ignore();
  while(n--){
    string a,b;
    getline(cin,a);
    getline(cin,b);
    int num[100] = {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>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>


using namespace std;


int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		char a[1024], b[1024];
		scanf(" %s %s", a, b);
		if (strlen(a) > 80 || strlen(b) > 80)
		{
			puts("overflow");
			continue;
		}
		int aa[80], bb[80];
		memset(aa, 0, sizeof(aa));
		memset(bb, 0, sizeof(bb));
		for (int j = 0; j < strlen(a); ++j)
			aa[j] = a[strlen(a)-j-1] - '0';
		for (int j = 0; j < strlen(b); ++j)
			bb[j] = b[strlen(b)-j-1] - '0';

		int sum[81];
		memset(sum, 0, sizeof(sum));
		for (int j = 0; j < 80; ++j)
		{
			sum[j] += aa[j]+bb[j];
			sum[j+1] = sum[j]/10;
			sum[j] %= 10;
		}
		if (sum[80])
			puts("overflow");
		else
		{
			int d;
			for (d = 80; sum[d] == 0 && d > 0; --d)
				;
			for (; d >= 0; --d)
				printf("%d", sum[d]);
			printf("\n");
		}
	}

	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
				in[i][ie[i]]=in[i][ie[i]]-'0';
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			max10=0;
			
			for(;ien[NMin]>-1;ien[NMin]--){
				in[NMin][ien[NMin]]=in[NMin][ien[NMin]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			for(int i=0;i<2;i++){
				for(int j=0;j<ie[i]+1;j++){
					in[i][j]=in[i][j]+'0';
				}
			}
			
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

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

using namespace std;

#define MAX_INT_LENGTH 80

//large integer upto 80 digits
struct largeInt{
    int vals[MAX_INT_LENGTH]; // MAX_INT_LENGTH digits
};

void toLargeInt(string str, largeInt &lv){
    int start = MAX_INT_LENGTH-str.length();
    for (int i = 0; i < MAX_INT_LENGTH; i++){
        if (i >= start)
            lv.vals[i] = (str[i-start] - '0');
        else
            lv.vals[i] = 0;
    }
}

largeInt addLargeInt(const largeInt &lv1, const largeInt &lv2){
    largeInt sum;
    int carry = 0;
    for (int i = MAX_INT_LENGTH-1; i >= 0; i--){
        int sub_sum = lv1.vals[i] + lv2.vals[i] + carry;
        sum.vals[i] = sub_sum % 10;
        carry = sub_sum / 10;
    }
    return sum;
}

string toString(const largeInt &v){
    stringstream ss;
    int i = 0;
    while (i < MAX_INT_LENGTH-1 && v.vals[i]==0) i++;
    while (i < MAX_INT_LENGTH){
        ss << v.vals[i] + '0';
        i++;
    }
    return ss.str();
}

int main()
{
    //ifstream cin("input.txt");
    
    // input data
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        string v1,v2;
        cin >> v1 >> v2;
        largeInt lv1, lv2;
        if (v1.length()>MAX_INT_LENGTH || v2.length()>MAX_INT_LENGTH){
            cout << "overflow" << endl;
            continue;
        }
        toLargeInt(v1,lv1);
        toLargeInt(v2,lv2);
        largeInt sum = addLargeInt(lv1,lv2);
        cout << toString(sum) << endl;
    }
   return 0;
}

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

int main() {
	int n;	
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		int size=4;
		std::string a, b;
		std::vector<int> va, vb, out;
		std::cin >> a >> b;
		for (std::string::iterator aitr = a.begin(); aitr != a.end(); aitr++) {
			va.push_back((int)*aitr - '0');
		}
		for (std::string::iterator bitr = b.begin(); bitr != b.end(); bitr++) {
			vb.push_back((int)*bitr - '0');
		}
		std::reverse(va.begin(), va.end()); std::reverse(vb.begin(), vb.end());
		out.push_back(0);
		size = va.size() > vb.size() ? va.size() : vb.size();
		for (int i = 0; i < size; i++) {
			out[i] = out[i] + (i < va.size() ? va[i] : 0) + (i < vb.size() ? vb[i] : 0);
			if (out[i] > 9) {
				out[i] = out[i] % 10;
				out.push_back(1);
			}
			else {
				out.push_back(0);
			}
		}
		if (out.back() == 0) out.pop_back();
		if (out.size() > 80) std::cout << "overflow" << std::endl;
		else {
			std::reverse(out.begin(), out.end());
			for (std::vector<int>::iterator itr = out.begin(); itr != out.end(); itr++) {
				std::cout << *itr;
			}
			std::cout << std::endl;
		}
	}
}

C++: #include <stdio.h>
#include <string.h>
int main() {
	char L[85],R[85];int left,right,i,j,N;scanf("%d",&N);while (N--) {scanf("%s\n%s",&L,&R);left=strlen(L),right=strlen(R);
		if (left>=right) {for (i=right-1,j=left-1;i>=0;i--,j--) R[j]=R[i];right=left;for (;j>=0;R[j--]='0');} else {for (i=right-1,j=left-1;j>=0;i--,j--) L[i]=L[j];left=right;for (;i>=0;L[i--]='0');}
		L[left]=0;for (i=left-1,j=0;i>=0;i--) {L[i]+=R[i]+j-48;if (L[i]>'9') j=1,L[i]-=10; else j=0;}if (j) printf("1");puts(L);} return 0;}

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

using namespace std;

int main(){
	int n,l1,l2,i;
	string a, b;
	char *ans;
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80)cout<<"overflow"<<endl;
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		ans=new char[l1+1];
		for(i=0;i<l1;i++)ans[i]='0';
		for(i=1;i<l2+1;i++){
			ia=(int)a[l1-i]-(int)'0';
			ib=(int)b[l2-i]-(int)'0';
			sum=ia+ib;
			ans[l1-i]+=sum;
		}
		for(i=l2+1;i<l1+1;i++){
			ans[l1-i]=a[l1-i];
		}
		for(i=0;i<l1;i++){
			if(ans[i]-'0'>9){
				ans[i]=ans[i]-10;
				ans[i-1]+=1;
			}
		}
		for(i=0;i<l1;i++){
			cout<<(int)ans[i]-'0';
		}
		cout<<endl;
	}
	return 0;
}