Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

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

#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))

int main(void)
{
	char num1[81];
	char num2[81];
	char num3[81];
	int n;
	
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		scanf("%s%s", num1, num2);
		
		int i;
		int len = min(strlen(num1), strlen(num2));
		memset(num3, 0, sizeof(num3));
		for (i = 0; i < len; i++){
			num3[i] += num1[strlen(num1) - 1 - i] - '0' + num2[strlen(num2) - 1 - i] - '0';
			if (num3[i] >= 10){
				num3[i + 1] = 1;
				num3[i] %= 10;
			}
			num3[i] += '0';
		}
		
		len = max(strlen(num1), strlen(num2));
		for (; i < len; i++){
			num3[i] += (strlen(num1) == len ? num1[strlen(num1) - 1 - i] : num2[strlen(num2) - 1 - i]) - '0';
			if (num3[i] >= 10){
				num3[i + 1] = 1;
				num3[i] %= 10;
			}
			num3[i] += '0';
		}
		
		if (num3[i] == 1){
			num3[i] += '0';
		}
		
		if (num3[80] != 0){
			printf("overflow\n");
		}
		
		else {
			for (int i = 0; i < strlen(num3); i++){
				num1[i] = num3[strlen(num3) - 1 - i];
			}
			num1[strlen(num3)] = '\0';
			
			printf("%s\n", num1);
		}
	}
	
	return (0);
}

C++: #include<iostream>
#include<string>
#include<algorithm>
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;
	}
}

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

int charToInt(char);
string sumStr(string, string);

int charToInt(char c) {
  return (int)c - (int)'0';
}

string sumStr(string a, string b) {
  int pa = a.length()-1, pb = b.length()-1;
  string str(81, '0');
  int pstr = str.length()-1;
  int next = 0;
  while(pa >= 0 && pb >= 0) {
    int temp = charToInt(a[pa]) + charToInt(b[pb]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pa--;
    pb--;
    pstr--;
  }
  while(pa >= 0) {
    int temp = charToInt(a[pa]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pa--;
    pstr--;
  }
  while(pb >= 0) {
    int temp = charToInt(b[pb]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pb--;
    pstr--;
  }
  str[pstr] = (char)(next + (int)'0');

  for(int i = 0; i < str.length(); i++) {
    if(str[i] != '0') {
      return str.substr(i, str.length()-i);
    }
  }
  return "0";
}

int main() {
  int N;
  cin >> N;
  for(int i = 0; i < N; i++) {
    bool overflow = false;
    int data[N][8];
    string sum;
    for(int j = 0; j < 2; j++) {
      string str;
      cin >> str;

      if(!overflow) {
	if(j == 0) sum = str;
	else       sum = sumStr(sum, str);
        if(sum.length() > 80) overflow = true;
      }
    }

    if(overflow) cout << "overflow" << endl;
    else         cout << sum << endl;
  }
  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][10000];
	char ans[100000];
	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>80){
			cout<<"overflow"<<endl;
		}else if((Min>79)&&(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;
			if(in[NMin][ien[NMin]+1]>9){
				in[NMin][ien[NMin]+1]-=10;
				max10=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 "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int N; cin >> N;
	while (N--) {

		string a, b; cin >> a >> b;
		vector<int>v(101);
		for (int i = 0; i < a.size(); ++i) {
			v[101 - a.size() + i] = a[i] - '0';
		}
		for (int i = 0; i < b.size(); ++i) {
			v[101 - b.size() + i] += b[i] - '0';
		}
		for (int i = 100; i > 0; --i) {
			if (v[i] >= 10) {
				v[i - 1]++;
				v[i] -= 10;
			}
		}
		int num = 0;
		num = find_if(v.begin(), v.end(), [](const int a) {return a; })-v.begin();
		if (num <= 20)cout << "overflow" << endl;
		else {
			if (num == 101)cout << 0 << endl;
			else {

				for (int i = num; i < 101; ++i) {
					cout << v[i];
				}
				cout << endl;
			}
		}
	}
	return 0;
}

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

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k;
	char fi[100],se[100],ans[100];

	scanf("%d",&N);

	for(i=0;i<N;i++){

		scanf("%s",&fi);
		scanf("%s",&se);

		
		for(j=strlen(fi)-1,k=strlen(se)-1,keta=0,kuri=0;j>=0||k>=0;j--,k--,keta++){
			if(j<0) math1=0;
			else math1=fi[j]-'0';
			if(k<0) math2=0;
			else math2=se[k]-'0';
            ans[keta]=((math1+math2+kuri)%10)+'0';
			kuri=(math1+math2+kuri)/10;
		}
		if(keta-1<=80){
			for(j=keta-1;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		printf("\n");
	}

	return 0;
}

C++: //0015
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int main(){
	string n1,n2,rn1,rn2,ans="";
	char a='0';
	int b,bb,ro;
	int s1,s2,rs1,rs2,s=0;
	bool up=false;
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		ans="";
		cin>>n1>>n2;
		n1.length()>=n2.length() ? ro=n1.length() : ro=n2.length();
		reverse(n1.begin(),n1.end());
		rn1=n1;
		reverse(n2.begin(),n2.end());
		rn2=n2;
		//cout<<"_______"<<endl;
		for(int j=0;j<ro+1;j++){
			b=(rn1[j]-'0')+(rn2[j]-'0')+up;
			if(b>=10){
				b=b-10;
				a=b+'0';
				up=true;
			}else{
				a=b+'0';
			}
				ans[s]=a;
				s++;
		}

		if(ans.length()>80){
			cout<<"overflow"<<endl;
		}
		else{
			cout<<ans<<endl;
		}

	}
	return 0;
}