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;
string* sum (string& a, string& b);

int main(){
  string a1 = "", a2 = "", *sum0;
  int n, A1, A2;

  cin >> n;
  for(int i = 0; i < n ; i++){
    cin >> a1 >> a2;
    reverse(a1.begin(), a1.end());
    reverse(a2.begin(), a2.end());
    A1 = a1.length();
    A2 = a2.length();
    if(A1 < A2) {
      swap (A1, A2);
      swap (a1, a2);
    }

    for(int i = 0; i < A1 - A2; i++)   a2 += '0';

    sum0 = sum(a1, a2);

    if (sum0->length() > 80) sum0 = new string("overflow");
    else  reverse(sum0->begin(), sum0->end());
    
    cout << *sum0 <<endl;
  }
}

string* sum(string& a, string& b){
  static string buff = "";
  int x = 0, y ;
  for(int i = 0; i < a.length(); i++){
    y = a[i] - '0' + b[i] - '0';
    if (y + x > 9){
      buff += (y + x)% 10 + '0';
      x = 1;
    } else {
      buff += y + x+ '0';
      x = 0;
    }
  }
  if (x==1) buff += '1';
  return &buff;
}

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

using namespace std;
int main(){
	int n,l,m,c;
	string a,b;
	cin >> n;
	for(int i=0;i<n;i++){
		char s[90] = {0};
		cin >> a;
		cin >> b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		if(a.length()<b.length())swap(a,b);
		l = a.length();
		m = b.length();
		c=0;
		for(int j=0;j<l;j++){
			int o=a[j]-'0' + c;
			if(j<m)o += b[j]-'0';
			c = o>9;
			s[j] = o%10 + '0';
		}
		if(c>0)s[l++]='1';
		reverse(s,s+l);
		if(l>80)cout << "overflow" << endl;
		else printf("%s\n",s);
	}
	return 0;
}

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;
}