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 <cmath>
#include <vector>
#include <string>


using namespace std;

//?????????10?????????????????????
vector<string> splitstring(string str, int n){
  vector<string> tmp;
  for(int i=0;i<str.length();i+=n){
    //    cout << "str.substr: " << str.substr(i, n) << endl;
    tmp.push_back(str.substr(i, n));
  }

  return tmp;
}


int main(){
  int numDatasets;
  cin >> numDatasets;

  for(int i=0;i<numDatasets;i++){
    vector<string> splittedStr1, splittedStr2;
    vector<int> splittedInt1, splittedInt2;
    string str1, str2;
    cin >> str1;
    
    splittedStr1 = splitstring(str1, 7);
    for(int i=0;i<splittedStr1.size();i++){
      splittedInt1.push_back(std::stoi(splittedStr1[i]));
      // cout << splittedInt1[i] << endl;
    }

    cin >> str2;

    splittedStr2 = splitstring(str2, 7);
    for(int i=0;i<splittedStr2.size();i++){
      splittedInt2.push_back(std::stoi(splittedStr2[i]));
      // cout << splittedInt2[i] << endl;
    }

    vector<int> calced(max(splittedInt1.size(), splittedInt2.size()), 0);
    
    for(int i=0;i<calced.size();i++){
      if(i < splittedInt1.size()){
	calced[i] += splittedInt1[i];
      }
      if(i < splittedInt2.size()){
	calced[i] += splittedInt2[i];
      }
    }

    //debug
    for(int i=0;i<calced.size();i++){
      // cout << i << ": " <<  calced[i] << endl;
    }

    // cout << "---" << endl;

    
    //??°???????????????
    vector<int> calcedRes(calced.size()+1, 0);
    for(int i=0;i<calced.size();i++){
      int tmp = (calced[i]+calcedRes[i])/(int)pow(10.0, 7);
      calcedRes[i] = (calced[i]+calcedRes[i]) - tmp*pow(10.0, 7);
      calcedRes[i+1] = tmp;
      // cout << "calcedRes[" << i  << "]: " << calcedRes[i] << ", tmp: " << tmp << endl;
    }
      
      
      
      // calcedRes[calced.size()-i-2] += tmp;
      // calced[calced.size()-i-1] -= tmp*pow(10.0, 7);

      // int tmp = calced[i-1]/(int)pow(10.0, 7);
      // calced[i-1] -= tmp;
      // calced[i] += tmp; 

    // cout << "---" << endl;

    //int to str;
    string res = "";
    for(int i=calcedRes.size()-1;i>-1;i--){
      string str = to_string(calcedRes[i]);
      // cout << i << ":" << str << endl;
      if(i==calcedRes.size()-1){
	
	if(calcedRes[i]==0){
	  continue;
	}
      }

      while(str.length()<7){
	if(i==calcedRes.size()-1){
	  break;
	}
	str += "0";
      }


      
      res += str;
    }

    // cout << "result: " << res << endl;
    cout << res << endl;
  }
}

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;
    
    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        cin>>d;
        if((int)(d.size())>80){
            printf("overflow");
        }else{
            cin>>e;
            if((int)(e.size())>80){
                printf("overflow");
            }
        }
        
        if((int)(d.size())>80||(int)(e.size())>80){
            //printf("overflow");
        }else{
            for(int j=0; j<(int)(d.size()); j++){
                st1.push(d[j]);
            }
            for(int j=0; j<(int)(e.size()); j++){
                st2.push(e[j]);
            }
            int temp=0;
            char temp_char;
            while(st1.empty()==false||st2.empty()==false){
                if(st1.empty()==false&&st2.empty()==false){
                    temp_char=st1.top();
                    temp+=atoi(&temp_char);
                    temp_char=st2.top();
                    temp+=atoi(&temp_char);
                    st1.pop();
                    st2.pop();
                }else if(st1.empty()==false&&st2.empty()==true){
                    temp_char=st1.top();
                    temp+=atoi(&temp_char);
                    st1.pop();
                }else if(st1.empty()==true&&st2.empty()==false){
                    temp_char=st2.top();
                    temp+=atoi(&temp_char);
                    st2.pop();
                }
                st3.push(temp%10);
                temp=temp/10;
            }
            
            if(temp!=0){
                st3.push(temp);
            }
            
            if(st3.size()>80){
                printf("overflow");
            }else{
                while(st3.empty()==false){
                    printf("%d",st3.top());
                    st3.pop();
                }
            }
            
        }
        printf("\n");
    }
    
}

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

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

inline std::string Add_MultiplePrecision(const std::string A, const std::string B) {

	int a[200] = {};
	int b[200] = {};
	int c[300] = {};

	for (unsigned int i = 0; i < A.length(); i++) {
		a[i] = A[A.length() - 1 - i] - '0';
	}
	for (unsigned int i = 0; i < B.length(); i++) {
		b[i] = B[B.length() - 1 - i] - '0';
	}

	int carry = 0;
	for (unsigned int i = 0; i < std::max(A.length(), B.length()); i++) {
		c[i] = (a[i] + b[i] + carry) % 10;
		c[i + 1] = carry = (a[i] + b[i] + carry) / 10;
	}

	int st = 299;
	while (c[st] == 0) {
		st--;
	}

	std::string ans;
	for (int i = st; i >= 0; i--) {
		ans += std::to_string(c[i]);
	}

	if (ans == "") {
		ans = "0";
	}

	return ans;
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	int n = 0;
	std::cin >> n;
	std::vector<std::string> ans(n);

	for (int i = 0; i < n; i++) {
		std::string temp1, temp2, temp3;
		std::cin >> temp1 >> temp2;
		temp3 = Add_MultiplePrecision(temp1, temp2);
		if (temp3.length() >= 80) {
			ans[i] = "overflow";
		}
		else {
			ans[i] = temp3;
		}
	}

	for (int i = 0; i < n; i++) {
		std::cout << ans[i] << std::endl;
	}
}

C++: //0015 National Budget
//80ÜÅÌ2ÂÌ®Ì«µZÊðoÍ¹æ
//1sÚÉf[^Zbgnª^¦çêé

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(void)
{
	int n;
	cin >> n;
	while(n--)
	{
		const int N = 82;
		string str;
		int arg[2][N] = {0}, result[N] = {0};
		int digit[2];

		for(int i = 0; i < 2; i++)
		{
			cin >> str;
			digit[i] = str.size();
			for(int j = 0; j < digit[i]; j++)
			{
				arg[i][j] = str[j] - '0';
			}
			//vZµâ·¢æ¤É½]
			reverse(arg[i], arg[i]+digit[i]);
		}

		bool isRead[2] = {true, true};
		for(int i = 0; isRead[0] || isRead[1]; i++)
		{
			if(i > digit[0])
				isRead[0] = false;
			if(i > digit[1])
				isRead[1] = false;

			int s = 0;
			if(isRead[0])
				s += arg[0][i];
			if(isRead[1])
				s += arg[1][i];

			result[i] += s%10;
			result[i+1] += s/10 + result[i]/10;
			result[i] %= 10;
		}

		bool isPrint = false;
		for(int i = N-1; i >= 0; i--)
		{
			if(result[i])
				isPrint = true;
			if(isPrint)
				cout << result[i];
		}
		cout << endl;
	}
	return 0;
}