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 <stdlib.h>
#include <string.h>

void ctod(char *c, int *d){
	int len = strlen(c);
	char ct[10];
	int h = len / 9;
	int a = len % 9;

	for(int i=0;i<9;++i){
		d[i] = 0;
	}
	if(a != 0){
		memcpy(ct, c, a);
		ct[a] = '\0';
		d[h] = atoi(ct);
	}

	for(int i=0; i<h; ++i){
		memcpy(ct, c + len - 9*(i + 1), 9);
		ct[9] = '\0';
		d[i] = atoi(ct);
	}
}

void dtoc(char *c, int *d){
	char ct[10];
	int m = -1;
	int o = 0;
	for(int i=8; i>=0; --i){
		if(d[i] != 0){
			m = i;
			break;
		}
	}
	if(m == -1){
		c[0] = '0';
		c[1] = '\0';
		return;
	}

	sprintf(c, "%d", d[m]);
	o = strlen(c);
	for(int i = m-1; i>=0; --i){
		sprintf(c+o, "%09d", d[i]);
		o += 9;
	}
}

void add(int *d1, int *d2, int *d){
	int s = 0;
	for (int i=0; i<9; ++i){
		d[i] = d1[i] + d2[i] + s;
		s = d[i] / 1000000000;
		if(s > 0){
			d[i] -= 1000000000;
		}
	}
}

int main(void){
	int n = 0;
	char i1[100], i2[100], o[100];
	int d1[9], d2[9], d[9];

	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%s", i1);
		scanf("%s", i2);
		if(strlen(i1) > 80 || strlen(i2) > 80){
			puts("overflow");
			continue;
		}

		for(int j=0; j<9;++j){
			d1[j] = d2[j] = d[j] = 0;
		}
		ctod(i1, d1);
		ctod(i2, d2);
		add(d1, d2, d);
		dtoc(o, d);
		if(strlen(o) > 80){
			puts("overflow");
			continue;
		}
		printf("%s\n", o);
	}
	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>81)||((Min>80)&&(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 <iostream>
using namespace std;
int main(){
	string s1, s2;
	int n;
	cin>>n;
	while(n--){
		string m1, m2, m;
		int k=0;
		cin>>s1>>s2;
		if(s1.length()>80 || s2.length()>80){
			cout<<"overflow"<<endl;
		}
		else{
			if(s1.length()<s2.length()){
				string memo=s1;
				s1=s2;
				s2=memo;
			}
			int c1=s1.length(), c2=s2.length();
			for(int i=s2.length()-1; i>=0; i--){
				k+=s1[i+c1-c2]-'0'+s2[i]-'0';
				m=to_string(k%10)+m;
				k=k/10;
			}
			for(int i=c1-c2-1; i>=0; i--){
				k+=s1[i]-'0';
				m=to_string(k%10)+m;
				k=k/10;
			}
			if(k==1)
				m=to_string(k)+m;
			if(m.length()>80)
				cout<<"overflow"<<endl;
			else
				cout<<m<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;
string S, T; int n, x[10000], a[10000], b[10000], cnt; char U[11] = "0123456789";
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> S >> T;
		memset(x, 0, sizeof(x));
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < S.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == S[i]) {
					a[S.size() - 1 - i] = j;
				}
			}
		}
		for (int i = 0; i < T.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == T[i]) {
					b[T.size() - 1 - i] = j;
				}
			}
		}
		if (S.size() > 80 || T.size()>80) {
			cout << "OVERFLOW" << endl; goto E;
		}
		for (int i = 0; i < 80; i++) {
			x[i] += (a[i] + b[i]) % 10;
			x[i + 1] += (a[i] + b[i]) / 10;
		}
		cnt = 0;
		if (x[80] > 0) {
			cout << "OVERFLOW" << endl;
		}
		else {
			for (int i = 79; i >= 0; i--) {
				if (x[i] > 0) { cnt++; }
				if (cnt) { cout << x[i]; }
			}
			cout << endl;
		}
	E:;
	}
}

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

using namespace std;

int main(){
	int n, c, res;
	bool f;
	string opr[2], buf;
	cin >> n;
	for(int i = 0;i < n;++i){
		c = 0;
		f = false;
		for(int j = 0;j < 2;++j){
			cin >> buf;
			for(int k = 0;k < buf.length();++k) buf[k] = buf[k] - '0';
			opr[j].clear();
			for(int k = 0;k < 80 - buf.length();++k) opr[j] += (char)(0);
			opr[j] += buf;
		}
		for(int j = opr[0].length() - 1;0 <= j;--j){
			res = opr[0][j] + opr[1][j] + c;
			opr[0][j] = res % 10;
			c = res / 10;
		}
		if(!c){
			for(int j = 0;j < opr[0].length();++j){
				if(!f) f = opr[0][j] != 0;
				if(f) cout << (char)(opr[0][j] + '0');
			}
		}
		else cout << "overflow";
		cout << endl;
	}
}

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

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

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

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::cin >> i1;
		std::cin >> i2;
		for(int j=0;j<80;j++){
			char c='0';
			if(cflag)
				c+=1;
			cflag=false;
			if(strlen(i1)>j){
				c+=i1[strlen(i1)-j-1]-'0';
			}
			if(strlen(i2)>j){
				c+=i2[strlen(i2)-j-1]-'0';
			}
			if(c > '9'){
				cflag=true;
				c-=10;
			}
			res[79-j]=c;
		}

		if(cflag){
			std::cout << "overflow" << std::endl;
			return 0;
		}
		char *p = res;
		while(*p++ == '0');
		std::cout << (p-1) << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<sstream>
#include<stack>
#include<map>
using namespace std;
#define pd pair<double,double>
	
	string rever(string a){
		string b=a;
		for(int i=0;i<a.size();i++)b[i]=a[a.size()-i-1];
		//cout<<b<<endl;
		return b;
	}
	
	int main(){
	string a,b,c;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>a>>b;
	c="ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss";
	if(a.size()<b.size())swap(a,b);
	b=rever(b);
	cout<<c<<endl;
	//cout<<a<<" "<<b<<endl;
	for(int i=0;i<=a.size()-b.size();i++){b.push_back('0');}
	b=rever(b);
	int as=a.size();
	bool kuriagari=false;
	for(int i=as-1;i>=0;i--){
		int n1=a[i]-'0';
		int n2=b[i]-'0';
		int ans=0;
		ans=n1+n2;
		if(kuriagari)ans++;
		if(ans>=10){
		kuriagari=true;
		ans-=10;
		}
		else kuriagari=false;
		c[i]=ans+'0';
	}
	
	if(c.find("s")!=string::npos){
		int fin=c.find("s");
		c.erase(fin);
	}
	//cout<<c<<endl;
	
	if(c.size()<80)cout<<c<<endl;
	else cout<<"overfllow"<<endl;
	}
    return 0;
}