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>
#include <cstdlib>
#include <algorithm>

#define MAX_DIGIT 80
#define ERROR ("overflow")



int main(void){
	using namespace std;

	int N;
	cin >> N;

	vector< pair<string,string> > input;
	input.reserve(N);

	for(int i=1; i<=N; i++){

		string slhs, srhs;
		cin >> slhs >> srhs;

		reverse(slhs.begin(), slhs.end());
		reverse(srhs.begin(), srhs.end());

		input.push_back(make_pair(slhs,srhs));
	}

	for(auto p=input.begin(); p!=input.end(); p++){
		auto slhs = p->first, srhs = p->second;

		if(slhs.size()>MAX_DIGIT || srhs.size()>MAX_DIGIT){
			cout << ERROR << endl;
			continue;
		}

		int lhs[MAX_DIGIT], rhs[MAX_DIGIT], res[MAX_DIGIT];
		fill(lhs, lhs+MAX_DIGIT, 0);
		fill(rhs, rhs+MAX_DIGIT, 0);
		fill(res, res+MAX_DIGIT, 0);
		auto atoi_digit = [] (char x) -> int {
			return atoi(&x);
		};
		transform(slhs.begin(), slhs.end(), lhs, atoi_digit);
		transform(srhs.begin(), srhs.end(), rhs, atoi_digit);

		int headDigit;
		for (headDigit=MAX_DIGIT-1; headDigit>=0; headDigit--){
			if(lhs[headDigit]!=0 || rhs[headDigit]!=0){
				break;
			}
		}
		if(headDigit != MAX_DIGIT-1){
			headDigit++;
		}

		int carry = 0;
		for (int j=0; j<=headDigit; j++){
			auto d = div(lhs[j]+rhs[j]+carry,10);
			carry = d.quot;
			res[j] = d.rem;
		}
		if(headDigit==MAX_DIGIT-1 && carry !=0){
			cout << ERROR << endl;
			continue;
		}


		for (; headDigit>=1; headDigit--){
			if(res[headDigit]!=0){
				break;
			}
		}
		for (int j=headDigit; j>=0; j--){
			cout << res[j];
		}
		cout << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
char strn[1000],str1[101],str2[101];
void add(int one,int two)
{
    int n,carry=0;
    for(int i=0;one-i>=0||two-i>=0||carry==1;i++){
        if(one-i>=0&&two-i>=0)n=(str1[one-i]-'0')+(str2[two-i]-'0');
        else if(one-i>=0)n=(str1[one-i]-'0');
        else if(two-i>=0)n=(str2[two-i]-'0');
        else n=0;
        if(n+carry>9){
            strn[i]=n+'0'+carry-10;
            carry=1;
        }
        else {
            strn[i]=n+'0'+carry;
            carry=0;
        }
    }
}
int main()
{
    int n,firs,seco,co;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>str1>>str2;
        firs=strlen(str1);
        seco=strlen(str2);
        if(firs>80||seco>80)cout<<"overflow"<<endl;
        else {
            add(firs,seco);
            co=strlen(strn);
            if(co>80)cout<<"overflow"<<endl;
            else {
                for(int i=co-1;i>0;i--)printf("%c",strn[i]);
                cout<<endl;
            }
        }

    }
}

C++: #include<stdio.h>
#include<string>
#include<algorithm>
using namespace std;
int max(int a,int b){return a>b?a:b;}
int main(){
	int n;
	scanf("%d",&n);
	for(int d=0;d<n;d++){
		char a[100];
		char b[100];
		scanf(" %s",a);
		scanf(" %s",b);
		string s,t;
		int i=0;
		s.append(a);
		t.append(b);
		reverse(s.begin(),s.end());
		reverse(t.begin(),t.end());
		string ans;
		int k=0;
		for(i=0;i<max(s.size(),t.size())+1;i++){
			int x,y;
			if(i>=s.size())x=0;
			else x=s[i]-'0';
			if(i>=t.size())y=0;
			else y=t[i]-'0';
			int z=x+y+k;
			k=z/10;
			char c=z%10+'0';
			if(i!=max(s.size(),t.size())||c!='0')ans.append(1,c);
		}
		reverse(ans.begin(),ans.end());
		if(ans.size()>=81)printf("overflow\n");
		else printf("%s\n",ans.c_str());
	}
	return 0;
}

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

int main(){
	int n, len, car;
	string a, b, ans;
	cin >> n;
	for(int i = 0;i < n;++i){
		car = 0;
		ans = "";
		cin >> a >> b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		len = max(a.length(), b.length());
		for(int i = 0;i < len;++i){
			int x, y, s;
			x = i < a.length() ? a[i] - '0' : 0;
			y = i < b.length() ? b[i] - '0' : 0;
			s = x + y + car;
			car = s / 10;
			ans += (s % 10 + '0');
		}
		if(car != 0) ans += (car + '0');
		if(ans.length() <= 80){
			reverse(ans.begin(), ans.end());
			cout << ans << endl;
		}
		else{
			cout << "overflow" << endl;
		}
	}
	return 0;
}

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

int main(){
	int n, max;
	cin >> n;
	for (int z = 0; z < n;z++) {
		string x, xx, y, yy, outp;
		cin >> x >> y;
		if (cin.eof()) { break; }
		int lengx = x.size();
		int lengy = y.size();
		
		if (lengx > 80 || lengy > 80) {
			cout << "overflow" << endl;
			continue;
		}
		
		if (lengx < lengy){
			max = lengy;
		}
		else{
			max = lengx;
		}

		int m[81], n[81], wa[81];
		for(int i=0;i<81;i++){
			m[i] = 0;
			n[i] = 0;
			wa[i] = 0;
		}

		for (int i = 0; i<lengx; i++) {
			xx = x[lengx - i - 1];
			m[i] = stoi(xx);
		}
		for (int i = 0; i<lengy; i++) {
			yy = y[lengy - i - 1];
			n[i] = stoi(yy);
		}

		for(int i = 0; i < max; i++){
			wa[i] += n[i];
			wa[i] += m[i];

			if (wa[i]>=10){
				wa[i] -= 10;
				wa[i + 1] += 1;
			}

		}
		if(wa[80] == 1){
			cout << "overflow" << endl;
			continue;
		}

		int c = max;
		if(wa[max] == 1){
			c += 1;
		}

		for(int i=0;i<c;i++){
			outp += to_string(wa[c - i -1]);
		}
		cout << outp << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
    
    string d;
    string e;
    
    
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        int f[81]={0};
        int g[81]={0};
        int h[81]={0};
        
        cin>>d;
        cin>>e;
        
        if((int)d.length()>80||(int)e.length()>80){
            printf("overflow\n");
        }else{
            int j=80;
            for(int i=(int)d.length()-1; i>=0; i--){
                f[j] = (d[i]-'0');
                j--;
            }
            j=80;
            for(int i=(int)e.length()-1; i>=0; i--){
                g[j] = (e[i]-'0');
                j--;
            }
            
//            for(int i=0; i<81; i++){
//                printf("%d",f[i]);
//            }
//            printf("\n");
//            
//            for(int i=0; i<81; i++){
//                printf("%d",g[i]);
//            }
//            printf("\n");
            
            int temp=0;

            for(int i=80; i>=0; i--){
                temp = temp + f[i] + g[i];
                h[i] = temp % 10;
                temp = temp / 10;
            }
            j=0;
            if(h[j]!=0){
                printf("overflow\n");
            }else{
                while(h[j]==0){
                    j++;
                }
                if(j==165){
                    printf("0");
                }else{
                    for(int i=j; i<81; i++){
                        printf("%d",h[i]);
                    }
                }
            }
            printf("\n");
        }
        
        
        
    }
return 0;
    
    
}