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;

    string c = "0123456789";
    for(int i=0; i<n; i++) {
        string in1, in2;
        cin >> in1 >> in2;
        if(in1.size() > 80 || in2.size() > 80) {
            cout << "overflow" << endl;
            continue;
        }

        string ans = "";
        int k = 0;
        for(int j=0; j<80; j++) {
            int x = in1.size() - 1 - j;
            if(x >= 0) {
                k += in1[x] - '0';
            }
            int y = in2.size() - 1 - j;
            if(y >= 0) {
                k += in2[y] - '0';
            }
            ans = c[k%10] + ans;
            k /= 10;
        }

        if(k!=0) {
            cout << "overflow" << endl;
        } else {
            bool flag = true;
            for(int i=0; i<ans.size(); i++) {
                if(ans[i] == '0' && flag) continue;
                flag = false;
                cout << ans[i];
            }
            if(flag) cout << "0";
            cout << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string.h>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int alen,blen,mlen;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		alen=in.size();
		blen=in2.size();
		for(int i=0;i<alen;i++){
			a[alen-1-i]=in[i]-'0';
		}
		for(int i=0;i<blen;i++){
			b[blen-1-i]=in[i]-'0';
		}
		mlen=max(alen,blen);
		if(mlen>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<mlen+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[mlen]!=0){
			//if(m_len>79){
				//cout<<"overflow"<<endl;
				//continue;
			//}
			//cout<<ans[m_len];
		}
		
		for(int i=0;i<mlen;i++){
			//cout<<ans[m_len-1-i];
		}cout<<endl;
		
		
	}
	return 0;
}

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

using namespace std;

void tasu(string s1, string s2){
        int num[2][max(s1.length(), s2.length())+1];
        for(int i = 0; i < sizeof(num[0])/sizeof(int); i++){
                if(s1.length() > i){ 
                        num[0][i] = (int)s1.at(s1.length()-1-i) - (int)'0';
                }else{
                        num[0][i] = 0;
                }   
                if(s2.length() > i){ 
                        num[1][i] = (int)s2.at(s2.length()-1-i) - (int)'0';
                }else{
                        num[1][i] = 0;
                }   
        }   
        for(int i = 0; i < sizeof(num[0])/sizeof(int)-1; i++){
                num[1][i] += num[0][i];
                if(num[1][i] > 9){ 
                        num[1][i+1] += (int)(num[1][i]/10);
                        num[1][i] %= 10; 
                }   
        }   
        int keta = sizeof(num[0])/sizeof(int);
        while(keta && !num[1][keta-1]){
                keta--;
        }   
        if(keta >= 80){
                cout << "overflow" << endl;
        }else{
                while(keta--){
                        cout << num[1][keta];
                }   
                cout << endl;
        }   
}
int main(){
        int n;
        cin >> n;
        while(n--){
                string s1, s2; 
                cin >> s1 >> s2; 
                tasu(s1, s2);
        }   
}

C++: //#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
//#include <iomanip>
#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <cmath>
//#include <time.h>

using namespace std;


int main(){

	int n, k1, k2, left, right, buf, flag;
	string s1, s2 , out;
	int aa1[10], aa2[10], ans[10];

	cin >> n;

	for (int i = 0; i < n; i++){
		for (int i = 0; i < 10; i++){
			aa1[i] = 0;
			aa2[i] = 0;
			ans[i] = 0;
		}
		flag = 0;

		cin >> s1 >> s2;
		k1 = s1.size();
		k2 = s2.size();

		if (k1 > 80 || k2 > 80){
			cout << "overflow" << endl;
		}
		else{
			buf = 8 - k1 % 8;
			for(int i = 0; i < buf; i++){
				s1.insert(0,"0");
			}
			buf = 8 - k2 % 8;
			for (int i = 0; i < buf; i++){
				s2.insert(0, "0");
			}
			left = s1.size()-8;
			for (int i = 0; i < 10; i++){
				aa1[i] = atoi(s1.substr(left, 8).c_str());
				left -= 8;
				if (left < 0)break;
			}
			left = s2.size() - 8;
			for (int i = 0; i < 10; i++){
				aa2[i] = atoi(s2.substr(left, 8).c_str());
				left -= 8;
				if (left < 0)break;
			}

			for (int i = 0; i < 10; i++){
				ans[i] += aa1[i] + aa2[i];
				if (ans[i] >= 100000000){
					ans[i + 1] += 1;
					ans[i] -= 100000000;
				}
			}
			if (ans[10] >= 100000000){
				cout << "overflow" << endl;
			}
			else{
				for (int i = 9; i >= 0; i--){
					if (flag == 0){
						if (ans[i] != 0){
							printf("%d",ans[i]);
							flag = 1;
						}
					}
					else{
						printf("%08d", ans[i]);
					}
				}
				cout << endl;
			}
		}

	}
	
	return 0;
}

C++: #include<stdio.h>
int nationalbudget(){
	int xsize=0,ysize=0,k=0;
	char x[101],y[101];
	scanf("%s",x);
	scanf("%s",y);
	for(int i=0;x[i]!='\0';i++){
		xsize++;
		if(i>79){
			printf("overflow\n");
			return 0;}}
	for(int i=0;y[i]!='\0';i++){
		ysize++;
		if(i>79){
			printf("overflow\n");
			return 0;}}
	if(xsize>=ysize){
		for(int i=0;i<xsize;i++){
			if(ysize-1-i>=0){
				int t=(x[xsize-1-i]-'0')+(y[ysize-1-i]-'0')+k;
				if(t>=10){
					if(i==79){
						printf("overflow\n");
						return 0;}
					else{
						k=1;
						t%=10;}}
				else k=0;
				x[xsize-1-i]=t+'0';}
			else{
				int t=(x[xsize-1-i]-'0')+k;
				if(t>=10){
					if(i==79){
						printf("overflow\n");
						return 0;}
					else{
						k=1;
						t%=10;}}
				else k=0;
				x[xsize-1-i]=t+'0';}}
		if(k==1)printf("1");
		for(int i=0;i<xsize;i++)printf("%c",x[i]);}
	else{
		for(int i=0;i<ysize;i++){
			if(xsize-1-i>=0){
				int t=(x[xsize-1-i]-'0')+(y[ysize-1-i]-'0')+k;
				if(t>=10){
					if(i==79){
						printf("overflow\n");
						return 0;}
					else{
						k=1;
						t%=10;}}
				else k=0;
				y[ysize-1-i]=t+'0';}
			else{
				int t=(y[ysize-1-i]-'0')+k;
				if(t>=10){
					if(i==79){
						printf("overflow\n");
						return 0;}
					else{
						k=1;
						t%=10;}}
				else k=0;
				y[ysize-1-i]=t+'0';}}
		if(k==1)printf("1");
		for(int i=0;i<ysize;i++)printf("%c",y[i]);}
	printf("\n");}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)nationalbudget();
	return 0;}