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=str.length();i>0;i-=n){
    // cout << "i: " << i << ", i-n:" << i-n << ", i-1:" << i-1 << " ";
    if(i-n > 0){
      // cout << "str.substr: " << str.substr(i-n, n) << endl;
      tmp.push_back(str.substr(i-n, n));
    }
    else{
      // cout << "str.substr: " << str.substr(0, i) << endl;
      tmp.push_back(str.substr(0, i));
    }
  }
  
  // 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 || i==calcedRes.size()-2){
	  break;
	}
	str += "0";
      }


      
      res += str;
    }

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

C++: #include <cstdio>
#include <vector>
using namespace std;

int main(){
	const int size = 80;
	char str1[size + 10], str2[size + 10];
	int num1[size], num2[size], res[size];
	int n, leng1, leng2, loop, kuri;
	bool output;
	
	scanf("%d", &n);
	
	while(n--){
		fill(str1, str1 + size + 10, 0);
		fill(str2, str2 + size + 10, 0);
		fill(num1, num1 + size, 0);
		fill(num2, num2 + size, 0);
		scanf("%s", str1);
		scanf("%s", str2);
		
		//char -> int
		for(leng1 = 0; (int)str1[leng1 + 1] >= 48 && (int)str1[leng1 + 1] <= 57; leng1++);//length of str1
		for(leng2 = 0; (int)str2[leng2 + 1] >= 48 && (int)str2[leng2 + 1] <= 57; leng2++);//length of str2
		
		loop = 1;
		while(leng1 >= 0){
			num1[size - loop] = (int)str1[leng1] - 48;
			leng1--; loop++;
		}
		loop = 1;
		while(leng2 >= 0){
			num2[size - loop] = (int)str2[leng2] - 48;
			leng2--; loop++;
		}
		kuri = 0;
		for(int i = size - 1; i >= 0; i--){
			res[i] = num1[i] + num2[i] + kuri;
			kuri = res[i] / 10;
			if(kuri > 0) res[i] -= 10;
		}
		
		if(kuri > 0) printf("overflow\n");
		else{
			output = false;
			for(int i = 0; i < size; i++){
				if(!output && res[i] == 0) continue;
				else{
					output = true;
					printf("%d", res[i]);
				}
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;

int main()
{
	
	
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++){
		string a;
		string b;

		cin >> a;
		cin >> b;	
		string res;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int carry = 0;
		int idx;
		for(int j=0;j<min(a.size(),b.size());j++){
			int lhs = a[j] - '0';
			int rhs = b[j] - '0';
			res.push_back((carry + lhs + rhs) % 10 + '0');
			carry = (carry + lhs + rhs) / 10 ? 1 : 0;
			idx =j;
		}

		for(int j=idx+1;j<max(a.size(),b.size());j++){
			if(a.size() > b.size()){
				int lhs = a[j] - '0';
				res.push_back((carry + lhs) % 10 + '0');
				carry = (carry + lhs) / 10 ? 1 : 0;
			}
			else{
				int rhs = b[j] - '0';
				res.push_back((carry + rhs) % 10 + '0');
				carry = (carry + rhs) / 10 ? 1 : 0;
			}
		}
		if(carry) res.push_back(carry+'0');
		reverse(res.begin(),res.end());
		cout << res << endl;
	}	
}

C++: #include <stdio.h>
#include <string.h>

int main(void)
{
	char str[2][1000];
	int b, s;
	int len[2];
	int i, j;
	int n;
	int flag;
	
	scanf("%d", &n);
	
	while (n){
		for (i = 0; i < 1000; i++){
			str[0][i] = str[1][i] = 0;
		}
		s = 1;
		b = 0;
		for (i = 0; i < 2; i++){
			scanf("%s", str[i]);
			len[i] = strlen(str[i]);
		}
		
		if (len[0] > 80 || len[1] > 80){
			printf("overflow\n");
		}
		else {
			if (len[0] < len[1]){
				s = 0;
				b = 1;
			}
			
			for (i = len[b], j = len[s]; i >= 0; i--, j--){
				if (j >= 0){
					str[s][i] = str[s][j];
				}
				else {
					str[s][i] = '0';
				}
			}
			
			flag = 0;
			i = len[b];
			while (i >= 0){
				if (str[s][i] + str[b][i] - '0' + flag > '9'){
					flag = 1;
				}
				else {
					flag = 0;
				}
				i--;
			}
			
			if (flag){
				for (i = len[b]; i >= 0; i--){
					for (j = 0; j < 2; j++){
						str[j][i + 1] = str[j][i];
					}
				}
				str[0][0] = '0';
				str[1][0] = '0';
			}
			
			for (i = len[b] + flag; i >= 0; i--){
				str[b][i] += (str[s][i] - '0');
				if (str[b][i] > '9'){
					str[b][i] -= 10;
					str[b][i - 1]++;
				}
			}
			str[b][len[b] + flag] = '\0';
			
			printf("%s\n", str[b]);
		}
		
		n--;
	}
	
	return (0);
}