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<iostream>
#include<string>

using namespace std;

int main() {

	int n;

	cin >> n;

	for (int i = 0; i < n; ++i) {
		bool carry = false;
		string first, second;
		cin >> first >> second;

		string sum;

		auto it1 = first.rbegin();
		auto it2 = second.rbegin();
		while (it1 != first.rend() || it2 != second.rend()) {

			int temp1 = (it1 != first.rend()) ? (*it1++) - '0' : 0;
			int temp2 = (it2 != second.rend()) ? (*it2++) - '0' : 0;
			int temp_sum = temp1 + temp2 + (carry ? 1 : 0);
			if (temp_sum / 10 != 0) {
				carry = true;
				temp_sum %= 10;
			}
			else {
				carry = false;
			}

			sum.insert(0, to_string(temp_sum));
		}
		if (carry == true) {
			sum.insert(0, 1, '1');
		}

		if (first.length() > 80 || second.length() > 80 || sum.length() > 80) {
			cout << "overflow" << endl;
		}
		else {
			cout << sum << endl;
		}
	}


	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  for (int i = 0; i < n; i ++) {
    string a, b;
    cin >> a >> b;
    int alen = a.length();
    int blen = b.length();
    int maxlen = max(alen, blen);
    vector<int> a_vec(maxlen, 0);
    vector<int> b_vec(maxlen, 0);
    vector<int> c_vec(maxlen + 1, 0); // carry
    vector<int> r_vec; // result
    for (int i = 0; i < alen; i ++) {
      a_vec[alen - i - 1] = (a[i] - '0');
    }
    for (int i = 0; i < blen; i ++) {
      b_vec[blen - i - 1] = (b[i] - '0');
    }
    for (int i = 0; i < maxlen; i ++) {
      c_vec[i + 1] = (a_vec[i] + b_vec[i] + c_vec[i]) / 10;
      r_vec.insert(r_vec.begin(), (a_vec[i] + b_vec[i] + c_vec[i]) % 10);
      if (i == maxlen - 1 && c_vec[maxlen] != 0) {
        r_vec.insert(r_vec.begin(), c_vec[maxlen]);
      }
    }
    if (alen > 80 || blen > 80 || r_vec.size() > 80) {
      cout << "overflow" << endl;
      continue;
    }
    for (auto itr = r_vec.begin(); itr != r_vec.end(); ++itr) {
      cout << *itr;
    }
    cout << endl;
  }
}

C++: #include <stdio.h>

void rev_str(char str[1024]) {
	int length = 0;
	char str2[1024];
	int temp;

	int i;

	for(i = 0; i < 1024; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[1024];
	char input_b[1024];
	char ans[286][1024];
	char kuriagari;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 1024; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[j][i] = '\0';
		}

		kuriagari = 0;

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[j][i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}

		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[j][i] = kuriagari + '0';
		}

		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[j][i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[j][i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[j][i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[j][i] = input_a[i];
			i++;
		}

		rev_str(ans[j]);
		
		if(ans[j][81])
			printf("overflow");
		else
			printf("%s", ans[j]);

		putchar('\n');

	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	string a,b,c;
	int n;
	cin>>n;
	for(int fjal=0;fjal<n;fjal++){
	cin>>a>>b;
	c.clear();
	if(a.size()<b.size())swap(a,b);
	int as=a.size();]
	while(as!=b.size())b="0"+b;
	//cout<<a<<" "<<b;
	bool kuri=false;
	for(int i=as-1;i>=0;i--){
		int _a=a[i]-'0',_b=b[i]-'0',ans=_a+_b;
		if(kuri)ans++;
		if(ans>=10){
			kuri=true;
			ans-=10;
		}
		else {kuri=false;}
		//cout<<ans<<" "<<i;
		c.push_back(ans+'0');
	}
		if(kuri)c.push_back('1');
		string ans;
		if(c.size()<80){for(int i=c.size()-1;i>=0;i--)ans.push_back(c[i]);
		cout<<ans<<endl;
		}
		else cout<<"overflow"<<endl;
	}
	return 0;
}

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

int main()
{
char n[80]={};
char m[80]={};
int p[80]={};
int q[80]={};
int k=0;
int kk=0;
int kkk=0;
int H=0;
int bi;
string str1,str2;
char x;
char y;
cin>>bi;
/*

while(1)

{scanf("%c",&x);
	if(isspace(x)!=0)break;
	n[k]=x-'0';k++;} 

while(1)
{scanf("%c",&x);
	if(isspace(x)!=0)break;
	m[k]=x-'0';kk++;} 
	*/
for(int kk=0;kk<bi;kk++)
{
	cin>>str1>>str2;
	for(int i=0;i<str1.size();i++)
		{n[i]=str1[i];
	}
	for(int i=0;i<str2.size();i++)
		m[i]=str2[i];
	kkk=str1.size();
		for(int i=0;i<kkk;i++)
		p[kkk-i-1]=n[i]-'0';


		kkk=str2.size();
	for(int i=0;i<kkk;i++)
		p[kkk-i-1]+=m[i]-'0';
	if(str2.size()<str1.size())kkk=str1.size();

	for(int i=0;i<kkk;i++)
	{
		q[i]=(H+p[i])%10;
	    H=0;
		if(p[i]/10==1)H=1;
	}

	for(int i=0;i<kkk;i++)
		cout<<q[kkk-i-1];
	cout<<endl;
}
return 0;
}

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

int main() {
int N;
cin >> N;
for (; N > 0; --N) {
int a[80] = {}, b[80] = {}, sum[80] = {};
bool co = false;
string s, t;
cin >> s >> t;
for (int i = 0; i < s.length(); ++i) a[i] = (int)(s[i] - '0');
for (int i = 0; i < t.length(); ++i) b[i] = (int)(t[i] - '0');
for (int i = 0; i < 80; ++i) {
co = ((co?1:0)+a[i]+b[i]) >= 10;
sum[i] = ((co?1:0)+a[i]+b[i])%10;
}
if (co) cout << "overflow" << endl;
else {
bool fz = true;
for (int i = 79; i >= 0; --i) {
if (fz && sum[i] != 0) {fz = false;}
if (!fz) cout << sum[i];
}
}
cout << endl;
}
return 0;
}